Skip to content

Commit 9b4a217

Browse files
Merge pull request #2677 from shellixyz/nav_launch_min_time
NAV_LAUNCH: add min time before leaving
2 parents 7106993 + 7df1aef commit 9b4a217

File tree

4 files changed

+7
-1
lines changed

4 files changed

+7
-1
lines changed

src/main/fc/settings.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1256,6 +1256,10 @@ groups:
12561256
field: fw.launch_motor_spinup_time
12571257
min: 0
12581258
max: 1000
1259+
- name: nav_fw_launch_min_time
1260+
field: fw.launch_min_time
1261+
min: 0
1262+
max: 60000
12591263
- name: nav_fw_launch_timeout
12601264
field: fw.launch_timeout
12611265
max: 60000

src/main/navigation/navigation.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ PG_RESET_TEMPLATE(navConfig_t, navConfig,
139139
.launch_idle_throttle = 1000, // Motor idle or MOTOR_STOP
140140
.launch_motor_timer = 500, // ms
141141
.launch_motor_spinup_time = 100, // ms, time to gredually increase throttle from idle to launch
142+
.launch_min_time = 0, // ms, min time in launch mode
142143
.launch_timeout = 5000, // ms, timeout for launch procedure
143144
.launch_climb_angle = 18, // 18 degrees
144145
.launch_max_angle = 45 // 45 deg

src/main/navigation/navigation.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ typedef struct navConfig_s {
155155
uint16_t launch_throttle; // Launch throttle
156156
uint16_t launch_motor_timer; // Time to wait before setting launch_throttle (ms)
157157
uint16_t launch_motor_spinup_time; // Time to speed-up motors from idle to launch_throttle (ESC desync prevention)
158+
uint16_t launch_min_time; // Minimum time in launch mode to prevent possible bump of the sticks from leaving launch mode early
158159
uint16_t launch_timeout; // Launch timeout to disable launch mode and swith to normal flight (ms)
159160
uint8_t launch_climb_angle; // Target climb angle for launch (deg)
160161
uint8_t launch_max_angle; // Max tilt angle (pitch/roll combined) to consider launch successful. Set to 180 to disable completely [deg]

src/main/navigation/navigation_fw_launch.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ void applyFixedWingLaunchController(timeUs_t currentTimeUs)
149149
const float timeElapsedSinceLaunchMs = US2MS(currentTimeUs - launchState.launchStartedTime);
150150

151151
// If user moves the stick - finish the launch
152-
if ((ABS(rcCommand[ROLL]) > rcControlsConfig()->pos_hold_deadband) || (ABS(rcCommand[PITCH]) > rcControlsConfig()->pos_hold_deadband)) {
152+
if ((timeElapsedSinceLaunchMs > navConfig()->fw.launch_min_time) && ((ABS(rcCommand[ROLL]) > rcControlsConfig()->pos_hold_deadband) || (ABS(rcCommand[PITCH]) > rcControlsConfig()->pos_hold_deadband))) {
153153
launchState.launchFinished = true;
154154
}
155155

0 commit comments

Comments
 (0)