From 0ba3f3ba0fc3ab04cfbbc860afcb736d838a7057 Mon Sep 17 00:00:00 2001 From: jon-stumpf Date: Sun, 5 Mar 2017 00:45:41 -0500 Subject: Performed all KEY_POWER and KEY_BATTERY conversions using multiplication versus division; --- src/org/traccar/protocol/FoxProtocolDecoder.java | 2 +- src/org/traccar/protocol/GatorProtocolDecoder.java | 2 +- src/org/traccar/protocol/HaicomProtocolDecoder.java | 2 +- src/org/traccar/protocol/SkypatrolProtocolDecoder.java | 2 +- src/org/traccar/protocol/TotemProtocolDecoder.java | 4 ++-- 5 files changed, 6 insertions(+), 6 deletions(-) (limited to 'src/org') diff --git a/src/org/traccar/protocol/FoxProtocolDecoder.java b/src/org/traccar/protocol/FoxProtocolDecoder.java index e01c3aae3..e48b13cb7 100644 --- a/src/org/traccar/protocol/FoxProtocolDecoder.java +++ b/src/org/traccar/protocol/FoxProtocolDecoder.java @@ -108,7 +108,7 @@ public class FoxProtocolDecoder extends BaseProtocolDecoder { position.setCourse(parser.nextDouble()); position.set(Position.KEY_INPUT, parser.nextInt(2)); - position.set(Position.KEY_POWER, parser.nextDouble() / 10); + position.set(Position.KEY_POWER, parser.nextDouble() * 0.1); position.set(Position.PREFIX_TEMP + 1, parser.nextInt()); position.set(Position.KEY_RPM, parser.nextInt()); position.set(Position.KEY_FUEL_LEVEL, parser.nextInt()); diff --git a/src/org/traccar/protocol/GatorProtocolDecoder.java b/src/org/traccar/protocol/GatorProtocolDecoder.java index f01efb9d8..2ad4be3d3 100644 --- a/src/org/traccar/protocol/GatorProtocolDecoder.java +++ b/src/org/traccar/protocol/GatorProtocolDecoder.java @@ -120,7 +120,7 @@ public class GatorProtocolDecoder extends BaseProtocolDecoder { position.set(Position.KEY_STATUS, buf.readUnsignedByte()); position.set("key", buf.readUnsignedByte()); position.set("oil", buf.readUnsignedShort() / 10.0); - position.set(Position.KEY_POWER, buf.readUnsignedByte() + buf.readUnsignedByte() / 100.0); + position.set(Position.KEY_POWER, buf.readUnsignedByte() + buf.readUnsignedByte() * 0.01); position.set(Position.KEY_ODOMETER, buf.readUnsignedInt()); return position; diff --git a/src/org/traccar/protocol/HaicomProtocolDecoder.java b/src/org/traccar/protocol/HaicomProtocolDecoder.java index 97e980290..db26db820 100644 --- a/src/org/traccar/protocol/HaicomProtocolDecoder.java +++ b/src/org/traccar/protocol/HaicomProtocolDecoder.java @@ -105,7 +105,7 @@ public class HaicomProtocolDecoder extends BaseProtocolDecoder { position.set(Position.KEY_GPS, parser.next()); position.set(Position.KEY_INPUT, parser.next()); position.set(Position.KEY_OUTPUT, parser.next()); - position.set(Position.KEY_BATTERY, parser.nextDouble() / 10); + position.set(Position.KEY_BATTERY, parser.nextDouble() * 0.1); return position; } diff --git a/src/org/traccar/protocol/SkypatrolProtocolDecoder.java b/src/org/traccar/protocol/SkypatrolProtocolDecoder.java index 345c1aea3..f4dded972 100644 --- a/src/org/traccar/protocol/SkypatrolProtocolDecoder.java +++ b/src/org/traccar/protocol/SkypatrolProtocolDecoder.java @@ -166,7 +166,7 @@ public class SkypatrolProtocolDecoder extends BaseProtocolDecoder { } if (BitUtil.check(mask, 24)) { - position.set(Position.KEY_POWER, buf.readUnsignedShort() / 1000.0); + position.set(Position.KEY_POWER, buf.readUnsignedShort() * 0.001); } if (BitUtil.check(mask, 25)) { diff --git a/src/org/traccar/protocol/TotemProtocolDecoder.java b/src/org/traccar/protocol/TotemProtocolDecoder.java index 67a1d1213..c7dc9e6c1 100644 --- a/src/org/traccar/protocol/TotemProtocolDecoder.java +++ b/src/org/traccar/protocol/TotemProtocolDecoder.java @@ -275,7 +275,7 @@ public class TotemProtocolDecoder extends BaseProtocolDecoder { position.setTime(dateBuilder.getDate()); position.set(Position.PREFIX_IO + 1, parser.next()); - position.set(Position.KEY_BATTERY, parser.nextDouble() / 10); + position.set(Position.KEY_BATTERY, parser.nextDouble() * 0.1); position.set(Position.KEY_POWER, parser.nextDouble()); position.set(Position.PREFIX_ADC + 1, parser.next()); position.set(Position.PREFIX_ADC + 2, parser.next()); @@ -303,7 +303,7 @@ public class TotemProtocolDecoder extends BaseProtocolDecoder { .setTime(parser.nextInt(), parser.nextInt(), parser.nextInt()); position.setTime(dateBuilder.getDate()); - position.set(Position.KEY_BATTERY, parser.nextDouble() / 10); + position.set(Position.KEY_BATTERY, parser.nextDouble() * 0.1); position.set(Position.KEY_POWER, parser.nextDouble()); position.set(Position.PREFIX_ADC + 1, parser.next()); -- cgit v1.2.3