@@ -520,6 +520,10 @@ static const blackboxSimpleFieldDefinition_t blackboxSlowFields[] = {
520520 {"escRPM" , -1 , UNSIGNED , PREDICT (0 ), ENCODING (UNSIGNED_VB )},
521521 {"escTemperature" , -1 , SIGNED , PREDICT (PREVIOUS ), ENCODING (SIGNED_VB )},
522522#endif
523+ #ifdef USE_TERRAIN
524+ {"terrainAGL" , -1 , UNSIGNED , PREDICT (0 ), ENCODING (SIGNED_VB )},
525+ {"terrainAMSL" , -1 , UNSIGNED , PREDICT (0 ), ENCODING (SIGNED_VB )},
526+ #endif
523527};
524528
525529#define BLACKBOX_FIRST_HEADER_SENDING_STATE BLACKBOX_STATE_SEND_HEADER
@@ -624,6 +628,10 @@ typedef struct blackboxSlowState_s {
624628#ifdef USE_ESC_SENSOR
625629 uint32_t escRPM ;
626630 int8_t escTemperature ;
631+ #endif
632+ #ifdef USE_TERRAIN
633+ int32_t terrainAGL ;
634+ int32_t terrainAMSL ;
627635#endif
628636 uint16_t rxUpdateRate ;
629637 uint8_t activeWpNumber ;
@@ -1409,6 +1417,10 @@ static void writeSlowFrame(void)
14091417 blackboxWriteUnsignedVB (slowHistory .escRPM );
14101418 blackboxWriteSignedVB (slowHistory .escTemperature );
14111419#endif
1420+ #ifdef USE_TERRAIN
1421+ blackboxWriteSignedVB (slowHistory .terrainAGL );
1422+ blackboxWriteSignedVB (slowHistory .terrainAMSL );
1423+ #endif
14121424
14131425 blackboxSlowFrameIterationTimer = 0 ;
14141426}
@@ -1484,6 +1496,10 @@ static void loadSlowState(blackboxSlowState_t *slow)
14841496 slow -> escRPM = escSensor -> rpm ;
14851497 slow -> escTemperature = escSensor -> temperature ;
14861498#endif
1499+ #ifdef USE_TERRAIN
1500+ slow -> terrainAGL = terrainGetLastDistanceCm ();
1501+ slow -> terrainAMSL = terrainGetLastAMSL ();
1502+ #endif
14871503}
14881504
14891505/**
0 commit comments