From 1c0d5ea6289eaea55452f4387deb353c46b0726f Mon Sep 17 00:00:00 2001 From: Armel FAUVEAU Date: Mon, 27 Apr 2026 03:54:13 +0200 Subject: [PATCH] Move SysInf battery data to dedicated page (and patch m lower...) --- App/app/menu.c | 8 +++++++- App/font.c | 2 +- App/ui/menu.c | 43 +++++++++++++++++++++++++++---------------- 3 files changed, 35 insertions(+), 18 deletions(-) diff --git a/App/app/menu.c b/App/app/menu.c index 94a8e816..2290d12a 100644 --- a/App/app/menu.c +++ b/App/app/menu.c @@ -458,9 +458,15 @@ int MENU_GetLimits(uint8_t menu_id, int32_t *pMin, int32_t *pMax) #endif case MENU_VOL: { - // SysInf paginates: page 0 = identity, +1 if F4HWN_MEM (Flash/SRAM), + // SysInf paginates: + // page 0 = identity, + // page 1 = 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; + #endif #ifdef ENABLE_FEAT_F4HWN_MEM vol_max += 1; #endif diff --git a/App/font.c b/App/font.c index cbc66b59..d34cbd4c 100644 --- a/App/font.c +++ b/App/font.c @@ -362,7 +362,7 @@ const uint8_t gFontSmall[95-1][6] = {0x20, 0x40, 0x40, 0x3D, 0x00, 0x00}, // 'j' {0x00, 0x7F, 0x10, 0x28, 0x44, 0x00}, // 'k' {0x00, 0x00, 0x3F, 0x40, 0x00, 0x00}, // 'l' - {0x7C, 0x08, 0x10, 0x10, 0x08, 0x7C}, // 'm' + {0x7C, 0x04, 0x7C, 0x04, 0x78, 0x00}, // 'm' {0x7C, 0x04, 0x04, 0x04, 0x78, 0x00}, // 'n' {0x38, 0x44, 0x44, 0x44, 0x38, 0x00}, // 'o' {0x7C, 0x14, 0x14, 0x14, 0x08, 0x00}, // 'p' diff --git a/App/ui/menu.c b/App/ui/menu.c index 993232cc..b94dfb98 100644 --- a/App/ui/menu.c +++ b/App/ui/menu.c @@ -1132,18 +1132,19 @@ void UI_DisplayMenu(void) case MENU_VOL: { // SysInf is paginated. Pages appear in this order, only when their - // feature flag is enabled — so indices compact automatically: - // 0 → identity (always) - // next → Flash / SRAM usage (ENABLE_FEAT_F4HWN_MEM) - // next, +1 → CODE / WIKI QR codes (ENABLE_FEAT_F4HWN_QRCODE) - // The post-incremented `p` walks through every enabled page slot. + // feature flag is enabled: + // 0 -> identity + // next -> Battery (ENABLE_FEAT_F4HWN) + // next -> Flash / SRAM usage (ENABLE_FEAT_F4HWN_MEM) + // next, +1 -> CODE / WIKI QR codes (ENABLE_FEAT_F4HWN_QRCODE) + // In non-F4HWN builds, page 0 keeps the old battery-voltage display. const uint8_t page = (uint8_t)gSubMenuSelection; uint8_t p = 0; if (page == p++) { // Page 0: firmware identity. #ifdef ENABLE_FEAT_F4HWN - sprintf(String, "%s\n%s", AUTHOR_STRING_2, VERSION_STRING_2); + sprintf(String, "%s\n%s", AUTHOR_STRING_2, Edition); #else sprintf(String, "%u.%02uV\n%u%%", gBatteryVoltageAverage / 100, gBatteryVoltageAverage % 100, @@ -1151,6 +1152,23 @@ void UI_DisplayMenu(void) #endif break; } +#ifdef ENABLE_FEAT_F4HWN + if (page == p++) { + char val[16]; + + UI_PrintStringSmallNormalInverse("BATTERY", 63, 0, 1); + + sprintf(val, "%u.%02uV %u%%", + gBatteryVoltageAverage / 100, gBatteryVoltageAverage % 100, + BATTERY_VoltsToPercent(gBatteryVoltageAverage)); + UI_PrintStringSmallNormal(val, 49, 127, 3); + + UI_PrintStringSmallNormal(gSubMenu_BATTYP[gEeprom.BATTERY_TYPE], 49, 127, 5); + + already_printed = true; + break; + } +#endif #ifdef ENABLE_FEAT_F4HWN_MEM if (page == p++) { uint16_t flash_pct = 0; @@ -1415,21 +1433,14 @@ void UI_DisplayMenu(void) y = (small ? 3 : 2) - (lines / 2); - // only for SysInf, page 0 (identity); other pages own their layout + // Page 0 gets a fixed vertical position; other SysInf pages own their layout. if(UI_MENU_GetCurrentMenuId() == MENU_VOL && gSubMenuSelection == 0) { - sprintf(edit, "%u.%02uV %u%%", - gBatteryVoltageAverage / 100, gBatteryVoltageAverage % 100, - BATTERY_VoltsToPercent(gBatteryVoltageAverage) - ); - - UI_PrintStringSmallNormal(edit, 54, 127, 1); - #ifdef ENABLE_FEAT_F4HWN - UI_PrintStringSmallNormal(Edition, 54, 127, 6); + UI_PrintStringSmallNormal(VERSION_STRING_2, 54, 127, 6); #endif - y = 2; + y = 1; } // draw the text lines