From 1bb131c3f8b1e64e5bad5ce4db97399f805db633 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 b33842f1..9f1e7852 100644 --- a/plugins/modbus/modbus_req.c +++ b/plugins/modbus/modbus_req.c @@ -175,7 +175,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: