Browse Source

Issue #84. prevent using the hardware serial in the Dual for debug messages

fastled
Xose Pérez 7 years ago
parent
commit
49a8e9ff1d
3 changed files with 12 additions and 8 deletions
  1. +5
    -1
      code/espurna/config/debug.h
  2. +3
    -3
      code/espurna/i2c.ino
  3. +4
    -4
      code/espurna/settings.ino

+ 5
- 1
code/espurna/config/debug.h View File

@ -1,7 +1,11 @@
#ifdef DEBUG_PORT
#ifndef SONOFF_DUAL
#define DEBUG_MSG(...) DEBUG_PORT.printf( __VA_ARGS__ )
#define DEBUG_MSG_P(...) { char buffer[81]; snprintf_P(buffer, 80, __VA_ARGS__ ); DEBUG_PORT.printf( buffer ); }
#else
#endif
#endif
#ifndef DEBUG_MSG
#define DEBUG_MSG(...)
#define DEBUG_MSG_P(...)
#endif

+ 3
- 3
code/espurna/i2c.ino View File

@ -24,14 +24,14 @@ void i2cScan() {
response = brzo_i2c_end_transaction();
if (response == 0) {
Serial.printf("[I2C] Device found at address 0x%02X\n", address);
DEBUG_MSG("[I2C] Device found at address 0x%02X\n", address);
nDevices++;
} else if (response != 32) {
//Serial.printf("[I2C] Unknown error at address 0x%02X\n", address);
//DEBUG_MSG("[I2C] Unknown error at address 0x%02X\n", address);
}
}
if (nDevices == 0) Serial.println("[I2C] No devices found");
if (nDevices == 0) DEBUG_MSG("[I2C] No devices found");
}


+ 4
- 4
code/espurna/settings.ino View File

@ -93,16 +93,16 @@ void settingsSetup() {
});
Embedis::command( F("STATUS"), [](Embedis* e) {
Serial.printf("Free heap: %d bytes\n", ESP.getFreeHeap());
e->stream->printf("Free heap: %d bytes\n", ESP.getFreeHeap());
e->response(Embedis::OK);
});
Embedis::command( F("EEPROM.DUMP"), [](Embedis* e) {
for (unsigned int i = 0; i < SPI_FLASH_SEC_SIZE; i++) {
if (i % 16 == 0) Serial.printf("\n[%04X] ", i);
Serial.printf("%02X ", EEPROM.read(i));
if (i % 16 == 0) e->stream->printf("\n[%04X] ", i);
e->stream->printf("%02X ", EEPROM.read(i));
}
Serial.printf("\n");
e->stream->printf("\n");
e->response(Embedis::OK);
});


Loading…
Cancel
Save