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

@ -6,7 +6,11 @@
#include "hmRadio.h"
#endif
#ifdef DEBUG_HMSYSTEM
#define DBGHMS(f,...) do { Serial.printf(PSTR(f), ##__VA_ARGS__); } while (0)
#else
#define DBGHMS(x...) do { (void)0; } while (0)
#endif
template <class RADIO, class BUFFER, uint8_t MAX_INVERTER=3, class INVERTERTYPE=Inverter<float>>
class HmSystem {
@ -24,16 +28,12 @@ class HmSystem {
}
void setup() {
#ifdef DEBUG_HMSYSTEM
DPRINTLN(F("hmSystem.h:setup"));
#endif
DBGHMS(F("hmSystem.h:setup"));
Radio.setup(&BufCtrl);
}
INVERTERTYPE *addInverter(const char *name, uint64_t serial, uint16_t chMaxPwr[]) {
#ifdef DEBUG_HMSYSTEM
DPRINTLN(F("hmSystem.h:addInverter"));
#endif
DBGHMS(F("hmSystem.h:addInverter"));
if(MAX_INVERTER <= mNumInv) {
DPRINT(F("max number of inverters reached!"));
return NULL;
@ -70,9 +70,7 @@ class HmSystem {
}
INVERTERTYPE *findInverter(uint8_t buf[]) {
#ifdef DEBUG_HMSYSTEM
//DPRINTLN(F("hmSystem.h:findInverter"));
#endif
//DBGHMS(F("hmSystem.h:findInverter"));
INVERTERTYPE *p;
for(uint8_t i = 0; i < mNumInv; i++) {
p = &mInverter[i];
@ -86,9 +84,7 @@ class HmSystem {
}
INVERTERTYPE *getInverterByPos(uint8_t pos) {
#ifdef DEBUG_HMSYSTEM
//DPRINTLN(F("hmSystem.h:getInverterByPos"));
#endif
//DBGHMS(F("hmSystem.h:getInverterByPos"));
if(mInverter[pos].serial.u64 != 0ULL)
return &mInverter[pos];
else
@ -96,9 +92,7 @@ class HmSystem {
}
uint8_t getNumInverters(void) {
#ifdef DEBUG_HMSYSTEM
//DPRINTLN(F("hmSystem.h:getNumInverters"));
#endif
//DBGHMS(F("hmSystem.h:getNumInverters"));
return mNumInv;
}