mirror of
https://github.com/OneOfEleven/uv-k5-firmware-custom.git
synced 2025-06-19 06:39:49 +03:00
fix major frequency/band bug
This commit is contained in:
11
app/app.c
11
app/app.c
@ -586,11 +586,12 @@ uint32_t APP_set_frequency_by_step(vfo_info_t *pInfo, int8_t Step)
|
||||
Frequency = Lower + Base + (Index * 833);
|
||||
}
|
||||
|
||||
if (Frequency >= FREQ_BAND_TABLE[pInfo->band].upper)
|
||||
Frequency = FREQ_BAND_TABLE[pInfo->band].lower;
|
||||
else
|
||||
if (Frequency < FREQ_BAND_TABLE[pInfo->band].lower)
|
||||
Frequency = FREQUENCY_FloorToStep(FREQ_BAND_TABLE[pInfo->band].upper, pInfo->step_freq, FREQ_BAND_TABLE[pInfo->band].lower);
|
||||
// if (Frequency >= FREQ_BAND_TABLE[pInfo->band].upper)
|
||||
// Frequency = FREQ_BAND_TABLE[pInfo->band].lower;
|
||||
// else
|
||||
// if (Frequency < FREQ_BAND_TABLE[pInfo->band].lower)
|
||||
// Frequency = FREQUENCY_floor_to_step(FREQ_BAND_TABLE[pInfo->band].upper, pInfo->step_freq, FREQ_BAND_TABLE[pInfo->band].lower);
|
||||
Frequency = FREQUENCY_wrap_to_step_band(Frequency, pInfo->step_freq, pInfo->band);
|
||||
|
||||
return Frequency;
|
||||
}
|
||||
|
11
app/main.c
11
app/main.c
@ -43,7 +43,7 @@
|
||||
void toggle_chan_scanlist(void)
|
||||
{ // toggle the selected channels scanlist setting
|
||||
|
||||
// if (IS_FREQ_CHANNEL(g_tx_vfo->channel_save))
|
||||
// if (IS_FREQ_CHANNEL(g_tx_vfo->channel_save)) // TODO: include the VFO freq as a channel when scanning
|
||||
if (IS_NOAA_CHANNEL(g_tx_vfo->channel_save))
|
||||
{
|
||||
g_beep_to_play = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
||||
@ -212,10 +212,10 @@ void processFKeyFunction(const key_code_t Key)
|
||||
if (g_setting_350_enable || Band != BAND5_350MHz)
|
||||
{
|
||||
if (Band > BAND7_470MHz)
|
||||
Band = BAND1_50MHz;
|
||||
Band = BAND1_50MHz; // wrap-a-round
|
||||
}
|
||||
else
|
||||
Band = BAND6_400MHz;
|
||||
Band = BAND6_400MHz; // jump to next band
|
||||
g_tx_vfo->band = Band;
|
||||
|
||||
g_eeprom.screen_channel[Vfo] = FREQ_CHANNEL_FIRST + Band;
|
||||
@ -545,10 +545,9 @@ void MAIN_Key_DIGITS(key_code_t Key, bool key_pressed, bool key_held)
|
||||
RADIO_configure_channel(Vfo, VFO_CONFIGURE_RELOAD);
|
||||
}
|
||||
|
||||
// Frequency += 75; // is this meant to be rounding ?
|
||||
Frequency += g_tx_vfo->step_freq / 2; // no idea, but this is
|
||||
Frequency += g_tx_vfo->step_freq / 2; // for rounding to nearest step size
|
||||
|
||||
Frequency = FREQUENCY_FloorToStep(Frequency, g_tx_vfo->step_freq, FREQ_BAND_TABLE[g_tx_vfo->band].lower);
|
||||
Frequency = FREQUENCY_floor_to_step(Frequency, g_tx_vfo->step_freq, FREQ_BAND_TABLE[g_tx_vfo->band].lower, FREQ_BAND_TABLE[g_tx_vfo->band].upper);
|
||||
|
||||
if (Frequency >= BX4819_BAND1.upper && Frequency < BX4819_BAND2.lower)
|
||||
{ // clamp the frequency to the limit
|
||||
|
@ -1424,7 +1424,7 @@ static void MENU_Key_0_to_9(key_code_t Key, bool key_pressed, bool key_held)
|
||||
NUMBER_Get(g_input_box, &Frequency);
|
||||
g_input_box_index = 0;
|
||||
|
||||
g_sub_menu_selection = FREQUENCY_FloorToStep(Frequency + (g_tx_vfo->step_freq / 2), g_tx_vfo->step_freq, 0);
|
||||
g_sub_menu_selection = FREQUENCY_floor_to_step(Frequency + (g_tx_vfo->step_freq / 2), g_tx_vfo->step_freq, 0, Frequency + (g_tx_vfo->step_freq / 2));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1852,7 +1852,7 @@ static void MENU_Key_UP_DOWN(bool key_pressed, bool key_held, int8_t Direction)
|
||||
else
|
||||
Offset = 0;
|
||||
|
||||
g_sub_menu_selection = FREQUENCY_FloorToStep(Offset, g_tx_vfo->step_freq, 0);
|
||||
g_sub_menu_selection = FREQUENCY_floor_to_step(Offset, g_tx_vfo->step_freq, 0, Offset);
|
||||
g_request_display_screen = DISPLAY_MENU;
|
||||
return;
|
||||
}
|
||||
|
Reference in New Issue
Block a user