0
mirror of https://github.com/OneOfEleven/uv-k5-firmware-custom.git synced 2025-06-19 06:39:49 +03:00

Fix frequency display position

This commit is contained in:
OneOfEleven
2023-09-19 14:48:09 +01:00
parent f4a65c5b87
commit 9651e52317
10 changed files with 117 additions and 124 deletions

View File

@ -143,7 +143,7 @@ void UI_DisplayMain(void)
memmove(pLine0 + 0, BITMAP_VFO_NotDefault, sizeof(BITMAP_VFO_NotDefault));
}
uint32_t SomeValue = 0;
uint32_t duff_beer = 0;
if (gCurrentFunction == FUNCTION_TRANSMIT)
{ // transmitting
@ -151,7 +151,7 @@ void UI_DisplayMain(void)
#ifdef ENABLE_ALARM
if (gAlarmState == ALARM_STATE_ALARM)
{
SomeValue = 2;
duff_beer = 2;
}
else
#endif
@ -159,14 +159,14 @@ void UI_DisplayMain(void)
Channel = (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF) ? gEeprom.RX_CHANNEL : gEeprom.TX_CHANNEL;
if (Channel == vfo_num)
{ // show the TX symbol
SomeValue = 1;
duff_beer = 1;
UI_PrintStringSmall("TX", 14, 0, Line);
}
}
}
else
{ // receiving .. show the RX symbol
SomeValue = 2;
duff_beer = 2;
if ((gCurrentFunction == FUNCTION_RECEIVE || gCurrentFunction == FUNCTION_MONITOR) && gEeprom.RX_CHANNEL == vfo_num)
UI_PrintStringSmall("RX", 14, 0, Line);
}
@ -319,7 +319,7 @@ void UI_DisplayMain(void)
#else
// show the frequency in the main font
sprintf(String, "%03u.%05u", frequency / 100000, frequency % 100000);
UI_PrintString(String, 38, 112, Line, 8);
UI_PrintString(String, 31, 112, Line, 8);
#endif
}
}
@ -329,7 +329,7 @@ void UI_DisplayMain(void)
{ // show the TX/RX level
uint8_t Level = 0;
if (SomeValue == 1)
if (duff_beer == 1)
{ // TX power level
switch (gRxVfo->OUTPUT_POWER)
{
@ -339,7 +339,7 @@ void UI_DisplayMain(void)
}
}
else
if (SomeValue == 2)
if (duff_beer == 2)
{ // RX signal level
#ifdef ENABLE_DBM
// dBm
@ -387,7 +387,7 @@ void UI_DisplayMain(void)
}
else
{ // or show the CTCSS/DCS symbol
const FREQ_Config_t *pConfig = (SomeValue == 1) ? gEeprom.VfoInfo[vfo_num].pTX : gEeprom.VfoInfo[vfo_num].pRX;
const FREQ_Config_t *pConfig = (duff_beer == 1) ? gEeprom.VfoInfo[vfo_num].pTX : gEeprom.VfoInfo[vfo_num].pRX;
const unsigned int code_type = pConfig->CodeType;
const char *code_list[] = {"", "CT", "DCS", "DCR"};
if (code_type >= 0 && code_type < ARRAY_SIZE(code_list))
@ -448,15 +448,9 @@ void UI_DisplayMain(void)
if (gChargingWithTypeC)
{ // charging .. show the battery state
#ifdef ENABLE_SHOW_CHARGE_LEVEL
const uint16_t volts = (gBatteryVoltageAverage < gMin_bat_v) ? gMin_bat_v :
(gBatteryVoltageAverage > gMax_bat_v) ? gMax_bat_v :
gBatteryVoltageAverage;
sprintf(String, "Charge %u.%02uV %u%%",
gBatteryVoltageAverage / 100,
gBatteryVoltageAverage % 100,
(100 * (volts - gMin_bat_v)) / (gMax_bat_v - gMin_bat_v));
const uint16_t volts = (gBatteryVoltageAverage < gMin_bat_v) ? gMin_bat_v : gBatteryVoltageAverage;
const uint16_t percent = (100 * (volts - gMin_bat_v)) / (gMax_bat_v - gMin_bat_v);
sprintf(String, "Charge %u.%02uV %u%%", gBatteryVoltageAverage / 100, gBatteryVoltageAverage % 100, percent);
UI_PrintStringSmall(String, 2, 0, 3);
#endif
}

View File

@ -48,22 +48,23 @@ const char MenuList[][7] =
"T-CTCS", // was "T_CTCS"
"T-DIR", // was "SFT_D"
"T-OFFS", // was "OFFSET"
"T-VFO", // was "WX"
"T-TOUT", // was "TOT"
"W/N",
"SCRAM", // was "SCR"
"BUSYCL", // was "BCL"
"MEMSAV", // was "MEM-CH"
"CH-SAV", // was "MEM-CH"
"CH-DEL", // was "DEL-CH"
"CH-DIS", // was "MDF"
"BATSAV", // was "SAVE"
"VOX",
"BACKLT", // was "ABR"
"DUALRX", // was "TDR"
"T-VFO", // was "WX"
"BEEP",
"T-TOUT", // was "TOT"
#ifdef ENABLE_VOICE
"VOICE",
#endif
"SC-REV",
"CHDISP", // was "MDF"
"KEYLOC", // was "AUTOLk"
"S-ADD1",
"S-ADD2",
@ -98,11 +99,10 @@ const char MenuList[][7] =
#ifdef ENABLE_NOAA
"NOAA-S",
#endif
"MEMDEL", // was "Del-CH"
"RESET",
"RESET", // might be better to move this to the hidden menu items ?
// hidden menu items from here on.
// enabled if pressing PTT and upper side button at power-on.
// hidden menu items from here on
// enabled if pressing both the PTT and upper side button at power-on
"F-LOCK",
"TX-200", // was "200TX"
@ -114,7 +114,7 @@ const char MenuList[][7] =
"TX-EN", // enable TX
"F-CALI", // reference xtal calibration
"" // end of list - DO NOT DELETE THIS !
"" // end of list - DO NOT DELETE THIS ! .. I use this to compute this list size
};
const char gSubMenu_TXP[3][5] =
@ -555,8 +555,9 @@ void UI_DisplayMenu(void)
{ // 2nd text line .. percentage
UI_PrintString(String, 50, 127, 1, 8);
const uint16_t volts = (gBatteryVoltageAverage < gMin_bat_v) ? gMin_bat_v : gBatteryVoltageAverage;
sprintf(String, "%u%%", (100 * (volts - gMin_bat_v)) / (gMax_bat_v - gMin_bat_v));
const uint16_t volts = (gBatteryVoltageAverage < gMin_bat_v) ? gMin_bat_v : gBatteryVoltageAverage;
const uint16_t percent = (100 * (volts - gMin_bat_v)) / (gMax_bat_v - gMin_bat_v);
sprintf(String, "%u%%", percent);
UI_PrintString(String, 50, 127, 3, 8);
#if 0
sprintf(String, "Curr %u", gBatteryCurrent); // needs scaling into mA

View File

@ -31,22 +31,23 @@ enum
MENU_T_CTCS,
MENU_SFT_D,
MENU_OFFSET,
MENU_XB,
MENU_TOT,
MENU_W_N,
MENU_SCR,
MENU_BCL,
MENU_MEM_CH,
MENU_DEL_CH,
MENU_MDF,
MENU_SAVE,
MENU_VOX,
MENU_ABR,
MENU_TDR,
MENU_XB,
MENU_BEEP,
MENU_TOT,
#ifdef ENABLE_VOICE
MENU_VOICE,
#endif
MENU_SC_REV,
MENU_MDF,
MENU_AUTOLK,
MENU_S_ADD1,
MENU_S_ADD2,
@ -81,7 +82,6 @@ enum
#ifdef ENABLE_NOAA
MENU_NOAA_S,
#endif
MENU_DEL_CH,
MENU_RESET,
// items after here are normally hidden

View File

@ -122,17 +122,21 @@ void UI_DisplayStatus(const bool test_display)
UI_PrintStringSmallBuffer(s, line);
//line += 8 * 4;
#elif defined(ENABLE_STATUSBAR_PERCENTAGE)
char s[6];
const uint16_t volts = (gBatteryVoltageAverage < gMin_bat_v) ? gMin_bat_v : gBatteryVoltageAverage;
sprintf(s, "%u%%", (100 * (volts - gMin_bat_v)) / (gMax_bat_v - gMin_bat_v));
UI_PrintStringSmallBuffer(s, line);
const uint16_t volts = (gBatteryVoltageAverage < gMin_bat_v) ? gMin_bat_v : gBatteryVoltageAverage;
const uint16_t percent = (100 * (volts - gMin_bat_v)) / (gMax_bat_v - gMin_bat_v);
const unsigned int x = (percent >= 100) ? 0 : 4; // move to the right a bit
char s[8];
sprintf(s, "%u%%", percent);
UI_PrintStringSmallBuffer(s, line + x);
//line += 8 * 4;
#endif
}
// else
// line += sizeof(BITMAP_F_Key);
line = gStatusLine + LCD_WIDTH - sizeof(BITMAP_BatteryLevel5) - sizeof(BITMAP_USB_C); // point to right side of the screen
// move to right side of the screen
line = gStatusLine + LCD_WIDTH - sizeof(BITMAP_BatteryLevel5) - sizeof(BITMAP_USB_C);
// USB-C charge indicator
if (gChargingWithTypeC || test_display)