File tree 1 file changed +10
-6
lines changed
1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -1891,15 +1891,19 @@ void updateHomePosition(void)
1891
1891
}
1892
1892
}
1893
1893
else {
1894
+ static bool isHomeResetAllowed = false;
1895
+
1894
1896
// If pilot so desires he may reset home position to current position
1895
- if (IS_RC_MODE_ACTIVE (BOXHOMERESET ) && !FLIGHT_MODE (NAV_RTH_MODE ) && !FLIGHT_MODE (NAV_WP_MODE ) && posControl .flags .hasValidPositionSensor ) {
1896
- if (STATE (GPS_FIX_HOME )) {
1897
- setHomePosition (& posControl .actualState .pos , posControl .actualState .yaw , NAV_POS_UPDATE_XY | NAV_POS_UPDATE_HEADING );
1898
- }
1899
- else {
1900
- setHomePosition (& posControl .actualState .pos , posControl .actualState .yaw , NAV_POS_UPDATE_XY | NAV_POS_UPDATE_Z | NAV_POS_UPDATE_HEADING );
1897
+ if (IS_RC_MODE_ACTIVE (BOXHOMERESET )) {
1898
+ if (isHomeResetAllowed && !FLIGHT_MODE (NAV_RTH_MODE ) && !FLIGHT_MODE (NAV_WP_MODE ) && posControl .flags .hasValidPositionSensor ) {
1899
+ const navSetWaypointFlags_t homeUpdateFlags = STATE (GPS_FIX_HOME ) ? (NAV_POS_UPDATE_XY | NAV_POS_UPDATE_HEADING ) : (NAV_POS_UPDATE_XY | NAV_POS_UPDATE_Z | NAV_POS_UPDATE_HEADING );
1900
+ setHomePosition (& posControl .actualState .pos , posControl .actualState .yaw , homeUpdateFlags );
1901
+ isHomeResetAllowed = false;
1901
1902
}
1902
1903
}
1904
+ else {
1905
+ isHomeResetAllowed = true;
1906
+ }
1903
1907
1904
1908
// Update distance and direction to home if armed (home is not updated when armed)
1905
1909
if (STATE (GPS_FIX_HOME )) {
You can’t perform that action at this time.
0 commit comments