2023-09-09 08:03:56 +01:00
|
|
|
/* Copyright 2023 Dual Tachyon
|
|
|
|
* https://github.com/DualTachyon
|
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
#include "app/action.h"
|
|
|
|
#include "app/app.h"
|
2023-09-14 09:56:30 +01:00
|
|
|
#ifdef ENABLE_FMRADIO
|
|
|
|
#include "app/fm.h"
|
|
|
|
#endif
|
2023-09-09 08:03:56 +01:00
|
|
|
#include "app/generic.h"
|
|
|
|
#include "app/main.h"
|
2023-10-14 14:07:05 +01:00
|
|
|
#include "app/search.h"
|
2023-10-18 18:50:37 +01:00
|
|
|
#ifdef ENABLE_SPECTRUM
|
|
|
|
// #include "app/spectrum.h"
|
|
|
|
#endif
|
2023-09-09 08:03:56 +01:00
|
|
|
#include "audio.h"
|
2023-10-03 23:33:01 +01:00
|
|
|
#include "board.h"
|
2023-09-27 23:22:01 +01:00
|
|
|
#include "driver/bk4819.h"
|
2023-10-15 22:34:21 +01:00
|
|
|
#include "driver/uart.h"
|
2023-09-09 08:03:56 +01:00
|
|
|
#include "dtmf.h"
|
|
|
|
#include "frequencies.h"
|
|
|
|
#include "misc.h"
|
|
|
|
#include "radio.h"
|
|
|
|
#include "settings.h"
|
|
|
|
#include "ui/inputbox.h"
|
|
|
|
#include "ui/ui.h"
|
2023-10-18 18:50:37 +01:00
|
|
|
#include "ui/menu.h"
|
2023-09-09 08:03:56 +01:00
|
|
|
|
2023-10-05 10:03:07 +01:00
|
|
|
void toggle_chan_scanlist(void)
|
|
|
|
{ // toggle the selected channels scanlist setting
|
|
|
|
|
2023-10-17 17:28:38 +01:00
|
|
|
if (g_screen_to_display != DISPLAY_MAIN ||
|
|
|
|
!IS_USER_CHANNEL(g_tx_vfo->channel_save) ||
|
|
|
|
g_current_function == FUNCTION_TRANSMIT ||
|
|
|
|
g_current_function == FUNCTION_PANADAPTER)
|
2023-10-17 11:05:41 +01:00
|
|
|
{
|
2023-10-17 17:28:38 +01:00
|
|
|
g_beep_to_play = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
|
|
|
return;
|
2023-10-17 11:05:41 +01:00
|
|
|
}
|
2023-10-17 17:28:38 +01:00
|
|
|
|
|
|
|
if (g_scan_state_dir != SCAN_STATE_DIR_OFF &&
|
|
|
|
g_scan_pause_10ms > 0 &&
|
|
|
|
g_scan_pause_10ms <= (200 / 10) &&
|
|
|
|
!g_scan_pause_mode)
|
2023-10-17 21:22:40 +01:00
|
|
|
{ // scanning isn't paused
|
2023-10-17 17:28:38 +01:00
|
|
|
g_beep_to_play = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2023-10-08 20:23:37 +01:00
|
|
|
if (g_tx_vfo->scanlist_1_participation)
|
2023-10-05 10:03:07 +01:00
|
|
|
{
|
2023-10-08 20:23:37 +01:00
|
|
|
if (g_tx_vfo->scanlist_2_participation)
|
|
|
|
g_tx_vfo->scanlist_1_participation = 0;
|
2023-10-05 10:03:07 +01:00
|
|
|
else
|
2023-10-08 20:23:37 +01:00
|
|
|
g_tx_vfo->scanlist_2_participation = 1;
|
2023-10-05 10:03:07 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2023-10-08 20:23:37 +01:00
|
|
|
if (g_tx_vfo->scanlist_2_participation)
|
|
|
|
g_tx_vfo->scanlist_2_participation = 0;
|
2023-10-05 10:03:07 +01:00
|
|
|
else
|
2023-10-08 20:23:37 +01:00
|
|
|
g_tx_vfo->scanlist_1_participation = 1;
|
2023-10-05 10:03:07 +01:00
|
|
|
}
|
|
|
|
|
2023-10-08 20:23:37 +01:00
|
|
|
SETTINGS_UpdateChannel(g_tx_vfo->channel_save, g_tx_vfo, true);
|
2023-10-05 10:03:07 +01:00
|
|
|
|
2023-10-08 20:23:37 +01:00
|
|
|
g_vfo_configure_mode = VFO_CONFIGURE;
|
|
|
|
g_flag_reset_vfos = true;
|
2023-10-05 10:03:07 +01:00
|
|
|
}
|
|
|
|
|
2023-10-17 21:22:40 +01:00
|
|
|
void processFKeyFunction(const key_code_t Key)
|
2023-09-09 08:03:56 +01:00
|
|
|
{
|
|
|
|
uint8_t Band;
|
2023-10-08 17:14:13 +01:00
|
|
|
uint8_t Vfo = g_eeprom.tx_vfo;
|
2023-09-09 08:03:56 +01:00
|
|
|
|
2023-10-17 11:05:41 +01:00
|
|
|
if (g_current_function == FUNCTION_TRANSMIT || g_screen_to_display == DISPLAY_MENU)
|
2023-10-05 17:38:25 +01:00
|
|
|
{
|
2023-10-11 18:32:10 +01:00
|
|
|
g_beep_to_play = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
2023-10-05 09:17:38 +01:00
|
|
|
return;
|
2023-10-05 17:38:25 +01:00
|
|
|
}
|
2023-10-08 20:23:37 +01:00
|
|
|
|
2023-09-09 08:03:56 +01:00
|
|
|
switch (Key)
|
|
|
|
{
|
2023-10-13 15:12:32 +01:00
|
|
|
case KEY_0: // FM
|
2023-10-16 06:43:42 +01:00
|
|
|
|
2023-10-17 11:05:41 +01:00
|
|
|
if (g_scan_state_dir != SCAN_STATE_DIR_OFF)
|
2023-10-17 21:22:40 +01:00
|
|
|
APP_stop_scan();
|
2023-10-17 11:05:41 +01:00
|
|
|
|
2023-09-14 09:56:30 +01:00
|
|
|
#ifdef ENABLE_FMRADIO
|
|
|
|
ACTION_FM();
|
2023-09-25 13:27:52 +01:00
|
|
|
#else
|
2023-09-27 00:26:58 +01:00
|
|
|
|
|
|
|
|
2023-10-04 22:56:54 +01:00
|
|
|
// TODO: make use of this function key
|
2023-09-27 00:26:58 +01:00
|
|
|
|
|
|
|
|
2023-09-14 09:56:30 +01:00
|
|
|
#endif
|
2023-10-17 11:05:41 +01:00
|
|
|
|
2023-09-09 08:03:56 +01:00
|
|
|
break;
|
2023-09-14 19:38:28 +01:00
|
|
|
|
2023-10-13 15:12:32 +01:00
|
|
|
case KEY_1: // BAND
|
2023-10-16 06:43:42 +01:00
|
|
|
|
2023-10-08 20:23:37 +01:00
|
|
|
if (!IS_FREQ_CHANNEL(g_tx_vfo->channel_save))
|
2023-09-09 08:03:56 +01:00
|
|
|
{
|
2023-10-17 11:05:41 +01:00
|
|
|
g_beep_to_play = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
2023-09-09 08:03:56 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2023-10-17 21:22:40 +01:00
|
|
|
APP_stop_scan();
|
2023-10-17 11:05:41 +01:00
|
|
|
|
2023-10-08 20:23:37 +01:00
|
|
|
Band = g_tx_vfo->band + 1;
|
|
|
|
if (g_setting_350_enable || Band != BAND5_350MHz)
|
2023-09-09 08:03:56 +01:00
|
|
|
{
|
2023-09-25 18:08:21 +01:00
|
|
|
if (Band > BAND7_470MHz)
|
2023-09-09 08:03:56 +01:00
|
|
|
Band = BAND1_50MHz;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
Band = BAND6_400MHz;
|
2023-10-08 20:23:37 +01:00
|
|
|
g_tx_vfo->band = Band;
|
2023-09-09 08:03:56 +01:00
|
|
|
|
2023-10-08 17:14:13 +01:00
|
|
|
g_eeprom.screen_channel[Vfo] = FREQ_CHANNEL_FIRST + Band;
|
|
|
|
g_eeprom.freq_channel[Vfo] = FREQ_CHANNEL_FIRST + Band;
|
2023-09-25 18:08:21 +01:00
|
|
|
|
2023-10-11 18:32:10 +01:00
|
|
|
g_request_save_vfo = true;
|
|
|
|
g_vfo_configure_mode = VFO_CONFIGURE_RELOAD;
|
2023-09-14 20:15:35 +01:00
|
|
|
|
2023-10-11 18:32:10 +01:00
|
|
|
g_request_display_screen = DISPLAY_MAIN;
|
2023-09-09 08:03:56 +01:00
|
|
|
break;
|
2023-09-14 19:38:28 +01:00
|
|
|
|
2023-10-13 15:12:32 +01:00
|
|
|
case KEY_2: // A/B
|
2023-10-16 06:43:42 +01:00
|
|
|
|
2023-10-17 21:22:40 +01:00
|
|
|
APP_stop_scan();
|
2023-10-17 11:05:41 +01:00
|
|
|
|
2023-10-08 17:14:13 +01:00
|
|
|
if (g_eeprom.cross_vfo_rx_tx == CROSS_BAND_CHAN_A)
|
|
|
|
g_eeprom.cross_vfo_rx_tx = CROSS_BAND_CHAN_B;
|
2023-09-09 08:03:56 +01:00
|
|
|
else
|
2023-10-08 17:14:13 +01:00
|
|
|
if (g_eeprom.cross_vfo_rx_tx == CROSS_BAND_CHAN_B)
|
|
|
|
g_eeprom.cross_vfo_rx_tx = CROSS_BAND_CHAN_A;
|
2023-09-09 08:03:56 +01:00
|
|
|
else
|
2023-10-08 17:14:13 +01:00
|
|
|
if (g_eeprom.dual_watch == DUAL_WATCH_CHAN_A)
|
|
|
|
g_eeprom.dual_watch = DUAL_WATCH_CHAN_B;
|
2023-09-09 08:03:56 +01:00
|
|
|
else
|
2023-10-08 17:14:13 +01:00
|
|
|
if (g_eeprom.dual_watch == DUAL_WATCH_CHAN_B)
|
|
|
|
g_eeprom.dual_watch = DUAL_WATCH_CHAN_A;
|
2023-09-09 08:03:56 +01:00
|
|
|
else
|
2023-10-08 17:14:13 +01:00
|
|
|
g_eeprom.tx_vfo = (Vfo + 1) & 1u;
|
2023-09-09 08:03:56 +01:00
|
|
|
|
2023-10-11 18:32:10 +01:00
|
|
|
g_request_save_settings = 1;
|
|
|
|
g_flag_reconfigure_vfos = true;
|
2023-10-03 23:33:01 +01:00
|
|
|
|
2023-10-11 18:32:10 +01:00
|
|
|
g_request_display_screen = DISPLAY_MAIN;
|
2023-09-09 08:03:56 +01:00
|
|
|
break;
|
2023-09-14 19:38:28 +01:00
|
|
|
|
2023-10-13 15:12:32 +01:00
|
|
|
case KEY_3: // VFO/MR
|
2023-10-17 11:05:41 +01:00
|
|
|
|
2023-10-17 21:22:40 +01:00
|
|
|
APP_stop_scan();
|
2023-10-17 11:05:41 +01:00
|
|
|
|
2023-10-16 06:43:42 +01:00
|
|
|
if (g_eeprom.vfo_open && IS_NOT_NOAA_CHANNEL(g_tx_vfo->channel_save))
|
2023-09-09 08:03:56 +01:00
|
|
|
{
|
|
|
|
uint8_t Channel;
|
2023-09-14 19:38:28 +01:00
|
|
|
|
2023-10-08 20:23:37 +01:00
|
|
|
if (IS_USER_CHANNEL(g_tx_vfo->channel_save))
|
2023-10-03 23:33:01 +01:00
|
|
|
{ // swap to frequency mode
|
2023-10-08 17:14:13 +01:00
|
|
|
g_eeprom.screen_channel[Vfo] = g_eeprom.freq_channel[g_eeprom.tx_vfo];
|
2023-10-11 18:32:10 +01:00
|
|
|
|
2023-09-14 09:56:30 +01:00
|
|
|
#ifdef ENABLE_VOICE
|
2023-10-11 18:32:10 +01:00
|
|
|
g_another_voice_id = VOICE_ID_FREQUENCY_MODE;
|
2023-09-09 08:03:56 +01:00
|
|
|
#endif
|
2023-10-11 18:32:10 +01:00
|
|
|
|
|
|
|
g_request_save_vfo = true;
|
|
|
|
g_vfo_configure_mode = VFO_CONFIGURE_RELOAD;
|
2023-09-09 08:03:56 +01:00
|
|
|
break;
|
|
|
|
}
|
2023-09-12 11:01:34 +01:00
|
|
|
|
2023-10-08 17:14:13 +01:00
|
|
|
Channel = RADIO_FindNextChannel(g_eeprom.user_channel[g_eeprom.tx_vfo], 1, false, 0);
|
2023-09-09 08:03:56 +01:00
|
|
|
if (Channel != 0xFF)
|
2023-10-03 23:33:01 +01:00
|
|
|
{ // swap to channel mode
|
2023-10-08 17:14:13 +01:00
|
|
|
g_eeprom.screen_channel[Vfo] = Channel;
|
2023-10-11 18:32:10 +01:00
|
|
|
|
2023-09-14 09:56:30 +01:00
|
|
|
#ifdef ENABLE_VOICE
|
2023-09-09 08:03:56 +01:00
|
|
|
AUDIO_SetVoiceID(0, VOICE_ID_CHANNEL_MODE);
|
|
|
|
AUDIO_SetDigitVoice(1, Channel + 1);
|
2023-10-08 17:14:13 +01:00
|
|
|
g_another_voice_id = (voice_id_t)0xFE;
|
2023-09-09 08:03:56 +01:00
|
|
|
#endif
|
2023-10-11 18:32:10 +01:00
|
|
|
|
|
|
|
g_request_save_vfo = true;
|
|
|
|
g_vfo_configure_mode = VFO_CONFIGURE_RELOAD;
|
2023-09-09 08:03:56 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2023-09-12 11:01:34 +01:00
|
|
|
|
2023-10-11 18:32:10 +01:00
|
|
|
g_beep_to_play = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
2023-09-27 00:26:58 +01:00
|
|
|
|
2023-09-09 08:03:56 +01:00
|
|
|
break;
|
2023-09-14 19:38:28 +01:00
|
|
|
|
2023-10-13 15:12:32 +01:00
|
|
|
case KEY_4: // FC
|
2023-10-16 06:43:42 +01:00
|
|
|
|
2023-10-17 21:22:40 +01:00
|
|
|
APP_stop_scan();
|
2023-09-27 00:26:58 +01:00
|
|
|
|
2023-10-17 11:05:41 +01:00
|
|
|
g_search_flag_start_scan = true;
|
|
|
|
g_search_single_frequency = false;
|
|
|
|
g_backup_cross_vfo_rx_tx = g_eeprom.cross_vfo_rx_tx;
|
|
|
|
g_eeprom.cross_vfo_rx_tx = CROSS_BAND_OFF;
|
2023-09-09 08:03:56 +01:00
|
|
|
break;
|
2023-09-14 19:38:28 +01:00
|
|
|
|
2023-10-13 15:12:32 +01:00
|
|
|
case KEY_5: // NOAA
|
2023-10-16 06:43:42 +01:00
|
|
|
|
2023-09-14 09:56:30 +01:00
|
|
|
#ifdef ENABLE_NOAA
|
2023-10-05 01:07:04 +01:00
|
|
|
|
2023-10-17 21:22:40 +01:00
|
|
|
APP_stop_scan();
|
2023-10-17 11:05:41 +01:00
|
|
|
|
2023-10-08 20:23:37 +01:00
|
|
|
if (IS_NOT_NOAA_CHANNEL(g_tx_vfo->channel_save))
|
2023-09-12 11:01:34 +01:00
|
|
|
{
|
2023-10-08 17:14:13 +01:00
|
|
|
g_eeprom.screen_channel[Vfo] = g_eeprom.noaa_channel[g_eeprom.tx_vfo];
|
2023-09-12 11:01:34 +01:00
|
|
|
}
|
2023-09-09 08:03:56 +01:00
|
|
|
else
|
|
|
|
{
|
2023-10-08 17:14:13 +01:00
|
|
|
g_eeprom.screen_channel[Vfo] = g_eeprom.freq_channel[g_eeprom.tx_vfo];
|
2023-10-17 11:05:41 +01:00
|
|
|
|
2023-09-14 09:56:30 +01:00
|
|
|
#ifdef ENABLE_VOICE
|
2023-10-08 17:14:13 +01:00
|
|
|
g_another_voice_id = VOICE_ID_FREQUENCY_MODE;
|
2023-09-09 08:03:56 +01:00
|
|
|
#endif
|
|
|
|
}
|
2023-10-08 20:23:37 +01:00
|
|
|
g_request_save_vfo = true;
|
|
|
|
g_vfo_configure_mode = VFO_CONFIGURE_RELOAD;
|
2023-10-05 01:07:04 +01:00
|
|
|
|
2023-09-18 00:48:40 +01:00
|
|
|
#else
|
2023-10-05 10:03:07 +01:00
|
|
|
#ifdef ENABLE_VOX
|
|
|
|
toggle_chan_scanlist();
|
|
|
|
#endif
|
2023-09-09 08:03:56 +01:00
|
|
|
#endif
|
2023-10-05 01:07:04 +01:00
|
|
|
|
2023-09-09 08:03:56 +01:00
|
|
|
break;
|
2023-09-14 19:38:28 +01:00
|
|
|
|
2023-10-13 15:12:32 +01:00
|
|
|
case KEY_6: // H/M/L
|
2023-10-16 06:43:42 +01:00
|
|
|
|
2023-10-17 11:05:41 +01:00
|
|
|
if (g_scan_state_dir == SCAN_STATE_DIR_OFF)
|
|
|
|
{
|
|
|
|
g_beep_to_play = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
|
|
|
return;
|
|
|
|
}
|
2023-10-17 17:28:38 +01:00
|
|
|
|
2023-09-09 08:03:56 +01:00
|
|
|
ACTION_Power();
|
|
|
|
break;
|
2023-09-14 19:38:28 +01:00
|
|
|
|
2023-10-13 15:12:32 +01:00
|
|
|
case KEY_7: // VOX
|
2023-10-16 06:43:42 +01:00
|
|
|
|
2023-10-04 11:57:34 +01:00
|
|
|
#ifdef ENABLE_VOX
|
2023-10-17 21:22:40 +01:00
|
|
|
APP_stop_scan();
|
2023-10-17 11:05:41 +01:00
|
|
|
|
2023-10-04 11:57:34 +01:00
|
|
|
ACTION_Vox();
|
|
|
|
#else
|
2023-10-05 10:03:07 +01:00
|
|
|
toggle_chan_scanlist();
|
2023-10-04 11:57:34 +01:00
|
|
|
#endif
|
2023-10-17 11:05:41 +01:00
|
|
|
|
2023-09-09 08:03:56 +01:00
|
|
|
break;
|
2023-09-14 19:38:28 +01:00
|
|
|
|
2023-10-13 15:12:32 +01:00
|
|
|
case KEY_8: // R
|
2023-10-16 06:43:42 +01:00
|
|
|
|
2023-10-17 11:05:41 +01:00
|
|
|
if (g_scan_state_dir == SCAN_STATE_DIR_OFF)
|
|
|
|
{
|
|
|
|
g_beep_to_play = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2023-10-08 20:23:37 +01:00
|
|
|
g_tx_vfo->frequency_reverse = g_tx_vfo->frequency_reverse == false;
|
|
|
|
g_request_save_channel = 1;
|
2023-10-17 11:05:41 +01:00
|
|
|
|
2023-09-09 08:03:56 +01:00
|
|
|
break;
|
2023-09-14 19:38:28 +01:00
|
|
|
|
2023-10-13 15:12:32 +01:00
|
|
|
case KEY_9: // CALL
|
2023-10-16 06:43:42 +01:00
|
|
|
|
2023-10-17 11:05:41 +01:00
|
|
|
if (!RADIO_CheckValidChannel(g_eeprom.chan_1_call, false, 0))
|
2023-09-09 08:03:56 +01:00
|
|
|
{
|
2023-10-17 11:05:41 +01:00
|
|
|
g_beep_to_play = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
|
|
|
return;
|
2023-09-09 08:03:56 +01:00
|
|
|
}
|
|
|
|
|
2023-10-17 11:05:41 +01:00
|
|
|
// swap to the CALL channel
|
2023-10-17 17:28:38 +01:00
|
|
|
|
2023-10-17 21:22:40 +01:00
|
|
|
APP_stop_scan();
|
2023-09-14 19:38:28 +01:00
|
|
|
|
2023-10-17 11:05:41 +01:00
|
|
|
g_eeprom.user_channel[Vfo] = g_eeprom.chan_1_call;
|
|
|
|
g_eeprom.screen_channel[Vfo] = g_eeprom.chan_1_call;
|
2023-09-14 20:15:35 +01:00
|
|
|
|
2023-10-17 11:05:41 +01:00
|
|
|
#ifdef ENABLE_VOICE
|
|
|
|
AUDIO_SetVoiceID(0, VOICE_ID_CHANNEL_MODE);
|
|
|
|
AUDIO_SetDigitVoice(1, g_eeprom.chan_1_call + 1);
|
|
|
|
g_another_voice_id = (voice_id_t)0xFE;
|
2023-10-11 18:32:10 +01:00
|
|
|
#endif
|
2023-10-17 17:28:38 +01:00
|
|
|
|
2023-10-17 11:05:41 +01:00
|
|
|
g_request_save_vfo = true;
|
|
|
|
g_vfo_configure_mode = VFO_CONFIGURE_RELOAD;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
// g_beep_to_play = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
2023-09-09 08:03:56 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-10-17 21:22:40 +01:00
|
|
|
void MAIN_Key_DIGITS(key_code_t Key, bool key_pressed, bool key_held)
|
2023-09-14 19:38:28 +01:00
|
|
|
{
|
2023-10-17 11:05:41 +01:00
|
|
|
g_key_input_count_down = key_input_timeout_500ms;
|
|
|
|
|
2023-10-08 20:23:37 +01:00
|
|
|
if (key_held)
|
2023-09-14 19:38:28 +01:00
|
|
|
{ // key held down
|
|
|
|
|
2023-10-08 20:23:37 +01:00
|
|
|
if (key_pressed)
|
2023-10-17 11:05:41 +01:00
|
|
|
{ // and pressed
|
2023-10-08 20:23:37 +01:00
|
|
|
if (g_screen_to_display == DISPLAY_MAIN)
|
2023-09-14 19:38:28 +01:00
|
|
|
{
|
2023-10-08 20:23:37 +01:00
|
|
|
if (g_input_box_index > 0)
|
2023-10-17 11:05:41 +01:00
|
|
|
{ // clear the user box
|
2023-10-08 20:23:37 +01:00
|
|
|
g_input_box_index = 0;
|
|
|
|
g_request_display_screen = DISPLAY_MAIN;
|
2023-10-05 10:03:07 +01:00
|
|
|
}
|
2023-09-15 15:36:43 +01:00
|
|
|
|
2023-10-17 11:05:41 +01:00
|
|
|
g_fkey_pressed = false;
|
|
|
|
g_update_status = true;
|
2023-09-15 15:36:43 +01:00
|
|
|
|
2023-10-11 18:32:10 +01:00
|
|
|
processFKeyFunction(Key);
|
2023-09-14 19:38:28 +01:00
|
|
|
}
|
2023-10-05 10:03:07 +01:00
|
|
|
}
|
2023-09-14 19:38:28 +01:00
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
2023-09-27 00:26:58 +01:00
|
|
|
|
2023-10-18 16:17:41 +01:00
|
|
|
if (key_pressed && !key_held)
|
|
|
|
{ // key just pressed
|
2023-10-17 11:05:41 +01:00
|
|
|
g_beep_to_play = BEEP_1KHZ_60MS_OPTIONAL;
|
|
|
|
return; // don't use the key till it's released
|
2023-10-05 10:03:07 +01:00
|
|
|
}
|
2023-09-27 00:26:58 +01:00
|
|
|
|
2023-10-17 11:05:41 +01:00
|
|
|
if (g_fkey_pressed)
|
|
|
|
{ // F-key was first pressed
|
|
|
|
processFKeyFunction(Key);
|
2023-09-14 19:38:28 +01:00
|
|
|
|
2023-10-17 11:05:41 +01:00
|
|
|
g_fkey_pressed = false;
|
|
|
|
g_update_status = true;
|
|
|
|
return;
|
|
|
|
}
|
2023-10-17 17:28:38 +01:00
|
|
|
|
2023-10-17 11:05:41 +01:00
|
|
|
const uint8_t Vfo = g_eeprom.tx_vfo;
|
2023-10-17 17:28:38 +01:00
|
|
|
|
2023-10-17 11:05:41 +01:00
|
|
|
if (g_scan_state_dir != SCAN_STATE_DIR_OFF || g_current_function == FUNCTION_TRANSMIT)
|
|
|
|
{
|
|
|
|
g_beep_to_play = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
|
|
|
return;
|
|
|
|
}
|
2023-10-17 17:28:38 +01:00
|
|
|
|
2023-10-17 11:05:41 +01:00
|
|
|
// add the digit to the channel/frequency input box
|
2023-10-17 17:28:38 +01:00
|
|
|
|
2023-10-17 11:05:41 +01:00
|
|
|
INPUTBOX_Append(Key);
|
2023-10-17 17:28:38 +01:00
|
|
|
|
2023-10-17 11:05:41 +01:00
|
|
|
g_request_display_screen = DISPLAY_MAIN;
|
2023-10-17 17:28:38 +01:00
|
|
|
|
2023-10-17 11:05:41 +01:00
|
|
|
if (IS_USER_CHANNEL(g_tx_vfo->channel_save))
|
|
|
|
{ // user is entering channel number
|
2023-10-17 17:28:38 +01:00
|
|
|
|
2023-10-17 11:05:41 +01:00
|
|
|
uint16_t Channel;
|
2023-10-17 17:28:38 +01:00
|
|
|
|
2023-10-17 11:05:41 +01:00
|
|
|
if (g_input_box_index != 3)
|
|
|
|
{
|
2023-09-14 19:38:28 +01:00
|
|
|
#ifdef ENABLE_VOICE
|
2023-10-17 11:05:41 +01:00
|
|
|
g_another_voice_id = (voice_id_t)Key;
|
2023-09-14 19:38:28 +01:00
|
|
|
#endif
|
2023-10-17 11:05:41 +01:00
|
|
|
g_request_display_screen = DISPLAY_MAIN;
|
2023-09-14 19:38:28 +01:00
|
|
|
return;
|
|
|
|
}
|
2023-10-17 17:28:38 +01:00
|
|
|
|
2023-10-17 11:05:41 +01:00
|
|
|
g_input_box_index = 0;
|
2023-10-17 17:28:38 +01:00
|
|
|
|
2023-10-17 11:05:41 +01:00
|
|
|
Channel = ((g_input_box[0] * 100) + (g_input_box[1] * 10) + g_input_box[2]) - 1;
|
2023-10-17 17:28:38 +01:00
|
|
|
|
2023-10-17 11:05:41 +01:00
|
|
|
if (!RADIO_CheckValidChannel(Channel, false, 0))
|
|
|
|
{
|
|
|
|
g_beep_to_play = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
|
|
|
return;
|
|
|
|
}
|
2023-10-17 17:28:38 +01:00
|
|
|
|
2023-10-17 11:05:41 +01:00
|
|
|
#ifdef ENABLE_VOICE
|
|
|
|
g_another_voice_id = (voice_id_t)Key;
|
|
|
|
#endif
|
2023-10-17 17:28:38 +01:00
|
|
|
|
2023-10-17 11:05:41 +01:00
|
|
|
g_eeprom.user_channel[Vfo] = (uint8_t)Channel;
|
|
|
|
g_eeprom.screen_channel[Vfo] = (uint8_t)Channel;
|
|
|
|
g_request_save_vfo = true;
|
|
|
|
g_vfo_configure_mode = VFO_CONFIGURE_RELOAD;
|
2023-10-17 17:28:38 +01:00
|
|
|
|
2023-10-17 11:05:41 +01:00
|
|
|
return;
|
|
|
|
}
|
2023-10-17 17:28:38 +01:00
|
|
|
|
2023-10-17 11:05:41 +01:00
|
|
|
// #ifdef ENABLE_NOAA
|
|
|
|
// if (IS_NOT_NOAA_CHANNEL(g_tx_vfo->channel_save))
|
|
|
|
// #endif
|
|
|
|
if (IS_FREQ_CHANNEL(g_tx_vfo->channel_save))
|
|
|
|
{ // user is entering a frequency
|
2023-10-17 17:28:38 +01:00
|
|
|
|
2023-10-17 11:05:41 +01:00
|
|
|
uint32_t Frequency;
|
2023-10-17 17:28:38 +01:00
|
|
|
|
2023-10-17 11:05:41 +01:00
|
|
|
if (g_input_box_index < 6)
|
|
|
|
{
|
|
|
|
#ifdef ENABLE_VOICE
|
|
|
|
g_another_voice_id = (voice_id_t)Key;
|
|
|
|
#endif
|
2023-10-17 17:28:38 +01:00
|
|
|
|
2023-10-17 11:05:41 +01:00
|
|
|
return;
|
|
|
|
}
|
2023-10-17 17:28:38 +01:00
|
|
|
|
2023-10-17 11:05:41 +01:00
|
|
|
g_input_box_index = 0;
|
2023-10-17 17:28:38 +01:00
|
|
|
|
2023-10-17 11:05:41 +01:00
|
|
|
NUMBER_Get(g_input_box, &Frequency);
|
2023-10-17 17:28:38 +01:00
|
|
|
|
2023-10-17 11:05:41 +01:00
|
|
|
// clamp the frequency entered to some valid value
|
|
|
|
if (Frequency < FREQ_BAND_TABLE[0].lower)
|
|
|
|
{
|
|
|
|
Frequency = FREQ_BAND_TABLE[0].lower;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
if (Frequency >= BX4819_BAND1.upper && Frequency < BX4819_BAND2.lower)
|
|
|
|
{
|
|
|
|
const uint32_t center = (BX4819_BAND1.upper + BX4819_BAND2.lower) / 2;
|
|
|
|
Frequency = (Frequency < center) ? BX4819_BAND1.upper : BX4819_BAND2.lower;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
if (Frequency > FREQ_BAND_TABLE[ARRAY_SIZE(FREQ_BAND_TABLE) - 1].upper)
|
|
|
|
{
|
|
|
|
Frequency = FREQ_BAND_TABLE[ARRAY_SIZE(FREQ_BAND_TABLE) - 1].upper;
|
|
|
|
}
|
2023-10-17 17:28:38 +01:00
|
|
|
|
2023-10-17 11:05:41 +01:00
|
|
|
{
|
|
|
|
const frequency_band_t band = FREQUENCY_GetBand(Frequency);
|
2023-10-17 17:28:38 +01:00
|
|
|
|
2023-10-17 11:05:41 +01:00
|
|
|
#ifdef ENABLE_VOICE
|
|
|
|
g_another_voice_id = (voice_id_t)Key;
|
|
|
|
#endif
|
2023-10-17 17:28:38 +01:00
|
|
|
|
2023-10-17 11:05:41 +01:00
|
|
|
if (g_tx_vfo->band != band)
|
2023-09-27 22:14:39 +01:00
|
|
|
{
|
2023-10-17 11:05:41 +01:00
|
|
|
g_tx_vfo->band = band;
|
|
|
|
g_eeprom.screen_channel[Vfo] = band + FREQ_CHANNEL_FIRST;
|
|
|
|
g_eeprom.freq_channel[Vfo] = band + FREQ_CHANNEL_FIRST;
|
2023-10-17 17:28:38 +01:00
|
|
|
|
2023-10-17 11:05:41 +01:00
|
|
|
SETTINGS_SaveVfoIndices();
|
2023-10-17 17:28:38 +01:00
|
|
|
|
2023-10-17 11:05:41 +01:00
|
|
|
RADIO_configure_channel(Vfo, VFO_CONFIGURE_RELOAD);
|
2023-09-27 22:14:39 +01:00
|
|
|
}
|
2023-10-17 17:28:38 +01:00
|
|
|
|
2023-10-17 11:05:41 +01:00
|
|
|
// Frequency += 75; // is this meant to be rounding ?
|
|
|
|
Frequency += g_tx_vfo->step_freq / 2; // no idea, but this is
|
2023-10-17 17:28:38 +01:00
|
|
|
|
2023-10-17 11:05:41 +01:00
|
|
|
Frequency = FREQUENCY_FloorToStep(Frequency, g_tx_vfo->step_freq, FREQ_BAND_TABLE[g_tx_vfo->band].lower);
|
2023-10-17 17:28:38 +01:00
|
|
|
|
2023-10-13 15:12:32 +01:00
|
|
|
if (Frequency >= BX4819_BAND1.upper && Frequency < BX4819_BAND2.lower)
|
2023-10-17 11:05:41 +01:00
|
|
|
{ // clamp the frequency to the limit
|
2023-10-13 15:12:32 +01:00
|
|
|
const uint32_t center = (BX4819_BAND1.upper + BX4819_BAND2.lower) / 2;
|
2023-10-17 11:05:41 +01:00
|
|
|
Frequency = (Frequency < center) ? BX4819_BAND1.upper - g_tx_vfo->step_freq : BX4819_BAND2.lower;
|
2023-09-27 22:14:39 +01:00
|
|
|
}
|
2023-10-17 17:28:38 +01:00
|
|
|
|
2023-10-17 11:05:41 +01:00
|
|
|
g_tx_vfo->freq_config_rx.frequency = Frequency;
|
2023-10-17 17:28:38 +01:00
|
|
|
|
2023-10-18 22:20:53 +01:00
|
|
|
// 1of11 .. test to prevent the monitor being turned off
|
|
|
|
// g_request_save_channel = 1;
|
|
|
|
SETTINGS_SaveChannel(g_tx_vfo->channel_save, g_eeprom.tx_vfo, g_tx_vfo, 1);
|
|
|
|
RADIO_setup_registers(true);
|
|
|
|
|
2023-10-17 11:05:41 +01:00
|
|
|
return;
|
|
|
|
}
|
2023-10-17 17:28:38 +01:00
|
|
|
|
2023-10-17 11:05:41 +01:00
|
|
|
}
|
|
|
|
#ifdef ENABLE_NOAA
|
|
|
|
else
|
|
|
|
if (IS_NOAA_CHANNEL(g_tx_vfo->channel_save))
|
|
|
|
{ // user is entering NOAA channel
|
2023-10-17 17:28:38 +01:00
|
|
|
|
2023-10-17 11:05:41 +01:00
|
|
|
uint8_t Channel;
|
2023-10-17 17:28:38 +01:00
|
|
|
|
2023-10-17 11:05:41 +01:00
|
|
|
if (g_input_box_index != 2)
|
2023-09-27 22:14:39 +01:00
|
|
|
{
|
2023-10-17 11:05:41 +01:00
|
|
|
#ifdef ENABLE_VOICE
|
|
|
|
g_another_voice_id = (voice_id_t)Key;
|
|
|
|
#endif
|
|
|
|
g_request_display_screen = DISPLAY_MAIN;
|
|
|
|
return;
|
2023-09-27 22:14:39 +01:00
|
|
|
}
|
2023-10-17 17:28:38 +01:00
|
|
|
|
2023-10-17 11:05:41 +01:00
|
|
|
g_input_box_index = 0;
|
2023-10-17 17:28:38 +01:00
|
|
|
|
2023-10-17 11:05:41 +01:00
|
|
|
Channel = (g_input_box[0] * 10) + g_input_box[1];
|
|
|
|
if (Channel >= 1 && Channel <= ARRAY_SIZE(NOAA_FREQUENCY_TABLE))
|
2023-09-14 19:38:28 +01:00
|
|
|
{
|
2023-10-17 11:05:41 +01:00
|
|
|
Channel += NOAA_CHANNEL_FIRST;
|
2023-09-28 10:17:45 +01:00
|
|
|
#ifdef ENABLE_VOICE
|
2023-10-17 11:05:41 +01:00
|
|
|
g_another_voice_id = (voice_id_t)Key;
|
2023-09-28 10:17:45 +01:00
|
|
|
#endif
|
2023-10-17 11:05:41 +01:00
|
|
|
g_eeprom.noaa_channel[Vfo] = Channel;
|
|
|
|
g_eeprom.screen_channel[Vfo] = Channel;
|
|
|
|
g_request_save_vfo = true;
|
|
|
|
g_vfo_configure_mode = VFO_CONFIGURE_RELOAD;
|
2023-09-28 10:17:45 +01:00
|
|
|
return;
|
2023-09-14 19:38:28 +01:00
|
|
|
}
|
|
|
|
}
|
2023-10-17 11:05:41 +01:00
|
|
|
#endif
|
2023-10-17 17:28:38 +01:00
|
|
|
|
2023-10-17 11:05:41 +01:00
|
|
|
g_request_display_screen = DISPLAY_MAIN;
|
|
|
|
g_beep_to_play = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
2023-09-14 19:38:28 +01:00
|
|
|
}
|
|
|
|
|
2023-10-17 21:22:40 +01:00
|
|
|
void MAIN_Key_EXIT(bool key_pressed, bool key_held)
|
2023-09-09 08:03:56 +01:00
|
|
|
{
|
2023-10-18 16:17:41 +01:00
|
|
|
if (key_pressed && !key_held)
|
|
|
|
{ // key just pressed
|
2023-09-30 11:22:19 +01:00
|
|
|
|
2023-10-08 20:23:37 +01:00
|
|
|
g_beep_to_play = BEEP_1KHZ_60MS_OPTIONAL;
|
2023-09-11 00:02:57 +01:00
|
|
|
|
2023-10-08 20:23:37 +01:00
|
|
|
if (g_dtmf_call_state != DTMF_CALL_STATE_NONE && g_current_function != FUNCTION_TRANSMIT)
|
2023-09-30 11:22:19 +01:00
|
|
|
{ // clear CALL mode being displayed
|
2023-10-08 20:23:37 +01:00
|
|
|
g_dtmf_call_state = DTMF_CALL_STATE_NONE;
|
|
|
|
g_update_display = true;
|
2023-09-30 11:22:19 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2023-09-14 09:56:30 +01:00
|
|
|
#ifdef ENABLE_FMRADIO
|
2023-10-08 20:23:37 +01:00
|
|
|
if (!g_fm_radio_mode)
|
2023-09-14 09:56:30 +01:00
|
|
|
#endif
|
2023-09-09 08:03:56 +01:00
|
|
|
{
|
2023-10-13 15:12:32 +01:00
|
|
|
if (g_scan_state_dir == SCAN_STATE_DIR_OFF)
|
2023-09-09 08:03:56 +01:00
|
|
|
{
|
2023-10-08 20:23:37 +01:00
|
|
|
if (g_input_box_index == 0)
|
2023-09-09 08:03:56 +01:00
|
|
|
return;
|
2023-10-08 20:23:37 +01:00
|
|
|
g_input_box[--g_input_box_index] = 10;
|
2023-09-11 00:02:57 +01:00
|
|
|
|
2023-10-08 20:23:37 +01:00
|
|
|
g_key_input_count_down = key_input_timeout_500ms;
|
2023-09-15 15:36:43 +01:00
|
|
|
|
2023-09-14 09:56:30 +01:00
|
|
|
#ifdef ENABLE_VOICE
|
2023-10-08 20:23:37 +01:00
|
|
|
if (g_input_box_index == 0)
|
2023-10-08 17:14:13 +01:00
|
|
|
g_another_voice_id = VOICE_ID_CANCEL;
|
2023-09-09 08:03:56 +01:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2023-10-16 06:43:42 +01:00
|
|
|
APP_stop_scan();
|
2023-09-11 00:02:57 +01:00
|
|
|
|
2023-09-14 09:56:30 +01:00
|
|
|
#ifdef ENABLE_VOICE
|
2023-10-08 17:14:13 +01:00
|
|
|
g_another_voice_id = VOICE_ID_SCANNING_STOP;
|
2023-09-09 08:03:56 +01:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2023-10-08 20:23:37 +01:00
|
|
|
g_request_display_screen = DISPLAY_MAIN;
|
2023-09-09 08:03:56 +01:00
|
|
|
return;
|
|
|
|
}
|
2023-09-11 00:02:57 +01:00
|
|
|
|
2023-09-14 09:56:30 +01:00
|
|
|
#ifdef ENABLE_FMRADIO
|
|
|
|
ACTION_FM();
|
|
|
|
#endif
|
2023-09-27 00:26:58 +01:00
|
|
|
|
2023-09-15 15:36:43 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2023-10-08 20:23:37 +01:00
|
|
|
if (key_held && key_pressed)
|
2023-09-30 11:22:19 +01:00
|
|
|
{ // exit key held down
|
|
|
|
|
2023-10-08 20:23:37 +01:00
|
|
|
if (g_input_box_index > 0 || g_dtmf_input_box_index > 0 || g_dtmf_input_mode)
|
2023-09-15 15:36:43 +01:00
|
|
|
{ // cancel key input mode (channel/frequency entry)
|
2023-10-08 20:23:37 +01:00
|
|
|
g_dtmf_input_mode = false;
|
|
|
|
g_dtmf_input_box_index = 0;
|
|
|
|
memset(g_dtmf_string, 0, sizeof(g_dtmf_string));
|
|
|
|
g_input_box_index = 0;
|
|
|
|
g_request_display_screen = DISPLAY_MAIN;
|
|
|
|
g_beep_to_play = BEEP_1KHZ_60MS_OPTIONAL;
|
2023-09-15 15:36:43 +01:00
|
|
|
}
|
2023-09-09 08:03:56 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-10-17 21:22:40 +01:00
|
|
|
void MAIN_Key_MENU(const bool key_pressed, const bool key_held)
|
2023-09-09 08:03:56 +01:00
|
|
|
{
|
2023-10-08 20:23:37 +01:00
|
|
|
if (key_pressed && !key_held)
|
2023-10-18 16:17:41 +01:00
|
|
|
{ // key just pressed
|
2023-10-18 18:50:37 +01:00
|
|
|
AUDIO_PlayBeep(BEEP_1KHZ_60MS_OPTIONAL);
|
2023-10-18 16:17:41 +01:00
|
|
|
}
|
|
|
|
|
2023-10-08 20:23:37 +01:00
|
|
|
if (key_held)
|
2023-09-30 11:22:19 +01:00
|
|
|
{ // menu key held down (long press)
|
2023-09-27 00:26:58 +01:00
|
|
|
|
2023-10-08 20:23:37 +01:00
|
|
|
if (key_pressed)
|
2023-10-03 23:33:01 +01:00
|
|
|
{ // long press MENU key
|
|
|
|
|
2023-10-09 22:49:29 +01:00
|
|
|
g_fkey_pressed = false;
|
2023-10-06 19:31:29 +01:00
|
|
|
|
2023-10-08 20:23:37 +01:00
|
|
|
if (g_screen_to_display == DISPLAY_MAIN)
|
2023-09-27 00:26:58 +01:00
|
|
|
{
|
2023-10-08 20:23:37 +01:00
|
|
|
if (g_input_box_index > 0)
|
2023-09-27 00:26:58 +01:00
|
|
|
{ // delete any inputted chars
|
2023-10-08 20:23:37 +01:00
|
|
|
g_input_box_index = 0;
|
|
|
|
g_request_display_screen = DISPLAY_MAIN;
|
2023-09-27 00:26:58 +01:00
|
|
|
}
|
|
|
|
|
2023-10-16 06:43:42 +01:00
|
|
|
g_fkey_pressed = false;
|
|
|
|
g_update_status = true;
|
2023-09-27 00:26:58 +01:00
|
|
|
|
2023-10-18 18:50:37 +01:00
|
|
|
#ifdef ENABLE_COPY_CHAN_TO_VFO_TO_CHAN
|
2023-10-08 20:23:37 +01:00
|
|
|
|
2023-10-18 18:50:37 +01:00
|
|
|
if (g_scan_state_dir == SCAN_STATE_DIR_OFF &&
|
|
|
|
g_css_scan_mode == CSS_SCAN_MODE_OFF &&
|
|
|
|
g_eeprom.dual_watch == DUAL_WATCH_OFF &&
|
|
|
|
g_eeprom.vfo_open)
|
|
|
|
{ // not scanning
|
|
|
|
|
2023-10-18 20:44:33 +01:00
|
|
|
//const unsigned int vfo = get_RX_VFO();
|
|
|
|
const unsigned int vfo = g_eeprom.tx_vfo;
|
2023-10-05 00:26:37 +01:00
|
|
|
|
2023-10-08 17:14:13 +01:00
|
|
|
if (IS_USER_CHANNEL(g_eeprom.screen_channel[vfo]))
|
2023-10-05 12:42:40 +01:00
|
|
|
{ // copy channel to VFO, then swap to the VFO
|
2023-10-08 20:23:37 +01:00
|
|
|
|
|
|
|
const unsigned int channel = FREQ_CHANNEL_FIRST + g_eeprom.vfo_info[vfo].band;
|
2023-10-05 00:26:37 +01:00
|
|
|
|
2023-10-16 06:43:42 +01:00
|
|
|
g_eeprom.screen_channel[vfo] = channel;
|
2023-10-08 20:23:37 +01:00
|
|
|
g_eeprom.vfo_info[vfo].channel_save = channel;
|
2023-10-16 06:43:42 +01:00
|
|
|
g_eeprom.tx_vfo = vfo;
|
2023-10-05 01:07:04 +01:00
|
|
|
|
2023-10-16 06:43:42 +01:00
|
|
|
RADIO_select_vfos();
|
2023-10-08 20:23:37 +01:00
|
|
|
RADIO_ApplyOffset(g_rx_vfo);
|
|
|
|
RADIO_ConfigureSquelchAndOutputPower(g_rx_vfo);
|
2023-10-16 06:43:42 +01:00
|
|
|
RADIO_setup_registers(true);
|
2023-10-05 01:07:04 +01:00
|
|
|
|
2023-10-08 20:23:37 +01:00
|
|
|
g_request_save_vfo = true;
|
2023-10-05 01:07:04 +01:00
|
|
|
|
2023-10-18 20:44:33 +01:00
|
|
|
g_beep_to_play = BEEP_880HZ_60MS_TRIPLE_BEEP;
|
|
|
|
//g_beep_to_play = BEEP_1KHZ_60MS_OPTIONAL;
|
2023-10-05 00:26:37 +01:00
|
|
|
|
2023-10-08 20:23:37 +01:00
|
|
|
g_update_status = true;
|
|
|
|
g_update_display = true;
|
2023-10-04 22:08:13 +01:00
|
|
|
}
|
2023-10-18 18:50:37 +01:00
|
|
|
else
|
|
|
|
if (IS_FREQ_CHANNEL(g_eeprom.screen_channel[vfo]))
|
|
|
|
{ // copy VFO to channel
|
|
|
|
|
2023-10-18 20:44:33 +01:00
|
|
|
// search the channels to see if the frequency is already present
|
|
|
|
const unsigned int chan = BOARD_find_channel(g_eeprom.vfo_info[vfo].p_tx->frequency);
|
|
|
|
|
|
|
|
g_screen_to_display = DISPLAY_INVALID;
|
|
|
|
GUI_SelectNextDisplay(DISPLAY_MENU);
|
|
|
|
|
|
|
|
g_flag_refresh_menu = false;
|
|
|
|
g_menu_cursor = MENU_MEM_SAVE;
|
|
|
|
g_is_in_sub_menu = true;
|
|
|
|
|
|
|
|
if (chan <= USER_CHANNEL_LAST)
|
|
|
|
{ // go straight to the channel that holds the same frequency
|
|
|
|
g_sub_menu_selection = chan;
|
|
|
|
}
|
|
|
|
|
|
|
|
g_screen_to_display = DISPLAY_MENU;
|
|
|
|
g_update_display = false;
|
|
|
|
UI_DisplayMenu();
|
|
|
|
|
2023-10-18 18:50:37 +01:00
|
|
|
#ifdef ENABLE_VOICE
|
2023-10-18 20:44:33 +01:00
|
|
|
g_another_voice_id = VOICE_ID_MENU;
|
2023-10-18 18:50:37 +01:00
|
|
|
#endif
|
2023-10-18 20:44:33 +01:00
|
|
|
|
|
|
|
g_beep_to_play = BEEP_880HZ_60MS_TRIPLE_BEEP;
|
2023-10-18 18:50:37 +01:00
|
|
|
}
|
2023-09-27 00:26:58 +01:00
|
|
|
}
|
2023-10-05 00:07:35 +01:00
|
|
|
else
|
|
|
|
{
|
2023-10-08 20:23:37 +01:00
|
|
|
g_beep_to_play = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
2023-10-05 00:07:35 +01:00
|
|
|
}
|
2023-10-05 01:07:04 +01:00
|
|
|
|
2023-09-27 00:26:58 +01:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2023-10-08 20:23:37 +01:00
|
|
|
if (!key_pressed && !g_dtmf_input_mode)
|
2023-09-30 11:22:19 +01:00
|
|
|
{ // menu key released
|
2023-10-16 06:43:42 +01:00
|
|
|
|
2023-10-08 20:23:37 +01:00
|
|
|
const bool flag = (g_input_box_index == 0);
|
2023-10-16 06:43:42 +01:00
|
|
|
|
|
|
|
g_input_box_index = 0;
|
2023-09-09 08:03:56 +01:00
|
|
|
|
2023-10-08 20:23:37 +01:00
|
|
|
if (flag)
|
2023-09-09 08:03:56 +01:00
|
|
|
{
|
2023-10-08 20:23:37 +01:00
|
|
|
g_flag_refresh_menu = true;
|
|
|
|
g_request_display_screen = DISPLAY_MENU;
|
2023-10-18 18:50:37 +01:00
|
|
|
|
2023-09-14 09:56:30 +01:00
|
|
|
#ifdef ENABLE_VOICE
|
2023-10-08 17:14:13 +01:00
|
|
|
g_another_voice_id = VOICE_ID_MENU;
|
2023-09-09 08:03:56 +01:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2023-10-08 20:23:37 +01:00
|
|
|
g_request_display_screen = DISPLAY_MAIN;
|
2023-09-09 08:03:56 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-10-17 21:22:40 +01:00
|
|
|
void MAIN_Key_STAR(bool key_pressed, bool key_held)
|
2023-09-09 08:03:56 +01:00
|
|
|
{
|
2023-10-08 20:23:37 +01:00
|
|
|
if (g_input_box_index > 0)
|
2023-10-17 11:05:41 +01:00
|
|
|
{ // entering a channel, frequency or DTMF string
|
2023-10-08 20:23:37 +01:00
|
|
|
if (!key_held && key_pressed)
|
|
|
|
g_beep_to_play = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
2023-09-09 08:03:56 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2023-10-09 22:49:29 +01:00
|
|
|
if (key_held && !g_fkey_pressed)
|
2023-10-06 19:31:29 +01:00
|
|
|
{ // long press .. toggle scanning
|
2023-10-16 06:43:42 +01:00
|
|
|
|
2023-10-08 20:23:37 +01:00
|
|
|
if (!key_pressed)
|
2023-10-16 06:43:42 +01:00
|
|
|
return; // released
|
2023-10-07 07:39:10 +01:00
|
|
|
|
2023-10-06 19:31:29 +01:00
|
|
|
ACTION_Scan(false);
|
2023-10-07 07:39:10 +01:00
|
|
|
|
2023-10-08 20:23:37 +01:00
|
|
|
g_beep_to_play = BEEP_1KHZ_60MS_OPTIONAL;
|
2023-10-06 19:31:29 +01:00
|
|
|
return;
|
|
|
|
}
|
2023-10-04 18:54:26 +01:00
|
|
|
|
2023-10-17 11:05:41 +01:00
|
|
|
if (g_scan_state_dir != SCAN_STATE_DIR_OFF || g_current_function == FUNCTION_TRANSMIT)
|
|
|
|
{ // RF scanning or TX'ing
|
|
|
|
g_beep_to_play = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2023-10-08 20:23:37 +01:00
|
|
|
if (key_pressed)
|
2023-10-06 19:31:29 +01:00
|
|
|
{ // just pressed
|
2023-10-16 06:43:42 +01:00
|
|
|
g_beep_to_play = BEEP_1KHZ_60MS_OPTIONAL;
|
2023-10-06 19:31:29 +01:00
|
|
|
return;
|
|
|
|
}
|
2023-10-08 20:23:37 +01:00
|
|
|
|
2023-10-09 22:49:29 +01:00
|
|
|
if (!g_fkey_pressed)
|
2023-10-06 19:31:29 +01:00
|
|
|
{ // pressed without the F-key
|
2023-09-09 08:03:56 +01:00
|
|
|
|
2023-10-16 06:43:42 +01:00
|
|
|
if (g_scan_state_dir == SCAN_STATE_DIR_OFF && IS_NOT_NOAA_CHANNEL(g_tx_vfo->channel_save))
|
2023-10-06 19:31:29 +01:00
|
|
|
{ // start entering a DTMF string
|
|
|
|
|
2023-10-16 06:43:42 +01:00
|
|
|
memmove( g_dtmf_input_box, g_dtmf_string,
|
2023-10-10 12:44:10 +01:00
|
|
|
(sizeof(g_dtmf_input_box) <= (sizeof(g_dtmf_string) - 1)) ? sizeof(g_dtmf_input_box) : sizeof(g_dtmf_string) - 1);
|
2023-10-16 06:43:42 +01:00
|
|
|
|
2023-10-08 20:23:37 +01:00
|
|
|
g_dtmf_input_box_index = 0;
|
|
|
|
g_dtmf_input_mode = true;
|
2023-10-06 19:31:29 +01:00
|
|
|
|
2023-10-16 06:43:42 +01:00
|
|
|
g_key_input_count_down = key_input_timeout_500ms;
|
2023-10-03 23:33:01 +01:00
|
|
|
|
2023-10-08 20:23:37 +01:00
|
|
|
g_request_display_screen = DISPLAY_MAIN;
|
2023-09-09 08:03:56 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
2023-10-06 19:31:29 +01:00
|
|
|
{ // with the F-key
|
2023-10-09 22:49:29 +01:00
|
|
|
g_fkey_pressed = false;
|
2023-09-09 08:03:56 +01:00
|
|
|
|
2023-10-16 06:43:42 +01:00
|
|
|
if (IS_NOAA_CHANNEL(g_tx_vfo->channel_save))
|
|
|
|
{
|
|
|
|
g_beep_to_play = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
|
|
|
return;
|
|
|
|
}
|
2023-10-07 07:39:10 +01:00
|
|
|
|
2023-10-06 19:31:29 +01:00
|
|
|
// scan the CTCSS/DCS code
|
2023-10-16 06:43:42 +01:00
|
|
|
g_search_flag_start_scan = true;
|
|
|
|
g_search_single_frequency = true;
|
|
|
|
g_backup_cross_vfo_rx_tx = g_eeprom.cross_vfo_rx_tx;
|
|
|
|
g_eeprom.cross_vfo_rx_tx = CROSS_BAND_OFF;
|
2023-09-09 08:03:56 +01:00
|
|
|
}
|
2023-10-06 19:31:29 +01:00
|
|
|
|
2023-10-16 06:43:42 +01:00
|
|
|
g_ptt_was_released = true;
|
2023-10-08 20:23:37 +01:00
|
|
|
|
2023-10-16 06:43:42 +01:00
|
|
|
g_update_status = true;
|
2023-09-09 08:03:56 +01:00
|
|
|
}
|
|
|
|
|
2023-10-17 21:22:40 +01:00
|
|
|
void MAIN_Key_UP_DOWN(bool key_pressed, bool key_held, scan_state_dir_t Direction)
|
2023-09-09 08:03:56 +01:00
|
|
|
{
|
2023-10-16 10:47:43 +01:00
|
|
|
#ifdef ENABLE_SQ_OPEN_WITH_UP_DN_BUTTS
|
|
|
|
static bool monitor_was_enabled = false;
|
|
|
|
#endif
|
|
|
|
|
2023-10-08 17:14:13 +01:00
|
|
|
uint8_t Channel = g_eeprom.screen_channel[g_eeprom.tx_vfo];
|
2023-09-09 08:03:56 +01:00
|
|
|
|
2023-10-18 16:17:41 +01:00
|
|
|
if (key_pressed && !key_held)
|
|
|
|
{ // key just pressed
|
|
|
|
g_beep_to_play = BEEP_1KHZ_60MS_OPTIONAL;
|
|
|
|
}
|
|
|
|
|
2023-10-16 21:59:17 +01:00
|
|
|
if (!key_pressed &&
|
|
|
|
g_scan_state_dir == SCAN_STATE_DIR_OFF &&
|
|
|
|
IS_NOT_NOAA_CHANNEL(Channel) &&
|
|
|
|
IS_FREQ_CHANNEL(Channel))
|
|
|
|
{ // key released in frequency mode
|
2023-10-16 10:47:43 +01:00
|
|
|
#ifdef ENABLE_SQ_OPEN_WITH_UP_DN_BUTTS
|
2023-10-16 21:59:17 +01:00
|
|
|
if (key_held && !monitor_was_enabled && g_current_function == FUNCTION_MONITOR)
|
2023-10-16 10:47:43 +01:00
|
|
|
{ // re-enable the squelch
|
|
|
|
APP_start_listening(FUNCTION_RECEIVE, false);
|
|
|
|
g_monitor_enabled = false;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// only update eeprom when the key is released - saves a LOT of wear and tear on the little eeprom
|
2023-10-18 22:20:53 +01:00
|
|
|
SETTINGS_SaveChannel(g_tx_vfo->channel_save, g_eeprom.tx_vfo, g_tx_vfo, 1);
|
2023-10-16 06:43:42 +01:00
|
|
|
|
|
|
|
#if defined(ENABLE_UART) && defined(ENABLE_UART_DEBUG)
|
|
|
|
// UART_printf("save chan\r\n");
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2023-10-08 20:23:37 +01:00
|
|
|
if (key_held || !key_pressed)
|
2023-10-06 19:31:29 +01:00
|
|
|
{ // long press
|
|
|
|
|
2023-10-08 20:23:37 +01:00
|
|
|
if (g_input_box_index > 0)
|
2023-09-09 08:03:56 +01:00
|
|
|
return;
|
|
|
|
|
2023-10-08 20:23:37 +01:00
|
|
|
if (!key_pressed)
|
2023-09-09 08:03:56 +01:00
|
|
|
{
|
2023-10-08 20:23:37 +01:00
|
|
|
if (!key_held)
|
2023-09-09 08:03:56 +01:00
|
|
|
return;
|
|
|
|
|
|
|
|
if (IS_FREQ_CHANNEL(Channel))
|
|
|
|
return;
|
|
|
|
|
2023-09-14 09:56:30 +01:00
|
|
|
#ifdef ENABLE_VOICE
|
2023-10-08 20:23:37 +01:00
|
|
|
AUDIO_SetDigitVoice(0, g_tx_vfo->channel_save + 1);
|
2023-10-08 17:14:13 +01:00
|
|
|
g_another_voice_id = (voice_id_t)0xFE;
|
2023-09-09 08:03:56 +01:00
|
|
|
#endif
|
2023-09-14 19:38:28 +01:00
|
|
|
|
2023-09-09 08:03:56 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2023-10-08 20:23:37 +01:00
|
|
|
if (g_input_box_index > 0)
|
2023-09-09 08:03:56 +01:00
|
|
|
{
|
2023-10-08 20:23:37 +01:00
|
|
|
g_beep_to_play = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
2023-09-09 08:03:56 +01:00
|
|
|
return;
|
|
|
|
}
|
2023-09-27 21:28:30 +01:00
|
|
|
|
2023-10-16 06:43:42 +01:00
|
|
|
// g_beep_to_play = BEEP_1KHZ_60MS_OPTIONAL;
|
2023-09-09 08:03:56 +01:00
|
|
|
}
|
|
|
|
|
2023-10-13 15:12:32 +01:00
|
|
|
if (g_scan_state_dir == SCAN_STATE_DIR_OFF)
|
2023-10-17 11:05:41 +01:00
|
|
|
{ // not RF scanning
|
2023-10-16 06:43:42 +01:00
|
|
|
|
|
|
|
if (IS_NOT_NOAA_CHANNEL(Channel))
|
2023-09-09 08:03:56 +01:00
|
|
|
{
|
|
|
|
uint8_t Next;
|
|
|
|
|
|
|
|
if (IS_FREQ_CHANNEL(Channel))
|
2023-09-27 21:28:30 +01:00
|
|
|
{ // step/down in frequency
|
2023-10-16 06:43:42 +01:00
|
|
|
|
|
|
|
frequency_band_t new_band;
|
2023-10-16 10:47:43 +01:00
|
|
|
const frequency_band_t old_band = FREQUENCY_GetBand(g_tx_vfo->freq_config_rx.frequency);
|
2023-10-16 06:43:42 +01:00
|
|
|
const uint32_t frequency = APP_set_frequency_by_step(g_tx_vfo, Direction);
|
2023-09-27 21:28:30 +01:00
|
|
|
|
2023-10-18 16:17:41 +01:00
|
|
|
if (FREQUENCY_rx_freq_check(frequency) < 0)
|
2023-09-27 21:28:30 +01:00
|
|
|
{ // frequency not allowed
|
2023-10-08 20:23:37 +01:00
|
|
|
g_beep_to_play = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
2023-09-27 21:28:30 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2023-10-16 06:43:42 +01:00
|
|
|
new_band = FREQUENCY_GetBand(frequency);
|
|
|
|
|
2023-10-08 20:23:37 +01:00
|
|
|
g_tx_vfo->freq_config_rx.frequency = frequency;
|
2023-10-03 23:33:01 +01:00
|
|
|
|
2023-10-16 06:43:42 +01:00
|
|
|
if (new_band != old_band)
|
2023-10-16 10:47:43 +01:00
|
|
|
{ // original slow method
|
2023-10-16 06:43:42 +01:00
|
|
|
g_request_save_channel = 1;
|
|
|
|
}
|
|
|
|
else
|
2023-10-18 22:20:53 +01:00
|
|
|
{ // don't need to go through all the other stuff .. lets speed things up !
|
2023-10-16 10:47:43 +01:00
|
|
|
|
|
|
|
#ifdef ENABLE_SQ_OPEN_WITH_UP_DN_BUTTS
|
|
|
|
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
|
|
|
|
g_monitor_enabled = true;
|
2023-10-16 21:59:17 +01:00
|
|
|
APP_start_listening(FUNCTION_MONITOR, false);
|
2023-10-16 10:47:43 +01:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2023-10-16 06:43:42 +01:00
|
|
|
BK4819_set_rf_frequency(frequency, true);
|
2023-10-17 21:22:40 +01:00
|
|
|
BK4819_set_rf_filter_path(frequency);
|
2023-10-16 06:43:42 +01:00
|
|
|
}
|
|
|
|
|
2023-09-09 08:03:56 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
Next = RADIO_FindNextChannel(Channel + Direction, Direction, false, 0);
|
|
|
|
if (Next == 0xFF)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (Channel == Next)
|
|
|
|
return;
|
|
|
|
|
2023-10-08 20:23:37 +01:00
|
|
|
g_eeprom.user_channel[g_eeprom.tx_vfo] = Next;
|
2023-10-08 17:14:13 +01:00
|
|
|
g_eeprom.screen_channel[g_eeprom.tx_vfo] = Next;
|
2023-09-09 08:03:56 +01:00
|
|
|
|
2023-10-08 20:23:37 +01:00
|
|
|
if (!key_held)
|
2023-09-09 08:03:56 +01:00
|
|
|
{
|
2023-09-14 09:56:30 +01:00
|
|
|
#ifdef ENABLE_VOICE
|
2023-09-09 08:03:56 +01:00
|
|
|
AUDIO_SetDigitVoice(0, Next + 1);
|
2023-10-08 17:14:13 +01:00
|
|
|
g_another_voice_id = (voice_id_t)0xFE;
|
2023-09-09 08:03:56 +01:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|
2023-09-14 09:56:30 +01:00
|
|
|
#ifdef ENABLE_NOAA
|
2023-09-09 08:03:56 +01:00
|
|
|
else
|
|
|
|
{
|
2023-10-08 17:14:13 +01:00
|
|
|
Channel = NOAA_CHANNEL_FIRST + NUMBER_AddWithWraparound(g_eeprom.screen_channel[g_eeprom.tx_vfo] - NOAA_CHANNEL_FIRST, Direction, 0, 9);
|
|
|
|
g_eeprom.noaa_channel[g_eeprom.tx_vfo] = Channel;
|
|
|
|
g_eeprom.screen_channel[g_eeprom.tx_vfo] = Channel;
|
2023-09-09 08:03:56 +01:00
|
|
|
}
|
|
|
|
#endif
|
2023-09-14 19:38:28 +01:00
|
|
|
|
2023-10-08 20:23:37 +01:00
|
|
|
g_request_save_vfo = true;
|
|
|
|
g_vfo_configure_mode = VFO_CONFIGURE_RELOAD;
|
2023-10-16 06:43:42 +01:00
|
|
|
|
2023-09-09 08:03:56 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2023-10-05 23:58:55 +01:00
|
|
|
// jump to the next channel
|
2023-10-16 06:43:42 +01:00
|
|
|
APP_channel_next(false, Direction);
|
2023-10-17 14:49:17 +01:00
|
|
|
|
|
|
|
g_scan_pause_10ms = 0; // go NOW
|
2023-09-09 08:03:56 +01:00
|
|
|
|
2023-10-16 06:43:42 +01:00
|
|
|
g_ptt_was_released = true;
|
2023-09-09 08:03:56 +01:00
|
|
|
}
|
|
|
|
|
2023-10-16 06:43:42 +01:00
|
|
|
void MAIN_process_key(key_code_t key, bool key_pressed, bool key_held)
|
2023-09-09 08:03:56 +01:00
|
|
|
{
|
2023-10-15 22:34:21 +01:00
|
|
|
#if defined(ENABLE_UART) && defined(ENABLE_UART_DEBUG)
|
2023-10-16 06:43:42 +01:00
|
|
|
// UART_printf(" main 1 key %2u %u %u %u\r\n", key, key_pressed, key_held);
|
2023-10-15 22:34:21 +01:00
|
|
|
#endif
|
2023-10-16 06:43:42 +01:00
|
|
|
|
2023-09-14 09:56:30 +01:00
|
|
|
#ifdef ENABLE_FMRADIO
|
2023-10-15 22:34:21 +01:00
|
|
|
if (g_fm_radio_mode && key != KEY_PTT && key != KEY_EXIT)
|
2023-09-14 09:56:30 +01:00
|
|
|
{
|
2023-10-08 20:23:37 +01:00
|
|
|
if (!key_held && key_pressed)
|
|
|
|
g_beep_to_play = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
2023-09-14 09:56:30 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
#endif
|
2023-09-09 08:03:56 +01:00
|
|
|
|
2023-10-10 00:00:22 +01:00
|
|
|
if (g_dtmf_input_mode)
|
2023-09-09 08:03:56 +01:00
|
|
|
{
|
2023-10-15 22:34:21 +01:00
|
|
|
const char Character = DTMF_GetCharacter(key);
|
2023-10-10 00:56:55 +01:00
|
|
|
if (Character != 0xFF)
|
|
|
|
{ // add key to DTMF string
|
|
|
|
if (key_pressed && !key_held)
|
|
|
|
{
|
2023-10-10 00:00:22 +01:00
|
|
|
DTMF_Append(Character);
|
|
|
|
g_key_input_count_down = key_input_timeout_500ms;
|
|
|
|
g_beep_to_play = BEEP_1KHZ_60MS_OPTIONAL;
|
|
|
|
g_request_display_screen = DISPLAY_MAIN;
|
2023-10-17 11:05:41 +01:00
|
|
|
g_ptt_was_released = true;
|
2023-10-10 00:00:22 +01:00
|
|
|
}
|
2023-10-10 00:56:55 +01:00
|
|
|
return;
|
2023-09-09 08:03:56 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-10-15 22:34:21 +01:00
|
|
|
switch (key)
|
2023-09-09 08:03:56 +01:00
|
|
|
{
|
|
|
|
case KEY_0:
|
|
|
|
case KEY_1:
|
|
|
|
case KEY_2:
|
|
|
|
case KEY_3:
|
|
|
|
case KEY_4:
|
|
|
|
case KEY_5:
|
|
|
|
case KEY_6:
|
|
|
|
case KEY_7:
|
|
|
|
case KEY_8:
|
|
|
|
case KEY_9:
|
2023-10-15 22:34:21 +01:00
|
|
|
MAIN_Key_DIGITS(key, key_pressed, key_held);
|
2023-09-09 08:03:56 +01:00
|
|
|
break;
|
|
|
|
case KEY_MENU:
|
2023-10-08 20:23:37 +01:00
|
|
|
MAIN_Key_MENU(key_pressed, key_held);
|
2023-09-09 08:03:56 +01:00
|
|
|
break;
|
|
|
|
case KEY_UP:
|
2023-10-08 20:23:37 +01:00
|
|
|
MAIN_Key_UP_DOWN(key_pressed, key_held, 1);
|
2023-09-09 08:03:56 +01:00
|
|
|
break;
|
|
|
|
case KEY_DOWN:
|
2023-10-08 20:23:37 +01:00
|
|
|
MAIN_Key_UP_DOWN(key_pressed, key_held, -1);
|
2023-09-09 08:03:56 +01:00
|
|
|
break;
|
|
|
|
case KEY_EXIT:
|
2023-10-08 20:23:37 +01:00
|
|
|
MAIN_Key_EXIT(key_pressed, key_held);
|
2023-09-09 08:03:56 +01:00
|
|
|
break;
|
|
|
|
case KEY_STAR:
|
2023-10-08 20:23:37 +01:00
|
|
|
MAIN_Key_STAR(key_pressed, key_held);
|
2023-09-09 08:03:56 +01:00
|
|
|
break;
|
|
|
|
case KEY_F:
|
2023-10-08 20:23:37 +01:00
|
|
|
GENERIC_Key_F(key_pressed, key_held);
|
2023-09-09 08:03:56 +01:00
|
|
|
break;
|
|
|
|
case KEY_PTT:
|
2023-10-08 20:23:37 +01:00
|
|
|
GENERIC_Key_PTT(key_pressed);
|
2023-09-09 08:03:56 +01:00
|
|
|
break;
|
|
|
|
default:
|
2023-10-08 20:23:37 +01:00
|
|
|
if (!key_held && key_pressed)
|
|
|
|
g_beep_to_play = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
2023-09-09 08:03:56 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|