Skip to content

Support if-else in State Transition Specifier #911

@etiennecollin

Description

@etiennecollin

Hi!
In state machines, the FPP specification currently only supports the following pattern for state transitions:

on identifier [ if identifier ] transition-or-do

See: State Transition Specifier

It would be great, and I don't think too hard, to enable the use of an else in that transition specifier. Here is a pattern that we would like to use in our flight sequencer:

guard guard_sensors_read_nominal_values
signal tick
action current_state_action

state CURRENT_STATE {
	on tick if guard_sensors_read_nominal_values do { current_state_action } else enter ABORT_STATE
}

state ABORT_STATE {}

In essence, we want something like the choice, but that supports both the transition-expression and the do-expression. This would allow a more solid and intuitive logic flow in the state machine.

Let me know if you believe it would be possible and acceptable for you to add that syntax to FPP.

Thank you for your work and have a great day,
Etienne

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions