Fix SCAN_SAVE_CHANNEL and UI_GenerateChannelStringEx

This commit is contained in:
Armel FAUVEAU committed 2026-02-08 03:24:25 +01:00
1 parent 086858945b
commit 85f1bfdb7f
5 files changed
+22 -14

No files matched your search

+1 -1
View File
@@ -2192,7 +2192,7 @@ Skip:
} }
if (gRequestSaveChannel > 0) { // TODO: remove the gRequestSaveChannel, why use global variable for that?? if (gRequestSaveChannel > 0) { // TODO: remove the gRequestSaveChannel, why use global variable for that??
if ((!bKeyHeld && !bKeyPressed) || (UI_MENU_GetCurrentMenuId() != 0 && gScreenToDisplay == DISPLAY_MENU)) if ((!bKeyHeld && !bKeyPressed) || (UI_MENU_GetCurrentMenuId() != 0 && gScreenToDisplay == DISPLAY_MENU) || gScreenToDisplay == DISPLAY_SCANNER)
{ {
SETTINGS_SaveChannel(gTxVfo->CHANNEL_SAVE, gEeprom.TX_VFO, gTxVfo, gRequestSaveChannel); SETTINGS_SaveChannel(gTxVfo->CHANNEL_SAVE, gEeprom.TX_VFO, gTxVfo, gRequestSaveChannel);
+4 -3
View File
@@ -1553,9 +1553,9 @@ static void MENU_Key_0_to_9(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
UI_MENU_GetCurrentMenuId() == MENU_S_PRI_CH_1 || UI_MENU_GetCurrentMenuId() == MENU_S_PRI_CH_1 ||
UI_MENU_GetCurrentMenuId() == MENU_S_PRI_CH_2 || UI_MENU_GetCurrentMenuId() == MENU_S_PRI_CH_2 ||
UI_MENU_GetCurrentMenuId() == MENU_MEM_NAME) UI_MENU_GetCurrentMenuId() == MENU_MEM_NAME)
{ // enter 3-digit channel number { // enter 4-digit channel number
if (gInputBoxIndex < 3) if (gInputBoxIndex < 4)
{ {
#ifdef ENABLE_VOICE #ifdef ENABLE_VOICE
gAnotherVoiceID = (VOICE_ID_t)Key; gAnotherVoiceID = (VOICE_ID_t)Key;
@@ -1566,7 +1566,8 @@ static void MENU_Key_0_to_9(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
gInputBoxIndex = 0; gInputBoxIndex = 0;
Value = ((gInputBox[0] * 100) + (gInputBox[1] * 10) + gInputBox[2]) - 1; //Value = ((gInputBox[0] * 100) + (gInputBox[1] * 10) + gInputBox[2]) - 1;
Value = ((gInputBox[0] * 1000) + (gInputBox[1] * 100) + (gInputBox[2] * 10) + gInputBox[3]) - 1;
if (IS_MR_CHANNEL(Value)) if (IS_MR_CHANNEL(Value))
{ {
+14 -7
View File
@@ -32,7 +32,7 @@ DCS_CodeType_t gScanCssResultType;
uint8_t gScanCssResultCode; uint8_t gScanCssResultCode;
bool gScanSingleFrequency; // scan CTCSS/DCS codes for current frequency bool gScanSingleFrequency; // scan CTCSS/DCS codes for current frequency
SCAN_SaveState_t gScannerSaveState; SCAN_SaveState_t gScannerSaveState;
uint8_t gScanChannel; uint16_t gScanChannel;
uint32_t gScanFrequency; uint32_t gScanFrequency;
SCAN_CssState_t gScanCssState; SCAN_CssState_t gScanCssState;
uint8_t gScanProgressIndicator; uint8_t gScanProgressIndicator;
@@ -52,7 +52,7 @@ static void SCANNER_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
gRequestDisplayScreen = DISPLAY_SCANNER; gRequestDisplayScreen = DISPLAY_SCANNER;
if (gInputBoxIndex < 3) { if (gInputBoxIndex < 4) {
#ifdef ENABLE_VOICE #ifdef ENABLE_VOICE
gAnotherVoiceID = (VOICE_ID_t)Key; gAnotherVoiceID = (VOICE_ID_t)Key;
#endif #endif
@@ -61,13 +61,14 @@ static void SCANNER_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
gInputBoxIndex = 0; gInputBoxIndex = 0;
uint16_t chan = ((gInputBox[0] * 100) + (gInputBox[1] * 10) + gInputBox[2]) - 1; // uint16_t chan = ((gInputBox[0] * 100) + (gInputBox[1] * 10) + gInputBox[2]) - 1;
uint16_t chan = ((gInputBox[0] * 1000) + (gInputBox[1] * 100) + (gInputBox[2] * 10) + gInputBox[3]) - 1;
if (IS_MR_CHANNEL(chan)) { if (IS_MR_CHANNEL(chan)) {
#ifdef ENABLE_VOICE #ifdef ENABLE_VOICE
gAnotherVoiceID = (VOICE_ID_t)Key; gAnotherVoiceID = (VOICE_ID_t)Key;
#endif #endif
gShowChPrefix = RADIO_CheckValidChannel(chan, false, 0); gShowChPrefix = RADIO_CheckValidChannel(chan, false, 0);
gScanChannel = (uint8_t)chan; gScanChannel = chan;
return; return;
} }
} }
@@ -207,7 +208,7 @@ static void SCANNER_Key_MENU(bool bKeyPressed, bool bKeyHeld)
gTxVfo->freq_config_TX.Code = gScanCssResultCode; gTxVfo->freq_config_TX.Code = gScanCssResultCode;
} }
uint8_t chan; uint16_t chan;
if (IS_MR_CHANNEL(gTxVfo->CHANNEL_SAVE)) { if (IS_MR_CHANNEL(gTxVfo->CHANNEL_SAVE)) {
chan = gScanChannel; chan = gScanChannel;
gEeprom.MrChannel[gEeprom.TX_VFO] = chan; gEeprom.MrChannel[gEeprom.TX_VFO] = chan;
@@ -275,10 +276,16 @@ void SCANNER_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
SCANNER_Key_MENU(bKeyPressed, bKeyHeld); SCANNER_Key_MENU(bKeyPressed, bKeyHeld);
break; break;
case KEY_UP: case KEY_UP:
SCANNER_Key_UP_DOWN(bKeyPressed, bKeyHeld, 1); if(gEeprom.SET_NAV == 0)
SCANNER_Key_UP_DOWN(bKeyPressed, bKeyHeld, -1);
else
SCANNER_Key_UP_DOWN(bKeyPressed, bKeyHeld, 1);
break; break;
case KEY_DOWN: case KEY_DOWN:
SCANNER_Key_UP_DOWN(bKeyPressed, bKeyHeld, -1); if(gEeprom.SET_NAV == 0)
SCANNER_Key_UP_DOWN(bKeyPressed, bKeyHeld, 1);
else
SCANNER_Key_UP_DOWN(bKeyPressed, bKeyHeld, -1);
break; break;
case KEY_EXIT: case KEY_EXIT:
SCANNER_Key_EXIT(bKeyPressed, bKeyHeld); SCANNER_Key_EXIT(bKeyPressed, bKeyHeld);
+1 -1
View File
@@ -40,7 +40,7 @@ extern DCS_CodeType_t gScanCssResultType;
extern uint8_t gScanCssResultCode; extern uint8_t gScanCssResultCode;
extern bool gScanSingleFrequency; extern bool gScanSingleFrequency;
extern SCAN_SaveState_t gScannerSaveState; extern SCAN_SaveState_t gScannerSaveState;
extern uint8_t gScanChannel; extern uint16_t gScanChannel;
extern uint32_t gScanFrequency; extern uint32_t gScanFrequency;
extern SCAN_CssState_t gScanCssState; extern SCAN_CssState_t gScanCssState;
extern uint8_t gScanProgressIndicator; extern uint8_t gScanProgressIndicator;
+2 -2
View File
@@ -44,11 +44,11 @@ void UI_GenerateChannelString(char *pString, const uint16_t Channel)
void UI_GenerateChannelStringEx(char *pString, const bool bShowPrefix, const uint16_t ChannelNumber) void UI_GenerateChannelStringEx(char *pString, const bool bShowPrefix, const uint16_t ChannelNumber)
{ {
if (gInputBoxIndex > 0) { if (gInputBoxIndex > 0) {
for (unsigned int i = 0; i < 3; i++) { for (unsigned int i = 0; i < 4; i++) {
pString[i] = (gInputBox[i] == 10) ? '-' : gInputBox[i] + '0'; pString[i] = (gInputBox[i] == 10) ? '-' : gInputBox[i] + '0';
} }
pString[3] = 0; pString[4] = 0;
return; return;
} }