mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2026-01-26 16:49:11 +03:00
disable uart when uploading, show when uploading, store flag showing its a new firmware
This commit is contained in:
@@ -1720,6 +1720,11 @@ void EMSESP::start() {
|
||||
#else
|
||||
LOG_INFO("EMS-ESP version %s", EMSESP_APP_VERSION);
|
||||
#endif
|
||||
|
||||
if (!EMSESP::nvs_.getBool(EMSESP_NVS_BOOT_NEW_FIRMWARE)) {
|
||||
LOG_DEBUG("Firmware is fresh");
|
||||
}
|
||||
|
||||
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());
|
||||
|
||||
|
||||
@@ -96,6 +96,8 @@ using DeviceValueNumOp = DeviceValue::DeviceValueNumOp;
|
||||
class EMSESPShell;
|
||||
class Shower;
|
||||
|
||||
static constexpr const char * EMSESP_NVS_BOOT_NEW_FIRMWARE = "fresh_firmware"; // max 15 characters
|
||||
|
||||
class EMSESP {
|
||||
public:
|
||||
EMSESP();
|
||||
|
||||
@@ -371,11 +371,21 @@ void System::get_partition_info() {
|
||||
void System::set_partition_install_date(bool override) {
|
||||
#ifndef EMSESP_STANDALONE
|
||||
auto current_partition = (const char *)esp_ota_get_running_partition()->label;
|
||||
// skip if it already has an install date
|
||||
if (!partition_info_[current_partition].install_date.empty() && !override) {
|
||||
auto is_fresh_firmware = EMSESP::nvs_.getBool(EMSESP_NVS_BOOT_NEW_FIRMWARE);
|
||||
|
||||
// reset flag after setting the install date
|
||||
EMSESP::nvs_.putBool(EMSESP_NVS_BOOT_NEW_FIRMWARE, false);
|
||||
|
||||
// skip if it already has an install date, unless override is true or the firmware is new
|
||||
// EMSESP_NVS_BOOT_NEW_FIRMWARE is set in UploadFileService::uploadComplete()
|
||||
if (!partition_info_[current_partition].install_date.empty() && !override && !is_fresh_firmware) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (is_fresh_firmware) {
|
||||
LOG_DEBUG("Firmware is fresh, setting the new install date");
|
||||
}
|
||||
|
||||
// set current date/time from NTP
|
||||
char time_string[25];
|
||||
time_t now = time(nullptr);
|
||||
|
||||
Reference in New Issue
Block a user