I have the following bytes which is received from lora gps tracker,
hex_value = 010000263032efbfbdefbfbd42efbfbd
hex_byte1 = 01
hex_byte2 = 00
hex_byte3 = 00
hex_byte4 = 26
hex_byte5 = 30
hex_byte6 = 32
hex_byte7 = ef
hex_byte8 = bf
hex_byte9 = bd
hex byte10 = ef
def parser(payload):
val = 0
for index in range(len(payload)):
val += payload[index]
if (index < len(payload) - 1):
val = val << 8
# print(val)
if (val > 0x7FFFFF):
lng_val = - (0x01000000 - val) * 180 / 0x800000
else:
lng_val = (val) * 180 / 0x7FFFFF
return lng_val
byteArrayLNG = [0xbf, 0xbd, 0xef]
lng = parser(byteArrayLNG)
print("long :: ", lng)
The value which I am getting is -90.36291360855103 whereas the actual longitude is -117.4588