Bugfix and QOL update
- Added watchdog to ensure 1.5 minutes evaluation of temperatur - added boot time output to MQTT ti track reboots - keep chosen set temp during resets (only power loss will result in reading the default temp from flash) - Add smaller case to fit concrete wall housings - added command to upload firmware to all targets as comment in platformio.ini
This commit is contained in:
parent
df516837cc
commit
da827054a7
BIN
CAD/UPgehaeuse_UG_bottom.3mf
Normal file
BIN
CAD/UPgehaeuse_UG_bottom.3mf
Normal file
Binary file not shown.
2786
CAD/UPgehaeuse_UG_bottom.step
Normal file
2786
CAD/UPgehaeuse_UG_bottom.step
Normal file
File diff suppressed because it is too large
Load Diff
Binary file not shown.
BIN
CAD/UPgehaeuse_back_OG.3mf
Normal file
BIN
CAD/UPgehaeuse_back_OG.3mf
Normal file
Binary file not shown.
3
Raumtermostat/.vscode/settings.json
vendored
3
Raumtermostat/.vscode/settings.json
vendored
@ -69,6 +69,7 @@
|
|||||||
"symbols.h": "c",
|
"symbols.h": "c",
|
||||||
"arduino.h": "c",
|
"arduino.h": "c",
|
||||||
"actions.h": "c",
|
"actions.h": "c",
|
||||||
"glbldata.h": "c"
|
"glbldata.h": "c",
|
||||||
|
"vars.h": "c"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -14,8 +14,8 @@ board = seeed_xiao_esp32c3
|
|||||||
monitor_speed = 115200
|
monitor_speed = 115200
|
||||||
framework = arduino
|
framework = arduino
|
||||||
board_build.partitions = min_spiffs.csv
|
board_build.partitions = min_spiffs.csv
|
||||||
;upload_protocol = espota
|
upload_protocol = espota
|
||||||
;upload_port = TMP-EG-Florian.fritz.box
|
upload_port = TMP-EG-Bad.fritz.box
|
||||||
lib_deps =
|
lib_deps =
|
||||||
moononournation/GFX Library for Arduino@^1.5.3
|
moononournation/GFX Library for Arduino@^1.5.3
|
||||||
lvgl/lvgl@^9.2.2
|
lvgl/lvgl@^9.2.2
|
||||||
@ -25,3 +25,5 @@ build_flags =
|
|||||||
-D LV_CONF_INCLUDE_SIMPLE
|
-D LV_CONF_INCLUDE_SIMPLE
|
||||||
-D LV_LVGL_H_INCLUDE_SIMPLE
|
-D LV_LVGL_H_INCLUDE_SIMPLE
|
||||||
-I src
|
-I src
|
||||||
|
;to install on all targets:
|
||||||
|
;(pio run -t nobuild -t upload --upload-port TMP-EG-WoZi.fritz.box) -and (pio run -t nobuild -t upload --upload-port TMP-EG-Florian.fritz.box) -and (pio run -t nobuild -t upload --upload-port TMP-EG-Bad.fritz.box)
|
||||||
@ -318,6 +318,8 @@ void MQTT::serveData(AsyncWebServerRequest *request){
|
|||||||
void MQTT::sendStatus(void){
|
void MQTT::sendStatus(void){
|
||||||
tm timeinfo;
|
tm timeinfo;
|
||||||
char buffer[35];
|
char buffer[35];
|
||||||
|
strftime(buffer, sizeof(buffer), "%FT%T%z", &glblData.bootTime);
|
||||||
|
publish_sub("Boot-Time",buffer,true);
|
||||||
publish_sub("hostname", Settings::prefs.hostname, true);
|
publish_sub("hostname", Settings::prefs.hostname, true);
|
||||||
publish_sub("IP", glblData.myIP, true);
|
publish_sub("IP", glblData.myIP, true);
|
||||||
publish_sub("NTP-Server", Settings::prefs.ntpServer, true);
|
publish_sub("NTP-Server", Settings::prefs.ntpServer, true);
|
||||||
@ -339,6 +341,7 @@ void MQTT::sendStatus(void){
|
|||||||
publish_sub("Set Temp[degC]",buffer,true);
|
publish_sub("Set Temp[degC]",buffer,true);
|
||||||
snprintf(buffer, sizeof buffer, "%d", WiFi.RSSI());
|
snprintf(buffer, sizeof buffer, "%d", WiFi.RSSI());
|
||||||
publish_sub("RSSI [dBm]",buffer,true);
|
publish_sub("RSSI [dBm]",buffer,true);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MQTT::remoteLog(const char* str, int32_t num){
|
void MQTT::remoteLog(const char* str, int32_t num){
|
||||||
|
|||||||
@ -17,10 +17,12 @@
|
|||||||
#include <PubSubClient.h>
|
#include <PubSubClient.h>
|
||||||
#include "MQTT.h"
|
#include "MQTT.h"
|
||||||
#include <tahoma.h>
|
#include <tahoma.h>
|
||||||
|
#include <esp_task_wdt.h>
|
||||||
|
|
||||||
|
#define MEASINT_S 5
|
||||||
#define MEASINT_S 1
|
#define SCREEN_UPDATE_S 30 //update screen every 30 secs
|
||||||
#define HISTINT_S (5*60) //make history point every 5 min.
|
#define HISTINT_S (5*60) //make history point every 5 min.
|
||||||
|
#define WDT_TIMEOUT SCREEN_UPDATE_S*3 //set WDT timeout to 3 times the screen update time
|
||||||
|
|
||||||
// -- Initial password to connect to the Thing, when it creates an own Access Point.
|
// -- Initial password to connect to the Thing, when it creates an own Access Point.
|
||||||
|
|
||||||
@ -53,6 +55,7 @@ bool newMeasurement=false,newHistory=false;
|
|||||||
float temp(NAN), hum(NAN), pres(NAN),seaLevelPress(NAN);
|
float temp(NAN), hum(NAN), pres(NAN),seaLevelPress(NAN);
|
||||||
bool presAlarm = false;
|
bool presAlarm = false;
|
||||||
bool mutex_locked = false;
|
bool mutex_locked = false;
|
||||||
|
static RTC_NOINIT_ATTR float test;
|
||||||
|
|
||||||
void measure(void){ //update temp every 30secs
|
void measure(void){ //update temp every 30secs
|
||||||
static uint8_t dropCNT=0;
|
static uint8_t dropCNT=0;
|
||||||
@ -81,12 +84,12 @@ void measure(void){ //update temp every 30secs
|
|||||||
dropCNT = 0;
|
dropCNT = 0;
|
||||||
presAlarm = false;
|
presAlarm = false;
|
||||||
}*/
|
}*/
|
||||||
if(screen_update_cnt == 30 || presAlarm){ //update every 30 secs
|
if(screen_update_cnt >= SCREEN_UPDATE_S/MEASINT_S || presAlarm){ //update every 30 secs
|
||||||
newMeasurement = true;
|
newMeasurement = true;
|
||||||
screen_update_cnt = 0;
|
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
|
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);
|
history_append(seaLevelPress,temp,hum);
|
||||||
hist_update_cnt = 0;
|
hist_update_cnt = 0;
|
||||||
newHistory = true;
|
newHistory = true;
|
||||||
@ -121,8 +124,18 @@ void setup(void)
|
|||||||
setBacklight(BL_BRIGHTNESS,300);
|
setBacklight(BL_BRIGHTNESS,300);
|
||||||
measurementTick.attach(MEASINT_S,measure);
|
measurementTick.attach(MEASINT_S,measure);
|
||||||
mqtt.begin();
|
mqtt.begin();
|
||||||
|
getLocalTime(&glblData.bootTime);
|
||||||
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 %s\n\nHeatBuffer:\n %d",glblData.myIP,Settings::prefs.hostname,Settings::prefs.mqtt_server,Settings::prefs.mqtt_port, Settings::prefs.mqtt_topic,glblData.enBuff);
|
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 %s\n\nHeatBuffer:\n %d",glblData.myIP,Settings::prefs.hostname,Settings::prefs.mqtt_server,Settings::prefs.mqtt_port, Settings::prefs.mqtt_topic,glblData.enBuff);
|
||||||
measure();
|
measure();
|
||||||
|
esp_reset_reason_t reason = esp_reset_reason();
|
||||||
|
if ((reason != ESP_RST_DEEPSLEEP) && (reason != ESP_RST_SW)) {
|
||||||
|
test = glblData.settemp;
|
||||||
|
}
|
||||||
|
glblData.settemp = test;
|
||||||
|
ui_settemp(glblData.settemp);
|
||||||
|
esp_task_wdt_deinit();
|
||||||
|
esp_task_wdt_init(WDT_TIMEOUT, true);
|
||||||
|
esp_task_wdt_add(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned long lastms = millis();
|
unsigned long lastms = millis();
|
||||||
@ -131,7 +144,9 @@ uint8_t statusCnt=0;
|
|||||||
void loop()
|
void loop()
|
||||||
{
|
{
|
||||||
if(newMeasurement){
|
if(newMeasurement){
|
||||||
|
esp_task_wdt_reset();
|
||||||
update_sensorNstatus(temp, hum, seaLevelPress,presAlarm);
|
update_sensorNstatus(temp, hum, seaLevelPress,presAlarm);
|
||||||
|
test = glblData.settemp;
|
||||||
newMeasurement = false;
|
newMeasurement = false;
|
||||||
mqtt.sendStatus();
|
mqtt.sendStatus();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
bool history_initialized = false;
|
bool history_initialized = false;
|
||||||
|
|
||||||
dataset_t glblData = {.temp = NAN, .hum = NAN, .pres = NAN, .seaLevelPress = NAN, .settemp= NAN, .heating=false, .enBuff =false, .relPowerSave=true, .presAlarm=false, .myIP={0}, .wifiStrength = WIFISTRENGTH_OFF, .wifiMode= WIFIMODE_OFF, .override = OVR_NONE};
|
dataset_t glblData = {.temp = NAN, .hum = NAN, .pres = NAN, .seaLevelPress = NAN, .settemp= NAN, .heating=false, .enBuff =false, .relPowerSave=true, .presAlarm=false, .myIP={0}, .wifiStrength = WIFISTRENGTH_OFF, .wifiMode= WIFIMODE_OFF, .override = OVR_NONE, .bootTime = {0}};
|
||||||
hist_t history = {{0},{0},{0}};
|
hist_t history = {{0},{0},{0}};
|
||||||
|
|
||||||
int32_t* history_getPressPt(void){
|
int32_t* history_getPressPt(void){
|
||||||
|
|||||||
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
#include <time.h>
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
@ -59,6 +60,7 @@ typedef struct dataset_s{
|
|||||||
wifistrength_t wifiStrength;
|
wifistrength_t wifiStrength;
|
||||||
wifimode_t wifiMode;
|
wifimode_t wifiMode;
|
||||||
override_t override;
|
override_t override;
|
||||||
|
struct tm bootTime;
|
||||||
}dataset_t;
|
}dataset_t;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user