From c46795ce30f2f06c16f53a863d14ecafa8ae63af Mon Sep 17 00:00:00 2001 From: fengzero Date: Fri, 23 Sep 2022 03:06:00 +0000 Subject: [PATCH] fix(modbus): bit operation --- plugins/modbus/modbus_req.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/modbus/modbus_req.c b/plugins/modbus/modbus_req.c index 7832ed64..7e4d44ef 100644 --- a/plugins/modbus/modbus_req.c +++ b/plugins/modbus/modbus_req.c @@ -168,7 +168,7 @@ int modbus_value_handle(void *ctx, uint8_t slave_id, uint16_t n_byte, neu_value16_u v16 = { 0 }; v16.value = htons(*(uint16_t *) dvalue.value.bytes); dvalue.value.u8 = - neu_value16_get_bit(v16, 15 - (*p_tag)->option.bit.bit); + neu_value16_get_bit(v16, (*p_tag)->option.bit.bit); break; } case MODBUS_AREA_COIL: