mirror of
https://github.com/OneOfEleven/uv-k5-firmware-custom.git
synced 2025-04-28 14:21:25 +03:00
Auto monitor on/off when holding frequency up/down buttons
This commit is contained in:
parent
7b44bb6253
commit
916be495d4
17
app/main.c
17
app/main.c
@ -718,14 +718,18 @@ static void MAIN_Key_STAR(bool key_pressed, bool key_held)
|
||||
|
||||
static void MAIN_Key_UP_DOWN(bool key_pressed, bool key_held, scan_state_dir_t Direction)
|
||||
{
|
||||
static bool monitor_was_enabled = false;
|
||||
|
||||
uint8_t Channel = g_eeprom.screen_channel[g_eeprom.tx_vfo];
|
||||
|
||||
// only update eeprom when the key is released (saves wear and tear)
|
||||
if (!key_pressed && g_scan_state_dir == SCAN_STATE_DIR_OFF && IS_NOT_NOAA_CHANNEL(Channel) && IS_FREQ_CHANNEL(Channel))
|
||||
{
|
||||
// monitor off
|
||||
if (key_held && !key_pressed && g_current_function == FUNCTION_MONITOR)
|
||||
if (key_held && !key_pressed && !monitor_was_enabled && g_current_function == FUNCTION_MONITOR)
|
||||
{ // re-enable the squelch
|
||||
APP_start_listening(FUNCTION_RECEIVE, false);
|
||||
g_monitor_enabled = false;
|
||||
}
|
||||
|
||||
SETTINGS_SaveChannel(g_tx_vfo->channel_save, g_eeprom.tx_vfo, g_tx_vfo, 1);
|
||||
|
||||
@ -799,9 +803,14 @@ static void MAIN_Key_UP_DOWN(bool key_pressed, bool key_held, scan_state_dir_t D
|
||||
else
|
||||
{ // don't need to go through all the other stuff
|
||||
|
||||
// open the squelch
|
||||
if (key_held && key_pressed && g_current_function != FUNCTION_MONITOR)
|
||||
if (!key_held && key_pressed)
|
||||
monitor_was_enabled = g_monitor_enabled;
|
||||
|
||||
if (key_held && key_pressed && !monitor_was_enabled)
|
||||
{ // open the squelch if the user holds the key down
|
||||
APP_start_listening(FUNCTION_MONITOR, false);
|
||||
g_monitor_enabled = true;
|
||||
}
|
||||
|
||||
BK4819_set_rf_frequency(frequency, true);
|
||||
//BK4819_PickRXFilterPathBasedOnFrequency(frequency);
|
||||
|
BIN
firmware.bin
BIN
firmware.bin
Binary file not shown.
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user