feat: Deadzone option for NV14 sticks (#1777)

Imported from open-flysky/Flysky-OpenTX-Test-Branch

* companion: Don't nuke `stickDeadZone` setting

* Implement data storage properly

* Add missing check for NV14 storage struct sizes

* Formatting

* Use one less byte in the packed data struct
Thanks @raphaelcoeffic :)

* Move setting of stickDeadZone default

* Use a Choice combo rather than NumberEdit

* Good riddance magic number

* Also set default stick zone if setting is missing

* Teach tests about `STICK_DEAD_ZONE`

* Tweak choice width

* Cpn NV14 add stick dead zone to hardware and section labels

* Cpn NV14 align default pot names to radio

Co-authored-by: elecpower <neilh713@tpg.com.au>
This commit is contained in:
Peter Feerick
2022-04-06 10:30:20 +10:00
committed by GitHub
co-authored by elecpower
parent 9d27a6923c
commit d9b51f8ecf
46 changed files with 173 additions and 11 deletions
+14
View File
@@ -346,6 +346,20 @@ void RadioHardwarePage::build(FormWindow * window)
grid.nextLine();
}
#if defined(STICK_DEAD_ZONE)
new StaticText(window, grid.getLabelSlot(true), STR_DEAD_ZONE);
auto choice =
new Choice(window, grid.getFieldSlot(2,0), 0, 7,
GET_DEFAULT(g_eeGeneral.stickDeadZone), [=](uint8_t newValue) {
g_eeGeneral.stickDeadZone = newValue;
SET_DIRTY();
});
choice->setTextHandler([](uint8_t value) {
return std::to_string(value ? 2 << (value - 1) : 0);
});
grid.nextLine();
#endif
// Pots
new Subtitle(window, grid.getLineSlot(), STR_POTS, 0, COLOR_THEME_PRIMARY1);
grid.nextLine();