소스 검색

more stuff on ui info page

Thomas Buck 5 달 전
부모
커밋
e08ef35ab2
1개의 변경된 파일15개의 추가작업 그리고 4개의 파일을 삭제
  1. 15
    4
      src/ui.cpp

+ 15
- 4
src/ui.cpp 파일 보기

@@ -15,6 +15,7 @@
15 15
  */
16 16
 
17 17
 #include <Arduino.h>
18
+#include <WiFi.h>
18 19
 
19 20
 #include "config.h"
20 21
 #include "mqtt.h"
@@ -55,6 +56,9 @@
55 56
 
56 57
 #define LDR_CHECK_MS 1000
57 58
 
59
+#define TOUCH_PRESSURE_MIN_DOWN 200
60
+#define TOUCH_PRESSURE_MIN_UP 10
61
+
58 62
 static SPIClass mySpi = SPIClass(HSPI);
59 63
 static XPT2046_Touchscreen ts(XPT2046_CS, XPT2046_IRQ);
60 64
 static TFT_eSPI tft = TFT_eSPI();
@@ -190,8 +194,15 @@ static void draw_info(void) {
190 194
     tft.drawString("Build Time: " __TIME__, 0, 40 + 16 * 1, 1);
191 195
     tft.drawString("Location: " SENSOR_LOCATION, 0, 40 + 16 * 2, 1);
192 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 208
 void ui_init(void) {
@@ -311,7 +322,7 @@ void ui_run(void) {
311 322
         p = touchToScreen(ts.getPoint());
312 323
 
313 324
         // minimum pressure
314
-        if (p.z < 100) {
325
+        if (p.z < TOUCH_PRESSURE_MIN_DOWN) {
315 326
             touched = false;
316 327
         }
317 328
     }
@@ -395,7 +406,7 @@ void ui_run(void) {
395 406
         }
396 407
 
397 408
         ui_draw_menu();
398
-    } else if ((!touched) && is_touched) {
409
+    } else if ((!touched) && is_touched && (p.z < TOUCH_PRESSURE_MIN_UP)) {
399 410
         is_touched = false;
400 411
     }
401 412
 }

Loading…
취소
저장