AP_Periph: Correctly report Temperature to UAVCAN

This commit is contained in:
James O'Shannessy 2021-06-01 10:36:49 +10:00 committed by Peter Barker
parent 89e4df485a
commit 819bb2938b
1 changed files with 3 additions and 1 deletions

View File

@ -1480,7 +1480,9 @@ void AP_Periph_FW::can_battery_update(void)
} }
float temperature; float temperature;
if (battery.lib.get_temperature(temperature, i)) { if (battery.lib.get_temperature(temperature, i)) {
pkt.temperature = temperature; // Battery lib reports temperature in Celsius.
// Convert Celsius to Kelvin for tranmission on CAN.
pkt.temperature = temperature + C_TO_KELVIN;
} }
fix_float16(pkt.voltage); fix_float16(pkt.voltage);