@@ -68,18 +68,19 @@ v2.0 - Calling action on every elements
6868 else if (value>high) value=high;
6969 }
7070 // lazy drawing, we have no drawing position here... so we will ask the menu to redraw
71- virtual void activate (menuOut& p,Stream&c,bool canExit=false ) {
71+ virtual promptFeedback activate (menuOut& p,Stream&c,bool canExit=false ) {
7272 if (activeNode!=this ) {
73- action (*this ,p,c);
73+ if ( action (*this ,p,c)) return true ; ;
7474 ox=activeNode->ox ;
7575 oy=activeNode->oy ;
7676 previousMenu=(menu*)activeNode;
7777 activeNode=this ;
7878 p.lastSel =-1 ;
7979 previousMenu->printMenu (p,previousMenu->canExit );
8080 }
81+ // printing here to solve U8GLX blank screen on field edit
8182 previousMenu->printMenu (p,previousMenu->canExit );
82- if (!c.available ()) return ;
83+ if (!c.available ()) return 0 ;
8384 if (strchr (numericChars,c.peek ())) {// a numeric value was entered
8485 value=c.parseFloat ();
8586 tunning=false ;
@@ -104,6 +105,7 @@ v2.0 - Calling action on every elements
104105 p.lastSel =-1 ;
105106 previousMenu->printMenu (p,previousMenu->canExit );
106107 }
108+ return 0 ;
107109 }
108110 };
109111
@@ -133,9 +135,9 @@ v2.0 - Calling action on every elements
133135 menuSelect<T>(target,text,sz,data) {menuSelect<T>::sync ();}
134136
135137 // ignore canExit (this exists by select), however we could use a cancel option instead of Exit
136- void activate (menuOut& p,Stream& c,bool ) {
138+ promptFeedback activate (menuOut& p,Stream& c,bool ) {
137139 if (menu::activeNode!=this ) {
138- menuSelect<T>::action (*this ,p,c);
140+ if ( menuSelect<T>::action (*this ,p,c)) return true ;
139141 this ->setPosition (menuNode::activeNode->ox ,menuNode::activeNode->oy );
140142 this ->menu ::previousMenu=(menu*)menu::activeNode;
141143 menu::activeNode=this ;
@@ -156,6 +158,7 @@ v2.0 - Calling action on every elements
156158 c.flush ();// reset the encoder
157159 }
158160 }
161+ return 0 ;
159162 }
160163 };
161164 template <typename T>
@@ -165,16 +168,17 @@ v2.0 - Calling action on every elements
165168 menuToggle (const char *text,unsigned int sz,menuValue<T>* const data[],T& target):
166169 menuSelect<T>(target,text,sz,data) {menuSelect<T>::sync ();}
167170
168- void activate (menuOut& p,Stream& c,bool canExit) {
171+ promptFeedback activate (menuOut& p,Stream& c,bool canExit) {
169172 // Serial.println("entering toggle");
170- menuSelect<T>::action (*this ,p,c);
173+ if ( menuSelect<T>::action (*this ,p,c)) return true ;
171174 /* ox=activeNode->ox;
172175 oy=activeNode->oy;*/
173176 this ->menu ::sel++;
174177 if (this ->menu ::sel>=this ->menu ::sz) this ->menu ::sel=0 ;
175178 p.lastSel =-1 ;// redraw only affected option
176179 this ->menuSelect <T>::target=((menuValue<T>*)this ->menu ::data[menu::sel])->value ;
177180 this ->menu ::data[this ->menu ::sel]->activate (p,c,true );
181+ return 0 ;
178182 }
179183 };
180184#endif
0 commit comments