diff --git a/src/Vehicle/BatteryFact.json b/src/Vehicle/BatteryFact.json index b915bc4..6a5eecb 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 79b61d2..82afb84 100644 --- a/src/Vehicle/Vehicle.cc +++ b/src/Vehicle/Vehicle.cc @@ -657,7 +657,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);