-
Notifications
You must be signed in to change notification settings - Fork 1
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
Replacing serial terminal with menu #336
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not (as suggested) use a miniconf tree for read
/write
?
The two issues I see have acceptable trade offs:
- read-only mac: intercept seems doable
- User needs to write json:
"1.2.3.4"
instead of1.2.3.4
Miniconf would indeed simplify a lot of this! That would be a nice way to remove a lot of the redundancy. I'll take a stab at this |
I've been playing around with it, and while it's indeed possible, there's a number of difficulties:
Thus, we could make a separate miniconf-enabled tree and then copy the contents into the struct that gets serialized to EEPROM later, but we still have to fight (1) above as well. If we juse used i.e. raw byte arrays for the leaves of the tree, the user would need to write I'm not opposed to refactoring this, but it would be a fair amount of thrash in the settings code. |
Why does For ser/de on external structs we can use |
I did some hacking and with a few wrapper types and support libs, I got around the most painful issues I mentioned above and am using Miniconf now. |
pub gateway: IpAddr, | ||
pub broker: IpAddr, | ||
pub fan_speed: f32, | ||
pub id: String<23>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a separate struct from BoosterMainBoardData so that we can hide away implementation details from miniconf (like the fact we have an id_len
u32 and id
is actually an array of bytes, etc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice.
I thought that there should be a way to make BoosterMainBoardData
and Properties
the same thing by impl Encode/Decode for
IpAddrand
String`, no?
But that can also become a later refactor.
We could combine them, but we would need a way to hide the |
Ah right. Might be easier to add a |
This PR refactors the serial port menu to use
menu
, which implements a lot of the things we want without having to maintain them here.Ultimately, it may be nice to abstract the various concepts here to make this menu usable in Stabilizer as well and reduce some of the redundant code.