mirror of
https://github.com/OneOfEleven/uv-k5-firmware-custom.git
synced 2025-06-19 06:39:49 +03:00
fix up/dn frequency tx offset bug
This commit is contained in:
16
app/fm.c
16
app/fm.c
@ -80,12 +80,12 @@ int FM_ConfigureChannelState(void)
|
||||
{
|
||||
g_eeprom.fm_frequency_playing = g_eeprom.fm_selected_frequency;
|
||||
|
||||
if (g_eeprom.fm_is_channel_mode)
|
||||
if (g_eeprom.fm_channel_mode)
|
||||
{
|
||||
const uint8_t Channel = FM_FindNextChannel(g_eeprom.fm_selected_channel, FM_CHANNEL_UP);
|
||||
if (Channel == 0xFF)
|
||||
{
|
||||
g_eeprom.fm_is_channel_mode = false;
|
||||
g_eeprom.fm_channel_mode = false;
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -160,7 +160,7 @@ void FM_PlayAndUpdate(void)
|
||||
|
||||
if (g_fm_auto_scan)
|
||||
{
|
||||
g_eeprom.fm_is_channel_mode = true;
|
||||
g_eeprom.fm_channel_mode = true;
|
||||
g_eeprom.fm_selected_channel = 0;
|
||||
}
|
||||
|
||||
@ -261,7 +261,7 @@ static void FM_Key_DIGITS(key_code_t Key, bool key_pressed, bool key_held)
|
||||
if (g_fm_scan_state != FM_SCAN_OFF)
|
||||
return;
|
||||
|
||||
State = g_eeprom.fm_is_channel_mode ? STATE_USER_MODE : STATE_FREQ_MODE;
|
||||
State = g_eeprom.fm_channel_mode ? STATE_USER_MODE : STATE_FREQ_MODE;
|
||||
}
|
||||
|
||||
INPUTBOX_append(Key);
|
||||
@ -368,7 +368,7 @@ static void FM_Key_DIGITS(key_code_t Key, bool key_pressed, bool key_held)
|
||||
break;
|
||||
|
||||
case KEY_3:
|
||||
g_eeprom.fm_is_channel_mode = !g_eeprom.fm_is_channel_mode;
|
||||
g_eeprom.fm_channel_mode = !g_eeprom.fm_channel_mode;
|
||||
|
||||
if (!FM_ConfigureChannelState())
|
||||
{
|
||||
@ -478,7 +478,7 @@ static void FM_Key_MENU(bool key_pressed, bool key_held)
|
||||
if (g_fm_scan_state == FM_SCAN_OFF)
|
||||
{ // not scanning
|
||||
|
||||
if (!g_eeprom.fm_is_channel_mode)
|
||||
if (!g_eeprom.fm_channel_mode)
|
||||
{ // frequency mode
|
||||
|
||||
if (g_ask_to_save)
|
||||
@ -578,7 +578,7 @@ static void FM_Key_UP_DOWN(bool key_pressed, bool key_held, int8_t Step)
|
||||
return;
|
||||
}
|
||||
|
||||
if (g_eeprom.fm_is_channel_mode)
|
||||
if (g_eeprom.fm_channel_mode)
|
||||
{ // we're in channel mode
|
||||
const uint8_t Channel = FM_FindNextChannel(g_eeprom.fm_selected_channel + Step, Step);
|
||||
if (Channel == 0xFF || g_eeprom.fm_selected_channel == Channel)
|
||||
@ -659,7 +659,7 @@ void FM_Play(void)
|
||||
g_fm_play_count_down_10ms = 0;
|
||||
g_fm_found_frequency = true;
|
||||
|
||||
if (!g_eeprom.fm_is_channel_mode)
|
||||
if (!g_eeprom.fm_channel_mode)
|
||||
g_eeprom.fm_selected_frequency = g_eeprom.fm_frequency_playing;
|
||||
|
||||
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
|
||||
|
15
app/main.c
15
app/main.c
@ -843,9 +843,20 @@ void MAIN_Key_UP_DOWN(bool key_pressed, bool key_held, scan_state_dir_t Directio
|
||||
// find the first channel that contains this frequency
|
||||
g_tx_vfo->freq_in_channel = BOARD_find_channel(g_tx_vfo->freq_config_rx.frequency);
|
||||
|
||||
// only update eeprom when the key is released - saves a LOT of wear and tear on the little eeprom
|
||||
SETTINGS_save_channel(g_tx_vfo->channel_save, g_eeprom.tx_vfo, g_tx_vfo, 1);
|
||||
|
||||
|
||||
RADIO_ApplyOffset(g_tx_vfo);
|
||||
if (!g_tx_vfo->frequency_reverse)
|
||||
{
|
||||
g_tx_vfo->p_rx = &g_tx_vfo->freq_config_rx;
|
||||
g_tx_vfo->p_tx = &g_tx_vfo->freq_config_tx;
|
||||
}
|
||||
else
|
||||
{
|
||||
g_tx_vfo->p_rx = &g_tx_vfo->freq_config_tx;
|
||||
g_tx_vfo->p_tx = &g_tx_vfo->freq_config_rx;
|
||||
}
|
||||
|
||||
#if defined(ENABLE_UART) && defined(ENABLE_UART_DEBUG)
|
||||
// UART_printf("save chan\r\n");
|
||||
#endif
|
||||
|
@ -560,7 +560,7 @@ void MENU_AcceptSetting(void)
|
||||
g_eeprom.vox_switch = g_sub_menu_selection != 0;
|
||||
if (g_eeprom.vox_switch)
|
||||
g_eeprom.vox_level = g_sub_menu_selection - 1;
|
||||
BOARD_EEPROM_LoadCalibration();
|
||||
BOARD_eeprom_loadCalibration();
|
||||
g_flag_reconfigure_vfos = true;
|
||||
g_update_status = true;
|
||||
break;
|
||||
@ -658,7 +658,7 @@ void MENU_AcceptSetting(void)
|
||||
|
||||
case MENU_MIC_GAIN:
|
||||
g_eeprom.mic_sensitivity = g_sub_menu_selection;
|
||||
BOARD_EEPROM_LoadCalibration();
|
||||
BOARD_eeprom_loadCalibration();
|
||||
g_flag_reconfigure_vfos = true;
|
||||
break;
|
||||
|
||||
@ -1898,7 +1898,7 @@ static void MENU_Key_UP_DOWN(bool key_pressed, bool key_held, int8_t Direction)
|
||||
{
|
||||
case MENU_OFFSET:
|
||||
{
|
||||
const int32_t max_freq = 100000000;
|
||||
const int32_t max_freq = MAX_TX_OFFSET;
|
||||
const int32_t step_size = g_tx_vfo->step_freq;
|
||||
int32_t offset = (int32_t)g_sub_menu_selection + (Direction * step_size);
|
||||
|
||||
|
@ -371,7 +371,7 @@ static void cmd_051D(const uint8_t *pBuffer)
|
||||
|
||||
#ifdef INCLUDE_AES
|
||||
if (reload_eeprom)
|
||||
BOARD_EEPROM_load();
|
||||
BOARD_eeprom_load();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user