added DBGXXX definitions to all header files

This commit is contained in:
stefan123t 2022-06-17 00:18:45 +02:00
parent 14c46e86bd
commit 17b186ee04
6 changed files with 91 additions and 184 deletions

View file

@ -18,6 +18,11 @@
#include "crc.h"
#include "debug.h"
#ifdef DEBUG_HMMAIN
#define DBGMAIN(f,...) do { Serial.printf(PSTR(f), ##__VA_ARGS__); } while (0)
#else
#define DBGMAIN(x...) do { (void)0; } while (0)
#endif
const byte mDnsPort = 53;
@ -41,9 +46,7 @@ class Main {
virtual void updateCrc(void);
inline uint16_t buildEEpCrc(uint32_t start, uint32_t length) {
#ifdef DEBUG_HMMAIN
DPRINTLN(F("main.h:buildEEpCrc"));
#endif
DBGMAIN(F("main.h:buildEEpCrc"));
uint8_t buf[32];
uint16_t crc = 0xffff;
uint8_t len;
@ -59,22 +62,16 @@ class Main {
}
bool checkEEpCrc(uint32_t start, uint32_t length, uint32_t crcPos) {
#ifdef DEBUG_HMMAIN
//DPRINTLN(F("main.h:checkEEpCrc"));
#endif
//DBGMAIN(F("main.h:checkEEpCrc"));
uint16_t crcRd, crcCheck;
crcCheck = buildEEpCrc(start, length);
mEep->read(crcPos, &crcRd);
#ifdef DEBUG_HMMAIN
//DPRINTLN("CRC RD: " + String(crcRd, HEX) + " CRC CALC: " + String(crcCheck, HEX));
#endif
//DBGMAIN("CRC RD: " + String(crcRd, HEX) + " CRC CALC: " + String(crcCheck, HEX));
return (crcCheck == crcRd);
}
void eraseSettings(bool all = false) {
#ifdef DEBUG_HMMAIN
//DPRINTLN(F("main.h:eraseSettings"));
#endif
//DBGMAIN(F("main.h:eraseSettings"));
uint8_t buf[64] = {0};
uint16_t addr = (all) ? ADDR_START : ADDR_START_SETTINGS;
uint16_t end;
@ -90,9 +87,7 @@ class Main {
}
inline bool checkTicker(uint32_t *ticker, uint32_t interval) {
#ifdef DEBUG_HMMAIN
//DPRINT(F("c"));
#endif
//DBGMAIN(F("c"));
uint32_t mil = millis();
if(mil >= *ticker) {
*ticker = mil + interval;
@ -107,9 +102,7 @@ class Main {
}
void stats(void) {
#ifdef DEBUG_HMMAIN
DPRINTLN(F("main.h:stats"));
#endif
DBGMAIN(F("main.h:stats"));
uint32_t free;
uint16_t max;
uint8_t frag;