Rename /version endpoint to /firmware_info; add heap memory statistics to firmware data and UI.

This commit is contained in:
Kai Börnert
2026-04-27 15:46:29 +02:00
parent f0c9ed4e7f
commit c04109a76c
7 changed files with 64 additions and 8 deletions

View File

@@ -1327,12 +1327,17 @@ async fn get_version(
let hash = &env!("VERGEN_GIT_SHA")[0..8];
let board = board.board_hal.get_esp();
let heap = esp_alloc::HEAP.stats();
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),
heap_total: heap.size,
heap_used: heap.current_usage,
heap_free: heap.size.saturating_sub(heap.current_usage),
heap_max_used: heap.max_usage,
}
}
@@ -1343,4 +1348,8 @@ struct VersionInfo {
current: String,
slot0_state: String,
slot1_state: String,
heap_total: usize,
heap_used: usize,
heap_free: usize,
heap_max_used: usize,
}