1616#define LCDWIRE_DIRECT 4
1717
1818// how the LCD is wired
19- // #define LCD_WIRE LCDWIRE_NONE
19+ #define LCD_WIRE LCDWIRE_NONE
2020// #define LCD_WIRE LCDWIRE_VPINS_I2C
21- #define LCD_WIRE LCDWIRE_VPINS_SPI// on shift registers thru vpins (same library)
21+ // #define LCD_WIRE LCDWIRE_VPINS_SPI//on shift registers thru vpins (same library)
2222// #define LCD_WIRE LCDWIRE_I2C//not tested
2323// #define LCD_WIRE LCDWIRE_DIRECT//not tested
2424
25- #define USE_TFT YES // YES|NO
25+ #define USE_TFT 0 // 0|1
2626
27- #if (USE_TFT == YES )
27+ #if (USE_TFT == 1 )
2828 #include < Adafruit_GFX.h> // Co1re graphics library
2929 #include < Adafruit_ST7735.h> // Hardware-specific library
3030 #include < menuGFX.h>
7777#define encB 4
7878// this encoder has a button here
7979#define encBtn A0
80- #define LEDPIN A3 // on uno use pin 13
80+ #define LEDPIN 13 // on uno use pin 13
8181
8282// /////////////////////////////////////////////////////////////////////////
8383// functions to wire as menu actions
8484
8585// aux function
86+ void nothing () {}
87+
8688void setValue (prompt &p,menuOut &o, Stream &i,int &value,const char * text,const char * units=" " ,int sensivity=5 ,int low=0 ,int hi=100 ,int steps=0 ,void (*func)()=nothing);
8789
8890void ledOn () {digitalWrite (LEDPIN,1 );}
@@ -155,31 +157,12 @@ menuPrint serial(Serial);
155157#if (LCD_WIRE!=LCDWIRE_NONE)
156158 menuLCD lcd (lcd1,16 ,2 );
157159#endif
158- #if (USE_TFT == YES )
160+ #if (USE_TFT == 1 )
159161 menuGFX gfx (tft);
160162 // menuGFX gfx(tft,BLUE,BLACK,WHITE,SILVER,5,8);
161163#endif
162164menuPrint menuSerialOut (Serial);// describe output device
163165
164- /* template<int N>
165- class chainOut:public Print {
166- public:
167- menuOut* out[N];
168- chainOut(Print* out[N]):out(out) {}
169- virtual void clear() {for(int n=0;n<N;n++) out[n]->clear();}
170- virtual void setCursor(int x,int y) {for(int n=0;n<N;n++) out[n]->setCursor(x,y);}
171- virtual void print(char ch) {for(int n=0;n<N;n++) out[n]->print(ch);}
172- virtual void print(const char *text) {for(int n=0;n<N;n++) out[n]->print(text);}
173- virtual void println(const char *text) {for(int n=0;n<N;n++) out[n]->print(text);}
174- virtual void print(int i) {for(int n=0;n<N;n++) out[n]->print(i);}
175- virtual void println(int i) {for(int n=0;n<N;n++) out[n]->print(i);}
176- virtual void print(prompt &o,bool selected,int idx,int posY,int width) {for(int n=0;n<N;n++) out[n]->print(o,selected,idx,posY,width);}
177- virtual void printMenu(menu&m,bool drawExit) {for(int n=0;n<N;n++) out[n]->print(m,drawExit);}
178- };
179-
180- menuOut* out[]={&lcd,&gfx};
181- chainOut<2> allOut(out);*/
182-
183166// /////////////////////////////////////////////////////////////////////////////
184167
185168void setup () {
@@ -188,7 +171,7 @@ void setup() {
188171 Serial.begin (9600 );
189172 Serial.println (" menu system test" );
190173
191- #if ((LCD_WIRE != LCDWIRE_NONE) || (USE_TFT == YES ))
174+ #if ((LCD_WIRE != LCDWIRE_NONE) || (USE_TFT == 1 ))
192175 pinMode (vpinsSPI_CS,OUTPUT);
193176 digitalWrite (vpinsSPI_CS,LOW);
194177#endif
@@ -208,7 +191,7 @@ void setup() {
208191
209192#endif
210193
211- #if (USE_TFT == YES )
194+ #if (USE_TFT == 1 )
212195 digitalWrite (vpinsSPI_CS,HIGH);
213196 digitalWrite (tftCS,HIGH);
214197 tft.initR (INITR_BLACKTAB);
@@ -233,28 +216,25 @@ void setup() {
233216// /////////////////////////////////////////////////////////////////////////////
234217// testing the menu system
235218void loop () {
236- // mainMenu.activate(menuSerialOut,Serial);//show menu to Serial and read keys from Serial
237- // Serial.println("");
238- // Serial.println("Restarting...");
239- // mainMenu.activate(Serial,enc);//bad combination! shopw menu on serial and navigate using quadEncoder
219+ mainMenu.activate (menuSerialOut,Serial);// show menu to Serial and read keys from Serial
220+ Serial.println (" " );
221+ Serial.println (" Restarting..." );
240222
241223 #if (LCD_WIRE != LCDWIRE_NONE)
242- digitalWrite (vpinsSPI_CS,LOW);
243- digitalWrite (tftCS,LOW);
224+ // digitalWrite(vpinsSPI_CS,LOW);
225+ // digitalWrite(tftCS,LOW);
244226 // mainMenu.activate(lcd,allIn);//show menu on LCD and use multiple inputs to navigate (defined encoder, encoder button, serial)
245227 // mainMenu.activate(lcd,Serial);//very bad combination!
246228 #endif
247229
248- #if (USE_TFT == YES )
249- digitalWrite (vpinsSPI_CS,HIGH);
250- digitalWrite (tftCS,HIGH);
251- mainMenu.activate (gfx,allIn);// show menu on LCD and use multiple inputs to navigate (defined encoder, encoder button, serial)
230+ #if (USE_TFT == 1 )
231+ // digitalWrite(vpinsSPI_CS,HIGH);
232+ // digitalWrite(tftCS,HIGH);
233+ // mainMenu.activate(gfx,allIn);//show menu on LCD and use multiple inputs to navigate (defined encoder, encoder button, serial)
252234 #endif
253235
254236}
255237
256- void nothing () {}
257-
258238void percentBar (menuOut &o,int percent) {
259239 int i=map (percent, 0 , 100 , 0 , o.maxX );
260240 for (int n=0 ;n<o.maxX ;n++)
0 commit comments