aboutsummaryrefslogtreecommitdiff
path: root/src/org
diff options
context:
space:
mode:
Diffstat (limited to 'src/org')
-rw-r--r--src/org/traccar/protocol/TytanProtocolDecoder.java15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/org/traccar/protocol/TytanProtocolDecoder.java b/src/org/traccar/protocol/TytanProtocolDecoder.java
index a16bd4e4b..e6710413e 100644
--- a/src/org/traccar/protocol/TytanProtocolDecoder.java
+++ b/src/org/traccar/protocol/TytanProtocolDecoder.java
@@ -177,7 +177,20 @@ public class TytanProtocolDecoder extends BaseProtocolDecoder {
position.set(Event.KEY_RPM, buf.readUnsignedByte() * 50);
break;
case 107:
- position.set(Event.KEY_FUEL, (buf.readUnsignedShort() & 0x3fff) * 0.5);
+ {
+ int fuel = buf.readUnsignedShort();
+ switch (fuel >> 16) {
+ case 1:
+ position.set(Event.KEY_FUEL, (buf.readUnsignedShort() & 0x3fff) * 0.4 + "%");
+ break;
+ case 2:
+ position.set(Event.KEY_FUEL, (buf.readUnsignedShort() & 0x3fff) * 0.5 + "l");
+ break;
+ case 3:
+ position.set(Event.KEY_FUEL, (buf.readUnsignedShort() & 0x3fff) * -0.5 + "l");
+ break;
+ }
+ }
break;
case 108:
position.set(Event.KEY_OBD_ODOMETER, buf.readUnsignedInt() * 5);