From: Mikko Rasa Date: Mon, 28 Oct 2013 20:11:14 +0000 (+0200) Subject: Respond to a zero-length packet with another zero-length packet X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=6f462a32920aa215a20b6512223e33df257d9f3a;p=model-railway-devices.git Respond to a zero-length packet with another zero-length packet This could be useful for sync recovery --- diff --git a/arducontrol/interface.c b/arducontrol/interface.c index 675770f..1cc4b15 100644 --- a/arducontrol/interface.c +++ b/arducontrol/interface.c @@ -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;