Optimize Broadcast FM display and remove dead channel formatter

This commit is contained in:
Armel FAUVEAU committed 2026-08-25 15:25:24 +02:00
1 parent 285f543d46
commit 24d3e5283f
3 files changed
+18 -28

No files matched your search

+18 -8
View File
@@ -31,6 +31,13 @@
void UI_DisplayFM(void)
{
// Keep these labels in sync with the limits in driver/bk1080.c.
static const char BandNames[][10] = {
"87.5-108M",
"76-108M",
"76-90M",
"64-76M",
};
char String[16];
char *pPrintStr = String;
UI_DisplayClear();
@@ -41,13 +48,7 @@ void UI_DisplayFM(void)
UI_PrintString("FM", 2, 0, 0, 8);
sprintf(String, "%d%s-%dM",
BK1080_GetFreqLoLimit(gEeprom.FM_Band)/10,
gEeprom.FM_Band == 0 ? ".5" : "",
BK1080_GetFreqHiLimit(gEeprom.FM_Band)/10
);
UI_PrintStringSmallNormal(String, 1, 0, 6);
UI_PrintStringSmallNormal(BandNames[gEeprom.FM_Band], 1, 0, 6);
//uint8_t spacings[] = {20,10,5};
//sprintf(String, "%d0k", spacings[gEeprom.FM_Space % 3]);
@@ -81,7 +82,16 @@ void UI_DisplayFM(void)
UI_PrintString(pPrintStr, 0, 127, 3, 10); // memory, vfo, scan
if (gAskToSave || (gEeprom.FM_IsMrMode && gInputBoxIndex > 0)) {
UI_GenerateChannelString(String, gFM_ChannelPosition);
if (gInputBoxIndex == 0) {
sprintf(String, "CH-%02u", gFM_ChannelPosition + 1);
} else {
String[0] = 'C';
String[1] = 'H';
String[2] = '-';
for (unsigned int i = 0; i < 2; i++)
String[i + 3] = (gInputBox[i] == 10) ? '-' : gInputBox[i] + '0';
String[5] = '\0';
}
} else if (gAskToDelete) {
sprintf(String, "CH-%02u", gEeprom.FM_SelectedChannel + 1);
} else {
-19
View File
@@ -25,25 +25,6 @@
#include "settings.h"
void UI_GenerateChannelString(char *pString, const uint16_t Channel)
{
unsigned int i;
if (gInputBoxIndex == 0)
{
sprintf(pString, "CH-%02u", Channel + 1);
return;
}
pString[0] = 'C';
pString[1] = 'H';
pString[2] = '-';
for (i = 0; i < 2; i++)
pString[i + 3] = (gInputBox[i] == 10) ? '-' : gInputBox[i] + '0';
pString[5] = 0;
}
void UI_GenerateChannelStringEx(char *pString, const bool bShowPrefix, const uint16_t ChannelNumber)
{
if (gInputBoxIndex > 0) {
-1
View File
@@ -20,7 +20,6 @@
#include <stdbool.h>
#include <stdint.h>
void UI_GenerateChannelString(char *pString, const uint16_t Channel);
void UI_GenerateChannelStringEx(char *pString, const bool bShowPrefix, const uint16_t ChannelNumber);
void UI_PrintString(const char *pString, uint8_t Start, uint8_t End, uint8_t Line, uint8_t Width);
void UI_PrintStringSmallNormal(const char *pString, uint8_t Start, uint8_t End, uint8_t Line);