mirror of
https://github.com/iNavFlight/inav.git
synced 2025-07-19 14:25:16 +03:00
Merge pull request #6612 from tonyyng/auto-load-waypoints
Automatically load waypoints during FC boot
This commit is contained in:
commit
bde46fb957
5 changed files with 20 additions and 1 deletions
|
@ -120,6 +120,7 @@ PG_RESET_TEMPLATE(navConfig_t, navConfig,
|
|||
.pos_failure_timeout = SETTING_NAV_POSITION_TIMEOUT_DEFAULT, // 5 sec
|
||||
.waypoint_radius = SETTING_NAV_WP_RADIUS_DEFAULT, // 2m diameter
|
||||
.waypoint_safe_distance = SETTING_NAV_WP_SAFE_DISTANCE_DEFAULT, // centimeters - first waypoint should be closer than this
|
||||
.waypoint_load_on_boot = SETTING_NAV_WP_LOAD_ON_BOOT_DEFAULT, // load waypoints automatically during boot
|
||||
.max_auto_speed = SETTING_NAV_AUTO_SPEED_DEFAULT, // 3 m/s = 10.8 km/h
|
||||
.max_auto_climb_rate = SETTING_NAV_AUTO_CLIMB_RATE_DEFAULT, // 5 m/s
|
||||
.max_manual_speed = SETTING_NAV_MANUAL_SPEED_DEFAULT,
|
||||
|
@ -2868,6 +2869,12 @@ bool loadNonVolatileWaypointList(void)
|
|||
if (ARMING_FLAG(ARMED))
|
||||
return false;
|
||||
|
||||
// if waypoints are already loaded, just unload them.
|
||||
if (posControl.waypointCount > 0) {
|
||||
resetWaypointList();
|
||||
return false;
|
||||
}
|
||||
|
||||
resetWaypointList();
|
||||
|
||||
for (int i = 0; i < NAV_MAX_WAYPOINTS; i++) {
|
||||
|
@ -3576,6 +3583,11 @@ void navigationInit(void)
|
|||
} else {
|
||||
DISABLE_STATE(FW_HEADING_USE_YAW);
|
||||
}
|
||||
|
||||
#if defined(NAV_NON_VOLATILE_WAYPOINT_STORAGE)
|
||||
if (navConfig()->general.waypoint_load_on_boot)
|
||||
loadNonVolatileWaypointList();
|
||||
#endif
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue