From 7e2df351d9d979e074e032e400be3807528ccbc6 Mon Sep 17 00:00:00 2001 From: lumapu Date: Fri, 17 Jun 2022 00:36:31 +0200 Subject: [PATCH] * fixed debug messages --- tools/esp8266/app.cpp | 63 +++++++++----------------------------- tools/esp8266/app.h | 4 +-- tools/esp8266/hmInverter.h | 4 +-- tools/esp8266/hmRadio.h | 4 +-- tools/esp8266/hmSystem.h | 4 +-- tools/esp8266/main.h | 6 ++-- 6 files changed, 26 insertions(+), 59 deletions(-) diff --git a/tools/esp8266/app.cpp b/tools/esp8266/app.cpp index c87ea3b5..e72ca602 100644 --- a/tools/esp8266/app.cpp +++ b/tools/esp8266/app.cpp @@ -12,9 +12,7 @@ //----------------------------------------------------------------------------- app::app() : Main() { -#ifdef DEBUG_APP - DPRINTLN(F("app::app():Main")); -#endif + DBGAPP(F("app::app():Main")); mSendTicker = 0xffff; mSendInterval = 0; mMqttTicker = 0xffff; @@ -51,9 +49,7 @@ app::~app(void) { //----------------------------------------------------------------------------- void app::setup(uint32_t timeout) { -#ifdef DEBUG_APP - DPRINTLN(F("app::setup")); -#endif + DBGAPP(F("app::setup")); Main::setup(timeout); mWeb->on("/", std::bind(&app::showIndex, this)); @@ -197,11 +193,7 @@ void app::setup(uint32_t timeout) { //----------------------------------------------------------------------------- void app::loop(void) { -#ifdef DEBUG_APP - //DPRINT(F("a")); - //DPRINTLN(F("a")); - //app_loops++; -#ifdef DEBUG_APP + //DBGAPP(F("app::loop")) Main::loop(); mSys->Radio.loop(); @@ -363,18 +355,14 @@ void app::loop(void) { //----------------------------------------------------------------------------- void app::handleIntr(void) { -#ifdef DEBUG_APP - //DPRINTLN(F("app::handleIntr")); -#endif + DBGAPP(F("app::handleIntr")); mSys->Radio.handleIntr(); } //----------------------------------------------------------------------------- bool app::buildPayload(uint8_t id) { -#ifdef DEBUG_APP - //DPRINTLN(F("app::buildPayload")); -#endif + //DBGAPP(F("app::buildPayload")); uint16_t crc = 0xffff, crcRcv; if(mPayload[id].maxPackId > MAX_PAYLOAD_ENTRIES) mPayload[id].maxPackId = MAX_PAYLOAD_ENTRIES; @@ -399,10 +387,7 @@ bool app::buildPayload(uint8_t id) { //----------------------------------------------------------------------------- void app::processPayload(bool retransmit) { -#ifdef DEBUG_APP - //DPRINTLN(F("app::processPayload")); - //DPRINT(F("p")); -#endif + //DBGAPP(F("app::processPayload")); for(uint8_t id = 0; id < mSys->getNumInverters(); id++) { Inverter<> *iv = mSys->getInverterByPos(id); if(NULL != iv) { @@ -468,9 +453,7 @@ void app::processPayload(bool retransmit) { //----------------------------------------------------------------------------- void app::showIndex(void) { -#ifdef DEBUG_APP - DPRINTLN(F("app::showIndex")); -#endif + //DBGAPP(F("app::showIndex")); String html = FPSTR(index_html); html.replace(F("{DEVICE}"), mDeviceName); html.replace(F("{VERSION}"), mVersion); @@ -482,9 +465,7 @@ void app::showIndex(void) { //----------------------------------------------------------------------------- void app::showSetup(void) { -#ifdef DEBUG_APP - DPRINTLN(F("app::showSetup")); -#endif + DBGAPP(F("app::showSetup")); // overrides same method in main.cpp uint16_t interval; @@ -604,18 +585,14 @@ void app::showSetup(void) { //----------------------------------------------------------------------------- void app::showSave(void) { -#ifdef DEBUG_APP - DPRINTLN(F("app::showSave")); -#endif + DBGAPP(F("app::showSave")); saveValues(true); } //----------------------------------------------------------------------------- void app::showErase() { -#ifdef DEBUG_APP - DPRINTLN(F("app::showErase")); -#endif + DBGAPP(F("app::showErase")); eraseSettings(); showReboot(); } @@ -623,9 +600,7 @@ void app::showErase() { //----------------------------------------------------------------------------- void app::showStatistics(void) { -#ifdef DEBUG_APP - //DPRINTLN(F("app::showStatistics")); -#endif + //DBGAPP(F("app::showStatistics")); String content = F("Receive success: ") + String(mRxSuccess) + "\n"; content += F("Receive fail: ") + String(mRxFailed) + "\n"; content += F("Frames received: ") + String(mFrameCnt) + "\n"; @@ -673,9 +648,7 @@ void app::showStatistics(void) { //----------------------------------------------------------------------------- void app::showHoymiles(void) { -#ifdef DEBUG_APP - DPRINTLN(F("app::showHoymiles")); -#endif + DBGAPP(F("app::showHoymiles")); String html = FPSTR(hoymiles_html); html.replace(F("{DEVICE}"), mDeviceName); html.replace(F("{VERSION}"), mVersion); @@ -687,9 +660,7 @@ void app::showHoymiles(void) { //----------------------------------------------------------------------------- void app::showLiveData(void) { -#ifdef DEBUG_APP - //DPRINTLN(F("app::showLiveData")); -#endif + //DBGAPP(F("app::showLiveData")); String modHtml; for(uint8_t id = 0; id < mSys->getNumInverters(); id++) { Inverter<> *iv = mSys->getInverterByPos(id); @@ -767,9 +738,7 @@ void app::showLiveData(void) { //----------------------------------------------------------------------------- void app::saveValues(bool webSend = true) { -#ifdef DEBUG_APP - DPRINTLN(F("app::saveValues")); -#endif + DBGAPP(F("app::saveValues")); Main::saveValues(false); // general configuration if(mWeb->args() > 0) { @@ -878,9 +847,7 @@ void app::saveValues(bool webSend = true) { //----------------------------------------------------------------------------- void app::updateCrc(void) { -#ifdef DEBUG_APP - DPRINTLN(F("app::updateCrc")); -#endif + DBGAPP(F("app::updateCrc")); Main::updateCrc(); uint16_t crc; diff --git a/tools/esp8266/app.h b/tools/esp8266/app.h index c357df32..ef22cd97 100644 --- a/tools/esp8266/app.h +++ b/tools/esp8266/app.h @@ -17,9 +17,9 @@ #include "mqtt.h" #ifdef DEBUG_APP -#define DBGAPP(f,...) do { Serial.printf(PSTR(f), ##__VA_ARGS__); } while (0) +#define DBGAPP(f) (DPRINTLN(f)) #else -#define DBGAPP(x...) do { (void)0; } while (0) +#define DBGAPP(f) #endif typedef CircularBuffer BufferType; diff --git a/tools/esp8266/hmInverter.h b/tools/esp8266/hmInverter.h index 2cb0af00..d8f575d5 100644 --- a/tools/esp8266/hmInverter.h +++ b/tools/esp8266/hmInverter.h @@ -9,9 +9,9 @@ #include "hmDefines.h" #ifdef DEBUG_HMINVERTER -#define DBGINV(f,...) do { Serial.printf(PSTR(f), ##__VA_ARGS__); } while (0) +#define DBGINV(f) (DPRINTLN(f)) #else -#define DBGINV(x...) do { (void)0; } while (0) +#define DBGINV(f) #endif /** diff --git a/tools/esp8266/hmRadio.h b/tools/esp8266/hmRadio.h index 5b13f0a6..cb6bcdbc 100644 --- a/tools/esp8266/hmRadio.h +++ b/tools/esp8266/hmRadio.h @@ -23,9 +23,9 @@ #ifdef DEBUG_HMRADIO -#define DBGHMR(f,...) do { Serial.printf(PSTR(f), ##__VA_ARGS__); } while (0) +#define DBGHMR(f) (DPRINTLN(f)) #else -#define DBGHMR(x...) do { (void)0; } while (0) +#define DBGHMR(f) #endif const char* const rf24AmpPower[] = {"MIN", "LOW", "HIGH", "MAX"}; diff --git a/tools/esp8266/hmSystem.h b/tools/esp8266/hmSystem.h index d34de32c..b5d97adb 100644 --- a/tools/esp8266/hmSystem.h +++ b/tools/esp8266/hmSystem.h @@ -12,9 +12,9 @@ #endif #ifdef DEBUG_HMSYSTEM -#define DBGHMS(f,...) do { Serial.printf(PSTR(f), ##__VA_ARGS__); } while (0) +#define DBGHMS(f) (DPRINTLN(f)) #else -#define DBGHMS(x...) do { (void)0; } while (0) +#define DBGHMS(f) #endif template > diff --git a/tools/esp8266/main.h b/tools/esp8266/main.h index dcf86958..50691bcf 100644 --- a/tools/esp8266/main.h +++ b/tools/esp8266/main.h @@ -23,10 +23,10 @@ #include "crc.h" #include "debug.h" -#ifdef DEBUG_HMMAIN -#define DBGMAIN(f,...) do { Serial.printf(PSTR(f), ##__VA_ARGS__); } while (0) +#ifdef DEBUG_MAIN +#define DBGMAIN(f) (DPRINTLN(f)) #else -#define DBGMAIN(x...) do { (void)0; } while (0) +#define DBGMAIN(f) #endif const byte mDnsPort = 53;