From d96d54cadabcfab04d0d7e7a5d9eceacb76b5d44 Mon Sep 17 00:00:00 2001 From: Armel FAUVEAU Date: Thu, 22 Feb 2024 20:21:34 +0100 Subject: [PATCH] Fix status bar --- bitmaps.c | 347 ++++++++++++---------------------------------------- bitmaps.h | 48 ++------ ui/status.c | 44 +++---- 3 files changed, 116 insertions(+), 323 deletions(-) diff --git a/bitmaps.c b/bitmaps.c index 36f5fd7..2952fc3 100644 --- a/bitmaps.c +++ b/bitmaps.c @@ -4,56 +4,69 @@ // all these images are on their right sides // turn your monitor 90-deg anti-clockwise to see the images -const uint8_t BITMAP_POWERSAVE[8] = + +const uint8_t gFontPowerSave[2][6] = { - // "PS" - 0b00000000, - 0b01111111, - 0b00010001, - 0b00001110, - 0b00000000, - 0b01000110, - 0b01001001, - 0b00110001 - + {0x00, 0x7f, 0x9, 0x9, 0x9, 0x6}, + {0x00, 0x26, 0x49, 0x49, 0x49, 0x32}, }; -const uint8_t BITMAP_TX[8] = -{ // "TX" - 0b00000000, - 0b00000001, - 0b00000001, - 0b01111111, - 0b00000001, - 0b00000001, - 0b00000000, - 0b00000000 +const uint8_t gFontTx[1][5] = +{ + {0x3, 0x1, 0x7f, 0x1, 0x3}, }; -const uint8_t BITMAP_RX[8] = -{ // "RX" - 0b00000000, - 0b01111111, - 0b00001001, - 0b00011001, - 0b01100110, - 0b00000000, - 0b00000000, - 0b00000000 +const uint8_t gFontRx[1][5] = +{ + {0x7f, 0x9, 0x19, 0x29, 0x46}, }; -const uint8_t BITMAP_FM[10] = -{ // "FM" - 0b00000000, - 0b01111111, - 0b00001001, - 0b00000001, - 0b00000000, - 0b01111111, - 0b00000010, - 0b00001100, - 0b00000010, - 0b01111111 +const uint8_t gFontPttOnePush[2][6] = +{ + {0x00, 0x3e, 0x41, 0x41, 0x41, 0x3e}, + {0x00, 0x7f, 0x9, 0x9, 0x9, 0x6}, +}; + +const uint8_t gFontPttClassic[2][6] = +{ + {0x00, 0x3e, 0x41, 0x41, 0x41, 0x22}, + {0x00, 0x7f, 0x40, 0x40, 0x40, 0x40}, +}; + +const uint8_t gFontFM[2][6] = +{ + {0x00, 0x7f, 0x9, 0x9, 0x9, 0x1}, + {0x00, 0x7f, 0x2, 0x1c, 0x2, 0x7f}, +}; + +const uint8_t gFontKeyLock[1][6] = +{ + {0x7c, 0x46, 0x45, 0x45, 0x46, 0x7c} +}; + +const uint8_t gFontF[1][7] = +{ + {0x7f, 0x7f, 0x41, 0x75, 0x75, 0x7f, 0x7f}, +}; + +const uint8_t gFontXB[2][6] = +{ // "XB" + {0x00, 0x63, 0x14, 0x8, 0x14, 0x63}, + {0x00, 0x7f, 0x49, 0x49, 0x49, 0x36}, +}; + +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}, +}; + +const uint8_t gFontHold[2][5] = +{ // "><" .. DW on hold + {0x0, 0x41, 0x22, 0x14, 0x8}, + {0x0, 0x8, 0x14, 0x22, 0x41}, }; const uint8_t BITMAP_BatteryLevel[2] = @@ -62,54 +75,30 @@ const uint8_t BITMAP_BatteryLevel[2] = 0b01011101 }; -#ifndef ENABLE_REVERSE_BAT_SYMBOL - // Quansheng way (+ pole to the left) - const uint8_t BITMAP_BatteryLevel1[17] = - { - 0b00000000, - 0b00111110, - 0b00100010, - 0b01000001, - 0b01000001, - 0b01000001, - 0b01000001, - 0b01000001, - 0b01000001, - 0b01000001, - 0b01000001, - 0b01000001, - 0b01000001, - 0b01000001, - 0b01000001, - 0b01000001, - 0b01111111 - }; -#else - // reversed (+ pole to the right) - const uint8_t BITMAP_BatteryLevel1[17] = - { - 0b00000000, - 0b01111111, - 0b01000001, - 0b01000001, - 0b01000001, - 0b01000001, - 0b01000001, - 0b01000001, - 0b01000001, - 0b01000001, - 0b01000001, - 0b01000001, - 0b01000001, - 0b01000001, - 0b01000001, - 0b00100010, - 0b00111110 - }; -#endif +// Quansheng way (+ pole to the left) +const uint8_t BITMAP_BatteryLevel1[17] = +{ + 0b00000000, + 0b00111110, + 0b00100010, + 0b01000001, + 0b01000001, + 0b01000001, + 0b01000001, + 0b01000001, + 0b01000001, + 0b01000001, + 0b01000001, + 0b01000001, + 0b01000001, + 0b01000001, + 0b01000001, + 0b01000001, + 0b01111111 +}; const uint8_t BITMAP_USB_C[9] = -{ // USB symbol +{ 0b00000000, 0b00011100, 0b00100111, @@ -121,185 +110,11 @@ const uint8_t BITMAP_USB_C[9] = 0b00011100 }; -const uint8_t BITMAP_KeyLock[6] = -{ // teeny padlock symbol - 0b00000000, - 0b01111100, - 0b01000110, - 0b01000101, - 0b01000110, - 0b01111100 -}; - -const uint8_t BITMAP_F_Key[6] = -{ // F-Key symbol - 0b00000000, - 0b01011111, - 0b01000101, - 0b01000101, - 0b01000101, - 0b01000001 -}; - #ifdef ENABLE_VOX - -#ifdef ENABLE_FEAT_F4HWN - const uint8_t BITMAP_VOX[12] = - { // "VX" - 0b00000000, - 0b00011111, - 0b00100000, - 0b01000000, - 0b00100000, - 0b00011111, - 0b00000000, - 0b01100011, - 0b00010100, - 0b00001000, - 0b00010100, - 0b01100011 - }; -#else - const uint8_t BITMAP_VOX[18] = - { // "VOX" - 0b00000000, - 0b00011111, - 0b00100000, - 0b01000000, - 0b00100000, - 0b00011111, - 0b00000000, - 0b00111110, - 0b01000001, - 0b01000001, - 0b01000001, - 0b00111110, - 0b00000000, - 0b01100011, - 0b00010100, - 0b00001000, - 0b00010100, - 0b01100011 - }; -#endif -#endif - - -#ifdef ENABLE_FEAT_F4HWN - const uint8_t BITMAP_PTT_ONE_PUSH[12] = - { // "OnePush" - 0b00000000, - 0b00111110, - 0b01000001, - 0b01000001, - 0b01000001, - 0b00111110, - 0b00000000, - 0b01111110, - 0b00010001, - 0b00010001, - 0b00010001, - 0b00001110, - }; - - const uint8_t BITMAP_PTT_CLASSIC[12] = - { // "Classic" - 0b00000000, - 0b00111110, - 0b01000001, - 0b01000001, - 0b01000001, - 0b00100010, - 0b00000000, - 0b00111111, - 0b01000000, - 0b01000000, - 0b01000000, - 0b01000000, - }; -#endif - -// 'XB' (cross-band/cross-VFO) -const uint8_t BITMAP_XB[12] = -{ // "XB" - 0b00000000, - 0b01100011, - 0b00010100, - 0b00001000, - 0b00010100, - 0b01100011, - 0b00000000, - 0b01111111, - 0b01001001, - 0b01001001, - 0b01001001, - 0b00110110 -}; - - -const uint8_t BITMAP_TDR1[16] = -{ // "DWR" - 0b00000000, - 0b01111111, - 0b01000001, - 0b01000001, - 0b00111110, - 0b00000000, - 0b01111111, - 0b00100000, - 0b00011000, - 0b00100000, - 0b01111111, - 0b00000000, - 0b01111111, - 0b00011001, - 0b00101001, - 0b01000110 -}; - -const uint8_t BITMAP_TDR2[10] = -{ // "><" .. DW on hold - 0b00000000, - 0b00100010, - 0b00110110, - 0b00011100, - 0b00001000, - 0b00000000, - 0b00001000, - 0b00011100, - 0b00110110, - 0b00100010, -}; - -#ifdef ENABLE_VOICE - const uint8_t BITMAP_VoicePrompt[9] = + const uint8_t gFontVox[2][6] = { - 0b00000000, - 0b00011000, - 0b00011000, - 0b00100100, - 0b00100100, - 0b01000010, - 0b01000010, - 0b11111111, - 0b00011000 - }; -#endif - -#ifdef ENABLE_NOAA - const uint8_t BITMAP_NOAA[11] = - { // "NS" - 0b00000000, - 0b01111111, - 0b00000100, - 0b00001000, - 0b00010000, - 0b01111111, - 0b00000000, - 0b01000110, - 0b01001001, - 0b01001001, - 0b00110001 + {0x00, 0x1f, 0x20, 0x40, 0x20, 0x1f}, + {0x00, 0x63, 0x14, 0x8, 0x14, 0x63}, }; #endif diff --git a/bitmaps.h b/bitmaps.h index dc15f3b..f862072 100644 --- a/bitmaps.h +++ b/bitmaps.h @@ -4,53 +4,31 @@ #include -extern const uint8_t BITMAP_POWERSAVE[8]; -extern const uint8_t BITMAP_TX[8]; -extern const uint8_t BITMAP_RX[8]; -extern const uint8_t BITMAP_FM[10]; +extern const uint8_t gFontPowerSave[2][6]; +extern const uint8_t gFontTx[1][5]; +extern const uint8_t gFontRx[1][5]; +extern const uint8_t gFontPttOnePush[2][6]; +extern const uint8_t gFontPttClassic[2][6]; +extern const uint8_t gFontFM[2][6]; +extern const uint8_t gFontKeyLock[1][6]; +extern const uint8_t gFontF[1][7]; +extern const uint8_t gFontXB[2][6]; +extern const uint8_t gFontDWR[3][6]; +extern const uint8_t gFontHold[2][5]; + extern const uint8_t BITMAP_BatteryLevel[2]; extern const uint8_t BITMAP_BatteryLevel1[17]; - extern const uint8_t BITMAP_USB_C[9]; -extern const uint8_t BITMAP_KeyLock[6]; - -extern const uint8_t BITMAP_F_Key[6]; - #ifdef ENABLE_VOX -#ifdef ENABLE_FEAT_F4HWN - extern const uint8_t BITMAP_VOX[12]; -#else - extern const uint8_t BITMAP_VOX[18]; -#endif -#endif - -#ifdef ENABLE_FEAT_F4HWN - extern const uint8_t BITMAP_PTT_ONE_PUSH[12]; - extern const uint8_t BITMAP_PTT_CLASSIC[12]; -#endif - -extern const uint8_t BITMAP_XB[12]; - -extern const uint8_t BITMAP_TDR1[16]; -extern const uint8_t BITMAP_TDR2[10]; - -#ifdef ENABLE_VOICE - extern const uint8_t BITMAP_VoicePrompt[9]; -#endif - -#ifdef ENABLE_NOAA - extern const uint8_t BITMAP_NOAA[11]; + extern const uint8_t gFontVox[2][6]; #endif extern const uint8_t BITMAP_Antenna[5]; - extern const uint8_t BITMAP_VFO_Default[8]; extern const uint8_t BITMAP_VFO_NotDefault[8]; - extern const uint8_t BITMAP_ScanList1[6]; extern const uint8_t BITMAP_ScanList2[6]; - extern const uint8_t BITMAP_compand[6]; #ifndef ENABLE_CUSTOM_MENU_LAYOUT diff --git a/ui/status.c b/ui/status.c index f52fed4..ee02459 100644 --- a/ui/status.c +++ b/ui/status.c @@ -45,13 +45,13 @@ void UI_DisplayStatus() // POWER-SAVE indicator if (gCurrentFunction == FUNCTION_TRANSMIT) { - memcpy(line + x, BITMAP_TX, sizeof(BITMAP_TX)); + memcpy(line + x, gFontTx, sizeof(gFontTx)); } else if (FUNCTION_IsRx()) { - memcpy(line + x, BITMAP_RX, sizeof(BITMAP_RX)); + memcpy(line + x, gFontRx, sizeof(gFontRx)); } else if (gCurrentFunction == FUNCTION_POWER_SAVE) { - memcpy(line + x, BITMAP_POWERSAVE, sizeof(BITMAP_POWERSAVE)); + memcpy(line + x, gFontPowerSave, sizeof(gFontPowerSave)); } x += 8; unsigned int x1 = x; @@ -73,8 +73,8 @@ void UI_DisplayStatus() #endif #ifdef ENABLE_FMRADIO if (gFmRadioMode) { // FM indicator - memcpy(line + x, BITMAP_FM, sizeof(BITMAP_FM)); - x1 = x + sizeof(BITMAP_FM); + memcpy(line + x, gFontFM, sizeof(gFontFM)); + x1 = x + sizeof(gFontFM); } else #endif @@ -110,50 +110,50 @@ void UI_DisplayStatus() uint8_t dw = (gEeprom.DUAL_WATCH != DUAL_WATCH_OFF) + (gEeprom.CROSS_BAND_RX_TX != CROSS_BAND_OFF) * 2; if(dw == 1 || dw == 3) { // DWR - dual watch + respond if(gDualWatchActive) - memcpy(line + x + (dw==1?0:2), BITMAP_TDR1, sizeof(BITMAP_TDR1) - (dw==1?0:5)); + memcpy(line + x + (dw==1?0:2), gFontDWR, sizeof(gFontDWR) - (dw==1?0:5)); else - memcpy(line + x + 3, BITMAP_TDR2, sizeof(BITMAP_TDR2)); + memcpy(line + x + 3, gFontHold, sizeof(gFontHold)); } else if(dw == 2) { // XB - crossband - memcpy(line + x + 2, BITMAP_XB, sizeof(BITMAP_XB)); + memcpy(line + x + 2, gFontXB, sizeof(gFontXB)); } } - x += sizeof(BITMAP_TDR1) + 1; + x += sizeof(gFontDWR) + 3; #ifdef ENABLE_VOX // VOX indicator if (gEeprom.VOX_SWITCH) { - memcpy(line + x, BITMAP_VOX, sizeof(BITMAP_VOX)); - x1 = x + sizeof(BITMAP_VOX) + 1; + memcpy(line + x, gFontVox, sizeof(gFontVox)); + x1 = x + sizeof(gFontVox) + 1; } - x += sizeof(BITMAP_VOX) + 1; + x += sizeof(gFontVox) + 3; #endif #ifdef ENABLE_FEAT_F4HWN // PTT indicator if (gSetting_set_ptt_session) { - memcpy(line + x, BITMAP_PTT_ONE_PUSH, sizeof(BITMAP_PTT_ONE_PUSH)); - x1 = x + sizeof(BITMAP_PTT_ONE_PUSH) + 1; + memcpy(line + x, gFontPttOnePush, sizeof(gFontPttOnePush)); + x1 = x + sizeof(gFontPttOnePush) + 1; } else { - memcpy(line + x, BITMAP_PTT_CLASSIC, sizeof(BITMAP_PTT_CLASSIC)); - x1 = x + sizeof(BITMAP_PTT_CLASSIC) + 1; + memcpy(line + x, gFontPttClassic, sizeof(gFontPttClassic)); + x1 = x + sizeof(gFontPttClassic) + 1; } - x += sizeof(BITMAP_PTT_CLASSIC) + 1; + x += sizeof(gFontPttClassic) + 3; #endif - x = MAX(x1, 61u); + x = MAX(x1, 70u); // KEY-LOCK indicator if (gEeprom.KEY_LOCK) { - memcpy(line + x, BITMAP_KeyLock, sizeof(BITMAP_KeyLock)); - x += sizeof(BITMAP_KeyLock); + memcpy(line + x, gFontKeyLock, sizeof(gFontKeyLock)); + x += sizeof(gFontKeyLock); x1 = x; } else if (gWasFKeyPressed) { - memcpy(line + x, BITMAP_F_Key, sizeof(BITMAP_F_Key)); - x += sizeof(BITMAP_F_Key); + memcpy(line + x, gFontF, sizeof(gFontF)); + x += sizeof(gFontF); x1 = x; }