@@ -25,9 +25,6 @@ v2.1 - Add full support of SetPosition(x,y) to move the menu inside the screen (
2525#ifndef RSITE_ARDUINO_MENU_SYSTEM
2626 #define RSITE_ARDUINO_MENU_SYSTEM
2727
28- // PGM activated by default, non pgm mode is not working ok
29- #define USEPGM
30-
3128 #include < Stream.h>
3229 #include < HardwareSerial.h>
3330
@@ -119,13 +116,15 @@ v2.1 - Add full support of SetPosition(x,y) to move the menu inside the screen (
119116 // a menu is also a prompt so we can have sub-menus
120117 class prompt {
121118 public:
122- const char * text MEMMODE;
119+ const char * text; // MEMMODE; memmode is defined by the source, here its only a pointer
123120 promptAction action;
124121 static promptFeedback nothing () {return false ;}
125122 bool enabled;
126123 inline prompt (const char * text):text(text),enabled(true ),action(nothing) {}
127124 inline prompt (const char * text,promptAction action)
128125 :text(text),action(action),enabled(true ) {}
126+ inline void enable () {enabled=true ;}
127+ inline void disable () {enabled=false ;}
129128 virtual void printTo (menuOut& p) {
130129 // p.print(text);
131130 print_P (p,text);
@@ -170,11 +169,13 @@ v2.1 - Add full support of SetPosition(x,y) to move the menu inside the screen (
170169 bool canExit;// store last canExit value for inner reference
171170 menu (const char * text,int sz,prompt* const data[]):menuNode(text),sz(sz),data(data),canExit(false ) {}
172171
172+ inline prompt& operator [](int i) {return *(prompt*)pgmPtrNear (&data[i]);}
173173 inline void setPosition (int x,int y) {ox=x;oy=y;}
174174 int menuKeys (menuOut &p,Stream& c,bool drawExit);
175- inline void printMenu (menuOut& p,bool drawExit) {
175+ inline void printMenu (menuOut& p,bool drawExit= false ) {
176176 p.printMenu (*this ,drawExit);
177177 }
178+ // virtual bool needRedraw(menuOut& o,bool) {return o.drawn!=true;}
178179 // force menu redraw on selected device
179180 inline void redraw (menuOut& p,Stream& c,bool canExit=false ) {p.drawn =NULL ;poll (p,c,canExit);}
180181 // set the focus to menu->Option idx, the focused menu will exit to the current
0 commit comments