Fixed APP_SetFrequencyByStep.

This commit is contained in:
Dual Tachyon 2023-08-28 13:30:17 +01:00
parent 9175b2d20b
commit 8e854d4c4b
2 changed files with 9 additions and 8 deletions

View File

@ -500,22 +500,23 @@ void FUN_000069f8(FUNCTION_Type_t Function)
}
}
void APP_AddStepToFrequency(VFO_Info_t *pInfo, uint8_t Step)
void APP_SetFrequencyByStep(VFO_Info_t *pInfo, int8_t Step)
{
uint32_t Frequency;
Frequency = pInfo->DCS[0].Frequency + (Step * pInfo->StepFrequency);
if (Frequency >= gLowerLimitFrequencyBandTable[pInfo->Band] && Frequency <= gUpperLimitFrequencyBandTable[pInfo->Band]) {
Frequency = FREQUENCY_FloorToStep(gUpperLimitFrequencyBandTable[pInfo->Band], pInfo->StepFrequency, Frequency);
if (Frequency >= gUpperLimitFrequencyBandTable[pInfo->Band]) {
pInfo->DCS[0].Frequency = gLowerLimitFrequencyBandTable[pInfo->Band];
} else if (Frequency < gLowerLimitFrequencyBandTable[pInfo->Band]) {
pInfo->DCS[0].Frequency = FREQUENCY_FloorToStep(gUpperLimitFrequencyBandTable[pInfo->Band], pInfo->StepFrequency, gLowerLimitFrequencyBandTable[pInfo->Band]);
} else {
Frequency = gLowerLimitFrequencyBandTable[pInfo->Band];
pInfo->DCS[0].Frequency = Frequency;
}
pInfo->DCS[0].Frequency = Frequency;
}
void APP_MoreRadioStuff(void)
{
APP_AddStepToFrequency(gInfoCHAN_A, gStepDirection);
APP_SetFrequencyByStep(gInfoCHAN_A, gStepDirection);
RADIO_ApplyOffset(gInfoCHAN_A);
RADIO_ConfigureSquelchAndOutputPower(gInfoCHAN_A);
RADIO_SetupRegisters(true);

View File

@ -9,7 +9,7 @@
extern void APP_SwitchToFM(void);
extern void FUN_0000773c(void);
extern void APP_AddStepToFrequency(VFO_Info_t *pInfo, uint8_t Step);
extern void APP_SetFrequencyByStep(VFO_Info_t *pInfo, int8_t Step);
extern void APP_ChangeStepDirectionMaybe(bool bFlag, uint8_t Direction);
extern void APP_CycleOutputPower(void);
extern void APP_FlipVoxSwitch(void);
@ -275,7 +275,7 @@ void MAIN_Key_UP_DOWN(bool bKeyPressed, bool bKeyHeld, int8_t Direction)
uint8_t Next;
if (199 < Channel) {
APP_AddStepToFrequency(gTxRadioInfo, Direction);
APP_SetFrequencyByStep(gTxRadioInfo, Direction);
gRequestSaveChannel = 1;
return;
}