From f141d3b461e1c75efccddef6fb66b13084033637 Mon Sep 17 00:00:00 2001 From: mikeller Date: Sun, 12 Mar 2017 17:51:38 +1300 Subject: [PATCH] Added EAM baro altitude to HoTT. --- src/main/telemetry/hott.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/main/telemetry/hott.c b/src/main/telemetry/hott.c index dfae08c7e8..2860c1abc3 100644 --- a/src/main/telemetry/hott.c +++ b/src/main/telemetry/hott.c @@ -267,6 +267,14 @@ static inline void hottEAMUpdateBatteryDrawnCapacity(HOTT_EAM_MSG_t *hottEAMMess hottEAMMessage->batt_cap_H = mAh >> 8; } +static inline void hottEAMUpdateAltitude(HOTT_EAM_MSG_t *hottEAMMessage) +{ + const uint16_t hottEamAltitude = (baro.BaroAlt / 100) + HOTT_EAM_OFFSET_HEIGHT; + + hottEAMMessage->altitude_L = hottEamAltitude & 0x00FF; + hottEAMMessage->altitude_H = hottEamAltitude >> 8; +} + void hottPrepareEAMResponse(HOTT_EAM_MSG_t *hottEAMMessage) { // Reset alarms @@ -276,6 +284,7 @@ void hottPrepareEAMResponse(HOTT_EAM_MSG_t *hottEAMMessage) hottEAMUpdateBattery(hottEAMMessage); hottEAMUpdateCurrentMeter(hottEAMMessage); hottEAMUpdateBatteryDrawnCapacity(hottEAMMessage); + hottEAMUpdateAltitude(hottEAMMessage); } static void hottSerialWrite(uint8_t c)