Merge lp://staging/~sammyshp/flashlight-firmware/2c-turbo-config into lp://staging/~toykeeper/flashlight-firmware/anduril2
Status: | Needs review |
---|---|
Proposed branch: | lp://staging/~sammyshp/flashlight-firmware/2c-turbo-config |
Merge into: | lp://staging/~toykeeper/flashlight-firmware/anduril2 |
Diff against target: |
122 lines (+36/-8) 4 files modified
ToyKeeper/spaghetti-monster/anduril/load-save-config-fsm.h (+3/-0) ToyKeeper/spaghetti-monster/anduril/load-save-config.c (+6/-0) ToyKeeper/spaghetti-monster/anduril/ramp-mode.c (+21/-8) ToyKeeper/spaghetti-monster/anduril/ramp-mode.h (+6/-0) |
To merge this branch: | bzr merge lp://staging/~sammyshp/flashlight-firmware/2c-turbo-config |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Selene ToyKeeper | Pending | ||
Review via email: mp+407822@code.staging.launchpad.net |
Description of the change
Add runtime configuration of 2C turbo style
This adds a new configuration option to the global configuration menu if `USE_2C_
If `USE_2C_
Also add dynamic setup of the global configuration menu.
Unmerged revisions
- 619. By Sven Greiner
-
Add runtime configuration of 2C turbo style
This adds a new configuration option to the global configuration menu if
`USE_2C_STYLE_CONFIG` is defined. The user can select between 0 (no
change), 1 (Anduril 1 behavior) and 2 (Anduril 2) behavior. The default
is taken from `USE_2C_MAX_TURBO` if it is defined.If `USE_2C_
STYLE_CONFIG` is not defined, this creates the same output as
before (no increase in code size).Also add dynamic setup of the global configuration menu.
Looks like we were working on the same thing at similar times.
I used a somewhat different approach though...
- retained the USE_2C_MAX_TURBO compile option, for backward compatibility and a smaller binary click-from- ramp
- made turbo config apply to more places, not just double-
- made simple and advanced modes use independent turbo configs
- added a third style: no turbo (to retain simple UI's no-turbo policy)
- put the turbo config into ramp menus instead of the misc/globals menu
It'd be nice to remove some of the older code at some point, but for now it's still available as a compile option.
I really like the tricks you did to handle counting depending on which options are compiled in, and will have to keep it in mind for cases where it's needed. I'm debating how to handle variable features in menus though, since things get confusing when the UI has different items at different menu indexes in different builds. So for now I've tried to keep the menu item number consistent, even if prior items were compiled out. On the one hand, this leaves a gap in the menu where the user can change a setting but it has no effect. On the other hand, it means the documentation can give accurate info about which item is which, even when some items are missing.
Also, you make a good point about being able to use global variables instead of preprocessor symbols sometimes... since the compiler can detect when it never gets changed, and compile it out. I'm hoping to replace the entire set of config vars with a struct though, and I'm not sure yet if the same method will work there. Will have to test if the compiler can retain the same granular detection, or if it leaves redundant vars in since the container struct gets modified. Regardless, refactoring the config vars is going to be a bit messy, and requires some deeper changes, so I'm putting it off for now.