From 3168438d6f168085a5772847e60344fb4fb11d28 Mon Sep 17 00:00:00 2001 From: MichaelDvP Date: Tue, 10 May 2022 13:26:50 +0200 Subject: [PATCH] LITTLEFS->LittleFS --- lib/framework/UploadFileService.cpp | 2 +- lib/framework/UploadFileService.h | 2 +- src/emsesp.cpp | 14 ++++++-------- src/system.cpp | 14 +++++--------- 4 files changed, 13 insertions(+), 19 deletions(-) diff --git a/lib/framework/UploadFileService.cpp b/lib/framework/UploadFileService.cpp index 51bdf1656..5edcc5dd8 100644 --- a/lib/framework/UploadFileService.cpp +++ b/lib/framework/UploadFileService.cpp @@ -52,7 +52,7 @@ void UploadFileService::handleUpload(AsyncWebServerRequest * request, const Stri } } else { // its a normal file, open a new temp file to write the contents too - request->_tempFile = LITTLEFS.open(TEMP_FILENAME_PATH, "w"); + request->_tempFile = LittleFS.open(TEMP_FILENAME_PATH, "w"); } } diff --git a/lib/framework/UploadFileService.h b/lib/framework/UploadFileService.h index fba0df0dd..4abcdf7ce 100644 --- a/lib/framework/UploadFileService.h +++ b/lib/framework/UploadFileService.h @@ -6,7 +6,7 @@ #include #include -#include +#include #include #include diff --git a/src/emsesp.cpp b/src/emsesp.cpp index 457e4fdf3..f7ff887b6 100644 --- a/src/emsesp.cpp +++ b/src/emsesp.cpp @@ -742,7 +742,6 @@ std::string EMSESP::pretty_telegram(std::shared_ptr telegram) { std::string src_name(""); std::string dest_name(""); std::string type_name(""); - std::string direction(""); for (const auto & emsdevice : emsdevices) { if (emsdevice) { // get src & dest @@ -779,17 +778,16 @@ std::string EMSESP::pretty_telegram(std::shared_ptr telegram) { type_name = read_flash_string(F("?")); } + std::string str; + str.reserve(200); if (telegram->operation == Telegram::Operation::RX_READ) { - direction = read_flash_string(F("<-")); + str = src_name + "(" + Helpers::hextoa(src) + ") <- " + dest_name + "(" + Helpers::hextoa(dest) + "), " + type_name + "(" + + Helpers::hextoa(telegram->type_id) + "), length: " + Helpers::hextoa(telegram->message_data[0]); } else { - direction = read_flash_string(F("->")); + str = src_name + "(" + Helpers::hextoa(src) + ") -> " + dest_name + "(" + Helpers::hextoa(dest) + "), " + type_name + "(" + + Helpers::hextoa(telegram->type_id) + "), data: " + telegram->to_string_message(); } - std::string str; - str.reserve(200); - str = src_name + "(" + Helpers::hextoa(src) + ") " + direction + " " + dest_name + "(" + Helpers::hextoa(dest) + "), " + type_name + "(" - + Helpers::hextoa(telegram->type_id) + "), data: " + telegram->to_string_message(); - if (offset) { str += " (offset " + Helpers::itoa(offset) + ")"; } diff --git a/src/system.cpp b/src/system.cpp index 332c9186a..47fbabb45 100644 --- a/src/system.cpp +++ b/src/system.cpp @@ -897,7 +897,7 @@ bool System::check_upgrade() { #ifndef EMSESP_STANDALONE // see if we have a temp file, if so try and read it - File new_file = LITTLEFS.open(TEMP_FILENAME_PATH); + File new_file = LittleFS.open(TEMP_FILENAME_PATH); if (new_file) { DynamicJsonDocument jsonDocument = DynamicJsonDocument(FS_BUFFER_SIZE); DeserializationError error = deserializeJson(jsonDocument, new_file); @@ -915,11 +915,7 @@ bool System::check_upgrade() { reboot_required |= saveSettings(EMSESP_SETTINGS_FILE, "Settings", input); } else if (settings_type == "customizations") { // it's a customization file, just replace it and there's no need to reboot - LOG_INFO(F("Applying new customizations")); - new_file.close(); - LITTLEFS.remove(EMSESP_CUSTOMIZATION_FILE); - LITTLEFS.rename(TEMP_FILENAME_PATH, EMSESP_CUSTOMIZATION_FILE); - return false; // no reboot required + saveSettings(EMSESP_CUSTOMIZATION_FILE, "Customization", input); } else { LOG_ERROR(F("Unrecognized file uploaded")); } @@ -929,7 +925,7 @@ bool System::check_upgrade() { // close (just in case) and remove the file new_file.close(); - LITTLEFS.remove(TEMP_FILENAME_PATH); + LittleFS.remove(TEMP_FILENAME_PATH); } #endif @@ -944,7 +940,7 @@ bool System::command_commands(const char * value, const int8_t id, JsonObject & // convert settings file into json object void System::extractSettings(const char * filename, const char * section, JsonObject & output) { #ifndef EMSESP_STANDALONE - File settingsFile = LITTLEFS.open(filename); + File settingsFile = LittleFS.open(filename); if (settingsFile) { DynamicJsonDocument jsonDocument = DynamicJsonDocument(EMSESP_JSON_SIZE_XLARGE_DYN); DeserializationError error = deserializeJson(jsonDocument, settingsFile); @@ -965,7 +961,7 @@ bool System::saveSettings(const char * filename, const char * section, JsonObjec #ifndef EMSESP_STANDALONE JsonObject section_json = input[section]; if (section_json) { - File section_file = LITTLEFS.open(filename, "w"); + File section_file = LittleFS.open(filename, "w"); if (section_file) { LOG_INFO(F("Applying new %s settings"), section); serializeJson(section_json, section_file);