aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2020-08-10 20:25:31 -0700
committerAnton Tananaev <anton.tananaev@gmail.com>2020-08-10 20:25:31 -0700
commitb56878dde35a8cc9275707a9c486a3cb095a09f5 (patch)
tree36975d27194b3a08b002854f50c0a9671d012557 /src/main/java/org/traccar
parent23c38ed4e661c89c6dfa2f0139efa7620c6fb429 (diff)
downloadtrackermap-server-b56878dde35a8cc9275707a9c486a3cb095a09f5.tar.gz
trackermap-server-b56878dde35a8cc9275707a9c486a3cb095a09f5.tar.bz2
trackermap-server-b56878dde35a8cc9275707a9c486a3cb095a09f5.zip
Fix battery level decoding
Diffstat (limited to 'src/main/java/org/traccar')
-rw-r--r--src/main/java/org/traccar/protocol/T800xProtocolDecoder.java8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/main/java/org/traccar/protocol/T800xProtocolDecoder.java b/src/main/java/org/traccar/protocol/T800xProtocolDecoder.java
index 3331ebb71..5822d6b8f 100644
--- a/src/main/java/org/traccar/protocol/T800xProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/T800xProtocolDecoder.java
@@ -230,10 +230,7 @@ public class T800xProtocolDecoder extends BaseProtocolDecoder {
position.set(Position.KEY_ODOMETER, buf.readUnsignedInt());
int battery = BcdUtil.readInteger(buf, 2);
- if (battery == 0) {
- battery = 100;
- }
- position.set(Position.KEY_BATTERY, battery);
+ position.set(Position.KEY_BATTERY_LEVEL, battery > 0 ? battery : 100);
}
@@ -284,7 +281,8 @@ public class T800xProtocolDecoder extends BaseProtocolDecoder {
}
position.set(Position.KEY_G_SENSOR, "[" + accelerationX + "," + accelerationY + "," + accelerationZ + "]");
- position.set(Position.KEY_BATTERY_LEVEL, BcdUtil.readInteger(buf, 2));
+ int battery = BcdUtil.readInteger(buf, 2);
+ position.set(Position.KEY_BATTERY_LEVEL, battery > 0 ? battery : 100);
position.set(Position.KEY_DEVICE_TEMP, (int) buf.readByte());
position.set("lightSensor", BcdUtil.readInteger(buf, 2) * 0.1);
position.set(Position.KEY_BATTERY, BcdUtil.readInteger(buf, 2) * 0.1);