Browse Source

more stuff on ui info page

Thomas Buck 5 months ago
parent
commit
e08ef35ab2
1 changed files with 15 additions and 4 deletions
  1. 15
    4
      src/ui.cpp

+ 15
- 4
src/ui.cpp View File

15
  */
15
  */
16
 
16
 
17
 #include <Arduino.h>
17
 #include <Arduino.h>
18
+#include <WiFi.h>
18
 
19
 
19
 #include "config.h"
20
 #include "config.h"
20
 #include "mqtt.h"
21
 #include "mqtt.h"
55
 
56
 
56
 #define LDR_CHECK_MS 1000
57
 #define LDR_CHECK_MS 1000
57
 
58
 
59
+#define TOUCH_PRESSURE_MIN_DOWN 200
60
+#define TOUCH_PRESSURE_MIN_UP 10
61
+
58
 static SPIClass mySpi = SPIClass(HSPI);
62
 static SPIClass mySpi = SPIClass(HSPI);
59
 static XPT2046_Touchscreen ts(XPT2046_CS, XPT2046_IRQ);
63
 static XPT2046_Touchscreen ts(XPT2046_CS, XPT2046_IRQ);
60
 static TFT_eSPI tft = TFT_eSPI();
64
 static TFT_eSPI tft = TFT_eSPI();
190
     tft.drawString("Build Time: " __TIME__, 0, 40 + 16 * 1, 1);
194
     tft.drawString("Build Time: " __TIME__, 0, 40 + 16 * 1, 1);
191
     tft.drawString("Location: " SENSOR_LOCATION, 0, 40 + 16 * 2, 1);
195
     tft.drawString("Location: " SENSOR_LOCATION, 0, 40 + 16 * 2, 1);
192
     tft.drawString("ID: " SENSOR_ID, 0, 40 + 16 * 3, 1);
196
     tft.drawString("ID: " SENSOR_ID, 0, 40 + 16 * 3, 1);
193
-
194
-    tft.drawString("LDR: " + String(ldr_value), 0, 40 + 16 * 5, 1);
197
+    tft.drawString("MAC: " + String(WiFi.macAddress()), 0, 40 + 16 * 4, 1);
198
+    tft.drawString("Free heap: " + String(ESP.getFreeHeap() / 1024.0f) + "k", 0, 40 + 16 * 5, 1);
199
+    tft.drawString("Free sketch space: " + String(ESP.getFreeSketchSpace() / 1024.0f) + "k", 0, 40 + 16 * 6, 1);
200
+    tft.drawString("Flash chip size: " + String(ESP.getFlashChipSize() / 1024.0f) + "k", 0, 40 + 16 * 7, 1);
201
+    tft.drawString("Uptime: " + String(millis() / 1000) + "sec", 0, 40 + 16 * 8, 1);
202
+    tft.drawString("IPv4: " + WiFi.localIP().toString(), 0, 40 + 16 * 9, 1);
203
+    tft.drawString("IPv6: " + WiFi.localIPv6().toString(), 0, 40 + 16 * 10, 1);
204
+
205
+    tft.drawString("LDR: " + String(ldr_value), 0, 40 + 16 * 12, 1);
195
 }
206
 }
196
 
207
 
197
 void ui_init(void) {
208
 void ui_init(void) {
311
         p = touchToScreen(ts.getPoint());
322
         p = touchToScreen(ts.getPoint());
312
 
323
 
313
         // minimum pressure
324
         // minimum pressure
314
-        if (p.z < 100) {
325
+        if (p.z < TOUCH_PRESSURE_MIN_DOWN) {
315
             touched = false;
326
             touched = false;
316
         }
327
         }
317
     }
328
     }
395
         }
406
         }
396
 
407
 
397
         ui_draw_menu();
408
         ui_draw_menu();
398
-    } else if ((!touched) && is_touched) {
409
+    } else if ((!touched) && is_touched && (p.z < TOUCH_PRESSURE_MIN_UP)) {
399
         is_touched = false;
410
         is_touched = false;
400
     }
411
     }
401
 }
412
 }

Loading…
Cancel
Save