Add Icon Fonts and bugfixing

This commit is contained in:
2025-04-05 23:41:46 +02:00
parent 2e818a5d8c
commit 686fd421a5
46 changed files with 392934 additions and 145 deletions
+29
View File
@@ -38,3 +38,32 @@
.clang_complete
.gcc-flags.json
.pio
# For PCBs designed using KiCad: https://www.kicad.org/
# Format documentation: https://kicad.org/help/file-formats/
# Temporary files
*.000
*.bak
*.bck
*.kicad_pcb-bak
*.kicad_sch-bak
*-backups
*.kicad_prl
*.sch-bak
*~
_autosave-*
*.tmp
*-save.pro
*-save.kicad_pcb
fp-info-cache
~*.lck
\#auto_saved_files#
# Netlist files (exported from Eeschema)
*.net
# Autorouter files (exported from Pcbnew)
*.dsn
*.ses
+1623
View File
File diff suppressed because it is too large Load Diff
+1770
View File
File diff suppressed because it is too large Load Diff
+1893
View File
File diff suppressed because it is too large Load Diff
+2349
View File
File diff suppressed because it is too large Load Diff
+2510
View File
File diff suppressed because it is too large Load Diff
+2685
View File
File diff suppressed because it is too large Load Diff
+2931
View File
File diff suppressed because it is too large Load Diff
+3199
View File
File diff suppressed because it is too large Load Diff
+3712
View File
File diff suppressed because it is too large Load Diff
+4233
View File
File diff suppressed because it is too large Load Diff
+4809
View File
File diff suppressed because it is too large Load Diff
+5514
View File
File diff suppressed because it is too large Load Diff
+6249
View File
File diff suppressed because it is too large Load Diff
+6984
View File
File diff suppressed because it is too large Load Diff
+1332
View File
File diff suppressed because it is too large Load Diff
+1518
View File
File diff suppressed because it is too large Load Diff
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -33,6 +33,7 @@
"footprint_text",
"footprint_anchors",
"ratsnest",
"grid",
"footprints_front",
"footprints_back",
"footprint_values",
File diff suppressed because it is too large Load Diff
+90 -90
View File
@@ -1985,14 +1985,14 @@
)
)
)
(footprint "Inductor_SMD:L_0805_2012Metric"
(footprint "Inductor_SMD:L_0805_2012Metric_Pad1.15x1.40mm_HandSolder"
(layer "F.Cu")
(uuid "3a3ff901-3c95-4279-b1dd-3dbd042ada37")
(at 151.225 87.83)
(descr "Inductor SMD 0805 (2012 Metric), square (rectangular) end terminal, IPC_7351 nominal, (Body size source: IPC-SM-782 page 80, https://www.pcb-3d.com/wordpress/wp-content/uploads/ipc-sm-782a_amendment_1_and_2.pdf), generated with kicad-footprint-generator")
(tags "inductor")
(descr "Inductor SMD 0805 (2012 Metric), square (rectangular) end terminal, IPC_7351 nominal with elongated pad for handsoldering. (Body size source: https://docs.google.com/spreadsheets/d/1BsfQQcO9C6DZCsRaXUlFlo91Tg2WpOkGARC1WS5S8t0/edit?usp=sharing), generated with kicad-footprint-generator")
(tags "inductor handsolder")
(property "Reference" "L2"
(at -2.75 0.05 0)
(at 0 -1.65 0)
(layer "F.SilkS")
(uuid "649b028e-ab06-4af8-8e5a-3b2e611a1bab")
(effects
@@ -2003,7 +2003,7 @@
)
)
(property "Value" "L"
(at 0 1.55 0)
(at 0 1.65 0)
(layer "F.Fab")
(uuid "f47a9033-d053-445e-a7e9-068e5325bd55")
(effects
@@ -2045,104 +2045,104 @@
(sheetfile "raumtemp_relay.kicad_sch")
(attr smd)
(fp_line
(start -0.399622 -0.56)
(end 0.399622 -0.56)
(start -0.261252 -0.71)
(end 0.261252 -0.71)
(stroke
(width 0.12)
(type solid)
)
(layer "F.SilkS")
(uuid "b3c59d30-1f09-4a40-9ce5-fdf4b4fad4db")
(uuid "d7cb7752-4457-4c09-bca3-e73dd1a51668")
)
(fp_line
(start -0.399622 0.56)
(end 0.399622 0.56)
(start -0.261252 0.71)
(end 0.261252 0.71)
(stroke
(width 0.12)
(type solid)
)
(layer "F.SilkS")
(uuid "ab9c582a-80fa-432c-a0e7-285e1fb10d1a")
(uuid "8904665a-227a-4340-8da9-bf074ee74e82")
)
(fp_line
(start -1.75 -0.85)
(end 1.75 -0.85)
(start -1.85 -0.95)
(end 1.85 -0.95)
(stroke
(width 0.05)
(type solid)
)
(layer "F.CrtYd")
(uuid "18092970-6da9-4ea4-b580-e547995a9da5")
(uuid "d467c095-e877-4040-9576-21fa15598869")
)
(fp_line
(start -1.75 0.85)
(end -1.75 -0.85)
(start -1.85 0.95)
(end -1.85 -0.95)
(stroke
(width 0.05)
(type solid)
)
(layer "F.CrtYd")
(uuid "0030de7c-2833-46e7-adef-020141cb6dee")
(uuid "5886ba3f-3f71-42f4-b960-254b99503c73")
)
(fp_line
(start 1.75 -0.85)
(end 1.75 0.85)
(start 1.85 -0.95)
(end 1.85 0.95)
(stroke
(width 0.05)
(type solid)
)
(layer "F.CrtYd")
(uuid "143cfdb9-da09-4081-83cb-637af139396d")
(uuid "c7ddcc52-df31-441a-b78f-d30efef6ff2e")
)
(fp_line
(start 1.75 0.85)
(end -1.75 0.85)
(start 1.85 0.95)
(end -1.85 0.95)
(stroke
(width 0.05)
(type solid)
)
(layer "F.CrtYd")
(uuid "c4dc9b5f-9559-4aa5-8f7a-07045b221f2c")
(uuid "7e61d2bb-b1e7-4aca-9e6f-40264695ad5c")
)
(fp_line
(start -1 -0.45)
(end 1 -0.45)
(start -1 -0.6)
(end 1 -0.6)
(stroke
(width 0.1)
(type solid)
)
(layer "F.Fab")
(uuid "977ba1a1-9687-4d2c-9f81-bd540a5f42e5")
(uuid "3a481fba-27e7-42e4-a0df-5f85b90ab75f")
)
(fp_line
(start -1 0.45)
(end -1 -0.45)
(start -1 0.6)
(end -1 -0.6)
(stroke
(width 0.1)
(type solid)
)
(layer "F.Fab")
(uuid "77be2818-ccec-4ce4-85c3-b11fc1956819")
(uuid "f3a5208f-0f1f-44eb-bc7c-233569448140")
)
(fp_line
(start 1 -0.45)
(end 1 0.45)
(start 1 -0.6)
(end 1 0.6)
(stroke
(width 0.1)
(type solid)
)
(layer "F.Fab")
(uuid "71531823-a518-42be-b95d-2d08c00a33be")
(uuid "10d521d0-a555-4c8b-ae99-4d34d126d272")
)
(fp_line
(start 1 0.45)
(end -1 0.45)
(start 1 0.6)
(end -1 0.6)
(stroke
(width 0.1)
(type solid)
)
(layer "F.Fab")
(uuid "128cfaf4-6b49-4840-a661-2445158d798d")
(uuid "64620b8a-57f0-4e19-9acc-cd42480ae49f")
)
(fp_text user "${REFERENCE}"
(at 0 0 0)
@@ -2156,27 +2156,27 @@
)
)
(pad "1" smd roundrect
(at -1.0625 0)
(size 0.875 1.2)
(at -1.025 0)
(size 1.15 1.4)
(layers "F.Cu" "F.Mask" "F.Paste")
(roundrect_rratio 0.25)
(roundrect_rratio 0.217391)
(net 2 "Net-(U1-SW)")
(pinfunction "1")
(pintype "passive")
(uuid "ad9f1850-8a81-4910-984f-4e484a7a4bf3")
)
(pad "2" smd roundrect
(at 1.0625 0)
(size 0.875 1.2)
(at 1.025 0)
(size 1.15 1.4)
(layers "F.Cu" "F.Mask" "F.Paste")
(roundrect_rratio 0.25)
(roundrect_rratio 0.217391)
(net 4 "+3V3")
(pinfunction "2")
(pintype "passive")
(uuid "b0031eb7-f8da-442a-833d-5a86ad27b32d")
)
(embedded_fonts no)
(model "${KICAD8_3DMODEL_DIR}/Inductor_SMD.3dshapes/L_0805_2012Metric.wrl"
(model "${KICAD9_3DMODEL_DIR}/Inductor_SMD.3dshapes/L_0805_2012Metric.wrl"
(offset
(xyz 0 0 0)
)
@@ -6602,7 +6602,7 @@
(type solid)
)
(layer "B.SilkS")
(uuid "49037670-0b06-4cc4-b007-35a12088cdf8")
(uuid "fa5a077c-8699-49b4-9448-55ac0dc69ad8")
)
(fp_line
(start -10.127 26.626993)
@@ -6612,7 +6612,7 @@
(type solid)
)
(layer "B.SilkS")
(uuid "ceaba0f5-6f0e-43e8-819b-dc5b6fde2c29")
(uuid "7471346b-faed-4ab6-af2a-8dd800676b26")
)
(fp_line
(start 2.627 -2.427001)
@@ -6622,7 +6622,7 @@
(type solid)
)
(layer "B.SilkS")
(uuid "bdb42e14-eded-4ad8-a46d-5153c7720c68")
(uuid "e6734628-1714-4846-95b5-f177a86017a9")
)
(fp_line
(start 2.627 26.626993)
@@ -6632,7 +6632,7 @@
(type solid)
)
(layer "B.SilkS")
(uuid "2448cde4-755f-405d-a70f-71b2b03a9d27")
(uuid "2181f636-198f-42a4-b59e-8b7b63f027f7")
)
(fp_line
(start -10.254 -2.554001)
@@ -6642,7 +6642,7 @@
(type solid)
)
(layer "B.CrtYd")
(uuid "5d86272d-3451-4086-85e7-ef19c906bdab")
(uuid "d4b096bf-2515-4ec0-8f15-d476604f23f6")
)
(fp_line
(start -10.254 26.753993)
@@ -6652,7 +6652,7 @@
(type solid)
)
(layer "B.CrtYd")
(uuid "3ee9a1e6-e29b-46fa-9b31-b4b1b0df3ad6")
(uuid "19903cfd-96f2-450f-8206-c104ee26816d")
)
(fp_line
(start 2.754 -2.554001)
@@ -6662,7 +6662,7 @@
(type solid)
)
(layer "B.CrtYd")
(uuid "d5d2cccb-d42c-4fda-815b-ae4e2c173e18")
(uuid "d929dd78-bf48-4363-bc3c-5f3930fc508b")
)
(fp_line
(start 2.754 26.753993)
@@ -6672,7 +6672,7 @@
(type solid)
)
(layer "B.CrtYd")
(uuid "9bdd7038-c5f9-43cb-ae72-b6897d8450cb")
(uuid "ea91aeac-eaab-4639-baff-70d6217ea930")
)
(fp_line
(start -10 -2.300001)
@@ -6682,7 +6682,7 @@
(type solid)
)
(layer "B.Fab")
(uuid "780d5a67-c415-4935-a6cb-d7dc240febdf")
(uuid "58fa35a6-d75e-4d8f-a080-54e8f317f340")
)
(fp_line
(start -10 26.499993)
@@ -6692,7 +6692,7 @@
(type solid)
)
(layer "B.Fab")
(uuid "28be3ad1-2d14-47f4-863b-3cf7c61cf30b")
(uuid "184cd387-3d3a-4e55-81bc-14e8c46e724b")
)
(fp_line
(start 2.5 -2.300001)
@@ -6702,7 +6702,7 @@
(type solid)
)
(layer "B.Fab")
(uuid "64fa4314-c9c8-4874-96ec-0bcc7a5689c6")
(uuid "03b9dfe5-0032-44e4-a18e-912563e100c4")
)
(fp_line
(start 2.5 26.499993)
@@ -6712,7 +6712,7 @@
(type solid)
)
(layer "B.Fab")
(uuid "eed57185-3863-428f-89d7-c03edd04e5a8")
(uuid "ce940640-84e2-4755-b712-6a1f44582bd2")
)
(fp_arc
(start -4.0548 26.499993)
@@ -6723,7 +6723,7 @@
(type solid)
)
(layer "B.Fab")
(uuid "4e79e59b-d560-473d-aca9-e169439d773a")
(uuid "d6a373aa-47c3-4e46-b90c-376c491f84dd")
)
(fp_circle
(center -6.5983 24.199993)
@@ -6734,13 +6734,13 @@
)
(fill no)
(layer "B.Fab")
(uuid "34f1fb21-2c93-42d5-bfe1-d4c2ee7f7181")
(uuid "93fd6ac3-6a84-43a3-8f5a-71fd41d3342b")
)
(fp_text user "*"
(at -7.5 32.133327 180)
(unlocked yes)
(layer "B.SilkS")
(uuid "b2ca5538-0d6f-43ba-88bf-9227d58e3e41")
(uuid "7b68b859-f4f0-4d57-9b64-c1c55cc69c7e")
(effects
(font
(size 1 1)
@@ -6752,7 +6752,7 @@
(fp_text user "*"
(at -7.5 32.133327 180)
(layer "B.SilkS")
(uuid "f40fe043-69f4-4b28-b66a-8e046a55fcf9")
(uuid "c073d6d2-529c-48ce-aa86-a25791960ca7")
(effects
(font
(size 1 1)
@@ -6765,7 +6765,7 @@
(at -7.5 27.533327 180)
(unlocked yes)
(layer "B.Fab")
(uuid "7a67ea2b-236b-4f61-ac96-5ae0474bd098")
(uuid "4ad63038-ead3-4672-bf58-453744375c30")
(effects
(font
(size 1 1)
@@ -6790,7 +6790,7 @@
(fp_text user "*"
(at -7.5 27.533327 180)
(layer "B.Fab")
(uuid "c67a9391-a96c-4dcd-a122-744aec336883")
(uuid "d6d7ef51-5098-44e5-bfc1-7cf58f747abf")
(effects
(font
(size 1 1)
@@ -8017,7 +8017,7 @@
(type solid)
)
(layer "B.SilkS")
(uuid "d6b7545b-61bd-4e89-8341-63c556b7d8d6")
(uuid "7c34045a-63c3-43b2-89f1-16ee7736c830")
)
(fp_line
(start -10.127 26.626993)
@@ -8027,7 +8027,7 @@
(type solid)
)
(layer "B.SilkS")
(uuid "ffaa0a38-ad2e-40ed-8a41-c1400b94d1a1")
(uuid "4bf73b37-dca2-4ad2-9f7f-6015bcd251c7")
)
(fp_line
(start 2.627 -2.427001)
@@ -8037,7 +8037,7 @@
(type solid)
)
(layer "B.SilkS")
(uuid "f60f0498-ae8d-4a06-922d-d0bd98d5b613")
(uuid "20dd008d-2d08-4d18-8d6a-0c030da033be")
)
(fp_line
(start 2.627 26.626993)
@@ -8047,7 +8047,7 @@
(type solid)
)
(layer "B.SilkS")
(uuid "108b1071-494f-4ef9-b6fe-7248edb72d77")
(uuid "ef297dc0-d049-4791-b191-8363669dee80")
)
(fp_line
(start -10.254 -2.554001)
@@ -8057,7 +8057,7 @@
(type solid)
)
(layer "B.CrtYd")
(uuid "a8e4d89d-640d-4f7d-87b5-9dcf9e99b846")
(uuid "71fca2db-1934-4b0b-9aa7-0c7f37f6143a")
)
(fp_line
(start -10.254 26.753993)
@@ -8067,7 +8067,7 @@
(type solid)
)
(layer "B.CrtYd")
(uuid "fbf3fc2d-36f8-4c13-8552-ae700aa1727e")
(uuid "77a2a762-a69b-4609-b82c-f0cbe9800ef4")
)
(fp_line
(start 2.754 -2.554001)
@@ -8077,7 +8077,7 @@
(type solid)
)
(layer "B.CrtYd")
(uuid "66c5e589-8997-4863-b561-56e15cb4974f")
(uuid "bc7900d5-6483-496c-8907-5e1bb8dcb2f2")
)
(fp_line
(start 2.754 26.753993)
@@ -8087,7 +8087,7 @@
(type solid)
)
(layer "B.CrtYd")
(uuid "60fa7947-5b98-497f-8128-ec5ff8b60c79")
(uuid "8a8f752d-adf4-46ce-942b-68de2020c924")
)
(fp_line
(start -10 -2.300001)
@@ -8097,7 +8097,7 @@
(type solid)
)
(layer "B.Fab")
(uuid "e9a8ddee-0b00-4d53-a8d8-c633c5bf7b93")
(uuid "0942b58e-4195-4ead-8dbf-a19ad5860509")
)
(fp_line
(start -10 26.499993)
@@ -8107,7 +8107,7 @@
(type solid)
)
(layer "B.Fab")
(uuid "ce251612-8326-4681-86e0-177cba78d3ed")
(uuid "2bd2545f-3710-4562-97c0-fe3fb69d8231")
)
(fp_line
(start 2.5 -2.300001)
@@ -8117,7 +8117,7 @@
(type solid)
)
(layer "B.Fab")
(uuid "480217bf-a3dc-491e-b95c-b82562fedd55")
(uuid "7fb1d3e5-3ca3-4cbc-8616-ea61dcd12d9d")
)
(fp_line
(start 2.5 26.499993)
@@ -8127,7 +8127,7 @@
(type solid)
)
(layer "B.Fab")
(uuid "408441f1-9abb-4a6e-9e6a-08a693d9b92c")
(uuid "c4766cc0-5735-4d73-a88b-4e9cb0aa6ad1")
)
(fp_arc
(start -4.0548 26.499993)
@@ -8138,7 +8138,7 @@
(type solid)
)
(layer "B.Fab")
(uuid "d28d151e-7873-412a-a053-458b155422e4")
(uuid "05fb7052-0501-4c25-94e2-c65c0e6989cf")
)
(fp_circle
(center -6.5983 24.199993)
@@ -8149,13 +8149,13 @@
)
(fill no)
(layer "B.Fab")
(uuid "dc2362a0-afdf-49c2-8ded-791cc8050dde")
(uuid "25258a22-d287-4627-bb8a-3df965ae86c8")
)
(fp_text user "*"
(at -7.5 32.133327 180)
(unlocked yes)
(layer "B.SilkS")
(uuid "430b1d6f-e8d6-407f-af6b-c05496eb7e53")
(uuid "5d2f8dc0-07e9-4575-9958-3823f05aa878")
(effects
(font
(size 1 1)
@@ -8167,7 +8167,20 @@
(fp_text user "*"
(at -7.5 32.133327 180)
(layer "B.SilkS")
(uuid "753d6b97-b86a-43b4-b4ba-dc79d7a6bbb6")
(uuid "8dc9889d-6abe-4840-84bc-3ce510d8fbc9")
(effects
(font
(size 1 1)
(thickness 0.15)
)
(justify mirror)
)
)
(fp_text user "*"
(at -7.5 27.533327 180)
(unlocked yes)
(layer "B.Fab")
(uuid "414fcf22-fa35-41e4-99bf-2085167fad36")
(effects
(font
(size 1 1)
@@ -8192,20 +8205,7 @@
(fp_text user "*"
(at -7.5 27.533327 180)
(layer "B.Fab")
(uuid "d11bf1a9-df63-4a21-bf61-47508c373e60")
(effects
(font
(size 1 1)
(thickness 0.15)
)
(justify mirror)
)
)
(fp_text user "*"
(at -7.5 27.533327 180)
(unlocked yes)
(layer "B.Fab")
(uuid "f2053ba8-d48f-405e-81a7-383861f559af")
(uuid "8d85499d-f175-4b63-ac83-3a0e1f754de3")
(effects
(font
(size 1 1)
@@ -6218,7 +6218,7 @@
)
)
)
(property "Footprint" "Inductor_SMD:L_0805_2012Metric"
(property "Footprint" "Inductor_SMD:L_0805_2012Metric_Pad1.15x1.40mm_HandSolder"
(at 215.9 92.71 0)
(effects
(font
Binary file not shown.
BIN
View File
Binary file not shown.
+2 -1
View File
@@ -2,6 +2,7 @@
"files.associations": {
"styles.h": "c",
"string.h": "c",
"system_error": "cpp"
"system_error": "cpp",
"random": "c"
}
}
+2 -2
View File
@@ -38,10 +38,10 @@ void MQTT::serveOverride(void){
}
switch(glblData.override){
case OVR_ALWAYSOFF:
sending += "\"Override\": \"Always ON\"}";
sending += "\"Override\": \"Always OFF\"}";
break;
case OVR_ALWAYSON:
sending += "\"Override\": \"Always OFF\"}";
sending += "\"Override\": \"Always ON\"}";
break;
case OVR_NONE:
sending += "\"Override\": \"NONE\"}";
+49 -19
View File
@@ -18,6 +18,9 @@
#include "MQTT.h"
#define MEASINT_S 1
#define HISTINT_S (5*60) //make history point every 5 min.
// -- Initial password to connect to the Thing, when it creates an own Access Point.
MQTT mqtt;
@@ -30,12 +33,12 @@ float barometerAltitude = 730.0; // meters ... map readings + barometer positio
/*定义ESP32的SPI使用的引脚*/
BME280I2C::Settings settings(
BME280::OSR_X1,
BME280::OSR_X1,
BME280::OSR_X4,
BME280::OSR_X1,
BME280::OSR_X1,
BME280::Mode_Forced,
BME280::Mode_Normal,
BME280::StandbyTime_1000ms,
BME280::Filter_2,
BME280::Filter_Off,
BME280::SpiEnable_False,
BME280I2C::I2CAddr_0x76
);
@@ -46,21 +49,46 @@ BME280I2C bme(settings);
uint32_t draw_buf[DRAW_BUF_SIZE / 4];
bool newMeasurement=false,newHistory=false;
float temp(NAN), hum(NAN), pres(NAN),seaLevelPress(NAN);
bool presAlarm = false;
bool mutex_locked = false;
void measure(void){ //update temp every 30secs
static uint8_t counter=0;
settings.mode = BME280::Mode_Forced;
bme.setSettings(settings);
static uint8_t dropCNT=0;
static float old_pres=0;
static uint32_t hist_update_cnt;
static uint32_t screen_update_cnt;
//settings.mode = BME280::Mode_Forced;
//bme.setSettings(settings);
++hist_update_cnt;
++screen_update_cnt;
if(newMeasurement){ //if flag was not yet handled completely, skip measurement but increase time counter for history timing
return;
}
bme.read(pres, temp, hum, BME280::TempUnit_Celsius, BME280::PresUnit_hPa);
settings.mode = BME280::Mode_Sleep;
bme.setSettings(settings);
//settings.mode = BME280::Mode_Sleep;
//bme.setSettings(settings);
temp = temp - 1.0; //adjust temp to compensate head dissipation of ESP
seaLevelPress = EnvironmentCalculations::EquivalentSeaLevelPressure(barometerAltitude, temp, pres, EnvironmentCalculations::AltitudeUnit_Meters, EnvironmentCalculations::TempUnit_Celsius);
newMeasurement = true;
if(++counter > 10 || history_isInitialized() == false){ //add a point to history every 5 mins
if(history_isInitialized() && old_pres - pres > 0.1){
if(++dropCNT > 1){ //pressure drop at leaast 2 secs
old_pres = pres;
presAlarm = true;
}
}else{
old_pres = pres;
dropCNT = 0;
presAlarm = false;
}
if(screen_update_cnt == 30 || presAlarm){ //update every 30 secs
newMeasurement = true;
screen_update_cnt = 0;
}
if(hist_update_cnt == HISTINT_S/MEASINT_S || history_isInitialized() == false){ //add a point to history every 5 mins or init the hist, if no point present yet
history_append(seaLevelPress,temp,hum);
counter = 0;
hist_update_cnt = 0;
newHistory = true;
newMeasurement = true;
}
}
@@ -86,8 +114,8 @@ void setup(void)
lv_indev_set_type(indev, LV_INDEV_TYPE_POINTER);
lv_indev_set_read_cb(indev, my_touch_read);
ui_init();
setBacklight(0x3FF);
measurementTick.attach(30,measure);
setBacklight(BL_BRIGHTNESS);
measurementTick.attach(MEASINT_S,measure);
mqtt.begin();
lv_label_set_text_fmt(objects.debugTxt, "IP:\n %s\n\nHostname:\n %s\n\nMqtt-Server:\n %s\n\nMqtt-Port:\n %d\n\nMqtt-Topic:\n %d\n\n",mqtt.getMyIP(),mqtt.getHostname(),mqtt.getMqttServer(),mqtt.getMqttPort(), mqtt.getMqttTopic());
@@ -97,14 +125,14 @@ void setup(void)
unsigned long lastms = millis();
unsigned long lastTick = 0;
uint8_t statusCnt=0;
uint16_t tickCounter = 0;
void loop()
{
if(newMeasurement){
update_sensorNstatus(temp, hum, seaLevelPress);
mqtt.sendStatus();
update_sensorNstatus(temp, hum, seaLevelPress,presAlarm);
newMeasurement = false;
mqtt.sendStatus();
}
if(newHistory){
newHistory=false;
@@ -113,7 +141,9 @@ void loop()
}
mqtt.loop();
ui_tick();
lv_task_handler(); // let the GUI do its work
lv_tick_inc(millis() - lastms); // tell LVGL how much time has passed
if(!ui_isSleeping()){
lv_task_handler(); // let the GUI do its work
lv_tick_inc(millis() - lastms); // tell LVGL how much time has passed
}
lastms = millis();
}
+47 -5
View File
@@ -5,24 +5,42 @@
bool arc_pressed = false;
bool animating = false;
dataset_t glblData;
dataset_t glblData = {.temp = NAN, .hum = NAN, .pres = NAN, .seaLevelPress = NAN, .settemp= NAN, .heating=false, .enBuff =false, .presAlarm=false, .override=OVR_NONE};
float curr_temp = 0.0;
int32_t scale_max = 0, scale_min = 0, lastSelChartValue = 0;
lv_point_t lastChartPt;
void update_sensorNstatus(float temp, float hum, float seaLevelPress){
void update_sensorNstatus(float temp, float hum, float seaLevelPress, bool presAlarm){
glblData.temp = temp;
glblData.hum = hum;
glblData.seaLevelPress = seaLevelPress;
glblData.presAlarm = presAlarm;
update_status();
}
static void alarm_ani_cb(void * var, int32_t v)
{
if(v > -1 && v < 256){
lv_led_set_brightness(objects.alarmLED, v);
//setBacklight((v<<4) | 0x00FF);
ledcFade(GFX_BL,ledcRead(GFX_BL),(v<<4) | 0x00FF,100);
}
}
static void alarm_ani_end_cb(lv_anim_t *var)
{
lv_obj_add_flag(objects.alarmLED, LV_OBJ_FLAG_HIDDEN);
setBacklight(BL_BRIGHTNESS);
lv_led_set_brightness(objects.alarmLED, 0);
}
void ui_settemp(float tmp){
lv_arc_set_value(objects.temp_arc, (int32_t) (tmp*2));
}
void update_status(void){
lv_label_set_text_fmt(objects.press_txt,"%4.0f hPa",glblData.seaLevelPress);
lv_label_set_text_fmt(objects.press_txt,"%4.2f hPa",glblData.seaLevelPress);
lv_label_set_text_fmt(objects.hum_txt,"%2.0f %%rH",glblData.hum);
if(!arc_pressed && !animating){
lv_label_set_text_fmt(objects.temp_txt,"%2.1f °C",glblData.temp);
@@ -30,8 +48,14 @@ void update_status(void){
glblData.settemp = lv_arc_get_value(objects.temp_arc)/2.0;
lv_label_set_text_fmt(objects.temp_txt,"%2.1f °C",glblData.settemp);
}
if(glblData.enBuff){
lv_obj_remove_flag(objects.bufferIcn, LV_OBJ_FLAG_HIDDEN);
}else{
lv_obj_add_flag(objects.bufferIcn, LV_OBJ_FLAG_HIDDEN);
}
switch(glblData.override){
case OVR_NONE:
lv_obj_set_style_text_color(objects.bufferIcn,lv_color_hex(0xFFfafafa),LV_STATE_DEFAULT);
if(glblData.temp < glblData.settemp-TMP_HYST){
glblData.heating = true;
}
@@ -40,6 +64,7 @@ void update_status(void){
}
break;
case OVR_ALWAYSON:
lv_obj_set_style_text_color(objects.bufferIcn,lv_color_hex(0xFF00AA00),LV_STATE_DEFAULT);
if(glblData.temp < glblData.settemp+3.0){ //allow for 3degC overheating
glblData.heating = true;
}
@@ -48,6 +73,7 @@ void update_status(void){
}
break;
case OVR_ALWAYSOFF:
lv_obj_set_style_text_color(objects.bufferIcn,lv_color_hex(0xFFAA0000),LV_STATE_DEFAULT);
if(glblData.temp < 12){ //ensure minimum of 12°C
glblData.heating = true;
}
@@ -57,12 +83,28 @@ void update_status(void){
break;
}
if(glblData.heating){
digitalWrite(PIN_REL,LOW);
lv_obj_add_flag(objects.heaterIcn, LV_OBJ_FLAG_HIDDEN);
digitalWrite(PIN_REL,HIGH);
lv_obj_remove_flag(objects.heaterIcn, LV_OBJ_FLAG_HIDDEN);
}else{
digitalWrite(PIN_REL,LOW);
lv_obj_add_flag(objects.heaterIcn, LV_OBJ_FLAG_HIDDEN);
}
if(glblData.presAlarm == true){
lv_obj_remove_flag(objects.alarmLED, LV_OBJ_FLAG_HIDDEN);
lv_anim_t alarmAni;
lv_anim_init(&alarmAni);
lv_anim_set_values(&alarmAni, 0, 255);
lv_anim_set_duration(&alarmAni, 600);
lv_anim_set_playback_delay(&alarmAni, 0);
lv_anim_set_playback_duration(&alarmAni, 600);
lv_anim_set_repeat_delay(&alarmAni, 100);
lv_anim_set_repeat_count(&alarmAni,7);
lv_anim_set_exec_cb(&alarmAni, alarm_ani_cb);
lv_anim_set_path_cb(&alarmAni, lv_anim_path_ease_in_out);
lv_anim_set_completed_cb(&alarmAni,alarm_ani_end_cb);
lv_anim_start(&alarmAni);
ui_exitSleep();
}
}
void update_wifi_strength(wifi_strength_t strength){
+3 -2
View File
@@ -22,11 +22,12 @@ typedef struct dataset_s{
float seaLevelPress;
float settemp;
bool heating;
bool buffRequest;
bool enBuff;
bool presAlarm;
override_t override;
}dataset_t;
typedef enum wifi_strength_e{
WIFI_STRENGTH_OFF,
WIFI_STRENGTH_LOW,
@@ -43,7 +44,7 @@ void showChartScreen(lv_event_t * e);
void showMainScreen(lv_event_t * e);
void action_show_cursors_cb(lv_event_t * e);
void chartDrawingCB(lv_event_t * e);
void update_sensorNstatus(float temp, float hum, float seaLevelPress);
void update_sensorNstatus(float temp, float hum, float seaLevelPress, bool presAlarm);
void update_status(void);
void update_wifi_strength(wifi_strength_t strength);
void chart_autoscale(void);
+17 -1
View File
@@ -12,6 +12,9 @@
objects_t objects;
lv_obj_t *tick_value_change_obj;
void create_screen_main() {
lv_obj_t *obj = lv_obj_create(0);
objects.main = obj;
@@ -20,6 +23,18 @@ void create_screen_main() {
lv_obj_add_event_cb(obj, action_switch_screens, LV_EVENT_GESTURE, (void *)0);
{
lv_obj_t *parent_obj = obj;
{
lv_obj_t *obj = lv_led_create(parent_obj);
objects.alarmLED = obj;
lv_obj_set_size(obj, 100, 100);
lv_obj_center(obj);
lv_led_set_color(obj, lv_color_hex(0xffff4411));
lv_led_set_brightness(obj, 0);
lv_obj_set_style_shadow_width(obj, 20, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_shadow_spread(obj, 16, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_add_flag(obj, LV_OBJ_FLAG_HIDDEN);
}
{
// tempArc
lv_obj_t *obj = lv_arc_create(parent_obj);
@@ -57,6 +72,7 @@ void create_screen_main() {
objects.hum_txt = obj;
lv_obj_set_pos(obj, 91, 141);
lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
lv_obj_align(obj,LV_ALIGN_CENTER,0,25);
lv_label_set_text(obj, "");
lv_obj_set_style_text_font(obj, &lv_font_montserrat_20, LV_PART_MAIN | LV_STATE_DEFAULT);
}
@@ -66,6 +82,7 @@ void create_screen_main() {
objects.press_txt = obj;
lv_obj_set_pos(obj, 81, 78);
lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
lv_obj_align(obj,LV_ALIGN_CENTER,0,-25);
lv_label_set_text(obj, "");
lv_obj_set_style_text_font(obj, &lv_font_montserrat_20, LV_PART_MAIN | LV_STATE_DEFAULT);
}
@@ -269,7 +286,6 @@ void create_screen_debug() {
}
void create_screens() {
lv_disp_t *dispp = lv_disp_get_default();
lv_theme_t *theme = lv_theme_default_init(dispp, lv_palette_main(LV_PALETTE_GREEN), lv_palette_main(LV_PALETTE_RED), true, LV_FONT_DEFAULT);
+1
View File
@@ -26,6 +26,7 @@ typedef struct _objects_t {
lv_obj_t *heaterIcn;
lv_obj_t *bufferIcn;
lv_obj_t *wifiIcn;
lv_obj_t *alarmLED;
lv_chart_cursor_t *chart_cursor;
lv_chart_series_t *chart_series;
} objects_t;
+336
View File
@@ -0,0 +1,336 @@
/**
* @file lv_symbol_def.h
*
*/
#ifndef LV_SYMBOL_DEF_H
#define LV_SYMBOL_DEF_H
#ifdef __cplusplus
extern "C" {
#endif
LV_FONT_DECLARE(Bootstrap_Icons_16);
//included icons in bootstrap font
//use this list for font generator:
/*
0xF619-0xF61C,0xF7F6,0xF4FF,0xF185-0xF188,0xF30B-0xF30D,0xF493,0xF4F7,0xF5CD-0xF5D20xF100,
*/
#define ICON_WIFI_LOW "\xEF\x98\x99" //F619
#define ICON_WIFI_MED "\xEF\x98\x9A" //F61A
#define ICON_WIFI_HIGH "\xEF\x98\x9C" //F61C
#define ICON_WIFI_OFF "\xEF\x98\x9B" //F61B
#define ICON_FIRE "\xEF\x9F\xB6" //F7F6
#define ICON_POWER "\xEF\x93\xBF" //F4FF
#define ICON_BATT_CHARG "\xEF\x86\x85" //F185
#define ICON_BATT_FULL "\xEF\x86\x86" //F186
#define ICON_BATT_HALF "\xEF\x86\x87" //F187
#define ICON_BATT "\xEF\x86\x88" //F188
#define ICON_DROPLET_FULL "\xEF\x8C\x8B" //F30B
#define ICON_DROPLET_HALF "\xEF\x8C\x8C" //F30C
#define ICON_DROPLET "\xEF\x8C\x8D" //F30D
#define ICON_MOISTURE "\xEF\x92\x93" //F493
#define ICON_PLUG "\xEF\x93\xB7" //F4F7
#define ICON_THERMOMETER_HALF "\xEF\x97\x8D" //F5CD
#define ICON_THERMOMETER_HIGH "\xEF\x97\x8E" //F5CE
#define ICON_THERMOMETER_LOW "\xEF\x97\x8F" //F5CF
#define ICON_THERMOMETER_SNOW "\xEF\x97\x90" //F5D0
#define ICON_THERMOMETER_SUN "\xEF\x97\x91" //F5D1
#define ICON_THERMOMETER "\xEF\x97\x92" //F5D2
#define ICON_SHUTTER "" //F100
#define ICON_MENU_LINES "" //F479
#define ICON_MENU_DOTS_H "" //F5D4
#define ICON_MENU_DOTS_V "" //F5D3
#define ICON_ROTATE_CW "" //F116
#define ICON_ROTATE_CC "" //F117
#define ICON_GRAPH "" //F3F2
#define ICON_ARROW_DOWN_FILL "" //F229
#define ICON_ARROW_DOWN "" //F22C
#define ICON_ARROW_UP_FILL "" //F235
#define ICON_ARROW_UP "" //F238
#define ICON_ARROW_LEFT_FILL "" //F22D
#define ICON_ARROW_LEFT "" //F230
#define ICON_ARROW_RIGHT_FILL "" //F231
#define ICON_ARROW_RIGHT "" //F234
/*-------------------------------
* Symbols from montserrat font
*-----------------------------*/
//use this list for font generator:
/*
0x20-0x7F,0x00B0-0xB4,0x2022,0xAB,0xBB-0xBE,0x3A9,0x3C0,0x2022
µÄÖÜäöüß
*/
/*-------------------------------
* Symbols from FontAwesome font
*-----------------------------*/
/*In the font converter use this list as range:
61441, 61448, 61451, 61452, 61453, 61457, 61459, 61461, 61465, 61468,
61473, 61478, 61479, 61480, 61502, 61507, 61512, 61515, 61516, 61517,
61521, 61522, 61523, 61524, 61543, 61544, 61550, 61552, 61553, 61556,
61559, 61560, 61561, 61563, 61587, 61589, 61636, 61637, 61639, 61641,
61664, 61671, 61674, 61683, 61724, 61732, 61787, 61931, 62016, 62017,
62018, 62019, 62020, 62087, 62099, 62189, 62212, 62810, 63426, 63650
*/
/* These symbols can be predefined in the lv_conf.h file.
* If they are not predefined, they will use the following values
*/
#if !defined LV_SYMBOL_AUDIO
#define LV_SYMBOL_AUDIO "\xEF\x80\x81" /*61441, 0xF001*/
#endif
#if !defined LV_SYMBOL_VIDEO
#define LV_SYMBOL_VIDEO "\xEF\x80\x88" /*61448, 0xF008*/
#endif
#if !defined LV_SYMBOL_LIST
#define LV_SYMBOL_LIST "\xEF\x80\x8B" /*61451, 0xF00B*/
#endif
#if !defined LV_SYMBOL_OK
#define LV_SYMBOL_OK "\xEF\x80\x8C" /*61452, 0xF00C*/
#endif
#if !defined LV_SYMBOL_CLOSE
#define LV_SYMBOL_CLOSE "\xEF\x80\x8D" /*61453, 0xF00D*/
#endif
#if !defined LV_SYMBOL_POWER
#define LV_SYMBOL_POWER "\xEF\x80\x91" /*61457, 0xF011*/
#endif
#if !defined LV_SYMBOL_SETTINGS
#define LV_SYMBOL_SETTINGS "\xEF\x80\x93" /*61459, 0xF013*/
#endif
#if !defined LV_SYMBOL_HOME
#define LV_SYMBOL_HOME "\xEF\x80\x95" /*61461, 0xF015*/
#endif
#if !defined LV_SYMBOL_DOWNLOAD
#define LV_SYMBOL_DOWNLOAD "\xEF\x80\x99" /*61465, 0xF019*/
#endif
#if !defined LV_SYMBOL_DRIVE
#define LV_SYMBOL_DRIVE "\xEF\x80\x9C" /*61468, 0xF01C*/
#endif
#if !defined LV_SYMBOL_REFRESH
#define LV_SYMBOL_REFRESH "\xEF\x80\xA1" /*61473, 0xF021*/
#endif
#if !defined LV_SYMBOL_MUTE
#define LV_SYMBOL_MUTE "\xEF\x80\xA6" /*61478, 0xF026*/
#endif
#if !defined LV_SYMBOL_VOLUME_MID
#define LV_SYMBOL_VOLUME_MID "\xEF\x80\xA7" /*61479, 0xF027*/
#endif
#if !defined LV_SYMBOL_VOLUME_MAX
#define LV_SYMBOL_VOLUME_MAX "\xEF\x80\xA8" /*61480, 0xF028*/
#endif
#if !defined LV_SYMBOL_IMAGE
#define LV_SYMBOL_IMAGE "\xEF\x80\xBE" /*61502, 0xF03E*/
#endif
#if !defined LV_SYMBOL_TINT
#define LV_SYMBOL_TINT "\xEF\x81\x83" /*61507, 0xF043*/
#endif
#if !defined LV_SYMBOL_PREV
#define LV_SYMBOL_PREV "\xEF\x81\x88" /*61512, 0xF048*/
#endif
#if !defined LV_SYMBOL_PLAY
#define LV_SYMBOL_PLAY "\xEF\x81\x8B" /*61515, 0xF04B*/
#endif
#if !defined LV_SYMBOL_PAUSE
#define LV_SYMBOL_PAUSE "\xEF\x81\x8C" /*61516, 0xF04C*/
#endif
#if !defined LV_SYMBOL_STOP
#define LV_SYMBOL_STOP "\xEF\x81\x8D" /*61517, 0xF04D*/
#endif
#if !defined LV_SYMBOL_NEXT
#define LV_SYMBOL_NEXT "\xEF\x81\x91" /*61521, 0xF051*/
#endif
#if !defined LV_SYMBOL_EJECT
#define LV_SYMBOL_EJECT "\xEF\x81\x92" /*61522, 0xF052*/
#endif
#if !defined LV_SYMBOL_LEFT
#define LV_SYMBOL_LEFT "\xEF\x81\x93" /*61523, 0xF053*/
#endif
#if !defined LV_SYMBOL_RIGHT
#define LV_SYMBOL_RIGHT "\xEF\x81\x94" /*61524, 0xF054*/
#endif
#if !defined LV_SYMBOL_PLUS
#define LV_SYMBOL_PLUS "\xEF\x81\xA7" /*61543, 0xF067*/
#endif
#if !defined LV_SYMBOL_MINUS
#define LV_SYMBOL_MINUS "\xEF\x81\xA8" /*61544, 0xF068*/
#endif
#if !defined LV_SYMBOL_EYE_OPEN
#define LV_SYMBOL_EYE_OPEN "\xEF\x81\xAE" /*61550, 0xF06E*/
#endif
#if !defined LV_SYMBOL_EYE_CLOSE
#define LV_SYMBOL_EYE_CLOSE "\xEF\x81\xB0" /*61552, 0xF070*/
#endif
#if !defined LV_SYMBOL_WARNING
#define LV_SYMBOL_WARNING "\xEF\x81\xB1" /*61553, 0xF071*/
#endif
#if !defined LV_SYMBOL_SHUFFLE
#define LV_SYMBOL_SHUFFLE "\xEF\x81\xB4" /*61556, 0xF074*/
#endif
#if !defined LV_SYMBOL_UP
#define LV_SYMBOL_UP "\xEF\x81\xB7" /*61559, 0xF077*/
#endif
#if !defined LV_SYMBOL_DOWN
#define LV_SYMBOL_DOWN "\xEF\x81\xB8" /*61560, 0xF078*/
#endif
#if !defined LV_SYMBOL_LOOP
#define LV_SYMBOL_LOOP "\xEF\x81\xB9" /*61561, 0xF079*/
#endif
#if !defined LV_SYMBOL_DIRECTORY
#define LV_SYMBOL_DIRECTORY "\xEF\x81\xBB" /*61563, 0xF07B*/
#endif
#if !defined LV_SYMBOL_UPLOAD
#define LV_SYMBOL_UPLOAD "\xEF\x82\x93" /*61587, 0xF093*/
#endif
#if !defined LV_SYMBOL_CALL
#define LV_SYMBOL_CALL "\xEF\x82\x95" /*61589, 0xF095*/
#endif
#if !defined LV_SYMBOL_CUT
#define LV_SYMBOL_CUT "\xEF\x83\x84" /*61636, 0xF0C4*/
#endif
#if !defined LV_SYMBOL_COPY
#define LV_SYMBOL_COPY "\xEF\x83\x85" /*61637, 0xF0C5*/
#endif
#if !defined LV_SYMBOL_SAVE
#define LV_SYMBOL_SAVE "\xEF\x83\x87" /*61639, 0xF0C7*/
#endif
#if !defined LV_SYMBOL_BARS
#define LV_SYMBOL_BARS "\xEF\x83\x89" /*61641, 0xF0C9*/
#endif
#if !defined LV_SYMBOL_ENVELOPE
#define LV_SYMBOL_ENVELOPE "\xEF\x83\xA0" /*61664, 0xF0E0*/
#endif
#if !defined LV_SYMBOL_CHARGE
#define LV_SYMBOL_CHARGE "\xEF\x83\xA7" /*61671, 0xF0E7*/
#endif
#if !defined LV_SYMBOL_PASTE
#define LV_SYMBOL_PASTE "\xEF\x83\xAA" /*61674, 0xF0EA*/
#endif
#if !defined LV_SYMBOL_BELL
#define LV_SYMBOL_BELL "\xEF\x83\xB3" /*61683, 0xF0F3*/
#endif
#if !defined LV_SYMBOL_KEYBOARD
#define LV_SYMBOL_KEYBOARD "\xEF\x84\x9C" /*61724, 0xF11C*/
#endif
#if !defined LV_SYMBOL_GPS
#define LV_SYMBOL_GPS "\xEF\x84\xA4" /*61732, 0xF124*/
#endif
#if !defined LV_SYMBOL_FILE
#define LV_SYMBOL_FILE "\xEF\x85\x9B" /*61787, 0xF158*/
#endif
#if !defined LV_SYMBOL_WIFI
#define LV_SYMBOL_WIFI "\xEF\x87\xAB" /*61931, 0xF1EB*/
#endif
#if !defined LV_SYMBOL_BATTERY_FULL
#define LV_SYMBOL_BATTERY_FULL "\xEF\x89\x80" /*62016, 0xF240*/
#endif
#if !defined LV_SYMBOL_BATTERY_3
#define LV_SYMBOL_BATTERY_3 "\xEF\x89\x81" /*62017, 0xF241*/
#endif
#if !defined LV_SYMBOL_BATTERY_2
#define LV_SYMBOL_BATTERY_2 "\xEF\x89\x82" /*62018, 0xF242*/
#endif
#if !defined LV_SYMBOL_BATTERY_1
#define LV_SYMBOL_BATTERY_1 "\xEF\x89\x83" /*62019, 0xF243*/
#endif
#if !defined LV_SYMBOL_BATTERY_EMPTY
#define LV_SYMBOL_BATTERY_EMPTY "\xEF\x89\x84" /*62020, 0xF244*/
#endif
#if !defined LV_SYMBOL_USB
#define LV_SYMBOL_USB "\xEF\x8a\x87" /*62087, 0xF287*/
#endif
#if !defined LV_SYMBOL_BLUETOOTH
#define LV_SYMBOL_BLUETOOTH "\xEF\x8a\x93" /*62099, 0xF293*/
#endif
#if !defined LV_SYMBOL_TRASH
#define LV_SYMBOL_TRASH "\xEF\x8B\xAD" /*62189, 0xF2ED*/
#endif
#if !defined LV_SYMBOL_EDIT
#define LV_SYMBOL_EDIT "\xEF\x8C\x84" /*62212, 0xF304*/
#endif
#if !defined LV_SYMBOL_BACKSPACE
#define LV_SYMBOL_BACKSPACE "\xEF\x95\x9A" /*62810, 0xF55A*/
#endif
#if !defined LV_SYMBOL_SD_CARD
#define LV_SYMBOL_SD_CARD "\xEF\x9F\x82" /*63426, 0xF7C2*/
#endif
#if !defined LV_SYMBOL_NEW_LINE
#define LV_SYMBOL_NEW_LINE "\xEF\xA2\xA2" /*63650, 0xF8A2*/
#endif
#if !defined LV_SYMBOL_DUMMY
/** Invalid symbol at (U+F8FF). If written before a string then `lv_img` will show it as a label*/
#define LV_SYMBOL_DUMMY "\xEF\xA3\xBF"
#endif
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_SYMBOL_DEF_H*/
+30 -23
View File
@@ -9,12 +9,10 @@
#include <TouchDrvCSTXXX.hpp>
#include <Ticker.h>
#define GFX_BL 1
Arduino_DataBus *bus = new Arduino_ESP32SPI(3 /* DC */, 5 /* CS */, 2 /* SCK */, 4 /* MOSI */, -1 /* MISO */, FSPI /* spi_num */);
Arduino_GC9A01 *gfx = new Arduino_GC9A01(bus, 0 /* RST */, 2 /* rotation */, true /* IPS */);
uint16_t brightness = 0, brightness_new = 0;
TouchDrvCSTXXX touch;
int16_t x[5], y[5];
bool isPressed = false,sleeping=false;
unsigned long lastTouch;
static int16_t currentScreen = -1;
@@ -78,38 +76,47 @@ void ui_init() {
loadScreen(SCREEN_ID_MAIN);
}
bool ui_isSleeping(void){
return sleeping;
}
void ui_exitSleep(){
if(sleeping){
isPressed = true;
}else{
lastTouch = millis();
}
}
void ui_tick() {
//tick_screen(currentScreen);
if(millis() - lastTouch > 10000){
if(millis() - lastTouch > SLEEP_TIMEOUT){
if(!sleeping){
displaySleep();
sleeping = true;
}
unsigned long millisbefore = millis();
/*
gpio_wakeup_enable(GPIO_NUM_8,GPIO_INTR_HIGH_LEVEL);
esp_sleep_enable_gpio_wakeup();
esp_sleep_enable_timer_wakeup(500000);
esp_light_sleep_start();
gpio_wakeup_disable(GPIO_NUM_8);
gpio_set_intr_type(GPIO_NUM_8,GPIO_INTR_NEGEDGE);*/
while((millis()-millisbefore) < 10000 && (millis() - lastTouch) > 60000){
//while((millis()-millisbefore) < 10000 && (millis() - lastTouch) > SLEEP_TIMEOUT){
delay(200);
if (isPressed){
isPressed = false;
lastTouch = millis();
}else{
lastTouch = millis()-SLEEP_TIMEOUT-1;
}
}
//}
}else if(sleeping){
sleeping= false;
Serial.print("WAKE!!");
lastTouch = millis();
displayWake();
lv_obj_invalidate(objects.temp_arc);
lv_task_handler(); // let the GUI do its work
sleeping= false;
isPressed = false;
}
}
void displaySleep(){
gfx->displayOff();
ledcFade(GFX_BL, 0x3FF, 0x000, 300);
ledcFade(GFX_BL, BL_BRIGHTNESS, 0x000, 300);
}
void displayWake(){
@@ -118,7 +125,7 @@ void displayWake(){
delay(10);
lv_obj_invalidate(objects.temp_arc);
lv_task_handler(); // let the GUI do its work
ledcFade(GFX_BL, 0x000, 0x3FF, 300);
ledcFade(GFX_BL, 0x000, BL_BRIGHTNESS, 300);
}
@@ -144,15 +151,15 @@ void displayWake(){
void my_touch_read(lv_indev_t * indev, lv_indev_data_t * data)
{
lv_coord_t last_x = 0;
lv_coord_t last_y = 0;
if (isPressed) {
int16_t x = 0;
int16_t y = 0;
if (isPressed && !sleeping) {
lastTouch = millis();
isPressed = false;
uint8_t touched = touch.getPoint(x, y, touch.getSupportTouchPoint());
uint8_t touched = touch.getPoint(&x, &y, 1);
if (touched) {
data->point.x = SCREEN_WIDTH - x[0];
data->point.y = SCREEN_HEIGHT - y[0];
data->point.x = SCREEN_WIDTH - x;
data->point.y = SCREEN_HEIGHT - y;
data->state = LV_INDEV_STATE_PRESSED;
}else {
data->state = LV_INDEV_STATE_RELEASED;
+6
View File
@@ -3,6 +3,10 @@
#include <lvgl.h>
#define SLEEP_TIMEOUT 30000 //sleep display after 30 secs
#define GFX_BL 1
#define BL_BRIGHTNESS 0x3FF
#define TouchInt 8
#define TouchRST 9
#define SCL 7
@@ -60,6 +64,8 @@ extern "C" {
void TouchHandleInterrupt(void);
void ui_init();
void ui_exitSleep();
bool ui_isSleeping(void);
void ui_tick();
void DisplayInit(void);
void log_print(lv_log_level_t level, const char * buf);
Binary file not shown.
File diff suppressed because it is too large Load Diff
Binary file not shown.
Binary file not shown.
+20
View File
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
<svg fill="#000000" width="800px" height="800px" viewBox="0 -2.05 122.88 122.88" version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" style="enable-background:new 0 0 122.88 118.77" xml:space="preserve">
<style type="text/css">
<![CDATA[
.st0{fill-rule:evenodd;clip-rule:evenodd;}
]]>
</style>
<g>
<path class="st0" d="M1.22,0.04h115.79c0.14-0.02,0.28-0.04,0.43-0.04c0.15,0,0.29,0.01,0.43,0.04c0.21,0.01,0.4,0.06,0.57,0.16 c0.91,0.38,1.54,1.25,1.54,2.27v99.12c0,0.09-0.01,0.19-0.02,0.28c1.73,0.91,2.92,2.73,2.92,4.82v6.65c0,2.99-2.45,5.44-5.44,5.44 l0,0c-2.99,0-5.44-2.45-5.44-5.44v-6.65c0-2.08,1.19-3.9,2.92-4.82c-0.01-0.09-0.02-0.18-0.02-0.28V10.29H1.22 C0.55,10.29,0,9.75,0,9.08V1.25C0,0.58,0.55,0.04,1.22,0.04L1.22,0.04z M3.21,92.21h103.98v4.91H3.21V92.21L3.21,92.21z M3.21,79.71h103.98v4.91H3.21V79.71L3.21,79.71z M3.21,67.21h103.98v4.91H3.21V67.21L3.21,67.21z M3.21,54.71h103.98v4.91H3.21 V54.71L3.21,54.71z M3.21,42.2h103.98v4.91H3.21V42.2L3.21,42.2z M3.21,29.7h103.98v4.91H3.21V29.7L3.21,29.7z M3.21,17.2h103.98 v4.91H3.21V17.2L3.21,17.2z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.2 KiB