Skip to content

Commit

Permalink
Merge pull request #1426 from bitcraze/rik/disarming
Browse files Browse the repository at this point in the history
Disarming improvements
  • Loading branch information
gemenerik authored Oct 21, 2024
2 parents 80ee72a + 6e1dc30 commit e0df606
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
6 changes: 3 additions & 3 deletions src/modules/src/supervisor.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
19 changes: 14 additions & 5 deletions src/modules/src/supervisor_state_machine.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,

Expand All @@ -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,
},
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit e0df606

Please sign in to comment.