Skip to content

Commit

Permalink
LITTLEFS->LittleFS
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelDvP committed May 10, 2022
1 parent 9202d79 commit 3168438
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 19 deletions.
2 changes: 1 addition & 1 deletion lib/framework/UploadFileService.cpp
Expand Up @@ -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");
}
}

Expand Down
2 changes: 1 addition & 1 deletion lib/framework/UploadFileService.h
Expand Up @@ -6,7 +6,7 @@
#include <Update.h>
#include <WiFi.h>

#include <LITTLEFS.h>
#include <LittleFS.h>

#include <ESPAsyncWebServer.h>
#include <SecurityManager.h>
Expand Down
14 changes: 6 additions & 8 deletions src/emsesp.cpp
Expand Up @@ -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
Expand Down Expand Up @@ -779,17 +778,16 @@ std::string EMSESP::pretty_telegram(std::shared_ptr<const Telegram> 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) + ")";
}
Expand Down
14 changes: 5 additions & 9 deletions src/system.cpp
Expand Up @@ -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);
Expand All @@ -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"));
}
Expand All @@ -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

Expand All @@ -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);
Expand All @@ -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);
Expand Down

0 comments on commit 3168438

Please sign in to comment.