]> git.tdb.fi Git - model-railway-devices.git/commitdiff
Respond to a zero-length packet with another zero-length packet
authorMikko Rasa <tdb@tdb.fi>
Mon, 28 Oct 2013 20:11:14 +0000 (22:11 +0200)
committerMikko Rasa <tdb@tdb.fi>
Mon, 28 Oct 2013 20:11:14 +0000 (22:11 +0200)
This could be useful for sync recovery

arducontrol/interface.c

index 675770f771ab09881256ac19ee43ba0b1c165119..1cc4b15fa77a1af3c9f3eae71a2a49dbf5144f89 100644 (file)
@@ -24,9 +24,11 @@ void interface_check(void)
        {
                uint8_t length = ~serial_read();
 
-               if(length>=0x10)
+               if(length==0)
+                       serial_write(0xFF);
+               else if(length>=0x10)
                        interface_send1(FRAMING_ERROR);
-               else if(length>0)
+               else
                {
                        uint8_t cmd[15];
                        uint8_t i;