mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 15:59:52 +03:00
fix FS format, move AP* from Network system info to own node
This commit is contained in:
@@ -1452,7 +1452,7 @@ bool System::command_service(const char * cmd, const char * value) {
|
|||||||
ok = true;
|
ok = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int n;
|
int n;
|
||||||
if (!ok && Helpers::value2number(value, n)) {
|
if (!ok && Helpers::value2number(value, n)) {
|
||||||
#ifndef EMSESP_STANDALONE
|
#ifndef EMSESP_STANDALONE
|
||||||
@@ -1661,15 +1661,6 @@ bool System::command_info(const char * value, const int8_t id, JsonObject output
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
#ifndef EMSESP_STANDALONE
|
|
||||||
EMSESP::esp32React.getAPSettingsService()->read([&](const APSettings & settings) {
|
|
||||||
const char * pM[] = {"always", "disconnected", "never"};
|
|
||||||
node["APProvisionMode"] = pM[settings.provisionMode];
|
|
||||||
node["APSecurity"] = settings.password.length() ? "wpa2" : "open";
|
|
||||||
node["APSSID"] = settings.ssid;
|
|
||||||
});
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// NTP status
|
// NTP status
|
||||||
node = output["ntp"].to<JsonObject>();
|
node = output["ntp"].to<JsonObject>();
|
||||||
EMSESP::esp32React.getNTPSettingsService()->read([&](const NTPSettings & settings) {
|
EMSESP::esp32React.getNTPSettingsService()->read([&](const NTPSettings & settings) {
|
||||||
@@ -1689,9 +1680,11 @@ bool System::command_info(const char * value, const int8_t id, JsonObject output
|
|||||||
// AP Status
|
// AP Status
|
||||||
node = output["ap"].to<JsonObject>();
|
node = output["ap"].to<JsonObject>();
|
||||||
EMSESP::esp32React.getAPSettingsService()->read([&](const APSettings & settings) {
|
EMSESP::esp32React.getAPSettingsService()->read([&](const APSettings & settings) {
|
||||||
node["provisionMode"] = settings.provisionMode; // 0 is on, 2 is off
|
const char * pM[] = {"always", "disconnected", "never"};
|
||||||
|
node["provisionMode"] = pM[settings.provisionMode];
|
||||||
node["ssid"] = settings.ssid;
|
node["ssid"] = settings.ssid;
|
||||||
#ifndef EMSESP_STANDALONE
|
#ifndef EMSESP_STANDALONE
|
||||||
|
node["security"] = settings.password.length() ? "wpa2" : "open";
|
||||||
node["channel"] = settings.channel;
|
node["channel"] = settings.channel;
|
||||||
node["ssidHidden"] = settings.ssidHidden;
|
node["ssidHidden"] = settings.ssidHidden;
|
||||||
node["maxClients"] = settings.maxClients;
|
node["maxClients"] = settings.maxClients;
|
||||||
@@ -1991,15 +1984,12 @@ bool System::load_board_profile(std::vector<int8_t> & data, const std::string &
|
|||||||
|
|
||||||
// format command - factory reset, removing all config files
|
// format command - factory reset, removing all config files
|
||||||
bool System::command_format(const char * value, const int8_t id) {
|
bool System::command_format(const char * value, const int8_t id) {
|
||||||
LOG_INFO("Removing all config files");
|
LOG_INFO("Formatting FS, removing all config files");
|
||||||
#ifndef EMSESP_STANDALONE
|
#ifndef EMSESP_STANDALONE
|
||||||
// TODO To replaced with LittleFS.rmdir(FS_CONFIG_DIRECTORY) now we're using IDF 4.2+
|
if (LittleFS.format()) {
|
||||||
File root = LittleFS.open(EMSESP_FS_CONFIG_DIRECTORY);
|
LOG_INFO("FS formatted successfully");
|
||||||
File file;
|
} else {
|
||||||
while ((file = root.openNextFile())) {
|
LOG_ERROR("Format failed");
|
||||||
String path = file.path();
|
|
||||||
file.close();
|
|
||||||
LittleFS.remove(path);
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user