Merge branch 'feature/fix_input_reg_max_reg_count_v2' into 'main'

modbus fix read input regs max number (backport v2)

See merge request idf/esp-modbus!95
This commit is contained in:
Alex Lisitsyn
2025-02-17 21:25:37 +08:00

View File

@@ -65,7 +65,7 @@ mb_exception_t mbs_fn_read_input_reg(mb_base_t *inst, uint8_t *frame_ptr, uint16
* return Modbus illegal data value exception.
*/
if ((reg_cnt >= 1)
&& (reg_cnt < MB_PDU_FUNC_READ_REGCNT_MAX)) {
&& (reg_cnt <= MB_PDU_FUNC_READ_REGCNT_MAX)) {
/* Set the current PDU data pointer to the beginning. */
frame_cur = &frame_ptr[MB_PDU_FUNC_OFF];
*len_buf = MB_PDU_FUNC_OFF;