From b1fc885f4e301d7b686e36c92bfc288f85fa0682 Mon Sep 17 00:00:00 2001 From: Empire Date: Tue, 20 Oct 2020 20:12:27 +0200 Subject: [PATCH] ota debugging attempts --- esp32/src/main.cpp | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/esp32/src/main.cpp b/esp32/src/main.cpp index daae6fb..5afe474 100644 --- a/esp32/src/main.cpp +++ b/esp32/src/main.cpp @@ -159,7 +159,7 @@ void mode2MQTT(){ } } - bool lipoTempWarning = abs(temp[1] - temp[2]) > 5; + bool lipoTempWarning = abs(temp[0] - temp[1]) > 5; if(lipoTempWarning){ wait4sleep.in(500, prepareSleep); return; @@ -462,8 +462,13 @@ bool switch3Handler(const HomieRange& range, const String& value) { return switchGeneralPumpHandler(2, range, value); } +void homieLoop(){ + +} + void systemInit(){ WiFi.mode(WIFI_STA); + Serial.println("1"); Homie_setFirmware("PlantControl", FIRMWARE_VERSION); @@ -472,12 +477,23 @@ void systemInit(){ deepSleepNightTime.setDefaultValue(0); wateringDeepSleep.setDefaultValue(60000); /* 1 minute in milliseconds */ +Serial.println("2"); + waterLevelMax.setDefaultValue(1000); /* 100cm in mm */ waterLevelMin.setDefaultValue(50); /* 5cm in mm */ waterLevelWarn.setDefaultValue(500); /* 50cm in mm */ waterLevelVol.setDefaultValue(5000); /* 5l in ml */ + Serial.println("4"); + Homie.setLoopFunction(homieLoop); + Serial.println("5"); + Homie.setup(); + Serial.println("6"); + + Serial.println("3"); + mConfigured = Homie.isConfigured(); + Serial.println("3b"); if (mConfigured) { // Advertise topics plant1.advertise("switch").setName("Pump 1") @@ -498,7 +514,6 @@ void systemInit(){ plant3.advertise("moist").setName("Percent") .setDatatype("number") .setUnit("%"); - #if (MAX_PLANTS >= 4) plant4.advertise("moist").setName("Percent") .setDatatype("number") .setUnit("%"); @@ -512,7 +527,6 @@ void systemInit(){ .setDatatype("number") .setUnit("%"); - #endif sensorTemp.advertise("control") .setName("Temperature") .setDatatype("number") @@ -544,8 +558,6 @@ void systemInit(){ // Mode 3 stayAlive.advertise("alive").setName("Alive").setDatatype("number").settable(aliveHandler); } - - Homie.setup(); }