#
# Feed this the output from readlots
+# Note that the interval length determination is known to be slightly
+# buggy at least under certain adverse conditions.
+
+# Output format:
+# ,value during interval
+# / ,classification chars
+# @<1105296455.621813 55..59 5e S-= 1 I112
+# ^interval ends just before \ decoded bit' `interpretation
+# `computed min and maxlength
+# Classification chars
+# S short interval
+# L long interval
+# U interval might have been short or long but we don't know
+# (interval is short iff actual length < 80)
+# followed by two chars which classify the measurement error etc.
+# first the min length is classified
+# < too short for NMRA decoder spec for interval (as classified)
+# - decoder must decode but power station may not produce, too short
+# = in spec
+# + decoder must decode but power station may not produce, too long
+# > too long for NMRA decoder spec for interval (as classified)
+# then the max length, just the same way.
+#
+# interpretations
+# Innn idle/preamble bit, number nnn
+# F <bytes>... framing bit indicates more data
+# <bytes> is those already received
+# B <bytes>(<bitno>) data bit no <bitno>
+# <bytes> includes byte under construction
+# P <bytes> packet end bit of good packet, <bytes> includes csum
+# EP (<error msg>) framing/decoding error
+
use strict qw(vars refs);
use IO::Handle;
$checksum ^= hex $byte;
}
if ($checksum) {
- packet_decoder_error("csum $checksum, @bytes");
+ $checksum= sprintf '%02x', $checksum;
+ packet_decoder_error("csum err $checksum in @bytes");
return;
}
print "P @bytes\n";
return;
}
$bitnum= 7;
- push @bytes, 0;
print "F @bytes...\n";
+ push @bytes, '00';
return;
}
$b= hex $bytes[$#bytes];