mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2026-01-26 08:39:09 +03:00
rollback to other partitions - #2837
This commit is contained in:
@@ -146,6 +146,22 @@ void WebStatusService::systemStatus(AsyncWebServerRequest * request) {
|
||||
root["has_partition"] = false;
|
||||
}
|
||||
|
||||
// get the partition info
|
||||
EMSESP::system_.get_partition_info();
|
||||
JsonArray partitions = root["partitions"].to<JsonArray>();
|
||||
for (const auto & partition : EMSESP::system_.partition_info_) {
|
||||
// Skip partition if it's the running one, version is empty, or size is 0
|
||||
if (partition.first == (const char *)esp_ota_get_running_partition()->label || partition.second.version.empty() || partition.second.size == 0) {
|
||||
continue;
|
||||
}
|
||||
JsonObject part = partitions.add<JsonObject>();
|
||||
part["partition"] = partition.first;
|
||||
part["version"] = partition.second.version;
|
||||
part["size"] = partition.second.size;
|
||||
}
|
||||
|
||||
root["developer_mode"] = EMSESP::system_.developer_mode();
|
||||
|
||||
// Also used in SystemMonitor.tsx
|
||||
root["status"] = EMSESP::system_.systemStatus(); // send the status. See System.h for status codes
|
||||
if (EMSESP::system_.systemStatus() == SYSTEM_STATUS::SYSTEM_STATUS_PENDING_RESTART) {
|
||||
@@ -185,6 +201,8 @@ void WebStatusService::action(AsyncWebServerRequest * request, JsonVariant json)
|
||||
|
||||
if (action == "checkUpgrade") {
|
||||
ok = checkUpgrade(root, param); // param could be empty, if so only send back version
|
||||
} else if (action == "setPartition") {
|
||||
ok = EMSESP::system_.set_partition(param.c_str());
|
||||
} else if (action == "export") {
|
||||
if (has_param) {
|
||||
ok = exportData(root, param);
|
||||
|
||||
Reference in New Issue
Block a user