X-Git-Url: http://git.tdb.fi/?p=model-railway-devices.git;a=blobdiff_plain;f=arducontrol%2Fmonitor.c;h=7966c3da40eb0e46cac63c4282924b9dc5995c32;hp=9b5154dddfcf1d2209b3253436ac9b0ee2289421;hb=49c7ae4a26f8dd7d09872b6b5e4c107ef33b4560;hpb=10a75dc39bf4cd91d235861f11b1fa0365d75c3e diff --git a/arducontrol/monitor.c b/arducontrol/monitor.c index 9b5154d..7966c3d 100644 --- a/arducontrol/monitor.c +++ b/arducontrol/monitor.c @@ -74,12 +74,11 @@ uint8_t monitor_command(const uint8_t *cmd_buf, uint8_t cmd_length) { if(cmd_buf[0]==READ_TRACK_CURRENT) { - uint8_t reply[3]; - if(cmd_length!=1) return LENGTH_ERROR; uint16_t value = track_current_milliamps(); + uint8_t reply[3]; reply[0] = TRACK_CURRENT; reply[1] = value>>8; reply[2] = value; @@ -101,12 +100,11 @@ uint8_t monitor_command(const uint8_t *cmd_buf, uint8_t cmd_length) } else if(cmd_buf[0]==READ_INPUT_VOLTAGE) { - uint8_t reply[3]; - if(cmd_length!=1) return LENGTH_ERROR; uint16_t value = input_voltage_millivolts(); + uint8_t reply[3]; reply[0] = INPUT_VOLTAGE; reply[1] = value>>8; reply[2] = value;