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

Implement MQTT-based control interface #51

Merged
merged 17 commits into from
Sep 7, 2020

Conversation

ryan-summers
Copy link
Member

@ryan-summers ryan-summers commented Sep 2, 2020

This PR adds a control interface to booster over MQTT. Currently, the following topics are used:

  • booster/enable - Enable a specific RF channel
  • booster/disable - Disable a specific RF channel
  • booster/thresholds - Configure interlock thresholds for a specific RF channel
  • booster/tune - Tune the RF bias current of an enabled channel

This closes #7 by implementing the RF bias current algorithm.

This closes #8 by allowing channel tuning over the MQTT control interface.

This also closes #50 by implementing a fix to the getter function.

TODO:

src/rf_channel.rs Outdated Show resolved Hide resolved
src/rf_channel.rs Outdated Show resolved Hide resolved
src/rf_channel.rs Show resolved Hide resolved
// to re-establish them once we reconnect.
Err(minimq::Error::Disconnected) => self.subscribed = false,

Err(e) => panic!("Unexpected error: {:?}", e),
Copy link
Member Author

Choose a reason for hiding this comment

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

I've been observing a spurious error here whenever the MQTT broker is disconnected minimq::Error::Network(Spi(5)) - need to find the root cause before merging.

Copy link
Member Author

Choose a reason for hiding this comment

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

This is now tracked in minimq, since the bug is related to minimq's management of W5500 errors.

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.

Feel free to decide whether to settle the tune request state thing before merging or address it later. Either is fine with me.

src/rf_channel.rs Show resolved Hide resolved
src/rf_channel.rs Show resolved Hide resolved
@ryan-summers ryan-summers requested a review from jordens September 5, 2020 09:18
@ryan-summers
Copy link
Member Author

@jordens I've done a minor refactor to include the Powered state and updated the API for the control interface to be a bit cleaner. Ran tests locally using the python script to ensure everything was working nominally.

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.

We may want to bikeshed the state names a bit (and the should_enable might be done as a separate state) but I don't have a clearly optimal set of names currently. I think this is fine for now.

@ryan-summers ryan-summers merged commit 90c3201 into develop Sep 7, 2020
@ryan-summers ryan-summers deleted the feature/control-interface branch September 7, 2020 07:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants