From 55dbee78f8069e80d54cf988943bf414db4a80a6 Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Wed, 31 Jan 2024 19:38:49 +1100 Subject: [PATCH] AP_LTM_Telem: add and use AP_BATTERY_ENABLED --- libraries/AP_LTM_Telem/AP_LTM_Telem.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libraries/AP_LTM_Telem/AP_LTM_Telem.cpp b/libraries/AP_LTM_Telem/AP_LTM_Telem.cpp index d4599d28d1..5d3bdc2f41 100644 --- a/libraries/AP_LTM_Telem/AP_LTM_Telem.cpp +++ b/libraries/AP_LTM_Telem/AP_LTM_Telem.cpp @@ -116,6 +116,7 @@ void AP_LTM_Telem::send_Gframe(void) // Sensors frame void AP_LTM_Telem::send_Sframe(void) { +#if AP_BATTERY_ENABLED const AP_BattMonitor &battery = AP::battery(); const uint16_t volt = (uint16_t) roundf(battery.voltage() * 1000.0f); // battery voltage (expects value in mV) float current; @@ -124,6 +125,10 @@ void AP_LTM_Telem::send_Sframe(void) } // note: max. current value we can send is 65.536 A const uint16_t amp = (uint16_t) roundf(current * 100.0f); // current sensor (expects value in hundredth of A) +#else + const uint16_t volt = 0; + const uint16_t amp = 0; +#endif // airspeed in m/s if available and enabled - even if not used - otherwise send 0 uint8_t airspeed = 0; // airspeed sensor (m/s)