aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/protocol
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2024-07-05 19:30:21 -0700
committerAnton Tananaev <anton@traccar.org>2024-07-05 19:30:21 -0700
commit381e25ab358de59c5b55a65767ada98b80d6d0f6 (patch)
treeeb050071fba91eb701bf79ed8920cc6a1773e905 /src/main/java/org/traccar/protocol
parent99b1436fbfb8c367808a9260d18e845c997b68fc (diff)
downloadtrackermap-server-381e25ab358de59c5b55a65767ada98b80d6d0f6.tar.gz
trackermap-server-381e25ab358de59c5b55a65767ada98b80d6d0f6.tar.bz2
trackermap-server-381e25ab358de59c5b55a65767ada98b80d6d0f6.zip
Improve EV02 battery level
Diffstat (limited to 'src/main/java/org/traccar/protocol')
-rw-r--r--src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java b/src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java
index 372cf5f78..1d77f75d7 100644
--- a/src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java
@@ -859,7 +859,11 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder {
position.set(Position.KEY_POWER, buf.readUnsignedShort() * 0.01);
}
int battery = buf.readUnsignedByte();
- position.set(Position.KEY_BATTERY_LEVEL, battery <= 6 ? battery * 100 / 6 : battery);
+ if (battery <= 6) {
+ position.set(Position.KEY_BATTERY_LEVEL, battery * 100 / 6);
+ } else if (battery <= 100) {
+ position.set(Position.KEY_BATTERY_LEVEL, battery);
+ }
position.set(Position.KEY_RSSI, buf.readUnsignedByte());
short alarmExtension = buf.readUnsignedByte();
if (variant != Variant.VXT01) {