mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-07 00:09:51 +03:00
remove Serial
This commit is contained in:
@@ -34,12 +34,10 @@ class FSPersistence {
|
|||||||
|
|
||||||
// debug added by Proddy
|
// debug added by Proddy
|
||||||
#if defined(EMSESP_DEBUG)
|
#if defined(EMSESP_DEBUG)
|
||||||
#if defined(EMSESP_USE_SERIAL)
|
|
||||||
Serial.println();
|
Serial.println();
|
||||||
Serial.printf("Reading file: %s: ", _filePath);
|
Serial.printf("Reading file: %s: ", _filePath);
|
||||||
serializeJson(jsonDocument, Serial);
|
serializeJson(jsonDocument, Serial);
|
||||||
Serial.println();
|
Serial.println();
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
_statefulService->updateWithoutPropagation(jsonObject, _stateUpdater);
|
_statefulService->updateWithoutPropagation(jsonObject, _stateUpdater);
|
||||||
settingsFile.close();
|
settingsFile.close();
|
||||||
@@ -51,11 +49,9 @@ class FSPersistence {
|
|||||||
// If we reach here we have not been successful in loading the config,
|
// If we reach here we have not been successful in loading the config,
|
||||||
// hard-coded emergency defaults are now applied.
|
// hard-coded emergency defaults are now applied.
|
||||||
#if defined(EMSESP_DEBUG)
|
#if defined(EMSESP_DEBUG)
|
||||||
#if defined(EMSESP_USE_SERIAL)
|
|
||||||
Serial.println();
|
Serial.println();
|
||||||
Serial.printf("Applying defaults for %s: ", _filePath);
|
Serial.printf("Applying defaults for %s: ", _filePath);
|
||||||
Serial.println();
|
Serial.println();
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
applyDefaults();
|
applyDefaults();
|
||||||
writeToFS(); // added to make sure the initial file is created
|
writeToFS(); // added to make sure the initial file is created
|
||||||
@@ -83,23 +79,19 @@ class FSPersistence {
|
|||||||
// failed to open file, return false
|
// failed to open file, return false
|
||||||
if (!settingsFile || !jsonObject.size()) {
|
if (!settingsFile || !jsonObject.size()) {
|
||||||
#if defined(EMSESP_DEBUG)
|
#if defined(EMSESP_DEBUG)
|
||||||
#if defined(EMSESP_USE_SERIAL)
|
|
||||||
Serial.println();
|
Serial.println();
|
||||||
Serial.printf("Cannot write to file system.");
|
Serial.printf("Cannot write to file system.");
|
||||||
Serial.println();
|
Serial.println();
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// debug added by Proddy
|
// debug added by Proddy
|
||||||
#if defined(EMSESP_DEBUG)
|
#if defined(EMSESP_DEBUG)
|
||||||
#if defined(EMSESP_USE_SERIAL)
|
|
||||||
Serial.println();
|
Serial.println();
|
||||||
Serial.printf("Writing to file: %s: ", _filePath);
|
Serial.printf("Writing to file: %s: ", _filePath);
|
||||||
serializeJson(jsonDocument, Serial);
|
serializeJson(jsonDocument, Serial);
|
||||||
Serial.println();
|
Serial.println();
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// serialize the data to the file
|
// serialize the data to the file
|
||||||
|
|||||||
@@ -39,12 +39,12 @@ void OTASettingsService::configureArduinoOTA() {
|
|||||||
_arduinoOTA->onEnd([]() { emsesp::EMSESP::system_.upload_status(false); });
|
_arduinoOTA->onEnd([]() { emsesp::EMSESP::system_.upload_status(false); });
|
||||||
|
|
||||||
_arduinoOTA->onProgress([](unsigned int progress, unsigned int total) {
|
_arduinoOTA->onProgress([](unsigned int progress, unsigned int total) {
|
||||||
#if defined(EMSESP_USE_SERIAL)
|
#if defined(EMSESP_DEBUG)
|
||||||
Serial.printf("Progress: %u%%\r\n", (progress / (total / 100)));
|
Serial.printf("Progress: %u%%\r\n", (progress / (total / 100)));
|
||||||
#endif
|
#endif
|
||||||
});
|
});
|
||||||
_arduinoOTA->onError([](ota_error_t error) {
|
_arduinoOTA->onError([](ota_error_t error) {
|
||||||
#if defined(EMSESP_USE_SERIAL)
|
#if defined(EMSESP_DEBUG)
|
||||||
Serial.printf("Error[%u]: ", error);
|
Serial.printf("Error[%u]: ", error);
|
||||||
if (error == OTA_AUTH_ERROR)
|
if (error == OTA_AUTH_ERROR)
|
||||||
Serial.println("Auth Failed");
|
Serial.println("Auth Failed");
|
||||||
|
|||||||
@@ -29,14 +29,6 @@ void UploadFileService::handleUpload(AsyncWebServerRequest * request, const Stri
|
|||||||
std::string extension = fname.substr(position + 1);
|
std::string extension = fname.substr(position + 1);
|
||||||
size_t fsize = request->contentLength();
|
size_t fsize = request->contentLength();
|
||||||
|
|
||||||
#ifdef EMSESP_DEBUG
|
|
||||||
#if defined(EMSESP_USE_SERIAL)
|
|
||||||
Serial.println();
|
|
||||||
Serial.printf("Received filename: %s, len: %d, index: %d, ext: %s, fsize: %d", filename.c_str(), len, index, extension.c_str(), fsize);
|
|
||||||
Serial.println();
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
is_firmware = false;
|
is_firmware = false;
|
||||||
if ((extension == "bin") && (fsize > 1500000)) {
|
if ((extension == "bin") && (fsize > 1500000)) {
|
||||||
is_firmware = true;
|
is_firmware = true;
|
||||||
@@ -79,9 +71,6 @@ void UploadFileService::handleUpload(AsyncWebServerRequest * request, const Stri
|
|||||||
}
|
}
|
||||||
request->onDisconnect(UploadFileService::handleEarlyDisconnect); // success, let's make sure we end the update if the client hangs up
|
request->onDisconnect(UploadFileService::handleEarlyDisconnect); // success, let's make sure we end the update if the client hangs up
|
||||||
} else {
|
} else {
|
||||||
#if defined(EMSESP_USE_SERIAL)
|
|
||||||
Update.printError(Serial);
|
|
||||||
#endif
|
|
||||||
handleError(request, 507); // failed to begin, send an error response Insufficient Storage
|
handleError(request, 507); // failed to begin, send an error response Insufficient Storage
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -99,16 +88,10 @@ void UploadFileService::handleUpload(AsyncWebServerRequest * request, const Stri
|
|||||||
// if we haven't delt with an error, continue with the firmware update
|
// if we haven't delt with an error, continue with the firmware update
|
||||||
if (!request->_tempObject) {
|
if (!request->_tempObject) {
|
||||||
if (Update.write(data, len) != len) {
|
if (Update.write(data, len) != len) {
|
||||||
#if defined(EMSESP_USE_SERIAL)
|
|
||||||
Update.printError(Serial);
|
|
||||||
#endif
|
|
||||||
handleError(request, 500);
|
handleError(request, 500);
|
||||||
}
|
}
|
||||||
if (final) {
|
if (final) {
|
||||||
if (!Update.end(true)) {
|
if (!Update.end(true)) {
|
||||||
#if defined(EMSESP_USE_SERIAL)
|
|
||||||
Update.printError(Serial);
|
|
||||||
#endif
|
|
||||||
handleError(request, 500);
|
handleError(request, 500);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -186,12 +186,6 @@ void WebDataService::device_data(AsyncWebServerRequest * request, JsonVariant &
|
|||||||
emsdevice->generate_values_web(output);
|
emsdevice->generate_values_web(output);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// #ifdef EMSESP_USE_SERIAL
|
|
||||||
// #ifdef EMSESP_DEBUG
|
|
||||||
// serializeJson(output, Serial);
|
|
||||||
// #endif
|
|
||||||
// #endif
|
|
||||||
|
|
||||||
#if defined(EMSESP_DEBUG)
|
#if defined(EMSESP_DEBUG)
|
||||||
size_t length = response->setLength();
|
size_t length = response->setLength();
|
||||||
EMSESP::logger().debug("Dashboard buffer used: %d", length);
|
EMSESP::logger().debug("Dashboard buffer used: %d", length);
|
||||||
|
|||||||
Reference in New Issue
Block a user