diff --git a/App/bitmaps.c b/App/bitmaps.c index 9c75c59a..d3e84911 100644 --- a/App/bitmaps.c +++ b/App/bitmaps.c @@ -5,14 +5,10 @@ // turn your monitor 90-deg anti-clockwise to see the images #ifdef ENABLE_FEAT_F4HWN_MULTIBOOT_HOT_CFG -const uint8_t gFontConfigBank[6][6] = -{ // "C", then "M" and banks 1..4 +const uint8_t gFontConfigBank[2][6] = +{ // "C" and "M"; numbered banks use the regular small font {0x00, 0x3e, 0x41, 0x41, 0x41, 0x22}, {0x00, 0x7f, 0x02, 0x1c, 0x02, 0x7f}, - {0x00, 0x40, 0x42, 0x7f, 0x40, 0x40}, - {0x00, 0x62, 0x51, 0x49, 0x49, 0x46}, - {0x00, 0x22, 0x41, 0x49, 0x49, 0x36}, - {0x00, 0x18, 0x14, 0x12, 0x7f, 0x10}, }; #else const uint8_t gFontPowerSave[2][6] = @@ -25,7 +21,7 @@ const uint8_t gFontPowerSave[2][6] = const uint8_t gFontPttOnePush[2][6] = { {0x00, 0x3e, 0x41, 0x41, 0x41, 0x3e}, - {0x00, 0x7f, 0x9, 0x9, 0x9, 0x6}, + {0x00, 0x7f, 0x09, 0x09, 0x09, 0x06}, }; const uint8_t gFontPttClassic[2][6] = @@ -103,23 +99,21 @@ const uint8_t gFontMute[12] = const uint8_t gFontXB[2][6] = { // "XB" - {0x00, 0x63, 0x14, 0x8, 0x14, 0x63}, + {0x00, 0x63, 0x14, 0x08, 0x14, 0x63}, {0x00, 0x7f, 0x49, 0x49, 0x49, 0x36}, }; - const uint8_t gFontMO[2][6] = { // "MO" - {0x00, 0x7f, 0x2, 0x1c, 0x2, 0x7f}, + {0x00, 0x7f, 0x02, 0x1c, 0x02, 0x7f}, {0x00, 0x3e, 0x41, 0x41, 0x41, 0x3e}, }; const uint8_t gFontDWR[3][6] = { // "DWR" - {0x00, 0x7f, 0x41, 0x41, 0x41, 0x3e}, {0x00, 0x3f, 0x40, 0x38, 0x40, 0x3f}, - {0x00, 0x7f, 0x9, 0x19, 0x29, 0x46}, + {0x00, 0x7f, 0x09, 0x19, 0x29, 0x46}, }; #ifdef ENABLE_FEAT_F4HWN_FULL_WATCH @@ -132,11 +126,11 @@ const uint8_t gFontFWR[3][6] = #endif #ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS - const uint8_t gFontRO[2][6] = - { // "RO" - {0x00, 0x7f, 0x9, 0x19, 0x29, 0x46}, - {0x00, 0x3e, 0x41, 0x41, 0x41, 0x3e}, - }; +const uint8_t gFontRO[2][6] = +{ // "RO" + {0x00, 0x7f, 0x09, 0x19, 0x29, 0x46}, + {0x00, 0x3e, 0x41, 0x41, 0x41, 0x3e}, +}; #endif const uint8_t gFontHold[2][5] = @@ -187,11 +181,11 @@ const uint8_t BITMAP_USB_C[9] = }; #ifdef ENABLE_VOX - const uint8_t gFontVox[2][6] = - { - {0x00, 0x1f, 0x20, 0x40, 0x20, 0x1f}, - {0x00, 0x63, 0x14, 0x8, 0x14, 0x63}, - }; +const uint8_t gFontVox[2][6] = +{ + {0x00, 0x1f, 0x20, 0x40, 0x20, 0x1f}, + {0x00, 0x63, 0x14, 0x08, 0x14, 0x63}, +}; #endif const uint8_t BITMAP_VFO_Lock[7] = diff --git a/App/bitmaps.h b/App/bitmaps.h index ac744e5d..1ffa4991 100644 --- a/App/bitmaps.h +++ b/App/bitmaps.h @@ -5,7 +5,7 @@ #include #ifdef ENABLE_FEAT_F4HWN_MULTIBOOT_HOT_CFG -extern const uint8_t gFontConfigBank[6][6]; +extern const uint8_t gFontConfigBank[2][6]; #else extern const uint8_t gFontPowerSave[2][6]; #endif @@ -26,7 +26,7 @@ extern const uint8_t gFontDWR[3][6]; extern const uint8_t gFontFWR[3][6]; #endif #ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS - extern const uint8_t gFontRO[2][6]; +extern const uint8_t gFontRO[2][6]; #endif extern const uint8_t gFontHold[2][5]; @@ -40,7 +40,7 @@ extern const uint8_t BITMAP_NotReady[7]; */ #ifdef ENABLE_VOX - extern const uint8_t gFontVox[2][6]; +extern const uint8_t gFontVox[2][6]; #endif extern const uint8_t BITMAP_VFO_Default[7]; diff --git a/App/ui/status.c b/App/ui/status.c index 8134afd8..98137245 100644 --- a/App/ui/status.c +++ b/App/ui/status.c @@ -26,6 +26,9 @@ #endif #include "app/scanner.h" #include "bitmaps.h" +#ifdef ENABLE_FEAT_F4HWN_MULTIBOOT_HOT_CFG +#include "driver/mb_flash.h" +#endif #include "driver/keyboard.h" #include "driver/st7565.h" #include "external/printf/printf.h" @@ -119,7 +122,7 @@ void UI_DisplayStatus() if (gSetting_set_tmr && (isTransmit || FUNCTION_IsRx())) { #endif convertTime(line, !isTransmit); - x += 39; + x += 35u; } else { #endif @@ -138,10 +141,16 @@ void UI_DisplayStatus() if (!(gScanStateDir != SCAN_OFF || SCANNER_IsScanning())) { const uint8_t bank = MB_GetActiveBank(); - if (bank < ARRAY_SIZE(gFontConfigBank) - 1u) { + if (bank < MB_BANK_COUNT) { memcpy(line + x, gFontConfigBank[0], sizeof(gFontConfigBank[0])); - memcpy(line + x + sizeof(gFontConfigBank[0]), - gFontConfigBank[bank + 1u], sizeof(gFontConfigBank[0])); + if (bank == 0u) { + memcpy(line + x + sizeof(gFontConfigBank[0]), + gFontConfigBank[1], sizeof(gFontConfigBank[0])); + } else { + str[0] = (char)('0' + bank); + str[1] = '\0'; + UI_PrintStringSmallBufferNormal(str, line + x + 6u); + } } } #else @@ -151,7 +160,7 @@ void UI_DisplayStatus() } #endif } - x += 8; + x += 8u; x1 = x; @@ -220,7 +229,7 @@ void UI_DisplayStatus() x1 = x + 10; } } - x += 10; // font character width + x += 10u; #ifdef ENABLE_FEAT_F4HWN_DEBUG // Only for debug @@ -240,11 +249,12 @@ void UI_DisplayStatus() x += sizeof(BITMAP_VoicePrompt); #endif - if(!SCANNER_IsScanning()) { + if (gScanStateDir == SCAN_OFF && !SCANNER_IsScanning()) { if(!gAirCopyBootMode) { - const void *src = NULL; // Pointer to the font/bitmap to copy - size_t sSize = 0; // Size of the font/bitmap - uint8_t sOff = 2; // Offset relative to the reference position + uint8_t *const modeLine = line + x - 1u; + const void *src = NULL; + size_t sSize = 0; + uint8_t sOff = 0; #ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS if (gEeprom.MENU_LOCK) { @@ -253,37 +263,34 @@ void UI_DisplayStatus() } else #endif { - uint8_t xb = (gEeprom.CROSS_BAND_RX_TX != CROSS_BAND_OFF); + const uint8_t xb = gEeprom.CROSS_BAND_RX_TX != CROSS_BAND_OFF; if (gEeprom.DUAL_WATCH != DUAL_WATCH_OFF) { if (gDualWatchActive) { - src = gFontDWR; - sOff = xb ? 2 : 0; - sSize = sizeof(gFontDWR) - (xb ? 5 : 0); + const uint8_t (*font)[6] = gFontDWR; #ifdef ENABLE_FEAT_F4HWN_FULL_WATCH - if (gEeprom.DUAL_WATCH == DUAL_WATCH_FULL) { - src = gFontFWR; - sSize -= xb; - } + if (gEeprom.DUAL_WATCH == DUAL_WATCH_FULL) + font = gFontFWR; #endif + memcpy(modeLine + sOff, font[0], sizeof(font[0])); + memcpy(modeLine + sOff + sizeof(font[0]), + font[xb ? 1u : 2u], sizeof(font[0])); } else { src = gFontHold; - sOff = 3; + sOff = 1u; sSize = sizeof(gFontHold); } } else { - src = xb ? gFontXB : gFontMO; // XB - crossband - sSize = xb ? sizeof(gFontXB) : sizeof(gFontMO); // MO - main only + src = xb ? gFontXB : gFontMO; + sSize = xb ? sizeof(gFontXB) : sizeof(gFontMO); } } - // Perform the memcpy if a source was selected - if (src) { - memcpy(line + x + sOff, src, sSize); - } + if (src != NULL) + memcpy(modeLine + sOff, src, sSize); } } - x += sizeof(gFontDWR) + 3; + x += 17u; #endif #if defined(ENABLE_FEAT_F4HWN_RX_TX_TIMER) && !defined(ENABLE_FEAT_F4HWN_DEBUG) @@ -294,25 +301,22 @@ void UI_DisplayStatus() // VOX indicator if (gEeprom.VOX_SWITCH) { memcpy(line + x, gFontVox, sizeof(gFontVox)); - x1 = x + sizeof(gFontVox) + 1; + x1 = x + sizeof(gFontVox) + 1u; } - x += sizeof(gFontVox) + 3; + x += sizeof(gFontVox) + 5u; #endif #ifdef ENABLE_FEAT_F4HWN // PTT indicator if(!gAirCopyBootMode) { - if (gSetting_set_ptt_session) { - memcpy(line + x, gFontPttOnePush, sizeof(gFontPttOnePush)); - x1 = x + sizeof(gFontPttOnePush) + 1; - } - else - { - memcpy(line + x, gFontPttClassic, sizeof(gFontPttClassic)); - x1 = x + sizeof(gFontPttClassic) + 1; - } + const void *src = gSetting_set_ptt_session + ? (const void *)gFontPttOnePush + : (const void *)gFontPttClassic; + + memcpy(line + x, src, sizeof(gFontPttClassic)); + x1 = x + sizeof(gFontPttClassic) + 1u; } - x += sizeof(gFontPttClassic) + 3; + x += sizeof(gFontPttClassic) + 5u; #endif x = MAX(x1, 69u);