diff --git a/src/hal/drivers/mesa-hostmot2/hm2_modbus.c b/src/hal/drivers/mesa-hostmot2/hm2_modbus.c index 6d5a81fd064..6754dbd775a 100644 --- a/src/hal/drivers/mesa-hostmot2/hm2_modbus.c +++ b/src/hal/drivers/mesa-hostmot2/hm2_modbus.c @@ -387,10 +387,10 @@ static unsigned calc_ifdelay(hm2_modbus_inst_t *inst, unsigned baudrate, unsigne } // calculation works for baudrates less than ~24 Mbit/s - if(baudrate <= 19200) + if(baudrate > 19200) return (175u * baudrate + 99999u) / 100000u; unsigned bits = 1 + 8 + (parity ? 1 : 0) + (stopbits > 1 ? 2 : 1); - return (bits * 35 + 9) / 10; // Bit-times * 3.5 rounded up + return (bits * 35 + 9) / 10; // Ceil of bits in 3.5 characters. } // @@ -1049,12 +1049,10 @@ static void process(void *arg, long period) break; } if(inst->maxicharbits && HM2_PKTUART_RCR_ICHARBITS_VAL(frsize) > inst->maxicharbits) { - MSG_WARN("%s: warning: reply to command %u had too long inter-character delay (%u > %u), dropping\n", + MSG_WARN("%s: warning: reply to command %u had too long inter-character delay (%u > %u), trying to interpret\n", inst->name, inst->cmdidx, HM2_PKTUART_RCR_ICHARBITS_VAL(frsize), inst->maxicharbits); set_error(inst, ENOMSG); - force_resend(inst); - break; } inst->rxdata[0] = 0; // This will fail the parse packet if the read did not resolve r = hm2_pktuart_queue_read_data(inst->uart, inst->rxdata, HM2_PKTUART_RCR_NBYTES_VAL(frsize));