keep ota around for alter queries to it
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
#![no_std]
|
||||
#![no_main]
|
||||
#![feature(never_type)]
|
||||
#![deny(
|
||||
clippy::mem_forget,
|
||||
reason = "mem::forget is generally not safe to do with esp_hal types, especially those \
|
||||
@@ -30,6 +31,7 @@ use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex;
|
||||
use embassy_sync::mutex::{Mutex, MutexGuard};
|
||||
use embassy_sync::once_lock::OnceLock;
|
||||
use embassy_time::Timer;
|
||||
use esp_alloc::heap_allocator;
|
||||
use esp_bootloader_esp_idf::ota::OtaImageState;
|
||||
use esp_hal::rom::ets_delay_us;
|
||||
use esp_hal::system::software_reset;
|
||||
@@ -601,7 +603,8 @@ async fn safe_main(spawner: Spawner) -> anyhow::Result<()> {
|
||||
board.board_hal.get_esp().set_restart_to_conf(false);
|
||||
board
|
||||
.board_hal
|
||||
.deep_sleep(1000 * 1000 * 60 * deep_sleep_duration_minutes as u64);
|
||||
.deep_sleep(1000 * 1000 * 60 * deep_sleep_duration_minutes as u64)
|
||||
.await;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -851,13 +854,11 @@ async fn publish_firmware_info(
|
||||
.mqtt_publish("/firmware/buildtime", version.build_time.as_bytes())
|
||||
.await;
|
||||
let _ = esp.mqtt_publish("/firmware/last_online", timezone_time.as_bytes());
|
||||
let state = esp.get_ota_state();
|
||||
let _ = esp
|
||||
.mqtt_publish(
|
||||
"/firmware/ota_state",
|
||||
state_to_string(esp.ota_state).as_bytes(),
|
||||
)
|
||||
.mqtt_publish("/firmware/ota_state", state.as_bytes())
|
||||
.await;
|
||||
let slot = esp.slot;
|
||||
let slot = esp.get_ota_slot();
|
||||
let _ = esp
|
||||
.mqtt_publish("/firmware/ota_slot", format!("slot{slot}").as_bytes())
|
||||
.await;
|
||||
@@ -1123,17 +1124,11 @@ async fn get_version(
|
||||
let hash = &env!("VERGEN_GIT_SHA")[0..8];
|
||||
|
||||
let board = board.board_hal.get_esp();
|
||||
let ota_slot = board.slot;
|
||||
let address = board.slot_addres;
|
||||
let partition = if ota_slot == 0 {
|
||||
"ota_1 @ "
|
||||
} else {
|
||||
"ota_0 @ "
|
||||
};
|
||||
let ota_slot = board.get_ota_slot();
|
||||
VersionInfo {
|
||||
git_hash: branch + "@" + hash,
|
||||
build_time: env!("VERGEN_BUILD_TIMESTAMP").to_owned(),
|
||||
partition: partition.to_owned() + &address.to_string(),
|
||||
partition: ota_slot,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user