diff --git a/src/modules/src/supervisor.c b/src/modules/src/supervisor.c index d9e6ae3e7..57816d650 100644 --- a/src/modules/src/supervisor.c +++ b/src/modules/src/supervisor.c @@ -263,9 +263,9 @@ static void postTransitionActions(SupervisorMem_t* this, const supervisorState_t if (newState == supervisorStateLanded) { supervisorSetLatestLandingTime(this, currentTick); } - - if ((previousState == supervisorStateLanded) && (newState == supervisorStateReset)) { - DEBUG_PRINT("Landing timeout, disarming\n"); + + if ((previousState == supervisorStateFlying || previousState == supervisorStateLanded) && (newState == supervisorStateReset)) { + DEBUG_PRINT("Disarming\n"); } if (newState == supervisorStateLocked) { diff --git a/src/modules/src/supervisor_state_machine.c b/src/modules/src/supervisor_state_machine.c index 636b6e378..73a1b9400 100644 --- a/src/modules/src/supervisor_state_machine.c +++ b/src/modules/src/supervisor_state_machine.c @@ -160,7 +160,7 @@ static SupervisorStateTransition_t transitionsFlying[] = { .newState = supervisorStateExceptFreeFall, .triggers = SUPERVISOR_CB_COMMANDER_WDT_TIMEOUT | SUPERVISOR_CB_EMERGENCY_STOP, - .negatedTriggers = SUPERVISOR_CB_ARMED, + .negatedTriggers = SUPERVISOR_CB_NONE, .triggerCombiner = supervisorAny, .blockerCombiner = supervisorNever, @@ -169,11 +169,20 @@ static SupervisorStateTransition_t transitionsFlying[] = { .newState = supervisorStateCrashed, .triggers = SUPERVISOR_CB_IS_TUMBLED, - .negatedTriggers = SUPERVISOR_CB_ARMED, + .negatedTriggers = SUPERVISOR_CB_NONE, .triggerCombiner = supervisorAny, .blockerCombiner = supervisorNever, }, + { + .newState = supervisorStateReset, + + .triggers = SUPERVISOR_CB_NONE, + .negatedTriggers = SUPERVISOR_CB_ARMED, + .triggerCombiner = supervisorAll, + + .blockerCombiner = supervisorNever, + }, { .newState = supervisorStateWarningLevelOut, @@ -199,8 +208,8 @@ static SupervisorStateTransition_t transitionsLanded[] = { .newState = supervisorStateReset, .triggers = SUPERVISOR_CB_LANDING_TIMEOUT, - .negatedTriggers = SUPERVISOR_CB_NONE, - .triggerCombiner = supervisorAll, + .negatedTriggers = SUPERVISOR_CB_ARMED, + .triggerCombiner = supervisorAny, .blockerCombiner = supervisorNever, }, @@ -230,7 +239,7 @@ static SupervisorStateTransition_t transitionsWarningLevelOut[] = { .newState = supervisorStateExceptFreeFall, .triggers = SUPERVISOR_CB_COMMANDER_WDT_TIMEOUT | SUPERVISOR_CB_IS_TUMBLED | SUPERVISOR_CB_EMERGENCY_STOP, - .negatedTriggers = SUPERVISOR_CB_ARMED, + .negatedTriggers = SUPERVISOR_CB_NONE, .triggerCombiner = supervisorAny, .blockerCombiner = supervisorNever,