Skip to content

Commit

Permalink
fix: rtu format_value bit
Browse files Browse the repository at this point in the history
  • Loading branch information
AvantLiu committed Feb 17, 2022
1 parent 3b063d3 commit 0a69b73
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions apps/dgiot_modbus/src/modbus/modbus_rtu.erl
Original file line number Diff line number Diff line change
Expand Up @@ -552,8 +552,8 @@ format_value(Buff, #{<<"dataForm">> := #{
<<"originaltype">> := <<"bit">>
}}) ->
IntLen = dgiot_utils:to_int(Len),
Size = max(2, IntLen) * 8,
<<Value:Size/binary, Rest/binary>> = Buff,
Size = max(2, IntLen) * 2,
<<Value:Size/binary, Rest/binary>> = dgiot_utils:binary_to_hex(Buff),
{Value, Rest};

format_value(Buff, #{<<"dataForm">> := #{
Expand Down

0 comments on commit 0a69b73

Please sign in to comment.