This commit is contained in:
Krzysiek Egzmont 2023-12-12 00:45:09 +01:00
parent 42a2e16e0e
commit 6bdce2d0e2
3 changed files with 82 additions and 159 deletions

View File

@ -6,27 +6,16 @@
const uint8_t BITMAP_POWERSAVE[8] = const uint8_t BITMAP_POWERSAVE[8] =
{ {
#if 0 // "PS"
// "S" 0b00000000,
0b00000000, 0b01111111,
0b00100110, 0b00010001,
0b01001001, 0b00001110,
0b01001001, 0b00000000,
0b01001001, 0b01000110,
0b01001001, 0b01001001,
0b01001001, 0b00110001
0b00110010
#else
// "PS"
0b00000000,
0b01111111,
0b00010001,
0b00001110,
0b00000000,
0b01000110,
0b01001001,
0b00110001
#endif
}; };
const uint8_t BITMAP_TX[8] = const uint8_t BITMAP_TX[8] =
@ -162,40 +151,24 @@ const uint8_t BITMAP_F_Key[6] =
}; };
#endif #endif
#if 0
const uint8_t BITMAP_WX[12] = // 'XB' (cross-band/cross-VFO)
{ // "WX" const uint8_t BITMAP_XB[12] =
0b00000000, { // "XB"
0b01111111, 0b00000000,
0b00100000, 0b01100011,
0b00011000, 0b00010100,
0b00100000, 0b00001000,
0b01111111, 0b00010100,
0b00000000, 0b01100011,
0b01100011, 0b00000000,
0b00010100, 0b01111111,
0b00001000, 0b01001001,
0b00010100, 0b01001001,
0b01100011 0b01001001,
}; 0b00110110
#else };
// 'XB' (cross-band/cross-VFO)
const uint8_t BITMAP_XB[12] =
{ // "XB"
0b00000000,
0b01100011,
0b00010100,
0b00001000,
0b00010100,
0b01100011,
0b00000000,
0b01111111,
0b01001001,
0b01001001,
0b01001001,
0b00110110
};
#endif
const uint8_t BITMAP_TDR1[15] = const uint8_t BITMAP_TDR1[15] =
{ // "DWR" { // "DWR"
@ -270,18 +243,6 @@ const uint8_t BITMAP_Antenna[5] =
0b00000011 0b00000011
}; };
const uint8_t BITMAP_MARKER[8] =
{
0b11111111,
0b11111111,
0b01111110,
0b01111110,
0b00111100,
0b00111100,
0b00011000,
0b00011000
};
const uint8_t BITMAP_VFO_Default[8] = const uint8_t BITMAP_VFO_Default[8] =
{ {
0b00000000, 0b00000000,

View File

@ -36,8 +36,6 @@ extern const uint8_t BITMAP_TDR2[9];
extern const uint8_t BITMAP_Antenna[5]; extern const uint8_t BITMAP_Antenna[5];
extern const uint8_t BITMAP_MARKER[8];
extern const uint8_t BITMAP_VFO_Default[8]; extern const uint8_t BITMAP_VFO_Default[8];
extern const uint8_t BITMAP_VFO_NotDefault[8]; extern const uint8_t BITMAP_VFO_NotDefault[8];

View File

@ -36,71 +36,52 @@
void UI_DisplayStatus() void UI_DisplayStatus()
{ {
uint8_t *line = gStatusLine; gUpdateStatus = false;
unsigned int x = 0;
unsigned int x1 = 0;
gUpdateStatus = false;
memset(gStatusLine, 0, sizeof(gStatusLine)); memset(gStatusLine, 0, sizeof(gStatusLine));
uint8_t *line = gStatusLine;
unsigned int x = 0;
// ************** // **************
// POWER-SAVE indicator // POWER-SAVE indicator
if (gCurrentFunction == FUNCTION_TRANSMIT) if (gCurrentFunction == FUNCTION_TRANSMIT) {
{ memcpy(line + x, BITMAP_TX, sizeof(BITMAP_TX));
memmove(line + x, BITMAP_TX, sizeof(BITMAP_TX));
x1 = x + sizeof(BITMAP_TX);
} }
else else if (FUNCTION_IsRx()) {
if (FUNCTION_IsRx()) memcpy(line + x, BITMAP_RX, sizeof(BITMAP_RX));
{
memmove(line + x, BITMAP_RX, sizeof(BITMAP_RX));
x1 = x + sizeof(BITMAP_RX);
} }
else else if (gCurrentFunction == FUNCTION_POWER_SAVE) {
if (gCurrentFunction == FUNCTION_POWER_SAVE) memcpy(line + x, BITMAP_POWERSAVE, sizeof(BITMAP_POWERSAVE));
{
memmove(line + x, BITMAP_POWERSAVE, sizeof(BITMAP_POWERSAVE));
x1 = x + sizeof(BITMAP_POWERSAVE);
} }
x += sizeof(BITMAP_POWERSAVE); x += 8;
unsigned int x1 = x;
#ifdef ENABLE_NOAA #ifdef ENABLE_NOAA
// NOASS SCAN indicator if (gIsNoaaMode) { // NOASS SCAN indicator
if (gIsNoaaMode) memcpy(line + x, BITMAP_NOAA, sizeof(BITMAP_NOAA));
{ x1 = x + sizeof(BITMAP_NOAA);
memmove(line + x, BITMAP_NOAA, sizeof(BITMAP_NOAA)); }
x1 = x + sizeof(BITMAP_NOAA); x += sizeof(BITMAP_NOAA);
} #endif
x += sizeof(BITMAP_NOAA);
#else
// hmmm, what to put in it's place
#endif
#ifdef ENABLE_DTMF_CALLING #ifdef ENABLE_DTMF_CALLING
if (gSetting_KILLED) if (gSetting_KILLED) {
{
memset(line + x, 0xFF, 10); memset(line + x, 0xFF, 10);
x1 = x + 10; x1 = x + 10;
} }
else else
#endif #endif
{ { // SCAN indicator
// SCAN indicator if (gScanStateDir != SCAN_OFF || SCANNER_IsScanning()) {
if (gScanStateDir != SCAN_OFF || SCANNER_IsScanning())
{
char * s = ""; char * s = "";
if (IS_MR_CHANNEL(gNextMrChannel) && !SCANNER_IsScanning()) if (IS_MR_CHANNEL(gNextMrChannel) && !SCANNER_IsScanning()) { // channel mode
{ // channel mode
switch(gEeprom.SCAN_LIST_DEFAULT) { switch(gEeprom.SCAN_LIST_DEFAULT) {
case 0: s = "1"; break; case 0: s = "1"; break;
case 1: s = "2"; break; case 1: s = "2"; break;
case 2: s = "*"; break; case 2: s = "*"; break;
} }
} }
else else { // frequency mode
{ // frequency mode
s = "S"; s = "S";
} }
UI_PrintStringSmallBuffer(s, line + x); UI_PrintStringSmallBuffer(s, line + x);
@ -109,97 +90,80 @@ void UI_DisplayStatus()
} }
x += 7; // font character width x += 7; // font character width
#ifdef ENABLE_VOICE #ifdef ENABLE_VOICE
// VOICE indicator // VOICE indicator
if (gEeprom.VOICE_PROMPT != VOICE_PROMPT_OFF) if (gEeprom.VOICE_PROMPT != VOICE_PROMPT_OFF){
{ memcpy(line + x, BITMAP_VoicePrompt, sizeof(BITMAP_VoicePrompt));
memmove(line + x, BITMAP_VoicePrompt, sizeof(BITMAP_VoicePrompt)); x1 = x + sizeof(BITMAP_VoicePrompt);
x1 = x + sizeof(BITMAP_VoicePrompt); }
} x += sizeof(BITMAP_VoicePrompt) + 1;
x += sizeof(BITMAP_VoicePrompt) + 1; #endif
#else
// hmmm, what to put in it's place
#endif
x++; x++;
if(!SCANNER_IsScanning()) { if(!SCANNER_IsScanning()) {
uint8_t dw = (gEeprom.DUAL_WATCH != DUAL_WATCH_OFF) + (gEeprom.CROSS_BAND_RX_TX != CROSS_BAND_OFF) * 2; 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(dw == 1 || dw == 3) { // DWR - dual watch + respond
if(gDualWatchActive) if(gDualWatchActive)
memmove(line + x, BITMAP_TDR1, sizeof(BITMAP_TDR1) - (dw==1?0:5)); memcpy(line + x, BITMAP_TDR1, sizeof(BITMAP_TDR1) - (dw==1?0:5));
else else
memmove(line + x + 3, BITMAP_TDR2, sizeof(BITMAP_TDR2)); memcpy(line + x + 3, BITMAP_TDR2, sizeof(BITMAP_TDR2));
} }
else if(dw == 2) { // XB - crossband else if(dw == 2) { // XB - crossband
memmove(line + x, BITMAP_XB, sizeof(BITMAP_XB)); memcpy(line + x, BITMAP_XB, sizeof(BITMAP_XB));
} }
} }
x += sizeof(BITMAP_TDR1) + 2; x += sizeof(BITMAP_TDR1) + 2;
#ifdef ENABLE_VOX #ifdef ENABLE_VOX
// VOX indicator // VOX indicator
if (gEeprom.VOX_SWITCH) if (gEeprom.VOX_SWITCH) {
{ memcpy(line + x, BITMAP_VOX, sizeof(BITMAP_VOX));
memmove(line + x, BITMAP_VOX, sizeof(BITMAP_VOX)); x1 = x + sizeof(BITMAP_VOX);
x1 = x + sizeof(BITMAP_VOX); }
} x += sizeof(BITMAP_VOX) + 2;
x += sizeof(BITMAP_VOX) + 2; #endif
#endif
x = MAX(x, 61u); x = MAX(x, 61u);
x1 = x; x1 = x;
// KEY-LOCK indicator // KEY-LOCK indicator
if (gEeprom.KEY_LOCK) if (gEeprom.KEY_LOCK) {
{ memcpy(line + x, BITMAP_KeyLock, sizeof(BITMAP_KeyLock));
memmove(line + x, BITMAP_KeyLock, sizeof(BITMAP_KeyLock));
x += sizeof(BITMAP_KeyLock); x += sizeof(BITMAP_KeyLock);
x1 = x; x1 = x;
} }
else else if (gWasFKeyPressed) {
if (gWasFKeyPressed) memcpy(line + x, BITMAP_F_Key, sizeof(BITMAP_F_Key));
{
memmove(line + x, BITMAP_F_Key, sizeof(BITMAP_F_Key));
x += sizeof(BITMAP_F_Key); x += sizeof(BITMAP_F_Key);
x1 = x; x1 = x;
} }
{ // battery voltage or percentage { // battery voltage or percentage
char s[8]; char s[8] = "";
unsigned int space_needed;
unsigned int x2 = LCD_WIDTH - sizeof(BITMAP_BatteryLevel1) - 3; unsigned int x2 = LCD_WIDTH - sizeof(BITMAP_BatteryLevel1) - 3;
if (gChargingWithTypeC) if (gChargingWithTypeC)
x2 -= sizeof(BITMAP_USB_C); // the radio is on charge x2 -= sizeof(BITMAP_USB_C); // the radio is on charge
switch (gSetting_battery_text) switch (gSetting_battery_text) {
{
default: default:
case 0: case 0:
break; break;
case 1: // voltage case 1: { // voltage
{
const uint16_t voltage = (gBatteryVoltageAverage <= 999) ? gBatteryVoltageAverage : 999; // limit to 9.99V const uint16_t voltage = (gBatteryVoltageAverage <= 999) ? gBatteryVoltageAverage : 999; // limit to 9.99V
sprintf(s, "%u.%02uV", voltage / 100, voltage % 100); sprintf(s, "%u.%02uV", voltage / 100, voltage % 100);
space_needed = (7 * strlen(s));
if (x2 >= (x1 + space_needed))
{
UI_PrintStringSmallBuffer(s, line + x2 - space_needed);
}
break; break;
} }
case 2: // percentage case 2: // percentage
{
sprintf(s, "%u%%", BATTERY_VoltsToPercent(gBatteryVoltageAverage)); sprintf(s, "%u%%", BATTERY_VoltsToPercent(gBatteryVoltageAverage));
space_needed = (7 * strlen(s));
if (x2 >= (x1 + space_needed))
UI_PrintStringSmallBuffer(s, line + x2 - space_needed);
break; break;
}
} }
unsigned int space_needed = (7 * strlen(s));
if (x2 >= (x1 + space_needed))
UI_PrintStringSmallBuffer(s, line + x2 - space_needed);
} }
// move to right side of the screen // move to right side of the screen
@ -207,7 +171,7 @@ void UI_DisplayStatus()
// USB-C charge indicator // USB-C charge indicator
if (gChargingWithTypeC) if (gChargingWithTypeC)
memmove(line + x, BITMAP_USB_C, sizeof(BITMAP_USB_C)); memcpy(line + x, BITMAP_USB_C, sizeof(BITMAP_USB_C));
x += sizeof(BITMAP_USB_C); x += sizeof(BITMAP_USB_C);
// BATTERY LEVEL indicator // BATTERY LEVEL indicator