Merge branch 'develop' of ssh://git.mannheim.ccc.de:1337/C3MA/PlantCtrl into develop

This commit is contained in:
2026-03-15 20:04:02 +01:00
14 changed files with 214 additions and 277 deletions

View File

@@ -42,6 +42,7 @@ use embassy_sync::once_lock::OnceLock;
use embassy_time::{Duration, Instant, Timer, WithTimeout};
use esp_hal::rom::ets_delay_us;
use esp_hal::system::software_reset;
use esp_hal_ota::OtaImgState;
use esp_println::{logger, println};
use hal::battery::BatteryState;
use log::LogMessage;
@@ -1242,13 +1243,35 @@ async fn get_version(
let branch = env!("VERGEN_GIT_BRANCH").to_owned();
let hash = &env!("VERGEN_GIT_SHA")[0..8];
let board = board.board_hal.get_esp();
let esp = board.board_hal.get_esp();
let current_partition: String = match esp.ota.get_currently_booted_partition() {
Some(partition) => match partition {
0 => "OTA0".to_string(),
1 => "OTA1".to_string(),
_ => format!("Pentry: {:?}", partition),
},
None => "Missing otainfo".to_string(),
};
let state = esp.ota.get_ota_image_state();
let current_state: String = match state {
Ok(state) => match state {
OtaImgState::EspOtaImgNew => "New".to_string(),
OtaImgState::EspOtaImgPendingVerify => "PendingVerify".to_string(),
OtaImgState::EspOtaImgValid => "Valid".to_string(),
OtaImgState::EspOtaImgInvalid => "Invalid".to_string(),
OtaImgState::EspOtaImgAborted => "Aborted".to_string(),
OtaImgState::EspOtaImgUndefined => "Undefined".to_string(),
},
Err(err) => {
format!("Error: {:?}", err)
}
};
VersionInfo {
git_hash: branch + "@" + hash,
build_time: env!("VERGEN_BUILD_TIMESTAMP").to_owned(),
current: format!("{:?}", board.current),
slot0_state: format!("{:?}", board.slot0_state),
slot1_state: format!("{:?}", board.slot1_state),
current: format!("{:?}", current_partition),
state: format!("{:?}", current_state),
}
}
@@ -1257,6 +1280,5 @@ struct VersionInfo {
git_hash: String,
build_time: String,
current: String,
slot0_state: String,
slot1_state: String,
state: String,
}