prevent serial when in debug mode, during update check

This commit is contained in:
proddy
2020-11-14 12:49:29 +01:00
parent 842683aae1
commit 6fefb8fd8f

View File

@@ -698,7 +698,7 @@ bool System::check_upgrade() {
l_cfg.setAutoFormat(false); l_cfg.setAutoFormat(false);
LittleFS.setConfig(l_cfg); // do not auto format if it can't find LittleFS LittleFS.setConfig(l_cfg); // do not auto format if it can't find LittleFS
if (LittleFS.begin()) { if (LittleFS.begin()) {
#if defined(EMSESP_DEBUG) #if defined(EMSESP_FORCE_SERIAL)
Serial.begin(115200); Serial.begin(115200);
Serial.println(F("FS is Littlefs")); Serial.println(F("FS is Littlefs"));
Serial.end(); Serial.end();
@@ -713,7 +713,7 @@ bool System::check_upgrade() {
cfg.setAutoFormat(false); // prevent formatting when opening SPIFFS filesystem cfg.setAutoFormat(false); // prevent formatting when opening SPIFFS filesystem
SPIFFS.setConfig(cfg); SPIFFS.setConfig(cfg);
if (!SPIFFS.begin()) { if (!SPIFFS.begin()) {
#if defined(EMSESP_DEBUG) #if defined(EMSESP_FORCE_SERIAL)
Serial.begin(115200); Serial.begin(115200);
Serial.println(F("No old SPIFFS found!")); Serial.println(F("No old SPIFFS found!"));
Serial.end(); Serial.end();
@@ -812,9 +812,7 @@ bool System::check_upgrade() {
file.close(); file.close();
if (failed) { if (failed) {
#if defined(EMSESP_DEBUG)
Serial.println(F("Failed to read system config. Quitting.")); Serial.println(F("Failed to read system config. Quitting."));
#endif
SPIFFS.end(); SPIFFS.end();
Serial.end(); Serial.end();
return false; return false;
@@ -837,10 +835,6 @@ bool System::check_upgrade() {
Serial.printf(PSTR("Error. Failed to deserialize custom json, error %s\n"), error.c_str()); Serial.printf(PSTR("Error. Failed to deserialize custom json, error %s\n"), error.c_str());
failed = true; failed = true;
} else { } else {
#if defined(EMSESP_DEBUG)
serializeJson(doc, Serial);
Serial.println();
#endif
custom_settings = doc["settings"]; custom_settings = doc["settings"];
EMSESP::webSettingsService.update( EMSESP::webSettingsService.update(
[&](WebSettings & settings) { [&](WebSettings & settings) {
@@ -868,9 +862,7 @@ bool System::check_upgrade() {
SPIFFS.end(); SPIFFS.end();
if (failed) { if (failed) {
#if defined(EMSESP_DEBUG)
Serial.println(F("Failed to read custom config. Quitting.")); Serial.println(F("Failed to read custom config. Quitting."));
#endif
Serial.end(); Serial.end();
return false; return false;
} }