diff --git a/code/espurna/config/general.h b/code/espurna/config/general.h index 2d38f2cb..77dfcf35 100644 --- a/code/espurna/config/general.h +++ b/code/espurna/config/general.h @@ -296,9 +296,8 @@ PROGMEM const char* const custom_reset_string[] = { // SPIFFS // ----------------------------------------------------------------------------- -// Do not add support for SPIFFS by default #ifndef SPIFFS_SUPPORT -#define SPIFFS_SUPPORT 0 +#define SPIFFS_SUPPORT 0 // Do not add support for SPIFFS by default #endif // ----------------------------------------------------------------------------- @@ -311,6 +310,10 @@ PROGMEM const char* const custom_reset_string[] = { // 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_INTERVAL 3600000 // Check for updates every hour diff --git a/code/espurna/espurna.ino b/code/espurna/espurna.ino index 73dc44f6..c11e8338 100644 --- a/code/espurna/espurna.ino +++ b/code/espurna/espurna.ino @@ -67,45 +67,46 @@ unsigned int sectors(size_t size) { void welcome() { 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")); 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("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 FSInfo fs_info; bool fs = SPIFFS.info(fs_info); 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 - 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 - 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 (fs) { 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 @@ -114,11 +115,13 @@ void welcome() { if (custom_reset > 0) { char buffer[32]; 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 { - 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")); diff --git a/code/espurna/mqtt.ino b/code/espurna/mqtt.ino index 6c903a4c..4e893e11 100644 --- a/code/espurna/mqtt.ino +++ b/code/espurna/mqtt.ino @@ -341,7 +341,7 @@ void mqttConnect() { if (strlen(host) == 0) return; unsigned int port = getSetting("mqttPort", MQTT_PORT).toInt(); _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); _mqttWill = strdup((_mqttTopic + MQTT_TOPIC_STATUS).c_str()); diff --git a/code/espurna/utils.ino b/code/espurna/utils.ino index c8428cb0..bc51585c 100644 --- a/code/espurna/utils.ino +++ b/code/espurna/utils.ino @@ -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() { unsigned long uptime_seconds = getUptime();