adda lot of basic webserver back

This commit is contained in:
2025-09-15 01:21:50 +02:00
parent 049a9d027c
commit 65f6670ca4
6 changed files with 279 additions and 142 deletions

View File

@@ -147,15 +147,14 @@ async fn safe_main(spawner: Spawner) -> anyhow::Result<()> {
info!("Startup Rust");
let mut to_config = false;
let mut board = BOARD_ACCESS.get().await.lock().await;
let version = get_version();
let version = get_version(&mut board).await;
info!(
"Version using git has {} build on {}",
version.git_hash, version.build_time
);
let _esp = BOARD_ACCESS.get().await.lock().await.board_hal.get_esp();
//TODO
// TODO
@@ -179,7 +178,7 @@ async fn safe_main(spawner: Spawner) -> anyhow::Result<()> {
//};
//log(LogMessage::PartitionState, 0, 0, "", ota_state_string);
let _ota_state_string = "unknown";
let mut board = BOARD_ACCESS.get().await.lock().await;
board.board_hal.general_fault(false).await;
let cur = board
.board_hal
@@ -1117,15 +1116,16 @@ pub fn in_time_range(cur: &DateTime<Tz>, start: u8, end: u8) -> bool {
}
}
fn get_version() -> VersionInfo {
async fn get_version(
board: &mut MutexGuard<'_, CriticalSectionRawMutex, HAL<'static>>,
) -> VersionInfo {
let branch = env!("VERGEN_GIT_BRANCH").to_owned();
let hash = &env!("VERGEN_GIT_SHA")[0..8];
//TODO
//let running_partition = unsafe { esp_ota_get_running_partition() };
let address = 0;
//let address = unsafe { (*running_partition).address };
let partition = if address > 100000 {
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 @ "