diff --git a/tools/esp8266/app.cpp b/tools/esp8266/app.cpp index d45baa62..1b05bf3e 100644 --- a/tools/esp8266/app.cpp +++ b/tools/esp8266/app.cpp @@ -283,7 +283,7 @@ void app::loop(void) { } } } - snprintf(val, 10, "%d", millis()/1000); + snprintf(val, 10, "%ld", millis()/1000); mMqtt.sendMsg("uptime", val); } @@ -480,8 +480,6 @@ void app::showSetup(void) { DPRINTLN(DBG_VERBOSE, F("app::showSetup")); // overrides same method in main.cpp - uint16_t interval; - String html = FPSTR(setup_html); html.replace(F("{SSID}"), mStationSsid); // PWD will be left at the default value (for protection) @@ -497,7 +495,6 @@ void app::showSetup(void) { String inv; uint64_t invSerial; char name[MAX_NAME_LENGTH + 1] = {0}; - uint8_t invType; uint16_t modPwr[4]; for(uint8_t i = 0; i < MAX_NUM_INVERTERS; i ++) { mEep->read(ADDR_INV_ADDR + (i * 8), &invSerial); @@ -802,7 +799,7 @@ void app::saveValues(bool webSend = true) { // address mWeb->arg("inv" + String(i) + "Addr").toCharArray(buf, 20); if(strlen(buf) == 0) - snprintf(buf, 20, "\0"); + memset(buf, 0, 20); addr.u64 = Serial2u64(buf); mEep->write(ADDR_INV_ADDR + (i * 8), addr.u64); diff --git a/tools/esp8266/debug.h b/tools/esp8266/debug.h index c1bb23cf..3c5d80a0 100644 --- a/tools/esp8266/debug.h +++ b/tools/esp8266/debug.h @@ -6,7 +6,6 @@ #ifndef __DEBUG_H__ #define __DEBUG_H__ - //----------------------------------------------------------------------------- // available levels #define DBG_ERROR 1 @@ -20,40 +19,44 @@ // globally used level #define DEBUG_LEVEL DBG_INFO - +#ifdef ARDUINO + #include "Arduino.h" +#endif #ifdef NDEBUG #define DBGPRINT(str) #define DBGPRINTLN(str) #else - #ifndef DSERIAL - #define DSERIAL Serial + #ifdef ARDUINO + #ifndef DSERIAL + #define DSERIAL Serial + #endif + + template + inline void DBGPRINT(T str) { DSERIAL.print(str); } + template + inline void DBGPRINTLN(T str) { DBGPRINT(str); DBGPRINT(F("\r\n")); } + inline void DHEX(uint8_t b) { + if( b<0x10 ) DSERIAL.print('0'); + DSERIAL.print(b,HEX); + } + inline void DHEX(uint16_t b) { + if( b<0x10 ) DSERIAL.print(F("000")); + else if( b<0x100 ) DSERIAL.print(F("00")); + else if( b<0x1000 ) DSERIAL.print(F("0")); + DSERIAL.print(b,HEX); + } + inline void DHEX(uint32_t b) { + if( b<0x10 ) DSERIAL.print(F("0000000")); + else if( b<0x100 ) DSERIAL.print(F("000000")); + else if( b<0x1000 ) DSERIAL.print(F("00000")); + else if( b<0x10000 ) DSERIAL.print(F("0000")); + else if( b<0x100000 ) DSERIAL.print(F("000")); + else if( b<0x1000000 ) DSERIAL.print(F("00")); + else if( b<0x10000000 ) DSERIAL.print(F("0")); + DSERIAL.print(b,HEX); + } #endif - - template - inline void DBGPRINT(T str) { DSERIAL.print(str); } - template - inline void DBGPRINTLN(T str) { DBGPRINT(str); DBGPRINT(F("\r\n")); } - inline void DHEX(uint8_t b) { - if( b<0x10 ) DSERIAL.print('0'); - DSERIAL.print(b,HEX); - } - inline void DHEX(uint16_t b) { - if( b<0x10 ) DSERIAL.print(F("000")); - else if( b<0x100 ) DSERIAL.print(F("00")); - else if( b<0x1000 ) DSERIAL.print(F("0")); - DSERIAL.print(b,HEX); - } - inline void DHEX(uint32_t b) { - if( b<0x10 ) DSERIAL.print(F("0000000")); - else if( b<0x100 ) DSERIAL.print(F("000000")); - else if( b<0x1000 ) DSERIAL.print(F("00000")); - else if( b<0x10000 ) DSERIAL.print(F("0000")); - else if( b<0x100000 ) DSERIAL.print(F("000")); - else if( b<0x1000000 ) DSERIAL.print(F("00")); - else if( b<0x10000000 ) DSERIAL.print(F("0")); - DSERIAL.print(b,HEX); - } #endif diff --git a/tools/esp8266/defines.h b/tools/esp8266/defines.h index 8861bab9..f12bcba6 100644 --- a/tools/esp8266/defines.h +++ b/tools/esp8266/defines.h @@ -21,7 +21,7 @@ //------------------------------------- #define VERSION_MAJOR 0 #define VERSION_MINOR 4 -#define VERSION_PATCH 20 +#define VERSION_PATCH 21 //-------------------------------------