Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restructuring channel power state to an enum #183

Merged
merged 10 commits into from
Feb 3, 2022

Conversation

ryan-summers
Copy link
Member

@ryan-summers ryan-summers commented Feb 2, 2022

This PR fixes #174 by refactoring the power state of channels to be a 3-valued enum.

TODO:

  • Verify that the new format can be loaded from old EEPROM data.

src/hardware/rf_channel.rs Outdated Show resolved Hide resolved
src/settings/channel_settings.rs Outdated Show resolved Hide resolved
src/settings/channel_settings.rs Show resolved Hide resolved
src/settings/channel_settings.rs Outdated Show resolved Hide resolved
src/settings/channel_settings.rs Outdated Show resolved Hide resolved
src/hardware/rf_channel.rs Outdated Show resolved Hide resolved
src/hardware/rf_channel.rs Outdated Show resolved Hide resolved
Copy link
Member

@jordens jordens left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.
There is no static analysis of the event/state combinations in smlang, right? I.e. if code does handle_event(X) while in state Y, we get a panic if there is no corresponding transition. Or does it ignore these events?

@ryan-summers
Copy link
Member Author

When you call process_event(event), it returns a Result indicating whether or not the event was accepted for the given state. In some cases, we don't care if the transition failed, so we just ok() it. In others when we can guarantee that the transition will always be valid, we do an unwrap() instead since it should never panic.

@ryan-summers ryan-summers merged commit 3582849 into develop Feb 3, 2022
@ryan-summers ryan-summers deleted the feature/powerstate branch February 3, 2022 16:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update desired channel state setting to reflect a three-valued enum
2 participants