Browse Source

Further info in the debug log

fastled
Xose Pérez 7 years ago
parent
commit
a1b88a5088
4 changed files with 75 additions and 30 deletions
  1. +5
    -2
      code/espurna/config/general.h
  2. +30
    -27
      code/espurna/espurna.ino
  3. +1
    -1
      code/espurna/mqtt.ino
  4. +39
    -0
      code/espurna/utils.ino

+ 5
- 2
code/espurna/config/general.h View File

@ -296,9 +296,8 @@ PROGMEM const char* const custom_reset_string[] = {
// SPIFFS // SPIFFS
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// Do not add support for SPIFFS by default
#ifndef SPIFFS_SUPPORT #ifndef SPIFFS_SUPPORT
#define SPIFFS_SUPPORT 0
#define SPIFFS_SUPPORT 0 // Do not add support for SPIFFS by default
#endif #endif
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
@ -311,6 +310,10 @@ PROGMEM const char* const custom_reset_string[] = {
// NOFUSS // NOFUSS
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#ifndef NOFUSS_SUPPORT
#define NOFUSS_SUPPORT 0 // Do not enable support for NoFuss by default
#endif
#define NOFUSS_SERVER "" // Default NoFuss Server #define NOFUSS_SERVER "" // Default NoFuss Server
#define NOFUSS_INTERVAL 3600000 // Check for updates every hour #define NOFUSS_INTERVAL 3600000 // Check for updates every hour


+ 30
- 27
code/espurna/espurna.ino View File

@ -67,45 +67,46 @@ unsigned int sectors(size_t size) {
void welcome() { void welcome() {
DEBUG_MSG_P(PSTR("\n\n")); DEBUG_MSG_P(PSTR("\n\n"));
DEBUG_MSG_P(PSTR("%s %s\n"), (char *) APP_NAME, (char *) APP_VERSION);
DEBUG_MSG_P(PSTR("%s\n%s\n\n"), (char *) APP_AUTHOR, (char *) APP_WEBSITE);
DEBUG_MSG_P(PSTR("CPU chip ID: 0x%06X\n"), ESP.getChipId());
DEBUG_MSG_P(PSTR("CPU frequency: %d MHz\n"), ESP.getCpuFreqMHz());
DEBUG_MSG_P(PSTR("SDK version: %s\n"), ESP.getSdkVersion());
DEBUG_MSG_P(PSTR("Core version: %s\n"), ESP.getCoreVersion().c_str());
DEBUG_MSG_P(PSTR("[INIT] %s %s\n"), (char *) APP_NAME, (char *) APP_VERSION);
DEBUG_MSG_P(PSTR("[INIT] %s\n"), (char *) APP_AUTHOR);
DEBUG_MSG_P(PSTR("[INIT] %s\n\n"), (char *) APP_WEBSITE);
DEBUG_MSG_P(PSTR("[INIT] CPU chip ID: 0x%06X\n"), ESP.getChipId());
DEBUG_MSG_P(PSTR("[INIT] CPU frequency: %d MHz\n"), ESP.getCpuFreqMHz());
DEBUG_MSG_P(PSTR("[INIT] SDK version: %s\n"), ESP.getSdkVersion());
DEBUG_MSG_P(PSTR("[INIT] Core version: %s\n"), ESP.getCoreVersion().c_str());
DEBUG_MSG_P(PSTR("\n")); DEBUG_MSG_P(PSTR("\n"));
FlashMode_t mode = ESP.getFlashChipMode(); FlashMode_t mode = ESP.getFlashChipMode();
DEBUG_MSG_P(PSTR("Flash chip ID: 0x%06X\n"), ESP.getFlashChipId());
DEBUG_MSG_P(PSTR("Flash speed: %u Hz\n"), ESP.getFlashChipSpeed());
DEBUG_MSG_P(PSTR("Flash mode: %s\n"), mode == FM_QIO ? "QIO" : mode == FM_QOUT ? "QOUT" : mode == FM_DIO ? "DIO" : mode == FM_DOUT ? "DOUT" : "UNKNOWN");
DEBUG_MSG_P(PSTR("[INIT] Flash chip ID: 0x%06X\n"), ESP.getFlashChipId());
DEBUG_MSG_P(PSTR("[INIT] Flash speed: %u Hz\n"), ESP.getFlashChipSpeed());
DEBUG_MSG_P(PSTR("[INIT] Flash mode: %s\n"), mode == FM_QIO ? "QIO" : mode == FM_QOUT ? "QOUT" : mode == FM_DIO ? "DIO" : mode == FM_DOUT ? "DOUT" : "UNKNOWN");
DEBUG_MSG_P(PSTR("\n")); DEBUG_MSG_P(PSTR("\n"));
DEBUG_MSG_P(PSTR("Flash sector size: %8u bytes\n"), SPI_FLASH_SEC_SIZE);
DEBUG_MSG_P(PSTR("Flash size (CHIP): %8u bytes\n"), ESP.getFlashChipRealSize());
DEBUG_MSG_P(PSTR("Flash size (SDK): %8u bytes / %4d sectors\n"), ESP.getFlashChipSize(), sectors(ESP.getFlashChipSize()));
DEBUG_MSG_P(PSTR("Firmware size: %8u bytes / %4d sectors\n"), ESP.getSketchSize(), sectors(ESP.getSketchSize()));
DEBUG_MSG_P(PSTR("OTA size: %8u bytes / %4d sectors\n"), ESP.getFreeSketchSpace(), sectors(ESP.getFreeSketchSpace()));
DEBUG_MSG_P(PSTR("[INIT] Flash sector size: %8u bytes\n"), SPI_FLASH_SEC_SIZE);
DEBUG_MSG_P(PSTR("[INIT] Flash size (CHIP): %8u bytes\n"), ESP.getFlashChipRealSize());
DEBUG_MSG_P(PSTR("[INIT] Flash size (SDK): %8u bytes / %4d sectors\n"), ESP.getFlashChipSize(), sectors(ESP.getFlashChipSize()));
DEBUG_MSG_P(PSTR("[INIT] Firmware size: %8u bytes / %4d sectors\n"), ESP.getSketchSize(), sectors(ESP.getSketchSize()));
DEBUG_MSG_P(PSTR("[INIT] OTA size: %8u bytes / %4d sectors\n"), ESP.getFreeSketchSpace(), sectors(ESP.getFreeSketchSpace()));
#if SPIFFS_SUPPORT #if SPIFFS_SUPPORT
FSInfo fs_info; FSInfo fs_info;
bool fs = SPIFFS.info(fs_info); bool fs = SPIFFS.info(fs_info);
if (fs) { if (fs) {
DEBUG_MSG_P(PSTR("SPIFFS size: %8u bytes / %4d sectors\n"), fs_info.totalBytes, sectors(fs_info.totalBytes));
DEBUG_MSG_P(PSTR("[INIT] SPIFFS size: %8u bytes / %4d sectors\n"), fs_info.totalBytes, sectors(fs_info.totalBytes));
} }
#else #else
DEBUG_MSG_P(PSTR("SPIFFS size: %8u bytes / %4d sectors\n"), 0, 0);
DEBUG_MSG_P(PSTR("[INIT] SPIFFS size: %8u bytes / %4d sectors\n"), 0, 0);
#endif #endif
DEBUG_MSG_P(PSTR("EEPROM size: %8u bytes / %4d sectors\n"), settingsMaxSize(), sectors(settingsMaxSize()));
DEBUG_MSG_P(PSTR("Empty space: %8u bytes / 4 sectors\n"), 4 * SPI_FLASH_SEC_SIZE);
DEBUG_MSG_P(PSTR("[INIT] EEPROM size: %8u bytes / %4d sectors\n"), settingsMaxSize(), sectors(settingsMaxSize()));
DEBUG_MSG_P(PSTR("[INIT] Empty space: %8u bytes / 4 sectors\n"), 4 * SPI_FLASH_SEC_SIZE);
#if SPIFFS_SUPPORT #if SPIFFS_SUPPORT
if (fs) { if (fs) {
DEBUG_MSG_P(PSTR("\n")); DEBUG_MSG_P(PSTR("\n"));
DEBUG_MSG_P(PSTR("SPIFFS total size: %8u bytes\n"), fs_info.totalBytes);
DEBUG_MSG_P(PSTR(" used size: %8u bytes\n"), fs_info.usedBytes);
DEBUG_MSG_P(PSTR(" block size: %8u bytes\n"), fs_info.blockSize);
DEBUG_MSG_P(PSTR(" page size: %8u bytes\n"), fs_info.pageSize);
DEBUG_MSG_P(PSTR(" max files: %8u\n"), fs_info.maxOpenFiles);
DEBUG_MSG_P(PSTR(" max length: %8u\n"), fs_info.maxPathLength);
DEBUG_MSG_P(PSTR("[INIT] SPIFFS total size: %8u bytes\n"), fs_info.totalBytes);
DEBUG_MSG_P(PSTR("[INIT] used size: %8u bytes\n"), fs_info.usedBytes);
DEBUG_MSG_P(PSTR("[INIT] block size: %8u bytes\n"), fs_info.blockSize);
DEBUG_MSG_P(PSTR("[INIT] page size: %8u bytes\n"), fs_info.pageSize);
DEBUG_MSG_P(PSTR("[INIT] max files: %8u\n"), fs_info.maxOpenFiles);
DEBUG_MSG_P(PSTR("[INIT] max length: %8u\n"), fs_info.maxPathLength);
} }
#endif #endif
@ -114,11 +115,13 @@ void welcome() {
if (custom_reset > 0) { if (custom_reset > 0) {
char buffer[32]; char buffer[32];
strcpy_P(buffer, custom_reset_string[custom_reset-1]); strcpy_P(buffer, custom_reset_string[custom_reset-1]);
DEBUG_MSG_P(PSTR("Last reset reason: %s\n"), buffer);
DEBUG_MSG_P(PSTR("[INIT] Last reset reason: %s\n"), buffer);
} else { } else {
DEBUG_MSG_P(PSTR("Last reset reason: %s\n"), (char *) ESP.getResetReason().c_str());
DEBUG_MSG_P(PSTR("[INIT] Last reset reason: %s\n"), (char *) ESP.getResetReason().c_str());
} }
DEBUG_MSG_P(PSTR("Free heap: %u bytes\n"), ESP.getFreeHeap());
DEBUG_MSG_P(PSTR("[INIT] Free heap: %u bytes\n"), ESP.getFreeHeap());
initDump();
DEBUG_MSG_P(PSTR("\n\n")); DEBUG_MSG_P(PSTR("\n\n"));


+ 1
- 1
code/espurna/mqtt.ino View File

@ -341,7 +341,7 @@ void mqttConnect() {
if (strlen(host) == 0) return; if (strlen(host) == 0) return;
unsigned int port = getSetting("mqttPort", MQTT_PORT).toInt(); unsigned int port = getSetting("mqttPort", MQTT_PORT).toInt();
_mqttUser = strdup(getSetting("mqttUser", MQTT_USER).c_str()); _mqttUser = strdup(getSetting("mqttUser", MQTT_USER).c_str());
_mqttPass = strdup(getSetting("mqttPassword", MQTT_PASSWORD).c_str());
_mqttPass = strdup(getSetting("mqttPassword", MQTT_PASS).c_str());
if (_mqttWill) free(_mqttWill); if (_mqttWill) free(_mqttWill);
_mqttWill = strdup((_mqttTopic + MQTT_TOPIC_STATUS).c_str()); _mqttWill = strdup((_mqttTopic + MQTT_TOPIC_STATUS).c_str());


+ 39
- 0
code/espurna/utils.ino View File

@ -55,6 +55,45 @@ unsigned long getUptime() {
} }
#define DUMP_SETTING(X, Y) DEBUG_MSG_P(PSTR(" %s: %s\n"), X, String(Y).c_str())
void initDump() {
DEBUG_MSG_P(PSTR("\n[INIT] Current settings:\n\n"));
DUMP_SETTING("MANUFACTURER", MANUFACTURER);
DUMP_SETTING("DEVICE", DEVICE);
DEBUG_MSG_P(PSTR(" ---------------------------\n"));
DUMP_SETTING("ALEXA_SUPPORT", ALEXA_SUPPORT);
DUMP_SETTING("ANALOG_SUPPORT", ANALOG_SUPPORT);
DUMP_SETTING("DEBUG_SERIAL_SUPPORT", DEBUG_SERIAL_SUPPORT);
DUMP_SETTING("DEBUG_UDP_SUPPORT", DEBUG_UDP_SUPPORT);
DUMP_SETTING("DHT_SUPPORT", DHT_SUPPORT);
DUMP_SETTING("DOMOTICZ_SUPPORT", DOMOTICZ_SUPPORT);
DUMP_SETTING("DS18B20_SUPPORT", DS18B20_SUPPORT);
DUMP_SETTING("EMON_SUPPORT", EMON_SUPPORT);
DUMP_SETTING("HOMEASSISTANT_SUPPORT", HOMEASSISTANT_SUPPORT);
DUMP_SETTING("I2C_SUPPORT", I2C_SUPPORT);
DUMP_SETTING("INFLUXDB_SUPPORT", INFLUXDB_SUPPORT);
DUMP_SETTING("MDNS_SUPPORT", MDNS_SUPPORT);
DUMP_SETTING("NOFUSS_SUPPORT", NOFUSS_SUPPORT);
DUMP_SETTING("NTP_SUPPORT", NTP_SUPPORT);
DUMP_SETTING("RF_SUPPORT", RF_SUPPORT);
DUMP_SETTING("SPIFFS_SUPPORT", SPIFFS_SUPPORT);
DUMP_SETTING("TERMINAL_SUPPORT", TERMINAL_SUPPORT);
DUMP_SETTING("WEB_SUPPORT", WEB_SUPPORT);
DEBUG_MSG_P(PSTR(" ---------------------------\n"));
DUMP_SETTING("LIGHT_PROVIDER", LIGHT_PROVIDER);
DUMP_SETTING("MQTT_AUTOCONNECT", MQTT_AUTOCONNECT);
DUMP_SETTING("MQTT_USE_ASYNC", MQTT_USE_ASYNC);
}
void heartbeat() { void heartbeat() {
unsigned long uptime_seconds = getUptime(); unsigned long uptime_seconds = getUptime();


Loading…
Cancel
Save