1
0
Fork 0
mirror of https://github.com/iNavFlight/inav.git synced 2025-07-23 16:25:26 +03:00

Fix fly time bug

Closes #4141
This commit is contained in:
Michel Pastor 2019-01-06 00:14:45 +01:00
parent 7f3c69e2c2
commit 2ea3f50e5e
5 changed files with 9 additions and 1 deletions

View file

@ -713,7 +713,7 @@ void taskMainPidLoop(timeUs_t currentTimeUs)
cycleTime = getTaskDeltaTime(TASK_SELF); cycleTime = getTaskDeltaTime(TASK_SELF);
dT = (float)cycleTime * 0.000001f; dT = (float)cycleTime * 0.000001f;
if (ARMING_FLAG(ARMED) && ((!STATE(FIXED_WING)) || (!isNavLaunchEnabled()) || (isNavLaunchEnabled() && isFixedWingLaunchDetected()))) { if (ARMING_FLAG(ARMED) && (!STATE(FIXED_WING) || !isNavLaunchEnabled() || (isNavLaunchEnabled() && (isFixedWingLaunchDetected() || isFixedWingLaunchFinishedOrAborted())))) {
flightTime += cycleTime; flightTime += cycleTime;
} }

View file

@ -1504,6 +1504,7 @@ static navigationFSMEvent_t navOnEnteringState_NAV_STATE_LAUNCH_WAIT(navigationF
if (feature(FEATURE_FW_LAUNCH)) { if (feature(FEATURE_FW_LAUNCH)) {
throttleStatus_e throttleStatus = calculateThrottleStatus(); throttleStatus_e throttleStatus = calculateThrottleStatus();
if ((throttleStatus == THROTTLE_LOW) && (areSticksDeflectedMoreThanPosHoldDeadband())) { if ((throttleStatus == THROTTLE_LOW) && (areSticksDeflectedMoreThanPosHoldDeadband())) {
abortFixedWingLaunch();
return NAV_FSM_EVENT_SWITCH_TO_IDLE; return NAV_FSM_EVENT_SWITCH_TO_IDLE;
} }
} }

View file

@ -417,6 +417,7 @@ bool navigationRTHAllowsLanding(void);
bool isNavLaunchEnabled(void); bool isNavLaunchEnabled(void);
bool isFixedWingLaunchDetected(void); bool isFixedWingLaunchDetected(void);
bool isFixedWingLaunchFinishedOrAborted(void);
float calculateAverageSpeed(); float calculateAverageSpeed();

View file

@ -122,6 +122,11 @@ bool isFixedWingLaunchFinishedOrAborted(void)
return launchState.launchFinished; return launchState.launchFinished;
} }
void abortFixedWingLaunch(void)
{
launchState.launchFinished = true;
}
#define LAUNCH_MOTOR_IDLE_SPINUP_TIME 1500 //ms #define LAUNCH_MOTOR_IDLE_SPINUP_TIME 1500 //ms
static void applyFixedWingLaunchIdleLogic(void) static void applyFixedWingLaunchIdleLogic(void)

View file

@ -424,6 +424,7 @@ void resetFixedWingLaunchController(timeUs_t currentTimeUs);
bool isFixedWingLaunchDetected(void); bool isFixedWingLaunchDetected(void);
void enableFixedWingLaunchController(timeUs_t currentTimeUs); void enableFixedWingLaunchController(timeUs_t currentTimeUs);
bool isFixedWingLaunchFinishedOrAborted(void); bool isFixedWingLaunchFinishedOrAborted(void);
void abortFixedWingLaunch(void);
void applyFixedWingLaunchController(timeUs_t currentTimeUs); void applyFixedWingLaunchController(timeUs_t currentTimeUs);
#endif #endif