You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Problem was found when encoding a dictionary back into a NMEA message.
In the int_to_bin function in the util.py file, the second to last statement converts the value into bytes and then into a bit array. However, when the value is converted to_bytes it always assumes the value is signed.
I ran into an issue when encoding a message type 5 that had a draught value of 12.8. 12.8 gets multiplied up to 128 in the from_course function. 128 is then ultimately passed to int_to_bin and expected to fit into 1 byte. However, a signed value of 128 doesn't fit into 1 byte. So I think int_to_bin needs to be told the signed-ness of the value from the calling function, it can't always be set to signed=True.
The text was updated successfully, but these errors were encountered:
Problem was found when encoding a dictionary back into a NMEA message.
In the int_to_bin function in the util.py file, the second to last statement converts the value into bytes and then into a bit array. However, when the value is converted to_bytes it always assumes the value is signed.
I ran into an issue when encoding a message type 5 that had a draught value of 12.8. 12.8 gets multiplied up to 128 in the from_course function. 128 is then ultimately passed to int_to_bin and expected to fit into 1 byte. However, a signed value of 128 doesn't fit into 1 byte. So I think int_to_bin needs to be told the signed-ness of the value from the calling function, it can't always be set to signed=True.
The text was updated successfully, but these errors were encountered: