Skip to content

Commit edf1195

Browse files
committed
I2C LCD example
comment-out touch support tests
1 parent ca1422e commit edf1195

File tree

3 files changed

+13
-51
lines changed

3 files changed

+13
-51
lines changed

Examples/menu_test/menu_test.ino

Lines changed: 4 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -142,9 +142,9 @@ MENU(subMenu,"LED ON/OFF",
142142
MENU(mainMenu,"Sistema",
143143
OP("Frequency",setFreq),
144144
OP("Dutty",setDutty),
145-
OP("Scroll up", scrollUp_test),
146-
OP("scroll down", scrollDown_test),
147145
OP("Disabled",disabledTest),
146+
/*OP("Scroll up", scrollUp_test),
147+
OP("scroll down", scrollDown_test),
148148
OP("Handler test",completeHandlerTest),
149149
OP("Handler test",completeHandlerTest),
150150
OP("Handler test",completeHandlerTest),
@@ -154,53 +154,10 @@ MENU(mainMenu,"Sistema",
154154
OP("Handler test",completeHandlerTest),
155155
OP("Handler test",completeHandlerTest),
156156
OP("Handler test",completeHandlerTest),
157-
OP("Handler test",completeHandlerTest),
157+
OP("Handler test",completeHandlerTest),*/
158158
SUBMENU(subMenu)
159159
);
160160

161-
//more menu functions that need the menu defs
162-
/*int scrollY(menuOut& o,int pixels) {
163-
tft.print(pixels);tft.println(" px");
164-
int lines=pixels/o.resY;//convert pixels to lines
165-
tft.print(lines);tft.println(" lines");
166-
tft.print(o.top);tft.println(" top");
167-
o.top+=lines;
168-
mainMenu.clampY(o);
169-
tft.print(o.top);tft.println(" clamped top");
170-
if (mainMenu.sel<o.top) mainMenu.sel=o.top;
171-
else if (mainMenu.sel>=(o.top+o.maxY)) mainMenu.sel=o.top+o.maxY-1;
172-
//menu needs to be redrawn after this
173-
return pixels-lines*o.resY;
174-
}*/
175-
176-
void scrollUp_test(prompt &p,menuOut &o,Stream &i) {
177-
setValue(stv,p,o,i,"dist:"," Pixels",1,0,16);
178-
/*selectTFT();
179-
tft.fillScreen(BLACK);tft.setCursor(0,0);
180-
int ot=o.top;
181-
int os=mainMenu.sel;*/
182-
int remain=mainMenu.scrollY(o,-stv);//assuming its main menu
183-
/*tft.print("top: ");tft.print(ot);tft.print(" sel: ");tft.println(os);
184-
tft.print("scroll ");tft.print(stv);tft.print(" remain:");tft.println(remain);
185-
tft.print("top: ");tft.print(o.top);tft.print(" sel: ");tft.println(mainMenu.sel);
186-
selectLCD();*/
187-
mainMenu.printMenu(o, false);
188-
}
189-
190-
void scrollDown_test(prompt &p,menuOut &o,Stream &i) {
191-
setValue(stv,p,o,i,"dist:"," Pixels",1,0,16);
192-
//selectTFT();
193-
//tft.fillScreen(BLACK);tft.setCursor(0,0);
194-
//int ot=o.top;
195-
//int os=mainMenu.sel;
196-
int remain=mainMenu.scrollY(o,stv);//assuming its main menu
197-
/*tft.print("top: ");tft.print(ot);tft.print(" sel: ");tft.println(os);
198-
tft.print("scroll ");tft.print(stv);tft.print(" remain:");tft.println(remain);
199-
tft.print("top: ");tft.print(o.top);tft.print(" sel: ");tft.println(mainMenu.sel);
200-
selectLCD();*/
201-
mainMenu.printMenu(o, false);
202-
}
203-
204161
//the quadEncoder
205162
quadEncoder quadEncoder(encA,encB);//simple quad encoder driver
206163
quadEncoderStream enc(quadEncoder,5);// simple quad encoder fake Stream
@@ -230,7 +187,7 @@ menuPrint menuSerialOut(Serial);//describe output device
230187

231188
/////////////////////////////////////////////////////////////////////////
232189
void setup() {
233-
mainMenu.data[4]->enabled=false;//disabling option
190+
mainMenu.data[2]->enabled=false;//disabling option
234191

235192
Serial.begin(9600);
236193
Serial.println("menu system test");

menu.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,10 @@ void menu::activate(menuOut& p,Stream& c,bool canExit) {
6767
} while(op!=-1);
6868
}
6969

70-
void menu::clampY(menuOut& o) {//keep menu inside screen Y
70+
//todo: preparing functions for touch screen support
71+
// this functions will probably move to the touch device class
72+
// however they are now here for test purposes
73+
/*void menu::clampY(menuOut& o) {//keep menu inside screen Y
7174
if (o.top+o.maxY>sz) o.top=sz-o.maxY;
7275
else if (o.top<0) o.top=0;
7376
}
@@ -92,4 +95,4 @@ void menu::click(menuOut &p, Stream &c,int x,int y) {
9295
}
9396
9497
95-
98+
*/

menu.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,9 +185,11 @@ for encoders, joysticks, keyboards or touch a stream must be made out of them
185185
void activate(menuOut& p,Stream& c,bool canExit=false);
186186

187187
//some funcs to support touch... TODO: test them
188-
void clampY(menuOut& o);//keep menu inside secreen
188+
// this functions will probably move to touch class...
189+
// will be here now for test while i wait for my touch screen to arrive.....
190+
/*void clampY(menuOut& o);//keep menu inside secreen
189191
int scrollY(menuOut& o,int pixels);//aux function for touch screen
190-
void click(menuOut &p, Stream &c,int x,int y);
192+
void click(menuOut &p, Stream &c,int x,int y);*/
191193
};
192194

193195
#endif

0 commit comments

Comments
 (0)