diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2015-10-08 22:06:36 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2015-10-08 22:06:36 +1300 |
commit | 1264391afbf2407b5ea406f3b540ca34cb667543 (patch) | |
tree | 959e89cc0338cb7e7f53ba34ab36fcef536ad7dc /src/org/traccar/protocol/TytanProtocolDecoder.java | |
parent | eb4ee7a9d4d0f132546b164c3483d62eb9e9f0db (diff) | |
download | trackermap-server-1264391afbf2407b5ea406f3b540ca34cb667543.tar.gz trackermap-server-1264391afbf2407b5ea406f3b540ca34cb667543.tar.bz2 trackermap-server-1264391afbf2407b5ea406f3b540ca34cb667543.zip |
Improve Tytan fuel decoding
Diffstat (limited to 'src/org/traccar/protocol/TytanProtocolDecoder.java')
-rw-r--r-- | src/org/traccar/protocol/TytanProtocolDecoder.java | 15 |
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); |