Unify PrintSmall functions

Size: 60420 -> 60364
This commit is contained in:
Juan Antonio
2023-12-25 01:35:06 +01:00
committed by egzumer
parent 78a45d9bbd
commit 7a7010da55
10 changed files with 108 additions and 138 deletions

View File

@@ -36,7 +36,7 @@
void UI_DisplayStatus()
{
gUpdateStatus = false;
gUpdateStatus = false;
memset(gStatusLine, 0, sizeof(gStatusLine));
uint8_t *line = gStatusLine;
@@ -69,7 +69,7 @@ void UI_DisplayStatus()
memset(line + x, 0xFF, 10);
x1 = x + 10;
}
else
else
#endif
#ifdef ENABLE_FMRADIO
if (gFmRadioMode) { // FM indicator
@@ -91,7 +91,7 @@ void UI_DisplayStatus()
else { // frequency mode
s = "S";
}
UI_PrintStringSmallBuffer(s, line + x + 1);
UI_PrintStringSmallBufferNormal(s, line + x + 1);
x1 = x + 10;
}
}
@@ -109,9 +109,9 @@ void UI_DisplayStatus()
if(!SCANNER_IsScanning()) {
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)
if(gDualWatchActive)
memcpy(line + x + (dw==1?0:2), BITMAP_TDR1, sizeof(BITMAP_TDR1) - (dw==1?0:5));
else
else
memcpy(line + x + 3, BITMAP_TDR2, sizeof(BITMAP_TDR2));
}
else if(dw == 2) { // XB - crossband
@@ -119,7 +119,7 @@ void UI_DisplayStatus()
}
}
x += sizeof(BITMAP_TDR1) + 1;
#ifdef ENABLE_VOX
// VOX indicator
if (gEeprom.VOX_SWITCH) {
@@ -144,7 +144,7 @@ void UI_DisplayStatus()
}
{ // battery voltage or percentage
char s[8] = "";
char s[8] = "";
unsigned int x2 = LCD_WIDTH - sizeof(BITMAP_BatteryLevel1) - 0;
if (gChargingWithTypeC)
@@ -154,13 +154,13 @@ void UI_DisplayStatus()
default:
case 0:
break;
case 1: { // voltage
const uint16_t voltage = (gBatteryVoltageAverage <= 999) ? gBatteryVoltageAverage : 999; // limit to 9.99V
sprintf(s, "%u.%02uV", voltage / 100, voltage % 100);
break;
}
case 2: // percentage
sprintf(s, "%u%%", BATTERY_VoltsToPercent(gBatteryVoltageAverage));
break;
@@ -168,12 +168,12 @@ void UI_DisplayStatus()
unsigned int space_needed = (7 * strlen(s));
if (x2 >= (x1 + space_needed))
UI_PrintStringSmallBuffer(s, line + x2 - space_needed);
UI_PrintStringSmallBufferNormal(s, line + x2 - space_needed);
}
// move to right side of the screen
x = LCD_WIDTH - sizeof(BITMAP_BatteryLevel1) - sizeof(BITMAP_USB_C);
// USB-C charge indicator
if (gChargingWithTypeC)
memcpy(line + x, BITMAP_USB_C, sizeof(BITMAP_USB_C));
@@ -181,7 +181,7 @@ void UI_DisplayStatus()
// BATTERY LEVEL indicator
UI_DrawBattery(line + x, gBatteryDisplayLevel, gLowBatteryBlink);
// **************
ST7565_BlitStatusLine();