Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,8 @@ class AircraftStateMachine {
val fcState = state.resolveFrom(isArmed, isFlying)
when {
// RC trigger arm while on ground: advance to armed
fcState.isArmed() && state.isOnTheGround() -> dispatch(ArmTransition)
fcState.isArmed() && !state.isArmed() && state.isOnTheGround() ->
dispatch(ArmTransition)

// Armed and on ground: advance to takeoff
fcState.isArmed() && fcState.isFlying() && state.isOnTheGround() ->
Expand All @@ -258,12 +259,13 @@ class AircraftStateMachine {
dispatch(FlyingTransition)

// Disarmed and grounded: return to standby
!fcState.isArmed() && !fcState.isFlying() && !state.armRequested ->
fcState.isStandBy() && !state.isStandBy() && !state.armRequested ->
dispatch(StandbyTransition)

// Catch unsuccessful arm
!fcState.isArmed() && state.armRequested -> {
if ((state.armTimestamp - System.currentTimeMillis()) > 10_000) {
if ((System.currentTimeMillis() - state.armTimestamp) > 10_000) {
logger.w { "Unable to arm! Moving to Standby state" }
dispatch(StandbyTransition)
}
}
Expand Down