void ArduProgram::serial_input_available()
{
- int c = serial.get();
- if(c==0x80)
- set_output();
- else
- throw runtime_error(format("Command error: %x\n", c));
+ unsigned l = serial.get()^0xFF;
+ if(l<0x10)
+ {
+ int c = serial.get();
+ if(c==0x80)
+ set_output();
+ else if((c&0xE0)==0x80)
+ throw runtime_error(format("Command error: %x\n", c));
+ while(--l)
+ serial.get();
+ }
}