tidy up EMSESP_DEBUG and EMSESP_TEST

This commit is contained in:
Proddy
2023-02-21 21:49:21 +01:00
parent 134f2671fb
commit 6aea27e30f
15 changed files with 18 additions and 120 deletions

View File

@@ -31,14 +31,6 @@ class FSPersistence {
DeserializationError error = deserializeJson(jsonDocument, settingsFile);
if (error == DeserializationError::Ok && jsonDocument.is<JsonObject>()) {
JsonObject jsonObject = jsonDocument.as<JsonObject>();
// debug added by Proddy
#if defined(EMSESP_DEBUG)
Serial.println();
Serial.printf("Reading file: %s: ", _filePath);
serializeJson(jsonDocument, Serial);
Serial.println();
#endif
_statefulService->updateWithoutPropagation(jsonObject, _stateUpdater);
settingsFile.close();
return;
@@ -46,13 +38,8 @@ class FSPersistence {
settingsFile.close();
}
// If we reach here we have not been successful in loading the config,
// hard-coded emergency defaults are now applied.
#if defined(EMSESP_DEBUG)
Serial.println();
Serial.printf("Applying defaults for %s: ", _filePath);
Serial.println();
#endif
// If we reach here we have not been successful in loading the config,
// hard-coded emergency defaults are now applied.
applyDefaults();
writeToFS(); // added to make sure the initial file is created
}
@@ -78,22 +65,9 @@ class FSPersistence {
// failed to open file, return false
if (!settingsFile || !jsonObject.size()) {
#if defined(EMSESP_DEBUG)
Serial.println();
Serial.printf("Cannot write to file system.");
Serial.println();
#endif
return false;
}
// debug added by Proddy
#if defined(EMSESP_DEBUG)
Serial.println();
Serial.printf("Writing to file: %s: ", _filePath);
serializeJson(jsonDocument, Serial);
Serial.println();
#endif
// serialize the data to the file
serializeJson(jsonDocument, settingsFile);
settingsFile.close();

View File

@@ -39,11 +39,10 @@ void OTASettingsService::configureArduinoOTA() {
_arduinoOTA->onEnd([]() { emsesp::EMSESP::system_.upload_status(false); });
_arduinoOTA->onProgress([](unsigned int progress, unsigned int total) {
#if defined(EMSESP_DEBUG)
Serial.printf("Progress: %u%%\r\n", (progress / (total / 100)));
#endif
// Serial.printf("Progress: %u%%\r\n", (progress / (total / 100)));
});
_arduinoOTA->onError([](ota_error_t error) {
/*
#if defined(EMSESP_DEBUG)
Serial.printf("Error[%u]: ", error);
if (error == OTA_AUTH_ERROR)
@@ -57,6 +56,7 @@ void OTASettingsService::configureArduinoOTA() {
else if (error == OTA_END_ERROR)
Serial.println("End Failed");
#endif
*/
});
_arduinoOTA->setMdnsEnabled(false); // disable as handled in NetworkSettingsService.cpp. https://github.com/emsesp/EMS-ESP32/issues/161