Skip to content

Commit

Permalink
only show running partition which is boot on 1st install and then cyc…
Browse files Browse the repository at this point in the history
…le between app0/app1
  • Loading branch information
proddy committed Sep 15, 2024
1 parent 9234bfd commit 5cb4f48
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 16 deletions.
6 changes: 2 additions & 4 deletions src/emsesp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1579,12 +1579,10 @@ void EMSESP::start() {
esp8266React.begin();

#ifndef EMSESP_STANDALONE
LOG_INFO("Booting EMS-ESP version %s from %s/%s partition",
EMSESP_APP_VERSION,
esp_ota_get_boot_partition()->label,
LOG_INFO("EMS-ESP version %s (%s partition)", EMSESP_APP_VERSION,
esp_ota_get_running_partition()->label); // welcome message
#else
LOG_INFO("Booting EMS-ESP version %s", EMSESP_APP_VERSION); // welcome message
LOG_INFO("EMS-ESP version %s", EMSESP_APP_VERSION); // welcome message
#endif
LOG_DEBUG("System is running in Debug mode");
LOG_INFO("Last system reset reason Core0: %s, Core1: %s", system_.reset_reason(0).c_str(), system_.reset_reason(1).c_str());
Expand Down
29 changes: 17 additions & 12 deletions src/system.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,12 @@ void System::system_restart(const char * partitionname) {
Shell::loop_all(); // flush log to output
delay(1000); // wait 1 second
ESP.restart();
#else
if (partitionname != nullptr) {
LOG_INFO("Restarting EMS-ESP from %s partition", partitionname);
} else {
LOG_INFO("Restarting EMS-ESP...");
}
#endif
}

Expand Down Expand Up @@ -999,7 +1005,7 @@ void System::show_system(uuid::console::Shell & shell) {
#ifndef EMSESP_STANDALONE
shell.printfln(" Platform: %s (%s)", EMSESP_PLATFORM, ESP.getChipModel());
shell.printfln(" Model: %s", getBBQKeesGatewayDetails().c_str());
shell.printfln(" Partition boot/running: %s/%s", esp_ota_get_boot_partition()->label, esp_ota_get_running_partition()->label);
shell.printfln(" Partition: %s", esp_ota_get_running_partition()->label);
#endif
shell.printfln(" Language: %s", locale().c_str());
shell.printfln(" Board profile: %s", board_profile().c_str());
Expand Down Expand Up @@ -1442,17 +1448,16 @@ bool System::command_info(const char * value, const int8_t id, JsonObject output
node["uptime"] = uuid::log::format_timestamp_ms(uuid::get_uptime_ms(), 3);
node["uptimeSec"] = uuid::get_uptime_sec();
#ifndef EMSESP_STANDALONE
node["platform"] = EMSESP_PLATFORM;
node["cpuType"] = ESP.getChipModel();
node["arduino"] = ARDUINO_VERSION;
node["sdk"] = ESP.getSdkVersion();
node["freeMem"] = getHeapMem();
node["maxAlloc"] = getMaxAllocMem();
node["freeCaps"] = heap_caps_get_free_size(MALLOC_CAP_8BIT) / 1024; // includes heap and psram
node["usedApp"] = EMSESP::system_.appUsed(); // kilobytes
node["freeApp"] = EMSESP::system_.appFree(); // kilobytes
node["partitionBootRunning"] = std::string(esp_ota_get_boot_partition()->label) + "/"
+ esp_ota_get_running_partition()->label; // will sycle app0/app0 - app1/app1 after OTA. boot/factory is on first install.
node["platform"] = EMSESP_PLATFORM;
node["cpuType"] = ESP.getChipModel();
node["arduino"] = ARDUINO_VERSION;
node["sdk"] = ESP.getSdkVersion();
node["freeMem"] = getHeapMem();
node["maxAlloc"] = getMaxAllocMem();
node["freeCaps"] = heap_caps_get_free_size(MALLOC_CAP_8BIT) / 1024; // includes heap and psram
node["usedApp"] = EMSESP::system_.appUsed(); // kilobytes
node["freeApp"] = EMSESP::system_.appFree(); // kilobytes
node["partition"] = esp_ota_get_running_partition()->label; // active partition
#endif
node["resetReason"] = EMSESP::system_.reset_reason(0) + " / " + EMSESP::system_.reset_reason(1);
#ifndef EMSESP_STANDALONE
Expand Down

0 comments on commit 5cb4f48

Please sign in to comment.