diff --git a/app/app.c b/app/app.c index 96e02dc..5d8a46d 100644 --- a/app/app.c +++ b/app/app.c @@ -1100,7 +1100,7 @@ void APP_TimeSlice10ms(void) APP_CheckKeys(); return; } - if (g_20000461 != 0) { + if (gScannerEditState != 0) { APP_CheckKeys(); return; } @@ -1323,7 +1323,7 @@ LAB_00004b08: } } - if (gScreenToDisplay == DISPLAY_SCANNER && g_20000461 == 0 && gScanState < 2) { + if (gScreenToDisplay == DISPLAY_SCANNER && gScannerEditState == 0 && gScanState < 2) { g_20000464++; if (0x20 < g_20000464) { if (gScanState == 1 && g_20000458 == 0) { @@ -1420,7 +1420,7 @@ void FUN_000075b0(void) if (g_20000458 == 1) { gScanState = 1; gScanFrequency = gInfoCHAN_A->pDCS_Current->Frequency; - gStepOffset = gInfoCHAN_A->STEP_SETTING; + gStepSetting = gInfoCHAN_A->STEP_SETTING; BK4819_PickRXFilterPathBasedOnFrequency(gScanFrequency); BK4819_SetScanFrequency(gScanFrequency); } else { @@ -1441,7 +1441,7 @@ void FUN_000075b0(void) g_CTCSS_Lost = false; g_VOX_Lost = false; g_SquelchLost = false; - g_20000461 = 0; + gScannerEditState = 0; g_20000464 = 0; } diff --git a/app/generic.c b/app/generic.c index 08bf5c5..9aaf1d2 100644 --- a/app/generic.c +++ b/app/generic.c @@ -154,7 +154,7 @@ void GENERIC_Key_PTT(bool bKeyPressed) return; } gRequestDisplayScreen = DISPLAY_MAIN; - gEeprom.CROSS_BAND_RX_TX = g_20000459; + gEeprom.CROSS_BAND_RX_TX = gBackupCROSS_BAND_RX_TX; g_2000036F = 1; gFlagStopScan = true; g_2000039A = 2; diff --git a/app/main.c b/app/main.c index f719b2a..68ad76d 100644 --- a/app/main.c +++ b/app/main.c @@ -214,7 +214,7 @@ void MAIN_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL; gFlagStartScan = true; g_20000458 = 0; - g_20000459 = gEeprom.CROSS_BAND_RX_TX; + gBackupCROSS_BAND_RX_TX = gEeprom.CROSS_BAND_RX_TX; gEeprom.CROSS_BAND_RX_TX = CROSS_BAND_OFF; break; @@ -344,7 +344,7 @@ void MAIN_Key_STAR(bool bKeyPressed, bool bKeyHeld) if (IS_NOT_NOAA_CHANNEL(gTxRadioInfo->CHANNEL_SAVE)) { gFlagStartScan = true; g_20000458 = 1; - g_20000459 = gEeprom.CROSS_BAND_RX_TX; + gBackupCROSS_BAND_RX_TX = gEeprom.CROSS_BAND_RX_TX; gEeprom.CROSS_BAND_RX_TX = CROSS_BAND_OFF; } else { gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL; diff --git a/misc.c b/misc.c index 9d358e5..0ede6fc 100644 --- a/misc.c +++ b/misc.c @@ -139,14 +139,13 @@ bool g_20000439; uint8_t gMenuListCount; uint8_t g_20000442; uint8_t g_20000458; -uint8_t g_20000459; +uint8_t gBackupCROSS_BAND_RX_TX; uint8_t g_CxCSS_Type; uint8_t g_CxCSS_Index; uint8_t g_2000045C; uint8_t g_2000045D; uint8_t g_2000045F; -uint8_t gStepOffset; -uint8_t g_20000461; +uint8_t gScannerEditState; uint8_t g_20000464; uint8_t gAircopySendCountdown; uint8_t gFSKWriteIndex; diff --git a/misc.h b/misc.h index 8e65b1a..b5eba47 100644 --- a/misc.h +++ b/misc.h @@ -163,14 +163,13 @@ extern bool g_20000439; extern uint8_t gMenuListCount; extern uint8_t g_20000442; extern uint8_t g_20000458; -extern uint8_t g_20000459; +extern uint8_t gBackupCROSS_BAND_RX_TX; extern uint8_t g_CxCSS_Type; extern uint8_t g_CxCSS_Index; extern uint8_t g_2000045C; extern uint8_t g_2000045D; extern uint8_t g_2000045F; -extern uint8_t gStepOffset; -extern uint8_t g_20000461; +extern uint8_t gScannerEditState; extern uint8_t g_20000464; extern uint8_t gAircopySendCountdown; extern uint8_t gFSKWriteIndex; diff --git a/radio.c b/radio.c index b8ac60b..83e8c94 100644 --- a/radio.c +++ b/radio.c @@ -38,6 +38,8 @@ DCS_CodeType_t gCodeType; DCS_CodeType_t gCopyOfCodeType; uint8_t gCode; +STEP_Setting_t gStepSetting; + bool RADIO_CheckValidChannel(uint16_t Channel, bool bCheckScanList, uint8_t VFO) { uint8_t Attributes; @@ -109,7 +111,7 @@ void RADIO_InitInfo(VFO_Info_t *pInfo, uint8_t ChannelSave, uint8_t Band, uint32 pInfo->Band = Band; pInfo->SCANLIST1_PARTICIPATION = true; pInfo->SCANLIST2_PARTICIPATION = true; - pInfo->STEP_SETTING = 5; + pInfo->STEP_SETTING = STEP_25_0kHz; pInfo->StepFrequency = 2500; pInfo->CHANNEL_SAVE = ChannelSave; pInfo->FrequencyReverse = false; @@ -218,8 +220,8 @@ void RADIO_ConfigureChannel(uint8_t VFO, uint32_t Arg) gEeprom.VfoInfo[VFO].AM_CHANNEL_MODE = !!(Data[3] & 0x10); Tmp = Data[6]; - if (Tmp > 6) { - Tmp = 5; + if (Tmp > STEP_8_33kHz) { + Tmp = STEP_25_0kHz; } gEeprom.VfoInfo[VFO].STEP_SETTING = Tmp; gEeprom.VfoInfo[VFO].StepFrequency = StepFrequencyTable[Tmp]; diff --git a/radio.h b/radio.h index 948af00..bc3c91b 100644 --- a/radio.h +++ b/radio.h @@ -46,6 +46,18 @@ enum PTT_ID_t { typedef enum PTT_ID_t PTT_ID_t; +enum STEP_Setting_t { + STEP_2_5kHz, + STEP_5_0kHz, + STEP_6_25kHz, + STEP_10_0kHz, + STEP_12_5kHz, + STEP_25_0kHz, + STEP_8_33kHz, +}; + +typedef enum STEP_Setting_t STEP_Setting_t; + typedef struct { uint32_t Frequency; DCS_CodeType_t CodeType; @@ -67,7 +79,7 @@ typedef struct VFO_Info_t { uint8_t SquelchCloseRSSIThresh; uint8_t SquelchCloseNoiseThresh; uint8_t SquelchOpenGlitchThresh; - uint8_t STEP_SETTING; + STEP_Setting_t STEP_SETTING; uint8_t OUTPUT_POWER; uint8_t TXP_CalculatedSetting; bool FrequencyReverse; @@ -92,6 +104,8 @@ extern DCS_CodeType_t gCodeType; extern DCS_CodeType_t gCopyOfCodeType; extern uint8_t gCode; +extern STEP_Setting_t gStepSetting; + bool RADIO_CheckValidChannel(uint16_t ChNum, bool bCheckScanList, uint8_t RadioNum); uint8_t RADIO_FindNextChannel(uint8_t ChNum, int8_t Direction, bool bCheckScanList, uint8_t RadioNum); void RADIO_InitInfo(VFO_Info_t *pInfo, uint8_t ChannelSave, uint8_t ChIndex, uint32_t Frequency); diff --git a/ui/scanner.c b/ui/scanner.c index fc55991..e64d048 100644 --- a/ui/scanner.c +++ b/ui/scanner.c @@ -50,12 +50,12 @@ void UI_DisplayScanner(void) UI_PrintString(String, 2, 127, 3, 8, 0); memset(String, 0, sizeof(String)); - if (g_20000461 == 2) { + if (gScannerEditState == 2) { strcpy(String, "SAVE?"); Start = 0; bCentered = 1; } else { - if (g_20000461 == 1) { + if (gScannerEditState == 1) { strcpy(String, "SAVE:"); UI_GenerateChannelStringEx(String + 5, gShowChPrefix, gScanChannel); } else if (gScanState < 2) {