1
0
Fork 0
mirror of https://github.com/iNavFlight/inav.git synced 2025-07-19 06:15:14 +03:00

add flown loiter radius for fixed wing

This commit is contained in:
breadoven 2024-06-29 13:43:10 +01:00
parent 41c89a7784
commit 817981fa4b
4 changed files with 65 additions and 51 deletions

View file

@ -5074,5 +5074,12 @@ bool canFwLandingBeCancelled(void)
{ {
return FLIGHT_MODE(NAV_FW_AUTOLAND) && posControl.navState != NAV_STATE_FW_LANDING_FLARE; return FLIGHT_MODE(NAV_FW_AUTOLAND) && posControl.navState != NAV_STATE_FW_LANDING_FLARE;
} }
#endif #endif
uint16_t getFlownLoiterRadius(void)
{
if (STATE(AIRPLANE) && navGetCurrentStateFlags() & NAV_CTL_HOLD) {
return CENTIMETERS_TO_METERS(calculateDistanceToDestination(&posControl.desiredState.pos));
}
return 0;
}

View file

@ -694,6 +694,7 @@ bool rthAltControlStickOverrideCheck(uint8_t axis);
int8_t navCheckActiveAngleHoldAxis(void); int8_t navCheckActiveAngleHoldAxis(void);
uint8_t getActiveWpNumber(void); uint8_t getActiveWpNumber(void);
uint16_t getFlownLoiterRadius(void);
/* Returns the heading recorded when home position was acquired. /* Returns the heading recorded when home position was acquired.
* Note that the navigation system uses deg*100 as unit and angles * Note that the navigation system uses deg*100 as unit and angles

View file

@ -830,6 +830,11 @@ static int logicConditionGetFlightOperandValue(int operand) {
case LOGIC_CONDITION_OPERAND_FLIGHT_LOITER_RADIUS: case LOGIC_CONDITION_OPERAND_FLIGHT_LOITER_RADIUS:
return getLoiterRadius(navConfig()->fw.loiter_radius); return getLoiterRadius(navConfig()->fw.loiter_radius);
break;
case LOGIC_CONDITION_OPERAND_FLIGHT_FLOWN_LOITER_RADIUS:
return getFlownLoiterRadius();
break;
case LOGIC_CONDITION_OPERAND_FLIGHT_AGL_STATUS: case LOGIC_CONDITION_OPERAND_FLIGHT_AGL_STATUS:
return isEstimatedAglTrusted(); return isEstimatedAglTrusted();

View file

@ -143,6 +143,7 @@ typedef enum {
LOGIC_CONDITION_OPERAND_FLIGHT_ATTITUDE_YAW, // deg // 40 LOGIC_CONDITION_OPERAND_FLIGHT_ATTITUDE_YAW, // deg // 40
LOGIC_CONDITION_OPERAND_FLIGHT_FW_LAND_STATE, // 41 LOGIC_CONDITION_OPERAND_FLIGHT_FW_LAND_STATE, // 41
LOGIC_CONDITION_OPERAND_FLIGHT_BATT_PROFILE, // int // 42 LOGIC_CONDITION_OPERAND_FLIGHT_BATT_PROFILE, // int // 42
LOGIC_CONDITION_OPERAND_FLIGHT_FLOWN_LOITER_RADIUS, // 43
} logicFlightOperands_e; } logicFlightOperands_e;
typedef enum { typedef enum {