From ee061d436b004bba073aa20c1a131b9f292007b2 Mon Sep 17 00:00:00 2001 From: Don Gagne Date: Tue, 6 Dec 2016 19:50:33 -0800 Subject: [PATCH] Change Vehicle.Battery.current to Amps units --- src/Vehicle/BatteryFact.json | 2 +- src/Vehicle/Vehicle.cc | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Vehicle/BatteryFact.json b/src/Vehicle/BatteryFact.json index b915bc4b2..6a5eecb36 100644 --- a/src/Vehicle/BatteryFact.json +++ b/src/Vehicle/BatteryFact.json @@ -25,7 +25,7 @@ "shortDescription": "Current", "type": "int32", "decimalPlaces": 0, - "units": "mA" + "units": "A" }, { "name": "temperature", diff --git a/src/Vehicle/Vehicle.cc b/src/Vehicle/Vehicle.cc index 90ad8003d..be65e9303 100644 --- a/src/Vehicle/Vehicle.cc +++ b/src/Vehicle/Vehicle.cc @@ -661,7 +661,8 @@ void Vehicle::_handleSysStatus(mavlink_message_t& message) if (sysStatus.current_battery == -1) { _batteryFactGroup.current()->setRawValue(VehicleBatteryFactGroup::_currentUnavailable); } else { - _batteryFactGroup.current()->setRawValue((double)sysStatus.current_battery * 10); + // Current is in Amps, current_battery is 10 * milliamperes (1 = 10 milliampere) + _batteryFactGroup.current()->setRawValue((int)(sysStatus.current_battery / 100)); } if (sysStatus.voltage_battery == UINT16_MAX) { _batteryFactGroup.voltage()->setRawValue(VehicleBatteryFactGroup::_voltageUnavailable); -- 2.22.0