mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-07 16:29:51 +03:00
LITTLEFS->LittleFS
This commit is contained in:
@@ -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");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include <Update.h>
|
||||
#include <WiFi.h>
|
||||
|
||||
#include <LITTLEFS.h>
|
||||
#include <LittleFS.h>
|
||||
|
||||
#include <ESPAsyncWebServer.h>
|
||||
#include <SecurityManager.h>
|
||||
|
||||
@@ -742,7 +742,6 @@ std::string EMSESP::pretty_telegram(std::shared_ptr<const Telegram> 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,16 +778,15 @@ std::string EMSESP::pretty_telegram(std::shared_ptr<const Telegram> telegram) {
|
||||
type_name = read_flash_string(F("?"));
|
||||
}
|
||||
|
||||
if (telegram->operation == Telegram::Operation::RX_READ) {
|
||||
direction = read_flash_string(F("<-"));
|
||||
} else {
|
||||
direction = read_flash_string(F("->"));
|
||||
}
|
||||
|
||||
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 (telegram->operation == Telegram::Operation::RX_READ) {
|
||||
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 {
|
||||
str = src_name + "(" + Helpers::hextoa(src) + ") -> " + dest_name + "(" + Helpers::hextoa(dest) + "), " + type_name + "("
|
||||
+ Helpers::hextoa(telegram->type_id) + "), data: " + telegram->to_string_message();
|
||||
}
|
||||
|
||||
if (offset) {
|
||||
str += " (offset " + Helpers::itoa(offset) + ")";
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user