mirror of https://github.com/ArduPilot/ardupilot
AP_LTM_Telem: add and use AP_BATTERY_ENABLED
This commit is contained in:
parent
7f6cb0eab3
commit
55dbee78f8
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue