Browse Source

Moved settings setup debug messages to info

i18n
Xose Pérez 6 years ago
parent
commit
0a6271a80a
3 changed files with 11 additions and 9 deletions
  1. +6
    -4
      code/espurna/espurna.ino
  2. +4
    -5
      code/espurna/settings.ino
  3. +1
    -0
      code/espurna/utils.ino

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

@ -38,11 +38,17 @@ void espurnaRegisterLoop(void (*callback)()) {
void setup() {
// -------------------------------------------------------------------------
// Basic modules, will always run
// -------------------------------------------------------------------------
// Init EEPROM, Serial, SPIFFS and system check
systemSetup();
// Init persistance and terminal features
settingsSetup();
// Hostname & board name initialization
if (getSetting("hostname").length() == 0) {
setSetting("hostname", getIdentifier());
}
@ -51,10 +57,6 @@ void setup() {
// Show welcome message and system configuration
info();
// -------------------------------------------------------------------------
// Basic modules, will always run
// -------------------------------------------------------------------------
wifiSetup();
otaSetup();
#if TELNET_SUPPORT


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

@ -41,7 +41,7 @@ bool _settings_save = false;
// Reverse engineering EEPROM storage format
// -----------------------------------------------------------------------------
unsigned long _settingsSize() {
unsigned long settingsSize() {
unsigned pos = SPI_FLASH_SEC_SIZE - 1;
while (size_t len = EEPROM.read(pos)) {
pos = pos - len - 2;
@ -49,6 +49,8 @@ unsigned long _settingsSize() {
return SPI_FLASH_SEC_SIZE - pos;
}
// -----------------------------------------------------------------------------
unsigned int _settingsKeyCount() {
unsigned count = 0;
unsigned pos = SPI_FLASH_SEC_SIZE - 1;
@ -156,7 +158,7 @@ void _settingsKeys() {
DEBUG_MSG_P(PSTR("> %s => %s\n"), (keys[i]).c_str(), value.c_str());
}
unsigned long freeEEPROM = SPI_FLASH_SEC_SIZE - _settingsSize();
unsigned long freeEEPROM = SPI_FLASH_SEC_SIZE - settingsSize();
DEBUG_MSG_P(PSTR("Number of keys: %d\n"), keys.size());
DEBUG_MSG_P(PSTR("Free EEPROM: %d bytes (%d%%)\n"), freeEEPROM, 100 * freeEEPROM / SPI_FLASH_SEC_SIZE);
@ -407,9 +409,6 @@ void settingsSetup() {
_settingsInitCommands();
DEBUG_MSG_P(PSTR("[SETTINGS] EEPROM size: %d bytes\n"), SPI_FLASH_SEC_SIZE);
DEBUG_MSG_P(PSTR("[SETTINGS] Settings size: %d bytes\n"), _settingsSize());
#if TERMINAL_SUPPORT
#ifdef SERIAL_RX_PORT
SERIAL_RX_PORT.begin(SERIAL_RX_BAUDRATE);


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

@ -403,6 +403,7 @@ void info() {
DEBUG_MSG_P(PSTR("[INIT] Last reset reason: %s\n"), (char *) ESP.getResetReason().c_str());
}
DEBUG_MSG_P(PSTR("[INIT] Settings size: %u bytes\n"), settingsSize());
DEBUG_MSG_P(PSTR("[INIT] Free heap: %u bytes\n"), getFreeHeap());
#if ADC_VCC_ENABLED
DEBUG_MSG_P(PSTR("[INIT] Power: %u mV\n"), ESP.getVcc());


Loading…
Cancel
Save