From: Othmar Gsenger Date: Wed, 14 Dec 2011 15:50:14 +0000 (+0000) Subject: moved to PORT D X-Git-Url: https://git.realraum.at/?a=commitdiff_plain;h=0caa04671fa16dbeb272fe5a9c62c91584d8419f;p=svn42.git moved to PORT D improved autodetection of signals --- diff --git a/rf433rcv/pc/decode.pl b/rf433rcv/pc/decode.pl index e90f345..6ee4192 100755 --- a/rf433rcv/pc/decode.pl +++ b/rf433rcv/pc/decode.pl @@ -22,51 +22,45 @@ for my $input (@data) for my $i (0..1) { - print "$i:\n"; + print STDERR "$i:\n"; my $stat = $statistics[$i]; for my $key (sort {$a <=> $b} keys %$stat) { - print "$key $stat->{$key}\n"; + if ($stat->{$key+1}) + { + if ($stat->{$key+1}>$stat->{$key}) + { + $stat->{$key+1}+=$stat->{$key}; + delete $stat->{$key}; + } else { + $stat->{$key}+=$stat->{$key+1}; + delete $stat->{$key+1}; + } + } + print STDERR "$key $stat->{$key}\n"; } } my $seq; -if (my $delemiter = $ARGV[0]) +if (defined $ARGV[0]) { - print "Starting decoding: $delemiter\n"; - my ($state,$time)=split /,/,$delemiter; + my ($state)=$ARGV[0]; + my ($time) = reverse sort {$a <=> $b} keys %{$statistics[$state]} ; my $start = 0; + my $counter=0; for my $data (@lengths) { - if ($start) - { - print $data->[0] . " => " . $data->[1] ."\n"; - $seq.= ($data->[0].',') x $data->[1]; - } if ($data->[0]==$state && $data->[1]==$time) { if ($start) - { last; + { + print "$counter\n"; + last; } else { $start =1; + print "$counter "; } } + $counter+=$data->[1]; } - chop $seq; - # print "$seq\n"; - my $bitcount=0; - my @binarydata; - for my $bits (reverse split /,/,$seq) - { - $binarydata[int($bitcount/8)]<<=1; - $binarydata[int($bitcount/8)]|=$bits; - $bitcount++; - } - $binarydata[int($bitcount/8)]<<= 8 - ($bitcount % 8) if $bitcount % 8; - my @chars = map { chr($_) } @binarydata; - print STDERR join '',@chars; -# print STDERR "\ns\x04"; # send 4 times -# print STDERR chr(8-($bitcount % 8)) if $bitcount % 8; - print "$bitcount total, offset ".($bitcount % 8)." bits\n"; - print ($bitcount/8 ," bytes (must be <= 63)\n"); } diff --git a/rf433rcv/teensy/example.c b/rf433rcv/teensy/example.c index fdc8980..df393ab 100644 --- a/rf433rcv/teensy/example.c +++ b/rf433rcv/teensy/example.c @@ -175,7 +175,7 @@ ISR(TIMER0_COMPA_vect) PORTF&=~1; if (capture) { write_buffer[active_buffer][output_count/8]<<=1; - write_buffer[active_buffer][output_count++/8]|=PINB&1; + write_buffer[active_buffer][output_count++/8]|=PIND&1; if (output_count>=64*8) { output_count=0;