From 5122ea6c10d19d5357631506a2173814ec630b8f Mon Sep 17 00:00:00 2001 From: Javier Arigita Date: Sat, 18 Apr 2020 20:49:38 +0200 Subject: [PATCH] Fix kCommandSource adding heating source --- tasmota/sendemail.ino | 4 ++-- tasmota/tasmota.h | 2 +- tasmota/xdrv_39_heating.ino | 23 ++++++++++++++++++++++- 3 files changed, 25 insertions(+), 4 deletions(-) diff --git a/tasmota/sendemail.ino b/tasmota/sendemail.ino index 8bcddb029..0edd52072 100644 --- a/tasmota/sendemail.ino +++ b/tasmota/sendemail.ino @@ -354,13 +354,13 @@ String buffer; client->println(msg); #endif client->println('.'); -#ifdef DEBUG_EMAIL_PORT +#ifdef _EMAIL_PORT AddLog_P2(LOG_LEVEL_INFO, PSTR("%s"),buffer.c_str()); #endif buffer = F("QUIT"); client->println(buffer); -#ifdef DEBUG_EMAIL_PORT +#ifdef _EMAIL_PORT AddLog_P2(LOG_LEVEL_INFO, PSTR("%s"),buffer.c_str()); #endif diff --git a/tasmota/tasmota.h b/tasmota/tasmota.h index 88511474e..768b2ec99 100644 --- a/tasmota/tasmota.h +++ b/tasmota/tasmota.h @@ -326,7 +326,7 @@ enum CommandSource { SRC_IGNORE, SRC_MQTT, SRC_RESTART, SRC_BUTTON, SRC_SWITCH, SRC_TIMER, SRC_RULE, SRC_MAXPOWER, SRC_MAXENERGY, SRC_OVERTEMP, SRC_LIGHT, SRC_KNX, SRC_DISPLAY, SRC_WEMO, SRC_HUE, SRC_RETRY, SRC_REMOTE, SRC_SHUTTER, SRC_HEATING, SRC_MAX }; const char kCommandSource[] PROGMEM = "I|MQTT|Restart|Button|Switch|Backlog|Serial|WebGui|WebCommand|WebConsole|PulseTimer|" - "Timer|Rule|MaxPower|MaxEnergy|Overtemp|Light|Knx|Display|Wemo|Hue|Retry|Remote|Shutter"; + "Timer|Rule|MaxPower|MaxEnergy|Overtemp|Light|Knx|Display|Wemo|Hue|Retry|Remote|Shutter|Heating"; const uint8_t kDefaultRfCode[9] PROGMEM = { 0x21, 0x16, 0x01, 0x0E, 0x03, 0x48, 0x2E, 0x1A, 0x00 }; diff --git a/tasmota/xdrv_39_heating.ino b/tasmota/xdrv_39_heating.ino index 47646b5ca..a62fd4065 100644 --- a/tasmota/xdrv_39_heating.ino +++ b/tasmota/xdrv_39_heating.ino @@ -17,6 +17,8 @@ #define XDRV_39 39 +#define DEBUG_HEATING + enum HeatingModes { HEAT_OFF, HEAT_AUTOMATIC_OP, HEAT_MANUAL_OP, HEAT_TIME_PLAN }; enum ControllerModes { CTR_HYBRID, CTR_PI, CTR_RAMP_UP }; enum ControllerHybridPhases { CTR_HYBRID_RAMP_UP, CTR_HYBRID_PI }; @@ -53,7 +55,11 @@ typedef union { uint16_t status_output : 1; // Status of the output switch uint16_t status_cycle_active : 1; // Status showing if cycle is active (Output ON) or not (Output OFF) uint16_t state_emergency : 1; // State for heating emergency +<<<<<<< HEAD uint16_t counter_seconds : 6; // Second counter +======= + uint16_t counter_seconds : 6; // Second counter used to track minutes +>>>>>>> new_branch_dev }; } HeatingBitfield; @@ -167,7 +173,7 @@ bool HeatingMinuteCounter() if ((Heating.status.counter_seconds % 60) == 0) { result = true; - Heating.status.counter_seconds = 1; + Heating.status.counter_seconds = 0; } return(result); } @@ -1156,6 +1162,9 @@ void CmndTimePiIntegrRead(void) bool Xdrv39(uint8_t function) { + #ifdef DEBUG_HEATING + char result_chr[FLOATSZ]; + #endif bool result = false; switch (function) { @@ -1172,6 +1181,18 @@ bool Xdrv39(uint8_t function) if (HeatingMinuteCounter()) { HeatingSignalProcessingSlow(); HeatingController(); + #ifdef DEBUG_HEATING + AddLog_P2(LOG_LEVEL_INFO, PSTR("")); + AddLog_P2(LOG_LEVEL_INFO, PSTR("------ Heating Start ------")); + dtostrfd(Heating.status.counter_seconds, 0, result_chr); + AddLog_P2(LOG_LEVEL_INFO, PSTR("Heating.status.counter_seconds: %s"), result_chr); + dtostrfd(Heating.status.heating_mode, 0, result_chr); + AddLog_P2(LOG_LEVEL_INFO, PSTR("Heating.status.heating_mode: %s"), result_chr); + dtostrfd(Heating.status.heating_mode, 0, result_chr); + AddLog_P2(LOG_LEVEL_INFO, PSTR("Heating.status.heating_mode: %s"), result_chr); + AddLog_P2(LOG_LEVEL_INFO, PSTR("------ Heating End ------")); + AddLog_P2(LOG_LEVEL_INFO, PSTR("")); + #endif } break; case FUNC_COMMAND: