Merge branch 'feature_update_v4' into REGA

This commit is contained in:
Armel FAUVEAU
2025-02-12 02:43:31 +01:00
committed by GitHub
30 changed files with 350 additions and 128 deletions

View File

@@ -110,6 +110,7 @@ void UI_PrintStringSmall(const char *pString, uint8_t Start, uint8_t End, uint8_
UI_PrintStringBuffer(pString, gFrameBuffer[Line] + Start, char_width, font);
}
void UI_PrintStringSmallNormal(const char *pString, uint8_t Start, uint8_t End, uint8_t Line)
{
UI_PrintStringSmall(pString, Start, End, Line, ARRAY_SIZE(gFontSmall[0]), (const uint8_t *)gFontSmall);
@@ -180,6 +181,46 @@ void UI_DisplayFrequency(const char *string, uint8_t X, uint8_t Y, bool center)
}
}
/*
void UI_DisplayFrequency(const char *string, uint8_t X, uint8_t Y, bool center)
{
const unsigned int char_width = 13;
uint8_t *pFb0 = gFrameBuffer[Y] + X;
uint8_t *pFb1 = pFb0 + 128;
bool bCanDisplay = false;
if (center) {
uint8_t len = 0;
for (const char *ptr = string; *ptr; ptr++)
if (*ptr != ' ') len++; // Ignores spaces for centering
X -= (len * char_width) / 2; // Centering adjustment
pFb0 = gFrameBuffer[Y] + X;
pFb1 = pFb0 + 128;
}
for (; *string; string++) {
char c = *string;
if (c == '-') c = '9' + 1; // Remap of '-' symbol
if (bCanDisplay || c != ' ') {
bCanDisplay = true;
if (c >= '0' && c <= '9' + 1) {
memcpy(pFb0 + 2, gFontBigDigits[c - '0'], char_width - 3);
memcpy(pFb1 + 2, gFontBigDigits[c - '0'] + char_width - 3, char_width - 3);
} else if (c == '.') {
memset(pFb1, 0x60, 3); // Replaces the three assignments
pFb0 += 3;
pFb1 += 3;
continue;
}
}
pFb0 += char_width;
pFb1 += char_width;
}
}
*/
void UI_DrawPixelBuffer(uint8_t (*buffer)[128], uint8_t x, uint8_t y, bool black)
{
const uint8_t pattern = 1 << (y % 8);

View File

@@ -1213,15 +1213,18 @@ void UI_DisplayMain(void)
if (gSetting_set_gui)
{
const char pwr_short[][3] = {"L1", "L2", "L3", "L4", "L5", "M", "H"};
sprintf(String, "%s", pwr_short[currentPower]);
UI_PrintStringSmallNormal(String, LCD_WIDTH + 42, 0, line + 1);
//sprintf(String, "%s", pwr_short[currentPower]);
//UI_PrintStringSmallNormal(String, LCD_WIDTH + 42, 0, line + 1);
UI_PrintStringSmallNormal(pwr_short[currentPower], LCD_WIDTH + 42, 0, line + 1);
arrowPos = 38;
}
else
{
const char pwr_long[][5] = {"LOW1", "LOW2", "LOW3", "LOW4", "LOW5", "MID", "HIGH"};
sprintf(String, "%s", pwr_long[currentPower]);
GUI_DisplaySmallest(String, 24, line == 0 ? 17 : 49, false, true);
//sprintf(String, "%s", pwr_long[currentPower]);
//GUI_DisplaySmallest(String, 24, line == 0 ? 17 : 49, false, true);
GUI_DisplaySmallest(pwr_long[currentPower], 24, line == 0 ? 17 : 49, false, true);
}
if(userPower == true)
@@ -1364,15 +1367,15 @@ void UI_DisplayMain(void)
*/
if (isMainVFO) {
if (gMonitor) {
sprintf(String, "MONI");
strcpy(String, "MONI");
} else {
sprintf(String, "SQL%d", gEeprom.SQUELCH_LEVEL);
sprintf(String, "SQL%d", gEeprom.SQUELCH_LEVEL);
}
if (gSetting_set_gui) {
UI_PrintStringSmallNormal(String, LCD_WIDTH + 98, 0, line + 1);
UI_PrintStringSmallNormal(String, LCD_WIDTH + 98, 0, line + 1);
} else {
GUI_DisplaySmallest(String, 110, line == 0 ? 17 : 49, false, true);
GUI_DisplaySmallest(String, 110, line == 0 ? 17 : 49, false, true);
}
}
#endif

View File

@@ -86,9 +86,7 @@ const t_menu_item MenuList[] =
{"BatSav", MENU_SAVE }, // was "SAVE"
{"BatTxt", MENU_BAT_TXT },
{"Mic", MENU_MIC },
#ifdef ENABLE_AUDIO_BAR
{"MicBar", MENU_MIC_BAR },
#endif
{"ChDisp", MENU_MDF }, // was "MDF"
{"POnMsg", MENU_PONMSG },
{"BLTime", MENU_ABR }, // was "ABR"
@@ -128,9 +126,7 @@ const t_menu_item MenuList[] =
{"AM Fix", MENU_AM_FIX },
#endif
#endif
#ifdef ENABLE_VOX
{"VOX", MENU_VOX },
#endif
#ifdef ENABLE_FEAT_F4HWN
{"SysInf", MENU_VOL }, // was "VOL"
#else
@@ -455,6 +451,9 @@ const t_sidefunction gSubMenu_SIDEFUNCTIONS[] =
{"MAIN ONLY", ACTION_OPT_MAINONLY},
{"PTT", ACTION_OPT_PTT},
{"WIDE\nNARROW", ACTION_OPT_WN},
#if !defined(ENABLE_SPECTRUM) || !defined(ENABLE_FMRADIO)
{"MUTE", ACTION_OPT_MUTE},
#endif
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
{"POWER\nHIGH", ACTION_OPT_POWER_HIGH},
{"REMOVE\nOFFSET", ACTION_OPT_REMOVE_OFFSET},
@@ -615,11 +614,13 @@ void UI_DisplayMenu(void)
}
break;
#ifdef ENABLE_AUDIO_BAR
case MENU_MIC_BAR:
case MENU_MIC_BAR:
#ifdef ENABLE_AUDIO_BAR
strcpy(String, gSubMenu_OFF_ON[gSubMenuSelection]);
break;
#endif
#else
strcpy(String, gSubMenu_OFF_ON[0]);
#endif
break;
case MENU_STEP: {
uint16_t step = gStepFrequencyTable[FREQUENCY_GetStepIdxFromSortedIdx(gSubMenuSelection)];
@@ -696,25 +697,29 @@ void UI_DisplayMenu(void)
break;
#endif
#ifdef ENABLE_VOX
case MENU_VOX:
case MENU_VOX:
#ifdef ENABLE_VOX
sprintf(String, gSubMenuSelection == 0 ? "OFF" : "%u", gSubMenuSelection);
break;
#endif
#else
strcpy(String, gSubMenu_OFF_ON[0]);
#endif
break;
case MENU_ABR:
if(gSubMenuSelection == 0)
{
sprintf(String, "%s", "OFF");
strcpy(String, "OFF");
}
else if(gSubMenuSelection < 61)
{
sprintf(String, "%02dm:%02ds", (((gSubMenuSelection) * 5) / 60), (((gSubMenuSelection) * 5) % 60));
#if !defined(ENABLE_SPECTRUM) || !defined(ENABLE_FMRADIO)
ST7565_Gauge(4, 1, 60, gSubMenuSelection);
#endif
}
else
{
sprintf(String, "%s", "ON");
strcpy(String, "ON");
}
// Obsolete ???
@@ -742,7 +747,9 @@ void UI_DisplayMenu(void)
else
{
sprintf(String, "%02dm:%02ds", ((gSubMenuSelection * 15) / 60), ((gSubMenuSelection * 15) % 60));
#if !defined(ENABLE_SPECTRUM) || !defined(ENABLE_FMRADIO)
ST7565_Gauge(4, 1, 40, gSubMenuSelection);
#endif
}
break;
@@ -857,7 +864,9 @@ void UI_DisplayMenu(void)
case MENU_TOT:
sprintf(String, "%02dm:%02ds", (((gSubMenuSelection + 1) * 5) / 60), (((gSubMenuSelection + 1) * 5) % 60));
#if !defined(ENABLE_SPECTRUM) || !defined(ENABLE_FMRADIO)
ST7565_Gauge(4, 5, 179, gSubMenuSelection);
#endif
break;
#ifdef ENABLE_VOICE
@@ -874,12 +883,16 @@ void UI_DisplayMenu(void)
else if(gSubMenuSelection < 81)
{
sprintf(String, "CARRIER\n%02ds:%03dms", ((gSubMenuSelection * 250) / 1000), ((gSubMenuSelection * 250) % 1000));
#if !defined(ENABLE_SPECTRUM) || !defined(ENABLE_FMRADIO)
ST7565_Gauge(5, 1, 80, gSubMenuSelection);
#endif
}
else
{
sprintf(String, "TIMEOUT\n%02dm:%02ds", (((gSubMenuSelection - 80) * 5) / 60), (((gSubMenuSelection - 80) * 5) % 60));
#if !defined(ENABLE_SPECTRUM) || !defined(ENABLE_FMRADIO)
ST7565_Gauge(5, 80, 104, gSubMenuSelection);
#endif
}
break;
@@ -1026,12 +1039,14 @@ void UI_DisplayMenu(void)
case MENU_SET_OFF:
if(gSubMenuSelection == 0)
{
sprintf(String, "%s", "OFF");
strcpy(String, "OFF");
}
else if(gSubMenuSelection < 121)
{
sprintf(String, "%dh:%02dm", (gSubMenuSelection / 60), (gSubMenuSelection % 60));
#if !defined(ENABLE_SPECTRUM) || !defined(ENABLE_FMRADIO)
ST7565_Gauge(4, 1, 120, gSubMenuSelection);
#endif
}
break;
#endif
@@ -1091,7 +1106,17 @@ void UI_DisplayMenu(void)
#ifdef ENABLE_FEAT_F4HWN_VOL
case MENU_SET_VOL:
sprintf(String, gSubMenuSelection == 0 ? "OFF" : "%02u", gSubMenuSelection);
if(gSubMenuSelection == 0)
{
strcpy(String, "OFF");
}
else if(gSubMenuSelection < 64)
{
sprintf(String, "%02u", gSubMenuSelection);
#if !defined(ENABLE_SPECTRUM) || !defined(ENABLE_FMRADIO)
ST7565_Gauge(4, 1, 63, gSubMenuSelection);
#endif
}
gEeprom.VOLUME_GAIN = gSubMenuSelection;
BK4819_WriteRegister(BK4819_REG_48,
(11u << 12) | // ??? .. 0 ~ 15, doesn't seem to make any difference
@@ -1138,10 +1163,14 @@ void UI_DisplayMenu(void)
}
// center vertically'ish
/*
if (small)
y = 3 - ((lines + 0) / 2); // untested
else
y = 2 - ((lines + 0) / 2);
*/
y = (small ? 3 : 2) - (lines / 2);
// only for SysInf
if(UI_MENU_GetCurrentMenuId() == MENU_VOL)
@@ -1210,6 +1239,7 @@ void UI_DisplayMenu(void)
if (gSubMenuSelection < 0 || !gEeprom.SCAN_LIST_ENABLED[i]) {
UI_PrintString(pPrintStr, menu_item_x1, menu_item_x2, 2, 8);
} else {
/*
UI_PrintStringSmallNormal(pPrintStr, menu_item_x1, menu_item_x2, 2);
if (IS_MR_CHANNEL(gEeprom.SCANLIST_PRIORITY_CH1[i])) {
@@ -1221,6 +1251,19 @@ void UI_DisplayMenu(void)
sprintf(String, "PRI%d:%u", 2, gEeprom.SCANLIST_PRIORITY_CH2[i] + 1);
UI_PrintString(String, menu_item_x1, menu_item_x2, 5, 8);
}
*/
UI_PrintStringSmallNormal(pPrintStr, menu_item_x1, menu_item_x2, 2);
for (uint8_t pri = 1; pri <= 2; pri++) {
uint8_t channel = (pri == 1) ? gEeprom.SCANLIST_PRIORITY_CH1[i] : gEeprom.SCANLIST_PRIORITY_CH2[i];
if (IS_MR_CHANNEL(channel)) {
sprintf(String, "PRI%d:%u", pri, channel + 1);
UI_PrintString(String, menu_item_x1, menu_item_x2, pri * 2 + 1, 8);
}
}
}
}

View File

@@ -53,9 +53,7 @@ enum
MENU_MEM_NAME,
MENU_MDF,
MENU_SAVE,
#ifdef ENABLE_VOX
MENU_VOX,
#endif
MENU_ABR,
MENU_ABR_ON_TX_RX,
MENU_ABR_MIN,
@@ -73,9 +71,7 @@ enum
MENU_STE,
MENU_RP_STE,
MENU_MIC,
#ifdef ENABLE_AUDIO_BAR
MENU_MIC_BAR,
#endif
MENU_COMPAND,
MENU_1_CALL,
MENU_S_LIST,

View File

@@ -212,30 +212,47 @@ void UI_DisplayStatus()
x = MAX(x1, 69u);
// KEY-LOCK indicator
const void *src = NULL; // Pointer to the font/bitmap to copy
size_t size = 0; // Size of the font/bitmap
// Determine the source and size based on conditions
if (gEeprom.KEY_LOCK) {
memcpy(line + x + 1, gFontKeyLock, sizeof(gFontKeyLock));
src = gFontKeyLock;
size = sizeof(gFontKeyLock);
}
else if (gWasFKeyPressed) {
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
if(gEeprom.MENU_LOCK == false) {
memcpy(line + x + 1, gFontF, sizeof(gFontF));
}
if (!gEeprom.MENU_LOCK) {
src = gFontF;
size = sizeof(gFontF);
}
#else
memcpy(line + x + 1, gFontF, sizeof(gFontF));
src = gFontF;
size = sizeof(gFontF);
#endif
}
else if (gBackLight)
{
memcpy(line + x + 1, gFontLight, sizeof(gFontLight));
#ifdef ENABLE_FEAT_F4HWN
else if (gMute) {
src = gFontMute;
size = sizeof(gFontMute);
}
#endif
else if (gBackLight) {
src = gFontLight;
size = sizeof(gFontLight);
}
#ifdef ENABLE_FEAT_F4HWN_CHARGING_C
else if (gChargingWithTypeC)
{
memcpy(line + x + 1, BITMAP_USB_C, sizeof(BITMAP_USB_C));
else if (gChargingWithTypeC) {
src = BITMAP_USB_C;
size = sizeof(BITMAP_USB_C);
}
#endif
// Perform the memcpy if a source was selected
if (src) {
memcpy(line + x + 1, src, size);
}
// Battery
unsigned int x2 = LCD_WIDTH - sizeof(BITMAP_BatteryLevel1) - 0;