1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2025-01-13 11:17:33 +01:00

Binary sensor: fixed byte overflow bug

This commit is contained in:
Daniel Dakhno 2022-12-27 19:45:44 +01:00
parent afeeff5293
commit fed5866f19

View File

@ -21,7 +21,7 @@ public class SensorState extends Parameter{
} }
public static SensorState decode(byte[] data){ public static SensorState decode(byte[] data){
int dataInt = (data[1] << 8) | data[0]; int dataInt = ((data[1] & 0xFF) << 8) | (data[0] & 0xFF);
byte stateByte = (byte)((dataInt >> 11) & 0x01); byte stateByte = (byte)((dataInt >> 11) & 0x01);
int count = dataInt & 0b11111111111; int count = dataInt & 0b11111111111;
return new SensorState( return new SensorState(