From fc2687947ae75fe813081d6100a7d97662779ca4 Mon Sep 17 00:00:00 2001 From: Emanuele Trabattoni Date: Fri, 29 Aug 2025 10:21:44 +0200 Subject: [PATCH] Fixed pinlist and temperature sensor map --- include/pinlist.h | 10 +++++----- platformio.ini | 4 ++-- src/commands.cpp | 2 ++ src/main.cpp | 11 +++++------ 4 files changed, 14 insertions(+), 13 deletions(-) diff --git a/include/pinlist.h b/include/pinlist.h index b64f7e7..eba9118 100644 --- a/include/pinlist.h +++ b/include/pinlist.h @@ -11,11 +11,11 @@ enum RO // relay output channels GND_FLOOR = 6, PUMP_HT = 7, PUMP_IRR = 8, - ZONE1 = 9, - ZONE2 = 10, - ZONE3 = 11, - DRIP = 12, - RETURN = 13, + RETURN = 9, + ZONE1 = 10, + ZONE2 = 11, + ZONE3 = 12, + DRIP = 13, RO_14 = 14, RO_15 = 15, RO_MAX = 16 // unused to detect invalid values diff --git a/platformio.ini b/platformio.ini index d2c1644..ab52b02 100644 --- a/platformio.ini +++ b/platformio.ini @@ -23,8 +23,8 @@ build_type = release board_build.filesystem = ffat board_build.partitions = fatfs_partition.csv ; se stai usando uno custom -upload_protocol = espota -upload_port = 10.0.2.139 +#upload_protocol = espota +#upload_port = 10.0.2.139 [env:esp32-s3-waveshare8-debug] diff --git a/src/commands.cpp b/src/commands.cpp index ef44773..baa0b19 100644 --- a/src/commands.cpp +++ b/src/commands.cpp @@ -204,6 +204,8 @@ namespace commands } for (const auto [lvl, ro] : c_hpLimitsMap) { + if (ro == RO::RO_MAX) + continue; // avoid overshooting relay range if (level == lvl && level != "UNLIMITED") dev.io.digitalOutWrite(ro, true); else diff --git a/src/main.cpp b/src/main.cpp index d6b009c..1bbb65c 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -94,13 +94,13 @@ void loop() MQTTwrapper::MessageCallback onMessage = [&devices](const MQTTwrapper::Topic &topic, const MQTTwrapper::Message &message) { - LOG_DEBUG("onMessage callback [", topic.c_str(), "]"); + LOG_DEBUG("onMessage callback [", topic.c_str(), "]\n", message.c_str()); devices.led.setColor(devices.led.COLOR_MAGENTA); }; MQTTwrapper::MessageCallback onPublish = [&devices](const MQTTwrapper::Topic &topic, const MQTTwrapper::Message &message) { - LOG_DEBUG("onPublish callback [", topic.c_str(), "]"); + LOG_DEBUG("onPublish callback [", topic.c_str(), "]\n", message.c_str()); devices.led.setColor(devices.led.COLOR_SKYBLUE); }; @@ -154,7 +154,6 @@ void loop() { // skip NTP update for drift testing buzzer.beep(250, NOTE_A); led.setColor(led.COLOR_ORANGE); - // rtc.setDatetime(drivers::PCF85063::fromEpoch(ntpTime)); const drivers::PCF85063::datetime_t dt(drivers::PCF85063::fromEpoch(ntpTime)); LOG_INFO("NTP Time: ", drivers::PCF85063::datetime2str(dt).c_str()); break; @@ -201,8 +200,8 @@ void loop() ArduinoJson::JsonDocument ti; auto tempinfo = tmp.getTempAll(); ti["solar"] = tempinfo.at(0); - ti["acs"] = tempinfo.at(0); - ti["heating"] = tempinfo.at(0); + ti["acs"] = tempinfo.at(1); + ti["heating"] = tempinfo.at(2); mqtt.publish(conf.m_mqttPublish["temperatures"], ti); }; @@ -228,4 +227,4 @@ void loop() //////////////////////////////////////// ///////// MAIN LOOP INSIDE LOOP //////// //////////////////////////////////////// -} \ No newline at end of file +}