Compare commits

...

3 Commits

View File

@ -67,6 +67,8 @@ void zeigeZeit(tm localTime, int x, int y);
void drawMenue(int32_t xs, int32_t sy); void drawMenue(int32_t xs, int32_t sy);
void Menue(); void Menue();
void zeige_IP(int x, int y); void zeige_IP(int x, int y);
void NoTouchScreen(TouchPoint touch_1);
void listDir(fs::FS &fs, const char * dirname, uint8_t levels) { void listDir(fs::FS &fs, const char * dirname, uint8_t levels) {
Serial.printf("Listing directory: %s\n", dirname); Serial.printf("Listing directory: %s\n", dirname);
@ -226,7 +228,7 @@ void testFileIO(fs::FS &fs, const char * path) {
} }
// ENDE TEST // ENDE TEST
int WiFiError = 36; int WiFiError = 35;
int Versuche; int Versuche;
int interval; int interval;
@ -241,7 +243,7 @@ void setup() {
// Start the tft display and set it to black // Start the tft display and set it to black
tft.init(); tft.init();
tft.setRotation(1); //This is the display in landscape tft.setRotation(3); //This is the display in landscape
// Clear the screen before writing to it // Clear the screen before writing to it
tft.fillScreen(TFT_BLACK); tft.fillScreen(TFT_BLACK);
@ -413,9 +415,12 @@ void loop() {
if (touch.zRaw != 0){ if (touch.zRaw != 0){
printTouchToSerial2(touch.x, touch.y, touch.xRaw); printTouchToSerial2(touch.x, touch.y, touch.xRaw);
if((touch.x >= 275) && (touch.y >= 210)){ if((touch.y >= 15) && (touch.y <= 30)){
Serial.printf(" Gefunden bei: %i : %i : %i \n", touch.y, touch.x, touch.zRaw); if((touch.x >= 15) && (touch.x <= 30)){
Menue(); //Serial.printf(" Gefunden bei: %i : %i : %i \n", touch.y, touch.x, touch.zRaw);
NoTouchScreen(touch);
Menue();
}
} }
} }
@ -519,68 +524,73 @@ void Menue(){
tft.setTextColor(TFT_WHITE, TFT_BLACK); tft.setTextColor(TFT_WHITE, TFT_BLACK);
tft.println("Interval der Messwert-\nspeicherung in Minuten."); tft.println("Interval der Messwert-\nspeicherung in Minuten.");
if (touch.zRaw != 0){ if (touch.zRaw != 0){
//printTouchToSerial2(touch.x, touch.y, touch.xRaw); printTouchToSerial2(touch.x, touch.y, touch.xRaw);
if ((touch.y >= 110) && (touch.y <= 145)){
if(((touch.x >= 15) && (touch.x <= 55)) && ((touch.y >= 95) && (touch.y <= 125))){ if((touch.x >= 245) && (touch.x <= 280)){
Serial.printf(" Gefunden bei 1: %i : %i : %i \n", touch.y, touch.x, touch.zRaw); Serial.printf(" Gefunden bei 1: %i : %i : %i \n", touch.y, touch.x, touch.zRaw);
tft.drawRoundRect(11,91,38,38,5,TFT_GOLD); tft.drawRoundRect(11,91,38,38,5,TFT_GOLD);
tft.drawRoundRect(12,92,36,36,5,TFT_GOLD); tft.drawRoundRect(12,92,36,36,5,TFT_GOLD);
tft.drawRoundRect(13,93,34,34,5,TFT_GOLD); tft.drawRoundRect(13,93,34,34,5,TFT_GOLD);
delay(1000); delay(1000);
tft.drawRoundRect(11,91,38,38,5,TFT_BLACK); tft.drawRoundRect(11,91,38,38,5,TFT_BLACK);
tft.drawRoundRect(12,92,36,36,5,TFT_BLACK); tft.drawRoundRect(12,92,36,36,5,TFT_BLACK);
tft.drawRoundRect(13,93,34,34,5,TFT_BLACK); tft.drawRoundRect(13,93,34,34,5,TFT_BLACK);
interval = 1; interval = 1;
} }
if(((touch.x >= 65) && (touch.x <= 95)) && ((touch.y >= 95) && (touch.y <= 125))){ if((touch.x >= 200) && (touch.x <= 245)){
Serial.printf(" Gefunden bei 2: %i : %i : %i \n", touch.y, touch.x, touch.zRaw); Serial.printf(" Gefunden bei 2: %i : %i : %i \n", touch.y, touch.x, touch.zRaw);
tft.drawRoundRect(61,91,38,38,5,TFT_GOLD); tft.drawRoundRect(61,91,38,38,5,TFT_GOLD);
tft.drawRoundRect(62,92,36,36,5,TFT_GOLD); tft.drawRoundRect(62,92,36,36,5,TFT_GOLD);
tft.drawRoundRect(63,93,34,34,5,TFT_GOLD); tft.drawRoundRect(63,93,34,34,5,TFT_GOLD);
delay(1000); delay(1000);
tft.drawRoundRect(61,91,38,38,5,TFT_BLACK); tft.drawRoundRect(61,91,38,38,5,TFT_BLACK);
tft.drawRoundRect(62,92,36,36,5,TFT_BLACK); tft.drawRoundRect(62,92,36,36,5,TFT_BLACK);
tft.drawRoundRect(63,93,34,34,5,TFT_BLACK); tft.drawRoundRect(63,93,34,34,5,TFT_BLACK);
interval = 5; interval = 5;
} }
if(((touch.x >= 110) && (touch.x <= 140)) && ((touch.y >= 95) && (touch.y <= 125))){ if((touch.x >= 165) && (touch.x <= 195)){
Serial.printf(" Gefunden bei 3: %i : %i : %i \n", touch.y, touch.x, touch.zRaw); Serial.printf(" Gefunden bei 3: %i : %i : %i \n", touch.y, touch.x, touch.zRaw);
tft.drawRoundRect(111,91,38,38,5,TFT_GOLD); tft.drawRoundRect(111,91,38,38,5,TFT_GOLD);
tft.drawRoundRect(112,92,36,36,5,TFT_GOLD); tft.drawRoundRect(112,92,36,36,5,TFT_GOLD);
tft.drawRoundRect(113,93,34,34,5,TFT_GOLD); tft.drawRoundRect(113,93,34,34,5,TFT_GOLD);
delay(1000); delay(1000);
tft.drawRoundRect(111,91,38,38,5,TFT_BLACK); tft.drawRoundRect(111,91,38,38,5,TFT_BLACK);
tft.drawRoundRect(112,92,36,36,5,TFT_BLACK); tft.drawRoundRect(112,92,36,36,5,TFT_BLACK);
tft.drawRoundRect(113,93,34,34,5,TFT_BLACK); tft.drawRoundRect(113,93,34,34,5,TFT_BLACK);
interval = 10; interval = 10;
} }
if(((touch.x >= 150) && (touch.x <= 195)) && ((touch.y >= 95) && (touch.y <= 125))){ if((touch.x >= 120) && (touch.x <= 150)){
Serial.printf(" Gefunden bei 4: %i : %i : %i \n", touch.y, touch.x, touch.zRaw); Serial.printf(" Gefunden bei 4: %i : %i : %i \n", touch.y, touch.x, touch.zRaw);
tft.drawRoundRect(161,91,38,38,5,TFT_GOLD); tft.drawRoundRect(161,91,38,38,5,TFT_GOLD);
tft.drawRoundRect(162,92,36,36,5,TFT_GOLD); tft.drawRoundRect(162,92,36,36,5,TFT_GOLD);
tft.drawRoundRect(163,93,34,34,5,TFT_GOLD); tft.drawRoundRect(163,93,34,34,5,TFT_GOLD);
delay(1000); delay(1000);
tft.drawRoundRect(161,91,38,38,5,TFT_BLACK); tft.drawRoundRect(161,91,38,38,5,TFT_BLACK);
tft.drawRoundRect(162,92,36,36,5,TFT_BLACK); tft.drawRoundRect(162,92,36,36,5,TFT_BLACK);
tft.drawRoundRect(163,93,34,34,5,TFT_BLACK); tft.drawRoundRect(163,93,34,34,5,TFT_BLACK);
interval = 30; interval = 30;
} }
if(((touch.x >= 200) && (touch.x <= 230)) && ((touch.y >= 95) && (touch.y <= 125))){ if((touch.x >= 75) && (touch.x <= 100)){
Serial.printf(" Gefunden bei 5: %i : %i : %i \n", touch.y, touch.x, touch.zRaw); Serial.printf(" Gefunden bei 5: %i : %i : %i \n", touch.y, touch.x, touch.zRaw);
tft.drawRoundRect(211,91,38,38,5,TFT_GOLD); tft.drawRoundRect(211,91,38,38,5,TFT_GOLD);
tft.drawRoundRect(212,92,36,36,5,TFT_GOLD); tft.drawRoundRect(212,92,36,36,5,TFT_GOLD);
tft.drawRoundRect(213,93,34,34,5,TFT_GOLD); tft.drawRoundRect(213,93,34,34,5,TFT_GOLD);
delay(1000); delay(1000);
tft.drawRoundRect(211,91,38,38,5,TFT_BLACK); tft.drawRoundRect(211,91,38,38,5,TFT_BLACK);
tft.drawRoundRect(212,92,36,36,5,TFT_BLACK); tft.drawRoundRect(212,92,36,36,5,TFT_BLACK);
tft.drawRoundRect(213,93,34,34,5,TFT_BLACK); tft.drawRoundRect(213,93,34,34,5,TFT_BLACK);
interval = 60; interval = 60;
} }
if((touch.x >= 275) && (touch.y >= 210)){ }
Serial.printf(" Gefunden bei: %i : %i : %i \n", touch.y, touch.x, touch.zRaw);
if((touch.y >= 15) && (touch.y <= 30)){
if((touch.x >= 15) && (touch.x <= 30)){
NoTouchScreen(touch);
zurueck = false; zurueck = false;
} }
}
} }
tft.drawRoundRect(10,90,40,40,5,TFT_GREEN); tft.drawRoundRect(10,90,40,40,5,TFT_GREEN);
tft.drawRoundRect(60,90,40,40,5,TFT_GREEN); tft.drawRoundRect(60,90,40,40,5,TFT_GREEN);
@ -608,4 +618,11 @@ void Menue(){
tft.setTextSize(2); tft.setTextSize(2);
tft.println(WiFi.localIP()); tft.println(WiFi.localIP());
tft.setTextSize(1); tft.setTextSize(1);
}
void NoTouchScreen(TouchPoint touch_1){
do{
delay(50);
//Serial.printf(" Gefunden bei --------->: %i : %i : %i \n", touch_1.y, touch_1.x, touch_1.zRaw);
touch_1 = touchscreen.getTouch();
} while(touch_1.zRaw > 0);
} }