chiark / gitweb /
Do not require NMRA buffers to be cleared by ON; add hex byte value annotations to...
authorian <ian>
Wed, 28 Dec 2005 02:55:59 +0000 (02:55 +0000)
committerian <ian>
Wed, 28 Dec 2005 02:55:59 +0000 (02:55 +0000)
cebpic/README.protocol
hostside/parse-proto-spec

index bbfcebeaab0f8250291df1b58417baa9867322dc..ebe53471c92a84c197bc080db673bbe2a1e3ec7a 100644 (file)
@@ -11,16 +11,16 @@ Each message consists of a number of 8-bit bytes.  The top bit of each
 byte is 1 iff there is another byte in the message.
 
  First       Second      ASCII  Message          Brief
-  Byte        byte etc.                 name      description
+  Byte        byte etc.         or hex  name      description
 
 From host to PIC:
 
- > 1 0100 TTT  0 TTTTTTT       POINT     Point T fire
- > 1 1111 111  ....             NMRADATA  NMRA data
- > 1 0001 XXX  0 XXXXXXX        PING     Ping `X' (please Pong `X')
- > 1 0010 RRR  E RRR...         POLARITY  Set polarity
- > 0 0100 001                   ON       Power on
- > 0 0100 000                   OFF      Power off
+ > 1 0100 TTT  0 TTTTTTT  (a0)  POINT    Point T fire
+ > 1 1111 111  ....       (ff)  NMRADATA  NMRA data
+ > 1 0001 XXX  0 XXXXXXX  (88+)        PING      Ping `X' (please Pong `X')
+ > 1 0010 RRR  E RRR...   (90+)        POLARITY  Set polarity
+ > 0 0100 001            (1 21)        ON        Power on
+ > 0 0100 000            (0 20)        OFF       Power off
 
  > 00000000                     CRASHED   Acknowledge panic, go to readout mode
  > 00000001                    ACKSERERR RS232 framing or overrung (panic'd)
@@ -53,15 +53,15 @@ From host to PIC:
 
 From PIC to host:
 
- < 1 001Y SSS  0 SSSSSSS        DETECT   Train is (Y=1) or is not (Y=0) at S
- < 1 0001 XXX  0 XXXXXXX        PONG     Pong `X' (reply to Ping `X')
+ < 1 001Y SSS  0 SSSSSSS  (9?) DETECT    Train is (Y=1) or is not (Y=0) at S
+ < 1 0001 XXX  0 XXXXXXX  (88+)        PONG      Pong `X' (reply to Ping `X')
  < 0 000 1001             (HT)  HELLO    I am booted
  < 0 000 1011             (VT)  AAARGH   Followed by debug chars (only)
  < 0 000 0111             (BEL) FAULT    Fault exists
  < 0 000 0110             (ACK) FIXED    Fault now fixed
- < 0 0100 PPP                   POINTED          Point change done using capacitor P
- < 0 0101 PPP                   CHARGED          Point capacitor P is now charged
- < 0 00000 FF                   NMRADONE  Have processed F NMRADATA message(s)
+ < 0 0100 PPP             (20+)        POINTED   Point change done using capacitor P
+ < 0 0101 PPP             (28+)        CHARGED   Point capacitor P is now charged
+ < 0 00000 FF                  NMRADONE  Have processed F NMRADATA message(s)
 
  < 0000 1010              (LF)  } debugging output        0x0a (newline) and
  < 001C CCCC                    } (works with terminal      0x20-0x7e
@@ -98,9 +98,7 @@ POWER AND FAULT
 
 The host can send ON and OFF to turn the track (and various other
 stuff) on and off.  After ON, the track power should be enabled and
-transmitting NMRA idle, and the CDU should be enabled.  (ON - or the
-things that might precede ON such as FAULT etc. - should clear the
-data from any previous NMRADATA commands.)
+transmitting NMRA idle, and the CDU should be enabled.
 
 If the power is ON, and a track power short circuit is detected, the
 PIC should send FAULT.  When the short circuit is removed, the PIC
@@ -110,8 +108,8 @@ should be reenabled when the host transmits ON.
 
        Track and CDU                     Track and CDU
         disabled      -------ON------->          enabled
-               .      (clears NMRA
-              /|\      buffers)             |
+               .
+              /|\                           |
                |                            |Short circuit detected
                 \                           |
                  \FIXED                   FAULT
index 5865e425aa0d64dcc2659aeeca970c04bf64735f..1698ebab49f899f0f25c00868ce834cd2dbf6b57 100755 (executable)
@@ -53,9 +53,9 @@ sub process_line () {
     next unless defined $dirn;
     next unless m/^ ([<>]) / && $1 eq $dirn;
     die if m/\t/;
-    die unless m/^ [<>] ([01A-Za-z. ]+?)   +(\S.*)$/;
+    die unless
+ m/^ [<>] ([01A-Za-z. ]+?)(?:   +|\s+\([+? A-Z0-9a-z]+\)\s+)([^() \t\n].*)$/;
     $msg= $1; $rhs= $2;
-    $rhs =~ s/^\([A-Z][0-9A-Z]+\) +//;
     next if $rhs =~ m/^\}/;
     next if $msg =~ m/\.\.\./;
     $rhs =~ m/^([A-Z]+)\s/ or die "$rhs?";