Using defined debug port and not Serial

This commit is contained in:
Federico Maggi 2019-11-06 01:41:08 +01:00
parent 1adae1bdbd
commit b599a35879
3 changed files with 28 additions and 28 deletions

View file

@ -19,15 +19,15 @@ int16_t RF69::begin(float freq, float br, float rxBw, float freqDev, int8_t powe
flagFound = true; flagFound = true;
} else { } else {
#ifdef RADIOLIB_DEBUG #ifdef RADIOLIB_DEBUG
Serial.print(F("RF69 not found! (")); RADIOLIB_DEBUG_PRINT(F("RF69 not found! ("));
Serial.print(i + 1); RADIOLIB_DEBUG_PRINT(i + 1);
Serial.print(F(" of 10 tries) RF69_REG_VERSION == ")); RADIOLIB_DEBUG_PRINT(F(" of 10 tries) RF69_REG_VERSION == "));
char buffHex[7]; char buffHex[7];
sprintf(buffHex, "0x%04X", version); sprintf(buffHex, "0x%04X", version);
Serial.print(buffHex); RADIOLIB_DEBUG_PRINT(buffHex);
Serial.print(F(", expected 0x0024")); RADIOLIB_DEBUG_PRINT(F(", expected 0x0024"));
Serial.println(); RADIOLIB_DEBUG_PRINTLN();
#endif #endif
delay(1000); delay(1000);
i++; i++;

View file

@ -18,15 +18,15 @@ int16_t SX1231::begin(float freq, float br, float rxBw, float freqDev, int8_t po
_chipRevision = version; _chipRevision = version;
} else { } else {
#ifdef RADIOLIB_DEBUG #ifdef RADIOLIB_DEBUG
Serial.print(F("SX127x not found! (")); RADIOLIB_DEBUG_PRINT(F("SX127x not found! ("));
Serial.print(i + 1); RADIOLIB_DEBUG_PRINT(i + 1);
Serial.print(F(" of 10 tries) SX127X_REG_VERSION == ")); RADIOLIB_DEBUG_PRINT(F(" of 10 tries) SX127X_REG_VERSION == "));
char buffHex[7]; char buffHex[7];
sprintf(buffHex, "0x%04X", version); sprintf(buffHex, "0x%04X", version);
Serial.print(buffHex); RADIOLIB_DEBUG_PRINT(buffHex);
Serial.print(F(", expected 0x0021 / 0x0022 / 0x0023")); RADIOLIB_DEBUG_PRINT(F(", expected 0x0021 / 0x0022 / 0x0023"));
Serial.println(); RADIOLIB_DEBUG_PRINTLN();
#endif #endif
delay(1000); delay(1000);
i++; i++;

View file

@ -955,16 +955,16 @@ bool SX127x::findChip(uint8_t ver) {
flagFound = true; flagFound = true;
} else { } else {
#ifdef RADIOLIB_DEBUG #ifdef RADIOLIB_DEBUG
Serial.print(F("SX127x not found! (")); RADIOLIB_DEBUG_PRINT(F("SX127x not found! ("));
Serial.print(i + 1); RADIOLIB_DEBUG_PRINT(i + 1);
Serial.print(F(" of 10 tries) SX127X_REG_VERSION == ")); RADIOLIB_DEBUG_PRINT(F(" of 10 tries) SX127X_REG_VERSION == "));
char buffHex[5]; char buffHex[5];
sprintf(buffHex, "0x%02X", version); sprintf(buffHex, "0x%02X", version);
Serial.print(buffHex); RADIOLIB_DEBUG_PRINT(buffHex);
Serial.print(F(", expected 0x00")); RADIOLIB_DEBUG_PRINT(F(", expected 0x00"));
Serial.print(ver, HEX); RADIOLIB_DEBUG_PRINT(ver, HEX);
Serial.println(); RADIOLIB_DEBUG_PRINTLN();
#endif #endif
delay(1000); delay(1000);
i++; i++;
@ -1013,23 +1013,23 @@ void SX127x::clearFIFO(size_t count) {
#ifdef RADIOLIB_DEBUG #ifdef RADIOLIB_DEBUG
void SX127x::regDump() { void SX127x::regDump() {
Serial.println(); RADIOLIB_DEBUG_PRINTLN();
Serial.println(F("ADDR\tVALUE")); RADIOLIB_DEBUG_PRINTLN(F("ADDR\tVALUE"));
for(uint16_t addr = 0x01; addr <= 0x70; addr++) { for(uint16_t addr = 0x01; addr <= 0x70; addr++) {
if(addr <= 0x0F) { if(addr <= 0x0F) {
Serial.print(F("0x0")); RADIOLIB_DEBUG_PRINT(F("0x0"));
} else { } else {
Serial.print(F("0x")); RADIOLIB_DEBUG_PRINT(F("0x"));
} }
Serial.print(addr, HEX); RADIOLIB_DEBUG_PRINT(addr, HEX);
Serial.print('\t'); RADIOLIB_DEBUG_PRINT('\t');
uint8_t val = _mod->SPIreadRegister(addr); uint8_t val = _mod->SPIreadRegister(addr);
if(val <= 0x0F) { if(val <= 0x0F) {
Serial.print(F("0x0")); RADIOLIB_DEBUG_PRINT(F("0x0"));
} else { } else {
Serial.print(F("0x")); RADIOLIB_DEBUG_PRINT(F("0x"));
} }
Serial.println(val, HEX); RADIOLIB_DEBUG_PRINTLN(val, HEX);
delay(50); delay(50);
} }