Use new data for mode changes

This commit is contained in:
Lorenz Meier
2016-03-12 16:36:04 +01:00
parent 3373e994b4
commit c198388dd5
+3 -3
View File
@@ -2944,13 +2944,13 @@ set_main_state_rc(struct vehicle_status_s *status_local, struct manual_control_s
}
/* we know something has changed - check if we are in mode slot operation */
if (_last_sp_man.mode_slot > 0) {
if (sp_man->mode_slot > 0) {
if (_last_sp_man.mode_slot >= sizeof(_flight_mode_slots) / sizeof(_flight_mode_slots[0])) {
if (sp_man->mode_slot >= sizeof(_flight_mode_slots) / sizeof(_flight_mode_slots[0])) {
return TRANSITION_DENIED;
}
int new_mode = _flight_mode_slots[_last_sp_man.mode_slot];
int new_mode = _flight_mode_slots[sp_man->mode_slot];
if (new_mode < 0) {
/* slot is unused */