@@ -2267,7 +2267,7 @@ int commander_thread_main(int argc, char *argv[])
22672267 main_state_before_rtl == commander_state_s::MAIN_STATE_STAB)) {
22682268
22692269 // transition to previous state if sticks are increased
2270- const float min_stick_change = 0.2 ;
2270+ const float min_stick_change = 0 .2f ;
22712271 if ((_last_sp_man.timestamp != sp_man.timestamp ) &&
22722272 ((fabsf (sp_man.x ) - fabsf (_last_sp_man.x ) > min_stick_change) ||
22732273 (fabsf (sp_man.y ) - fabsf (_last_sp_man.y ) > min_stick_change) ||
@@ -2982,11 +2982,14 @@ set_main_state_rc(struct vehicle_status_s *status_local, struct manual_control_s
29822982 (_last_sp_man.mode_slot == sp_man->mode_slot ))) {
29832983
29842984 // update these fields for the geofence system
2985- _last_sp_man.timestamp = sp_man->timestamp ;
2986- _last_sp_man.x = sp_man->x ;
2987- _last_sp_man.y = sp_man->y ;
2988- _last_sp_man.z = sp_man->z ;
2989- _last_sp_man.r = sp_man->r ;
2985+
2986+ if (!rtl_on) {
2987+ _last_sp_man.timestamp = sp_man->timestamp ;
2988+ _last_sp_man.x = sp_man->x ;
2989+ _last_sp_man.y = sp_man->y ;
2990+ _last_sp_man.z = sp_man->z ;
2991+ _last_sp_man.r = sp_man->r ;
2992+ }
29902993
29912994 /* no timestamp change or no switch change -> nothing changed */
29922995 return TRANSITION_NOT_CHANGED;
0 commit comments