AP_Hott_Telem: add and use AP_BATTERY_ENABLED

This commit is contained in:
Peter Barker 2024-01-31 19:38:49 +11:00 committed by Andrew Tridgell
parent 1f4c129341
commit 7f6cb0eab3
1 changed files with 2 additions and 0 deletions

View File

@ -109,6 +109,7 @@ void AP_Hott_Telem::send_EAM(void)
uint8_t stop_byte = 0x7D; //#44 stop
} msg {};
#if AP_BATTERY_ENABLED
const AP_BattMonitor &battery = AP::battery();
if (battery.num_instances() > 0) {
msg.batt1_voltage = uint16_t(battery.voltage(0) * 10);
@ -125,6 +126,7 @@ void AP_Hott_Telem::send_EAM(void)
if (battery.consumed_mah(used_mah)) {
msg.batt_used = used_mah * 0.1;
}
#endif // AP_BATTERY_ENABLED
const AP_Baro &baro = AP::baro();
msg.temp1 = uint8_t(baro.get_temperature(0) + 20.5);