1
0
Fork 0
mirror of https://github.com/iNavFlight/inav.git synced 2025-07-26 17:55:28 +03:00

Fix premature completion of launch sequence

This commit is contained in:
Konstantin Sharlaimov (DigitalEntity) 2017-03-07 19:59:41 +10:00
parent ca923c49da
commit f44b101888

View file

@ -142,6 +142,9 @@ void applyFixedWingLaunchController(timeUs_t currentTimeUs)
// Called at PID rate
if (launchState.launchDetected) {
bool applyLaunchIdleLogic = true;
if (launchState.motorControlAllowed) {
// If launch detected we are in launch procedure - control airplane
const float timeElapsedSinceLaunchMs = US2MS(currentTimeUs - launchState.launchStartedTime);
@ -156,7 +159,10 @@ void applyFixedWingLaunchController(timeUs_t currentTimeUs)
}
// Motor control enabled
if (launchState.motorControlAllowed && (timeElapsedSinceLaunchMs >= navConfig()->fw.launch_motor_timer)) {
if (timeElapsedSinceLaunchMs >= navConfig()->fw.launch_motor_timer) {
// Don't apply idle logic anymore
applyLaunchIdleLogic = false;
// Increase throttle gradually over `launch_motor_spinup_time` milliseconds
if (navConfig()->fw.launch_motor_spinup_time > 0) {
const float timeSinceMotorStartMs = constrainf(timeElapsedSinceLaunchMs - navConfig()->fw.launch_motor_timer, 0.0f, navConfig()->fw.launch_motor_spinup_time);
@ -169,7 +175,9 @@ void applyFixedWingLaunchController(timeUs_t currentTimeUs)
rcCommand[THROTTLE] = navConfig()->fw.launch_throttle;
}
}
else {
}
if (applyLaunchIdleLogic) {
// Launch idle logic - low throttle and zero out PIDs
applyFixedWingLaunchIdleLogic();
}