diff --git a/src/main/blackbox/blackbox.c b/src/main/blackbox/blackbox.c index cb12a7a896..5a5d88cb9c 100644 --- a/src/main/blackbox/blackbox.c +++ b/src/main/blackbox/blackbox.c @@ -436,6 +436,7 @@ static const blackboxSimpleFieldDefinition_t blackboxSlowFields[] = { {"escTemperature", -1, SIGNED, PREDICT(PREVIOUS), ENCODING(SIGNED_VB)}, #endif {"rxUpdateRate", -1, UNSIGNED, PREDICT(PREVIOUS), ENCODING(UNSIGNED_VB)}, + {"activeWpNumber", -1, UNSIGNED, PREDICT(0), ENCODING(UNSIGNED_VB)}, }; typedef enum BlackboxState { @@ -554,6 +555,7 @@ typedef struct blackboxSlowState_s { int8_t escTemperature; #endif uint16_t rxUpdateRate; + uint8_t activeWpNumber; } __attribute__((__packed__)) blackboxSlowState_t; // We pack this struct so that padding doesn't interfere with memcmp() //From rc_controls.c @@ -1291,6 +1293,7 @@ static void writeSlowFrame(void) blackboxWriteSignedVB(slowHistory.escTemperature); #endif blackboxWriteUnsignedVB(slowHistory.rxUpdateRate); + blackboxWriteUnsignedVB(slowHistory.activeWpNumber); blackboxSlowFrameIterationTimer = 0; } @@ -1368,6 +1371,7 @@ static void loadSlowState(blackboxSlowState_t *slow) #endif slow->rxUpdateRate = getRcUpdateFrequency(); + slow->activeWpNumber = getActiveWpNumber(); } /** diff --git a/src/main/navigation/navigation.c b/src/main/navigation/navigation.c index c566c94bfa..5e7f22665a 100644 --- a/src/main/navigation/navigation.c +++ b/src/main/navigation/navigation.c @@ -4583,3 +4583,8 @@ int8_t navCheckActiveAngleHoldAxis(void) return activeAxis; } + +uint8_t getActiveWpNumber(void) +{ + return NAV_Status.activeWpNumber; +} diff --git a/src/main/navigation/navigation.h b/src/main/navigation/navigation.h index d4ee6e078e..a939c623ef 100644 --- a/src/main/navigation/navigation.h +++ b/src/main/navigation/navigation.h @@ -595,7 +595,7 @@ bool isFixedWingAutoThrottleManuallyIncreased(void); bool navigationIsFlyingAutonomousMode(void); bool navigationIsExecutingAnEmergencyLanding(void); bool navigationIsControllingAltitude(void); -/* Returns true iff navConfig()->general.flags.rth_allow_landing is NAV_RTH_ALLOW_LANDING_ALWAYS +/* Returns true if navConfig()->general.flags.rth_allow_landing is NAV_RTH_ALLOW_LANDING_ALWAYS * or if it's NAV_RTH_ALLOW_LANDING_FAILSAFE and failsafe mode is active. */ bool navigationRTHAllowsLanding(void); @@ -628,6 +628,7 @@ void checkManualEmergencyLandingControl(bool forcedActivation); float updateBaroAltitudeRate(float newBaroAltRate, bool updateValue); int8_t navCheckActiveAngleHoldAxis(void); +uint8_t getActiveWpNumber(void); /* Returns the heading recorded when home position was acquired. * Note that the navigation system uses deg*100 as unit and angles