From 2f0852cd0334b4cb544099ca41bc1e3eebc47601 Mon Sep 17 00:00:00 2001 From: Armel FAUVEAU Date: Mon, 27 Apr 2026 04:12:51 +0200 Subject: [PATCH] Add SysInf build details page --- App/CMakeLists.txt | 1 + App/app/menu.c | 5 +++-- App/ui/menu.c | 21 +++++++++++---------- App/version.c | 3 +++ App/version.h | 3 +++ CMakeLists.txt | 15 +++++++++++++++ 6 files changed, 36 insertions(+), 12 deletions(-) diff --git a/App/CMakeLists.txt b/App/CMakeLists.txt index 956917d3..441ec36a 100644 --- a/App/CMakeLists.txt +++ b/App/CMakeLists.txt @@ -78,6 +78,7 @@ endif() target_compile_definitions(App INTERFACE "AUTHOR_STRING=\"${AUTHOR_STRING}\"" "VERSION_STRING=\"${VERSION_STRING}\"" + "BUILD_COMMIT=\"${BUILD_COMMIT}\"" ) if(NOT SQL_TONE) diff --git a/App/app/menu.c b/App/app/menu.c index 2290d12a..63a33048 100644 --- a/App/app/menu.c +++ b/App/app/menu.c @@ -460,12 +460,13 @@ int MENU_GetLimits(uint8_t menu_id, int32_t *pMin, int32_t *pMax) case MENU_VOL: { // SysInf paginates: // page 0 = identity, - // page 1 = battery, + // page 1 = build date/time, + // page 2 = battery, // +1 if F4HWN_MEM (Flash/SRAM), // +2 if F4HWN_QRCODE (Code QR + Wiki QR). int32_t vol_max = 0; #ifdef ENABLE_FEAT_F4HWN - vol_max += 1; + vol_max += 2; #endif #ifdef ENABLE_FEAT_F4HWN_MEM vol_max += 1; diff --git a/App/ui/menu.c b/App/ui/menu.c index b8f06763..7914e11e 100644 --- a/App/ui/menu.c +++ b/App/ui/menu.c @@ -1134,6 +1134,7 @@ void UI_DisplayMenu(void) // SysInf is paginated. Pages appear in this order, only when their // feature flag is enabled: // 0 -> identity + // next -> Build date/time (ENABLE_FEAT_F4HWN) // next -> Battery (ENABLE_FEAT_F4HWN) // next -> Flash / SRAM usage (ENABLE_FEAT_F4HWN_MEM) // next, +1 -> CODE / WIKI QR codes (ENABLE_FEAT_F4HWN_QRCODE) @@ -1153,6 +1154,16 @@ void UI_DisplayMenu(void) break; } #ifdef ENABLE_FEAT_F4HWN + if (page == p++) { + UI_PrintStringSmallNormalInverse("BUILD", 70, 0, 1); + UI_PrintStringSmallNormal(BuildDate, 49, 127, 3); + UI_PrintStringSmallNormal(BuildTime, 49, 127, 4); + UI_PrintStringSmallNormal(BuildCommit, 49, 127, 6); + + already_printed = true; + break; + } + if (page == p++) { char val[16]; @@ -1433,16 +1444,6 @@ void UI_DisplayMenu(void) y = (small ? 3 : 2) - (lines / 2); - // Page 0 gets a fixed vertical position; other SysInf pages own their layout. - if(UI_MENU_GetCurrentMenuId() == MENU_VOL && gSubMenuSelection == 0) - { - //#ifdef ENABLE_FEAT_F4HWN - // UI_PrintStringSmallNormal(VERSION_STRING_2, 54, 127, 6); - //#endif - - y = 1; - } - // draw the text lines for (i = 0; i < len && lines > 0; lines--) { diff --git a/App/version.c b/App/version.c index 4fd59293..5b854a05 100644 --- a/App/version.c +++ b/App/version.c @@ -8,6 +8,9 @@ #ifdef ENABLE_FEAT_F4HWN const char Version[] = AUTHOR_STRING_2 " " VERSION_STRING_2; const char Edition[] = EDITION_STRING; + const char BuildDate[] = __DATE__; + const char BuildTime[] = __TIME__; + const char BuildCommit[] = BUILD_COMMIT; #else const char Version[] = AUTHOR_STRING VER; #endif diff --git a/App/version.h b/App/version.h index 0af7d1c2..80467895 100644 --- a/App/version.h +++ b/App/version.h @@ -24,4 +24,7 @@ extern const char UART_Version[]; #ifdef ENABLE_FEAT_F4HWN extern const char Edition[]; +extern const char BuildDate[]; +extern const char BuildTime[]; +extern const char BuildCommit[]; #endif diff --git a/CMakeLists.txt b/CMakeLists.txt index cd3067dc..eb6ad2ed 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,6 +19,21 @@ message("Build type: " ${CMAKE_BUILD_TYPE}) enable_language(C ASM) +find_package(Git QUIET) +set(BUILD_COMMIT "unknown") +if(GIT_FOUND AND EXISTS "${CMAKE_SOURCE_DIR}/.git") + execute_process( + COMMAND "${GIT_EXECUTABLE}" rev-parse --short HEAD + WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" + OUTPUT_VARIABLE BUILD_COMMIT + OUTPUT_STRIP_TRAILING_WHITESPACE + ERROR_QUIET + ) + if(NOT BUILD_COMMIT) + set(BUILD_COMMIT "unknown") + endif() +endif() + if(ENABLE_FEAT_F4HWN) if(NOT AUTHOR_STRING_1) set(AUTHOR_STRING_1 "EGZUMER")