Moved over the rotation menu to new system

Had to change how the values where stored in RAM from singed to unsigned to be able to use the generic menu features. Also had to add the MenuEntrySub as a parameter to the menu callback functions to be able fo display and store the correct values.

Did some major cleanup now that the special case of rotator menu is gone together with all uses of the old version of the sub menu struct.
This commit is contained in:
Mikael Degerfält 2019-06-23 01:17:56 +02:00
parent 6c721e8b65
commit bddbffd51d
4 changed files with 189 additions and 287 deletions

View file

@ -5,24 +5,9 @@
enum MenuType {
ESub,
ESubNew,
ESubRotator,
EStateChange,
};
struct MenuEntry {
enum MenuType type;
const char* title;
};
struct MenuEntrySub {
enum MenuType type;
const char* title;
const char* subTitle;
byte* flag;
void (*subMenuFunc)(int color);
};
enum MenuEntryFlags {
ENone = 0,
EWrap = (1<<0),
@ -30,7 +15,15 @@ enum MenuEntryFlags {
EEnterHandler = (1<<2),
};
struct MenuEntrySubNew {
struct MenuEntry {
enum MenuType type;
const char* title;
};
struct MenuEntrySub;
typedef const MenuEntrySub& SubMenuRef;
struct MenuEntrySub {
enum MenuType type;
const char* title;
const char* subTitle;
@ -38,21 +31,11 @@ struct MenuEntrySubNew {
uint16_t min;
uint16_t max;
uint16_t flags;
void (*getSubTextFunc)(char*textBuffer, const char**label);
void (*applyFunc)(void);
void (*getSubTextFunc)(SubMenuRef, char*textBuffer, const char**label);
void (*applyFunc)(SubMenuRef);
bool (*onEnterFunc)(void);
};
struct MenuEntrySubRotator {
enum MenuType type;
const char* title;
const char* subTitle;
byte flagValue;
byte* flag;
void (*subMenuFunc)(int color);
};
struct MenuEntryStateCh {
enum MenuType type;
const char* title;
@ -70,8 +53,6 @@ struct MenuPage {
//***********************************************************
struct AdjustValue {
uint16_t *value;
uint16_t limitLow;