Skip to content

Commit

Permalink
Fix esp8266 compile error
Browse files Browse the repository at this point in the history
  • Loading branch information
cziter15 committed Feb 3, 2025
1 parent a8d0d0d commit 6628ee4
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions src/ksf/ksConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ namespace ksf
configPath += fileName;

/* Read config file. */
if (auto fileReader{LittleFS.open(configPath.c_str())}; fileReader)
if (auto fileReader{LittleFS.open(configPath.c_str(), PSTR("r"))})
{
/* Read until EOF. */
while (fileReader.available())
Expand Down Expand Up @@ -75,19 +75,16 @@ namespace ksf
if (!isDirty)
return;

/* Open file for writing */
File fileWriter = LittleFS.open(configPath.c_str(), "w", true);
if (!fileWriter)
/* If marked dirty, save changes to FS. */
auto fileWriter{LittleFS.open(configPath.c_str(), PSTR("w"))};
if (!fileWriter)
return;

/* Write parameters */
for (const auto& [name, value] : configParams)
for (const auto&[name, value] : configParams)
{
fileWriter.println(name.c_str());
fileWriter.println(value.c_str());
}

fileWriter.flush();
fileWriter.close();
}
}
}

0 comments on commit 6628ee4

Please sign in to comment.