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:
parent
ca923c49da
commit
f44b101888
1 changed files with 31 additions and 23 deletions
|
@ -142,8 +142,11 @@ 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);
|
||||
const float timeElapsedSinceLaunchMs = US2MS(currentTimeUs - launchState.launchStartedTime);
|
||||
|
||||
// If user moves the stick - finish the launch
|
||||
if ((ABS(rcCommand[ROLL]) > rcControlsConfig()->pos_hold_deadband) || (ABS(rcCommand[PITCH]) > rcControlsConfig()->pos_hold_deadband)) {
|
||||
|
@ -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();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue