@@ -85,6 +85,8 @@ void setValue(prompt &p,menuOut &o, Stream &i,int &value,const char* text,const
8585void ledOn () {digitalWrite (LEDPIN,1 );}
8686void ledOff () {digitalWrite (LEDPIN,0 );}
8787void disabledTest (prompt &p,menuOut &o,Stream &i) {
88+ o.clear ();
89+ o.setCursor (0 ,0 );
8890 o.print (" THIS IS AN ERROR, this option should never be called as it is disabled" );
8991 while (i.read ()!=13 );
9092}
@@ -97,6 +99,7 @@ void setDutty(prompt &p,menuOut &o,Stream &i) {setValue(p,o,i,dutty,"Dutty:","%"
9799
98100void completeHandlerTest (prompt &p,menuOut &o,Stream &i) {
99101 o.clear ();
102+ o.setCursor (0 ,0 );
100103 o.print (" Handler test ok!" );
101104 while (i.read ()!=13 );
102105}
@@ -114,6 +117,17 @@ MENU(mainMenu,"Sistema",
114117 OP(" Dutty" ,setDutty),
115118 OP(" Disabled" ,disabledTest),
116119 OP(" Handler test" ,completeHandlerTest),
120+ OP(" Handler test" ,completeHandlerTest),
121+ OP(" Handler test" ,completeHandlerTest),
122+ OP(" Handler test" ,completeHandlerTest),
123+ OP(" Handler test" ,completeHandlerTest),
124+ OP(" Handler test" ,completeHandlerTest),
125+ OP(" Handler test" ,completeHandlerTest),
126+ OP(" Handler test" ,completeHandlerTest),
127+ OP(" Handler test" ,completeHandlerTest),
128+ OP(" Handler test" ,completeHandlerTest),
129+ OP(" Handler test" ,completeHandlerTest),
130+ OP(" Handler test" ,completeHandlerTest),
117131 SUBMENU(subMenu)
118132);
119133
@@ -144,6 +158,8 @@ menuGFX gfx(tft);
144158// /////////////////////////////////////////////////////////////////////////////
145159
146160void setup () {
161+ mainMenu.data [2 ]->enabled =false ;// disabling option
162+
147163 Serial.begin (9600 );
148164 Serial.println (" menu system test" );
149165
@@ -166,7 +182,7 @@ void setup() {
166182 lcd1.print (" Menu test" );
167183
168184 digitalWrite (vpinsSPI_CS,HIGH);
169- digitalWrite (tftCS,LOW );
185+ digitalWrite (tftCS,HIGH );
170186 tft.initR (INITR_BLACKTAB);
171187 tft.setRotation (3 );
172188 tft.setTextWrap (false );
@@ -175,13 +191,22 @@ void setup() {
175191 tft.fillScreen (ST7735_BLACK);
176192 tft.print (" Menu test on GFX" );
177193 tft.setCursor (0 ,10 );
194+
195+ digitalWrite (vpinsSPI_CS,LOW);
196+ digitalWrite (tftCS,LOW);
197+ lcd1.setCursor (0 ,1 );
198+ lcd1.print (mainMenu.width );
199+ digitalWrite (vpinsSPI_CS,HIGH);
200+ digitalWrite (tftCS,HIGH);
201+
202+ // update limits after screen rotation
203+ gfx.maxX =tft.width ()/gfx.resX ;
204+ gfx.maxY =tft.height ()/gfx.resY ;
178205
179206 pinMode (encBtn, INPUT);
180207 digitalWrite (encBtn,1 );
181208
182209 pinMode (LEDPIN,OUTPUT);
183-
184- mainMenu.data [2 ]->enabled =false ;
185210}
186211
187212// /////////////////////////////////////////////////////////////////////////////
@@ -211,7 +236,7 @@ void setValue(prompt &p,menuOut &o, Stream &i,int &value,const char* text,const
211236 int at=strlen (text);// .length();
212237 o.setCursor (0 ,0 );
213238 o.print (text);
214- if (o.style ==menuOut::enumerated) {// probably a Serial terminal -------------------------------------
239+ /* if (o.style==menuOut::enumerated) {//probably a Serial terminal -------------------------------------
215240 //long timeout because some terminals send data righ away when typed, and parseInt would parse a partial number
216241 i.setTimeout(10000);//lib gives no access to previous timeout value :( ... cant restore it then, i would wait forever if possible
217242 value=i.parseInt();//assuming data was all delivered to the buffer (we had a large timeout)
@@ -221,7 +246,7 @@ void setValue(prompt &p,menuOut &o, Stream &i,int &value,const char* text,const
221246 i.setTimeout(1000);//assuming it was default
222247 Serial.println(value);//feed back
223248 while(i.available()) i.read();//clean up extra characters to avoid reentry
224- } else {// then we assume its some kind of encoder ---------------------------------------------------
249+ } else {*/ // then we assume its some kind of encoder ---------------------------------------------------
225250 if (!steps) steps=(hi-low)/(float )o.maxX ;
226251 float fact=((float )sensivity)/((float )steps);// sensivity factor
227252 float pos=quadEncoder.pos *fact;
@@ -243,7 +268,7 @@ void setValue(prompt &p,menuOut &o, Stream &i,int &value,const char* text,const
243268 last=pos;
244269 }
245270 // func();
246- }
271+ // }
247272 delay (100 );
248273 while (encButton.read ()==13 );
249274 }
0 commit comments