Add define DEBUG_TASMOTA_CORE

Add define DEBUG_TASMOTA_CORE
This commit is contained in:
Theo Arends 2019-08-08 16:24:11 +02:00
parent 43b2536021
commit 27efc08d2c
7 changed files with 13 additions and 5 deletions

View File

@ -189,6 +189,7 @@ platform = ${core_active.platform}
build_flags = ${core_active.build_flags} build_flags = ${core_active.build_flags}
; *** Optional Debug messages ; *** Optional Debug messages
; -DDEBUG_TASMOTA_CORE
; -DDEBUG_TASMOTA_DRIVER ; -DDEBUG_TASMOTA_DRIVER
; -DDEBUG_TASMOTA_SENSOR ; -DDEBUG_TASMOTA_SENSOR

View File

@ -496,6 +496,7 @@
* Debug features * Debug features
\*********************************************************************************************/ \*********************************************************************************************/
//#define DEBUG_TASMOTA_CORE // Enable core debug messages
//#define DEBUG_TASMOTA_DRIVER // Enable driver debug messages //#define DEBUG_TASMOTA_DRIVER // Enable driver debug messages
//#define DEBUG_TASMOTA_SENSOR // Enable sensor debug messages //#define DEBUG_TASMOTA_SENSOR // Enable sensor debug messages
//#define USE_DEBUG_DRIVER // Use xdrv_99_debug.ino providing commands CpuChk, CfgXor, CfgDump, CfgPeek and CfgPoke //#define USE_DEBUG_DRIVER // Use xdrv_99_debug.ino providing commands CpuChk, CfgXor, CfgDump, CfgPeek and CfgPoke

View File

@ -929,7 +929,7 @@ void Every250mSeconds(void)
if (!ota_result) { if (!ota_result) {
#ifndef FIRMWARE_MINIMAL #ifndef FIRMWARE_MINIMAL
int ota_error = ESPhttpUpdate.getLastError(); int ota_error = ESPhttpUpdate.getLastError();
// AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_UPLOAD "Ota error %d"), ota_error); DEBUG_CORE_LOG(PSTR("OTA: Error %d"), ota_error);
if ((HTTP_UE_TOO_LESS_SPACE == ota_error) || (HTTP_UE_BIN_FOR_WRONG_FLASH == ota_error)) { if ((HTTP_UE_TOO_LESS_SPACE == ota_error) || (HTTP_UE_BIN_FOR_WRONG_FLASH == ota_error)) {
RtcSettings.ota_loader = 1; // Try minimal image next RtcSettings.ota_loader = 1; // Try minimal image next
} }

View File

@ -517,6 +517,12 @@ void KNX_CB_Action(message_t const &msg, void *arg);
#undef USE_MQTT_TLS_CA_CERT #undef USE_MQTT_TLS_CA_CERT
#endif #endif
#ifdef DEBUG_TASMOTA_CORE
#define DEBUG_CORE_LOG(...) AddLog_Debug(__VA_ARGS__)
#else
#define DEBUG_CORE_LOG(...)
#endif
#ifdef DEBUG_TASMOTA_DRIVER #ifdef DEBUG_TASMOTA_DRIVER
#define DEBUG_DRIVER_LOG(...) AddLog_Debug(__VA_ARGS__) #define DEBUG_DRIVER_LOG(...) AddLog_Debug(__VA_ARGS__)
#else #else

View File

@ -199,7 +199,7 @@ void ButtonHandler(void)
if (holdbutton[button_index] > loops_per_second * Settings.param[P_HOLD_IGNORE] / 10) { if (holdbutton[button_index] > loops_per_second * Settings.param[P_HOLD_IGNORE] / 10) {
holdbutton[button_index] = 0; // Reset button hold counter to stay below hold trigger holdbutton[button_index] = 0; // Reset button hold counter to stay below hold trigger
multipress[button_index] = 0; // Discard button press to disable functionality multipress[button_index] = 0; // Discard button press to disable functionality
// AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_APPLICATION D_BUTTON "%d cancel by " D_CMND_SETOPTION "40 %d"), button_index +1, Settings.param[P_HOLD_IGNORE]); DEBUG_CORE_LOG(PSTR("BTN: " D_BUTTON "%d cancel by " D_CMND_SETOPTION "40 %d"), button_index +1, Settings.param[P_HOLD_IGNORE]);
} }
} }
if (holdbutton[button_index] == loops_per_second * Settings.param[P_HOLD_TIME] / 10) { // SetOption32 (40) - Button hold if (holdbutton[button_index] == loops_per_second * Settings.param[P_HOLD_TIME] / 10) { // SetOption32 (40) - Button hold

View File

@ -678,7 +678,7 @@ void _WSContentSend(const String& content) // Low level sendContent for a
#ifdef USE_DEBUG_DRIVER #ifdef USE_DEBUG_DRIVER
ShowFreeMem(PSTR("WSContentSend")); ShowFreeMem(PSTR("WSContentSend"));
#endif #endif
// AddLog_P2(LOG_LEVEL_DEBUG, PSTR("HTP: Chunk size %d"), len); DEBUG_DRIVER_LOG(PSTR("WEB: Chunk size %d"), len);
} }
void WSContentFlush() void WSContentFlush()
@ -2392,7 +2392,7 @@ int WebSend(char *buffer)
} }
url += command; // url = |http://192.168.178.86/cm?cmnd=POWER1 ON| url += command; // url = |http://192.168.178.86/cm?cmnd=POWER1 ON|
//AddLog_P2(LOG_LEVEL_DEBUG, PSTR("DBG: Uri |%s|"), url.c_str()); DEBUG_DRIVER_LOG(PSTR("WEB: Uri |%s|"), url.c_str());
#if defined(ARDUINO_ESP8266_RELEASE_2_3_0) || defined(ARDUINO_ESP8266_RELEASE_2_4_0) || defined(ARDUINO_ESP8266_RELEASE_2_4_1) || defined(ARDUINO_ESP8266_RELEASE_2_4_2) #if defined(ARDUINO_ESP8266_RELEASE_2_3_0) || defined(ARDUINO_ESP8266_RELEASE_2_4_0) || defined(ARDUINO_ESP8266_RELEASE_2_4_1) || defined(ARDUINO_ESP8266_RELEASE_2_4_2)
HTTPClient http; HTTPClient http;

View File

@ -221,7 +221,7 @@ void EnergyMarginCheck(void)
energy_voltage_u = (uint16_t)(energy_voltage); energy_voltage_u = (uint16_t)(energy_voltage);
energy_current_u = (uint16_t)(energy_current * 1000); energy_current_u = (uint16_t)(energy_current * 1000);
// AddLog_P2(LOG_LEVEL_DEBUG, PSTR("NRG: W %d, U %d, I %d"), energy_power_u, energy_voltage_u, energy_current_u); DEBUG_DRIVER_LOG(PSTR("NRG: W %d, U %d, I %d"), energy_power_u, energy_voltage_u, energy_current_u);
Response_P(PSTR("{")); Response_P(PSTR("{"));
jsonflg = false; jsonflg = false;