0
mirror of https://github.com/OneOfEleven/uv-k5-firmware-custom.git synced 2025-04-28 22:31:25 +03:00

Merge pull request #195 from cloudwindy/main

Make side button menu and keylock optional to save 1 kb of memory
This commit is contained in:
OneOfEleven 2023-10-20 14:53:54 +01:00 committed by GitHub
commit 76b6072a04
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
21 changed files with 204 additions and 105 deletions

View File

@ -3,21 +3,30 @@
# 0 = remove code
# 1 = include code
# When testing the extra options, be careful not to exceed the
# 64 kb flash memory limit.
ENABLE_CLANG := 0
ENABLE_SWD := 0
ENABLE_OVERLAY := 0
ENABLE_LTO := 1
# UART Programming 2.9 kb
ENABLE_UART := 1
ENABLE_UART_DEBUG := 0
ENABLE_AIRCOPY := 1
ENABLE_AIRCOPY_REMEMBER_FREQ := 1
ENABLE_AIRCOPY_RX_REBOOT := 0
# FM Radio 4.2 kb
ENABLE_FMRADIO := 1
# NOAA 1.2 kb
ENABLE_NOAA := 0
# Voice 1.7 kb
ENABLE_VOICE := 0
ENABLE_MUTE_RADIO_FOR_VOICE := 1
# Tx on Voice 1.0 kb
ENABLE_VOX := 0
ENABLE_REDUCE_LOW_MID_TX_POWER := 1
# Tx Alarm 0.6 kb
ENABLE_ALARM := 0
ENABLE_TX1750 := 0
ENABLE_PWRON_PASSWORD := 0
@ -37,16 +46,25 @@ ENABLE_SHOW_CHARGE_LEVEL := 0
ENABLE_REVERSE_BAT_SYMBOL := 1
ENABLE_FREQ_SEARCH_TIMEOUT := 0
ENABLE_CODE_SEARCH_TIMEOUT := 0
# Kill and Revive 0.4 kb
ENABLE_KILL_REVIVE := 0
# AM Fix 0.8 kb
ENABLE_AM_FIX := 1
ENABLE_AM_FIX_SHOW_DATA := 0
ENABLE_SQUELCH_MORE_SENSITIVE := 1
ENABLE_SQ_OPEN_WITH_UP_DN_BUTTS := 1
ENABLE_FASTER_CHANNEL_SCAN := 1
ENABLE_RX_SIGNAL_BAR := 1
ENABLE_TX_TIMEOUT_BAR := 0
ENABLE_TX_AUDIO_BAR := 1
ENABLE_COPY_CHAN_TO_VFO_TO_CHAN := 1
# Rx Signal Bar 0.4 kb
ENABLE_RX_SIGNAL_BAR := 1
# Tx Timeout Bar 0.2 kb
ENABLE_TX_TIMEOUT_BAR := 0
# Tx Audio Bar 0.3 kb
ENABLE_TX_AUDIO_BAR := 1
# Side Button Menu 0.3 kb
ENABLE_SIDE_BUTT_MENU := 1
# Key Lock 0.4 kb
ENABLE_KEYLOCK := 1
#ENABLE_PANADAPTER := 0
#ENABLE_SINGLE_VFO_CHAN := 0
@ -375,6 +393,12 @@ endif
ifeq ($(ENABLE_COPY_CHAN_TO_VFO_TO_CHAN),1)
CFLAGS += -DENABLE_COPY_CHAN_TO_VFO_TO_CHAN
endif
ifeq ($(ENABLE_SIDE_BUTT_MENU),1)
CFLAGS += -DENABLE_SIDE_BUTT_MENU
endif
ifeq ($(ENABLE_KEYLOCK),1)
CFLAGS += -DENABLE_KEYLOCK
endif
ifeq ($(ENABLE_SINGLE_VFO_CHAN),1)
CFLAGS += -DENABLE_SINGLE_VFO_CHAN
endif

View File

@ -37,20 +37,20 @@ You'll find the options at the top of "Makefile" ('0' = remove code, '1' = inclu
ENABLE_CLANG := 0 **experimental, builds with clang instead of gcc (LTO will be disabled if you enable this)
ENABLE_SWD := 0 only needed if using CPU's SWD port (debugging/programming)
ENABLE_OVERLAY := 0 cpu FLASH stuff, not needed
ENABLE_LTO := 0 **experimental, reduces size of compiled firmware but might break EEPROM reads (OVERLAY will be disabled if you enable this)
ENABLE_LTO := 1 **experimental, reduces size of compiled firmware but might break EEPROM reads (OVERLAY will be disabled if you enable this)
ENABLE_UART := 1 without this you can't configure radio via PC
ENABLE_UART_DEBUG := 0 just for code debugging, it sends debug info along the USB serial connection (programming lead)
ENABLE_AIRCOPY := 1 clone radio-to-radio via RF
ENABLE_AIRCOPY_REMEMBER_FREQ := 1 remember the aircopy frequency
ENABLE_AIRCOPY_RX_REBOOT := 0 auto reboot on an aircopy successful RX completion
ENABLE_FMRADIO := 1 WBFM VHF broadcast band receiver
ENABLE_NOAA := 1 everything NOAA (only of any use in the USA)
ENABLE_NOAA := 0 everything NOAA (only of any use in the USA)
ENABLE_VOICE := 0 want to hear voices ?
ENABLE_MUTE_RADIO_FOR_VOICE := 1 mute the radios audio when a voice is playing
ENABLE_VOX := 1 voice operated transmission
ENABLE_VOX := 0 voice operated transmission
ENABLE_REDUCE_LOW_MID_TX_POWER := 1 reduce the low and mid TX power levels (high remains unchanged)
ENABLE_ALARM := 1 TX alarms
ENABLE_1750HZ := 1 side key 1750Hz TX tone (older style repeater access)
ENABLE_ALARM := 0 TX alarms
ENABLE_1750HZ := 0 side key 1750Hz TX tone (older style repeater access)
ENABLE_PWRON_PASSWORD := 0 include power-on password code
ENABLE_RESET_AES_KEY := 1 '1' = reset/clear the AES key stored in the eeprom (only if it's set)
ENABLE_BIG_FREQ := 0 big font frequencies (like original QS firmware)
@ -66,18 +66,20 @@ ENABLE_BOOT_BEEPS := 0 gives user audio feedback on volume
ENABLE_DTMF_CALL_FLASH_LIGHT := 1 flash the flash light LED when a DTMF call is received
ENABLE_SHOW_CHARGE_LEVEL := 0 show the charge level when the radio is on charge
ENABLE_REVERSE_BAT_SYMBOL := 1 mirror the battery symbol on the status bar (+ pole on the right)
ENABLE_FREQ_SEARCH_TIMEOUT := 1 timeout if FREQ not found when using F+4 search function
ENABLE_FREQ_SEARCH_TIMEOUT := 0 timeout if FREQ not found when using F+4 search function
ENABLE_CODE_SEARCH_TIMEOUT := 0 timeout if CTCSS/CDCSS not found when using F+* search function
ENABLE_KILL_REVIVE := 0 include kill and revive code
ENABLE_AM_FIX := 1 dynamically adjust the front end gains when in AM mode to helo prevent AM demodulator saturation, ignore the on-screen RSSI level (for now)
ENABLE_AM_FIX_SHOW_DATA := 0 show debug data for the AM fix (still tweaking it)
ENABLE_AM_FIX := 1 dynamically adjust the front end gains when in AM mode to help prevent AM demodulator saturation, ignore the on-screen RSSI level (for now)
ENABLE_AM_FIX_SHOW_DATA := 1 show debug data for the AM fix (still tweaking it)
ENABLE_SQUELCH_MORE_SENSITIVE := 1 make squelch levels a little bit more sensitive - I plan to let user adjust the values themselves
ENABLE_SQ_OPEN_WITH_UP_DN_BUTTS := 1 open the squelch when holding down UP or DN buttons when in frequency mode
ENABLE_FASTER_CHANNEL_SCAN := 1 increases the channel scan speed, but the squelch is also made more twitchy
ENABLE_FASTER_CHANNEL_SCAN := 1 increase the channel scan speed, but also make the squelch more twitchy
ENABLE_COPY_CHAN_TO_VFO_TO_CHAN := 1 long press M, copy channel to VFO, or VFO to channel
ENABLE_RX_SIGNAL_BAR := 1 enable a dBm/Sn RSSI bar graph level inplace of the little antenna symbols
ENABLE_TX_TIMEOUT_BAR := 0 show the remainng TX time
ENABLE_TX_AUDIO_BAR := 1 enable TX audio level bar, includes remaining TX time (in seconds)
ENABLE_COPY_CHAN_TO_VFO_TO_CHAN := 1 long press M, copy channel to VFO, or VFO to channel
ENABLE_SIDE_BUTT_MENU := 1 change programmable side buttons in menu
ENABLE_KEYLOCK := 1 auto lock after 30 sec or long press F to lock
#ENABLE_BAND_SCOPE := 0 not yet implemented - spectrum/pan-adapter
#ENABLE_SINGLE_VFO_CHAN := 0 not yet implemented - single VFO on display when possible
```

View File

@ -1538,12 +1538,14 @@ void APP_time_slice_10ms(void)
{
g_flash_light_blink_counter++;
#ifdef ENABLE_UART
if (UART_IsCommandAvailable())
{
__disable_irq();
UART_HandleCommand();
__enable_irq();
}
#endif
// ***********
@ -2123,6 +2125,7 @@ void APP_time_slice_500ms(void)
g_search_css_state == SEARCH_CSS_STATE_REPEAT))
{
#ifdef ENABLE_KEYLOCK
if (g_eeprom.auto_keypad_lock &&
g_key_lock_count_down_500ms > 0 &&
!g_dtmf_input_mode &&
@ -2135,6 +2138,7 @@ void APP_time_slice_500ms(void)
g_update_status = true;
}
}
#endif
if (exit_menu)
{
@ -2426,9 +2430,11 @@ static void APP_process_key(const key_code_t Key, const bool key_pressed, const
// stay awake - for now
g_battery_save_count_down_10ms = battery_save_count_10ms;
#ifdef ENABLE_KEYLOCK
// keep the auto keylock at bay
if (g_eeprom.auto_keypad_lock)
g_key_lock_count_down_500ms = key_lock_timeout_500ms;
#endif
if (g_fkey_pressed && (Key == KEY_PTT || Key == KEY_EXIT || Key == KEY_SIDE1 || Key == KEY_SIDE2))
{ // cancel the F-key
@ -2438,6 +2444,7 @@ static void APP_process_key(const key_code_t Key, const bool key_pressed, const
// ********************
#ifdef ENABLE_KEYLOCK
if (g_eeprom.key_lock && g_current_function != FUNCTION_TRANSMIT && Key != KEY_PTT)
{ // keyboard is locked
@ -2480,6 +2487,7 @@ static void APP_process_key(const key_code_t Key, const bool key_pressed, const
return;
}
}
#endif
// key beep
// if (Key != KEY_PTT && !key_held && key_pressed)

View File

@ -51,6 +51,7 @@ void GENERIC_Key_F(bool key_pressed, bool key_held)
if (key_held)
{ // f-key held
#ifdef ENABLE_KEYLOCK
if (key_pressed && g_screen_to_display != DISPLAY_MENU && g_current_function != FUNCTION_TRANSMIT)
{ // toggle the keyboad lock
@ -66,6 +67,7 @@ void GENERIC_Key_F(bool key_pressed, bool key_held)
g_keypad_locked = 4; // 2 second pop-up
g_update_display = true;
}
#endif
return;
}

View File

@ -201,13 +201,15 @@ int MENU_GetLimits(uint8_t Cursor, int32_t *pMin, int32_t *pMax)
break;
#endif
case MENU_SIDE1_SHORT:
case MENU_SIDE1_LONG:
case MENU_SIDE2_SHORT:
case MENU_SIDE2_LONG:
*pMin = 0;
*pMax = ARRAY_SIZE(g_sub_menu_SIDE_BUTT) - 1;
break;
#ifdef ENABLE_SIDE_BUTT_MENU
case MENU_SIDE1_SHORT:
case MENU_SIDE1_LONG:
case MENU_SIDE2_SHORT:
case MENU_SIDE2_LONG:
*pMin = 0;
*pMax = ARRAY_SIZE(g_sub_menu_SIDE_BUTT) - 1;
break;
#endif
case MENU_RESET:
*pMin = 0;
@ -247,7 +249,9 @@ int MENU_GetLimits(uint8_t Cursor, int32_t *pMin, int32_t *pMax)
#endif
case MENU_BUSY_CHAN_LOCK:
case MENU_BEEP:
#ifdef ENABLE_KEYLOCK
case MENU_AUTO_KEY_LOCK:
#endif
case MENU_S_ADD1:
case MENU_S_ADD2:
case MENU_STE:
@ -612,10 +616,12 @@ void MENU_AcceptSetting(void)
g_eeprom.channel_display_mode = g_sub_menu_selection;
break;
#ifdef ENABLE_KEYLOCK
case MENU_AUTO_KEY_LOCK:
g_eeprom.auto_keypad_lock = g_sub_menu_selection;
g_key_lock_count_down_500ms = key_lock_timeout_500ms;
break;
#endif
case MENU_S_ADD1:
g_tx_vfo->scanlist_1_participation = g_sub_menu_selection;
@ -793,6 +799,7 @@ void MENU_AcceptSetting(void)
g_flag_reset_vfos = true;
return;
#ifdef ENABLE_SIDE_BUTT_MENU
case MENU_SIDE1_SHORT:
g_eeprom.key1_short_press_action = g_sub_menu_selection;
break;
@ -808,6 +815,7 @@ void MENU_AcceptSetting(void)
case MENU_SIDE2_LONG:
g_eeprom.key2_long_press_action = g_sub_menu_selection;
break;
#endif
case MENU_RESET:
BOARD_FactoryReset(g_sub_menu_selection);
@ -844,11 +852,11 @@ void MENU_AcceptSetting(void)
g_setting_tx_enable = g_sub_menu_selection;
break;
#ifdef ENABLE_F_CAL_MENU
#ifdef ENABLE_F_CAL_MENU
case MENU_F_CALI:
writeXtalFreqCal(g_sub_menu_selection, true);
return;
#endif
#endif
case MENU_BAT_CAL:
{
@ -1014,11 +1022,11 @@ void MENU_ShowCurrentSetting(void)
break;
case MENU_MEM_SAVE:
#if 0
#if 0
g_sub_menu_selection = g_eeprom.user_channel[0];
#else
#else
g_sub_menu_selection = g_eeprom.user_channel[g_eeprom.tx_vfo];
#endif
#endif
break;
case MENU_MEM_NAME:
@ -1029,11 +1037,11 @@ void MENU_ShowCurrentSetting(void)
g_sub_menu_selection = g_eeprom.battery_save;
break;
#ifdef ENABLE_VOX
#ifdef ENABLE_VOX
case MENU_VOX:
g_sub_menu_selection = g_eeprom.vox_switch ? g_eeprom.vox_level + 1 : 0;
break;
#endif
#endif
case MENU_AUTO_BACKLITE:
g_sub_menu_selection = g_eeprom.backlight;
@ -1046,11 +1054,11 @@ void MENU_ShowCurrentSetting(void)
g_sub_menu_selection = g_setting_backlight_on_tx_rx;
break;
#ifdef ENABLE_CONTRAST
#ifdef ENABLE_CONTRAST
case MENU_CONTRAST:
g_sub_menu_selection = g_setting_contrast;
break;
#endif
#endif
case MENU_DUAL_WATCH:
// g_sub_menu_selection = g_eeprom.dual_watch;
@ -1073,11 +1081,11 @@ void MENU_ShowCurrentSetting(void)
g_sub_menu_selection = g_eeprom.tx_timeout_timer;
break;
#ifdef ENABLE_VOICE
#ifdef ENABLE_VOICE
case MENU_VOICE:
g_sub_menu_selection = g_eeprom.voice_prompt;
break;
#endif
#endif
case MENU_SCAN_CAR_RESUME:
g_sub_menu_selection = g_eeprom.scan_resume_mode;
@ -1087,9 +1095,11 @@ void MENU_ShowCurrentSetting(void)
g_sub_menu_selection = g_eeprom.channel_display_mode;
break;
#ifdef ENABLE_KEYLOCK
case MENU_AUTO_KEY_LOCK:
g_sub_menu_selection = g_eeprom.auto_keypad_lock;
break;
#endif
case MENU_S_ADD1:
g_sub_menu_selection = g_tx_vfo->scanlist_1_participation;
@ -1111,17 +1121,17 @@ void MENU_ShowCurrentSetting(void)
g_sub_menu_selection = g_eeprom.mic_sensitivity;
break;
#ifdef ENABLE_TX_AUDIO_BAR
#ifdef ENABLE_TX_AUDIO_BAR
case MENU_TX_BAR:
g_sub_menu_selection = g_setting_mic_bar;
break;
#endif
#endif
#ifdef ENABLE_RX_SIGNAL_BAR
#ifdef ENABLE_RX_SIGNAL_BAR
case MENU_RX_BAR:
g_sub_menu_selection = g_setting_rssi_bar;
break;
#endif
#endif
case MENU_COMPAND:
g_sub_menu_selection = g_tx_vfo->compand;
@ -1143,11 +1153,11 @@ void MENU_ShowCurrentSetting(void)
g_sub_menu_selection = RADIO_FindNextChannel(0, 1, true, 1);
break;
#ifdef ENABLE_ALARM
#ifdef ENABLE_ALARM
case MENU_ALARM_MODE:
g_sub_menu_selection = g_eeprom.alarm_mode;
break;
#endif
#endif
case MENU_DTMF_ST:
g_sub_menu_selection = g_eeprom.dtmf_side_tone;
@ -1221,32 +1231,33 @@ void MENU_ShowCurrentSetting(void)
g_sub_menu_selection = g_tx_vfo->am_mode;
break;
#ifdef ENABLE_AM_FIX
#ifdef ENABLE_AM_FIX
case MENU_AM_FIX:
g_sub_menu_selection = g_setting_am_fix;
break;
#endif
#endif
#ifdef ENABLE_AM_FIX_TEST1
#ifdef ENABLE_AM_FIX_TEST1
case MENU_AM_FIX_TEST1:
g_sub_menu_selection = g_setting_am_fix_test1;
break;
#endif
#endif
#ifdef ENABLE_NOAA
#ifdef ENABLE_NOAA
case MENU_NOAA_SCAN:
g_sub_menu_selection = g_eeprom.noaa_auto_scan;
break;
#endif
#endif
case MENU_MEM_DEL:
#if 0
#if 0
g_sub_menu_selection = RADIO_FindNextChannel(g_eeprom.user_channel[0], 1, false, 1);
#else
#else
g_sub_menu_selection = RADIO_FindNextChannel(g_eeprom.user_channel[g_eeprom.tx_vfo], 1, false, 1);
#endif
#endif
break;
#ifdef ENABLE_SIDE_BUTT_MENU
case MENU_SIDE1_SHORT:
g_sub_menu_selection = g_eeprom.key1_short_press_action;
break;
@ -1262,6 +1273,7 @@ void MENU_ShowCurrentSetting(void)
case MENU_SIDE2_LONG:
g_sub_menu_selection = g_eeprom.key2_long_press_action;
break;
#endif
case MENU_350_TX:
g_sub_menu_selection = g_setting_350_tx_enable;
@ -1291,11 +1303,11 @@ void MENU_ShowCurrentSetting(void)
g_sub_menu_selection = g_setting_tx_enable;
break;
#ifdef ENABLE_F_CAL_MENU
#ifdef ENABLE_F_CAL_MENU
case MENU_F_CALI:
g_sub_menu_selection = g_eeprom.BK4819_xtal_freq_low;
break;
#endif
#endif
case MENU_BAT_CAL:
g_sub_menu_selection = g_battery_calibration[3];
@ -1399,15 +1411,15 @@ static void MENU_Key_0_to_9(key_code_t Key, bool key_pressed, bool key_held)
if (g_input_box_index < 6)
{ // invalid frequency
#ifdef ENABLE_VOICE
#ifdef ENABLE_VOICE
g_another_voice_id = (voice_id_t)Key;
#endif
#endif
return;
}
#ifdef ENABLE_VOICE
#ifdef ENABLE_VOICE
g_another_voice_id = (voice_id_t)Key;
#endif
#endif
NUMBER_Get(g_input_box, &Frequency);
g_sub_menu_selection = FREQUENCY_FloorToStep(Frequency + 75, g_tx_vfo->step_freq, 0);
@ -1424,9 +1436,9 @@ static void MENU_Key_0_to_9(key_code_t Key, bool key_pressed, bool key_held)
if (g_input_box_index < 3)
{
#ifdef ENABLE_VOICE
#ifdef ENABLE_VOICE
g_another_voice_id = (voice_id_t)Key;
#endif
#endif
g_request_display_screen = DISPLAY_MENU;
return;
}
@ -1437,9 +1449,9 @@ static void MENU_Key_0_to_9(key_code_t Key, bool key_pressed, bool key_held)
if (Value <= USER_CHANNEL_LAST)
{ // user channel
#ifdef ENABLE_VOICE
#ifdef ENABLE_VOICE
g_another_voice_id = (voice_id_t)Key;
#endif
#endif
g_sub_menu_selection = Value;
return;
}
@ -1500,9 +1512,9 @@ static void MENU_Key_EXIT(bool key_pressed, bool key_held)
g_input_box_index = 0;
g_flag_refresh_menu = true;
#ifdef ENABLE_VOICE
#ifdef ENABLE_VOICE
g_another_voice_id = VOICE_ID_CANCEL;
#endif
#endif
}
else
g_input_box[--g_input_box_index] = 10;
@ -1513,9 +1525,9 @@ static void MENU_Key_EXIT(bool key_pressed, bool key_held)
return;
}
#ifdef ENABLE_VOICE
#ifdef ENABLE_VOICE
g_another_voice_id = VOICE_ID_CANCEL;
#endif
#endif
g_request_display_screen = DISPLAY_MAIN;
@ -1529,9 +1541,9 @@ static void MENU_Key_EXIT(bool key_pressed, bool key_held)
{
MENU_stop_css_scan();
#ifdef ENABLE_VOICE
#ifdef ENABLE_VOICE
g_another_voice_id = VOICE_ID_SCANNING_STOP;
#endif
#endif
g_request_display_screen = DISPLAY_MENU;
}
@ -1549,16 +1561,16 @@ static void MENU_Key_MENU(const bool key_pressed, const bool key_held)
if (!g_is_in_sub_menu)
{
#ifdef ENABLE_VOICE
#ifdef ENABLE_VOICE
if (g_menu_cursor != MENU_SCRAMBLER)
g_another_voice_id = g_menu_list[g_menu_list_sorted[g_menu_cursor]].voice_id;
#endif
#endif
#if 1
#if 1
if (g_menu_cursor == MENU_MEM_DEL || g_menu_cursor == MENU_MEM_NAME)
if (!RADIO_CheckValidChannel(g_sub_menu_selection, false, 0))
return; // invalid channel
#endif
#endif
g_ask_for_confirmation = 0;
g_is_in_sub_menu = true;
@ -1637,18 +1649,18 @@ static void MENU_Key_MENU(const bool key_pressed, const bool key_held)
if (g_menu_cursor == MENU_RESET)
{
#ifdef ENABLE_VOICE
#ifdef ENABLE_VOICE
AUDIO_SetVoiceID(0, VOICE_ID_CONFIRM);
AUDIO_PlaySingleVoice(true);
#endif
#endif
MENU_AcceptSetting();
#if defined(ENABLE_OVERLAY)
#if defined(ENABLE_OVERLAY)
overlay_FLASH_RebootToBootloader();
#else
#else
NVIC_SystemReset();
#endif
#endif
}
g_flag_accept_setting = true;
@ -1669,12 +1681,12 @@ static void MENU_Key_MENU(const bool key_pressed, const bool key_held)
g_update_status = true;
}
#ifdef ENABLE_VOICE
#ifdef ENABLE_VOICE
if (g_menu_cursor == MENU_SCRAMBLER)
g_another_voice_id = (g_sub_menu_selection == 0) ? VOICE_ID_SCRAMBLER_OFF : VOICE_ID_SCRAMBLER_ON;
else
g_another_voice_id = VOICE_ID_CONFIRM;
#endif
#endif
g_input_box_index = 0;
}
@ -1716,18 +1728,18 @@ static void MENU_Key_STAR(const bool key_pressed, const bool key_held)
{
MENU_start_css_scan(1);
g_request_display_screen = DISPLAY_MENU;
#ifdef ENABLE_VOICE
#ifdef ENABLE_VOICE
AUDIO_SetVoiceID(0, VOICE_ID_SCANNING_BEGIN);
AUDIO_PlaySingleVoice(1);
#endif
#endif
}
else
{
MENU_stop_css_scan();
g_request_display_screen = DISPLAY_MENU;
#ifdef ENABLE_VOICE
#ifdef ENABLE_VOICE
g_another_voice_id = VOICE_ID_SCANNING_STOP;
#endif
#endif
}
}
@ -1921,9 +1933,9 @@ void MENU_process_key(key_code_t Key, bool key_pressed, bool key_held)
if (g_screen_to_display == DISPLAY_MENU)
{
if (g_menu_cursor == MENU_VOLTAGE ||
#ifdef ENABLE_F_CAL_MENU
#ifdef ENABLE_F_CAL_MENU
g_menu_cursor == MENU_F_CALI ||
#endif
#endif
g_menu_cursor == MENU_BAT_CAL)
{
g_menu_count_down = menu_timeout_long_500ms;

View File

@ -111,15 +111,17 @@ const uint8_t BITMAP_USB_C[8] =
__extension__ 0b00011100
};
const uint8_t BITMAP_KEYLOCK[6] =
{ // teeny weeny padlock symbol
__extension__ 0b00000000,
__extension__ 0b01111100,
__extension__ 0b01000110,
__extension__ 0b01000101,
__extension__ 0b01000110,
__extension__ 0b01111100
};
#ifdef ENABLE_KEYLOCK
const uint8_t BITMAP_KEYLOCK[6] =
{ // teeny weeny padlock symbol
__extension__ 0b00000000,
__extension__ 0b01111100,
__extension__ 0b01000110,
__extension__ 0b01000101,
__extension__ 0b01000110,
__extension__ 0b01111100
};
#endif
const uint8_t BITMAP_F_KEY[6] =
{ // F-Key symbol

View File

@ -12,7 +12,9 @@ extern const uint8_t BITMAP_BATTERY_LEVEL[17];
extern const uint8_t BITMAP_USB_C[8];
extern const uint8_t BITMAP_KEYLOCK[6];
#ifdef ENABLE_KEYLOCK
extern const uint8_t BITMAP_KEYLOCK[6];
#endif
extern const uint8_t BITMAP_F_KEY[6];

View File

@ -531,7 +531,9 @@ void BOARD_EEPROM_load(void)
#ifdef ENABLE_NOAA
g_eeprom.noaa_auto_scan = (Data[3] < 2) ? Data[3] : false;
#endif
g_eeprom.key_lock = (Data[4] < 2) ? Data[4] : false;
#ifdef ENABLE_KEYLOCK
g_eeprom.key_lock = (Data[4] < 2) ? Data[4] : false;
#endif
#ifdef ENABLE_VOX
g_eeprom.vox_switch = (Data[5] < 2) ? Data[5] : false;
g_eeprom.vox_level = (Data[6] < 10) ? Data[6] : 1;

BIN
firmware.bin Normal file → Executable file

Binary file not shown.

Binary file not shown.

2
main.c
View File

@ -65,7 +65,9 @@ void Main(void)
| SYSCON_DEV_CLK_GATE_AES_BITS_ENABLE;
SYSTICK_Init();
#ifdef ENABLE_UART
UART_Init();
#endif
BOARD_Init();
#if defined(ENABLE_UART)

12
misc.c
View File

@ -43,8 +43,10 @@ const uint8_t dtmf_txstop_countdown_500ms = 3000 / 500; // 6 sec
const uint8_t serial_config_count_down_500ms = 3000 / 500; // 3 seconds
const uint8_t key_input_timeout_500ms = 6000 / 500; // 6 seconds
const uint8_t key_lock_timeout_500ms = 30000 / 500; // 30 seconds
const uint8_t key_input_timeout_500ms = 6000 / 500; // 6 seconds
#ifdef ENABLE_KEYLOCK
const uint8_t key_lock_timeout_500ms = 30000 / 500; // 30 seconds
#endif
const uint8_t key_debounce_10ms = 30 / 10; // 30ms
const uint8_t key_long_press_10ms = 300 / 10; // 300ms
@ -159,8 +161,10 @@ volatile uint16_t g_tail_tone_elimination_count_down_10ms;
#endif
bool g_enable_speaker;
uint8_t g_key_input_count_down;
uint8_t g_key_lock_count_down_500ms;
uint8_t g_key_input_count_down;
#ifdef ENABLE_KEYLOCK
uint8_t g_key_lock_count_down_500ms;
#endif
uint8_t g_rtte_count_down;
bool g_password_locked;
uint8_t g_update_status;

11
misc.h
View File

@ -129,7 +129,10 @@ extern const uint8_t dtmf_txstop_countdown_500ms;
extern const uint8_t serial_config_count_down_500ms;
extern const uint8_t key_input_timeout_500ms;
extern const uint8_t key_lock_timeout_500ms;
#ifdef ENABLE_KEYLOCK
extern const uint8_t key_lock_timeout_500ms;
#endif
extern const uint8_t key_debounce_10ms;
extern const uint8_t key_long_press_10ms;
@ -245,7 +248,11 @@ extern volatile uint16_t g_tail_tone_elimination_count_down_10ms;
#endif
extern bool g_enable_speaker;
extern uint8_t g_key_input_count_down;
extern uint8_t g_key_lock_count_down_500ms;
#ifdef ENABLE_KEYLOCK
extern uint8_t g_key_lock_count_down_500ms;
#endif
extern uint8_t g_rtte_count_down;
extern bool g_password_locked;
extern uint8_t g_update_status;

View File

@ -741,7 +741,6 @@ void RADIO_setup_registers(bool switch_to_function_foreground)
!g_fm_radio_mode &&
#endif
g_eeprom.vox_switch &&
!g_fm_radio_mode &&
IS_NOT_NOAA_CHANNEL(g_current_vfo->channel_save) &&
g_current_vfo->am_mode == 0)
{

View File

@ -200,7 +200,12 @@ void SETTINGS_save(void)
#else
State[3] = false;
#endif
State[4] = g_eeprom.key_lock;
#ifdef ENABLE_KEYLOCK
State[4] = g_eeprom.key_lock;
#else
State[4] = false;
#endif
#ifdef ENABLE_VOX
State[5] = g_eeprom.vox_switch;
State[6] = g_eeprom.vox_level;

View File

@ -478,7 +478,9 @@ typedef struct {
uint8_t squelch_level;
uint8_t tx_timeout_timer;
bool key_lock;
#ifdef ENABLE_KEYLOCK
bool key_lock;
#endif
bool vox_switch;
uint8_t vox_level;
#ifdef ENABLE_VOICE

View File

@ -34,6 +34,7 @@ void UI_DisplayFM(void)
memset(g_frame_buffer, 0, sizeof(g_frame_buffer));
#ifdef ENABLE_KEYLOCK
if (g_eeprom.key_lock && g_keypad_locked > 0)
{ // tell user how to unlock the keyboard
backlight_turn_on(0);
@ -42,6 +43,7 @@ void UI_DisplayFM(void)
ST7565_BlitFullScreen();
return;
}
#endif
// *************************************
// upper text line

View File

@ -263,8 +263,10 @@ void UI_drawBars(uint8_t *p, const unsigned int level)
char s[16];
#ifdef ENABLE_KEYLOCK
if (g_eeprom.key_lock && g_keypad_locked > 0)
return false; // display is in use
#endif
if (g_current_function == FUNCTION_TRANSMIT ||
g_screen_to_display != DISPLAY_MAIN ||
@ -371,8 +373,10 @@ void UI_update_rssi(const int16_t rssi, const int vfo)
// **********************************************************
#ifdef ENABLE_KEYLOCK
if (g_eeprom.key_lock && g_keypad_locked > 0)
return; // display is in use
#endif
if (g_current_function == FUNCTION_TRANSMIT || g_screen_to_display != DISPLAY_MAIN)
return; // display is in use
@ -422,6 +426,7 @@ void UI_DisplayMain(void)
return;
}
#ifdef ENABLE_KEYLOCK
if (g_eeprom.key_lock && g_keypad_locked > 0)
{ // tell user how to unlock the keyboard
backlight_turn_on(10); // 5 seconds
@ -430,6 +435,7 @@ void UI_DisplayMain(void)
ST7565_BlitFullScreen();
return;
}
#endif
for (vfo_num = 0; vfo_num < 2; vfo_num++)
{

View File

@ -82,7 +82,9 @@ const t_menu_item g_menu_list[] =
{"VOICE", VOICE_ID_VOICE_PROMPT, MENU_VOICE },
#endif
{"SC REV", VOICE_ID_INVALID, MENU_SCAN_CAR_RESUME }, // was "SC_REV"
#ifdef ENABLE_KEYLOCK
{"KeyLOC", VOICE_ID_INVALID, MENU_AUTO_KEY_LOCK }, // was "AUTOLk"
#endif
{"S ADD1", VOICE_ID_INVALID, MENU_S_ADD1 },
{"S ADD2", VOICE_ID_INVALID, MENU_S_ADD2 },
{"STE", VOICE_ID_INVALID, MENU_STE },
@ -127,10 +129,12 @@ const t_menu_item g_menu_list[] =
#ifdef ENABLE_NOAA
{"NOAA-S", VOICE_ID_INVALID, MENU_NOAA_SCAN },
#endif
#ifdef ENABLE_SIDE_BUTT_MENU
{"Side1S", VOICE_ID_INVALID, MENU_SIDE1_SHORT },
{"Side1L", VOICE_ID_INVALID, MENU_SIDE1_LONG },
{"Side2S", VOICE_ID_INVALID, MENU_SIDE2_SHORT },
{"Side2L", VOICE_ID_INVALID, MENU_SIDE2_LONG },
#endif
{"VER", VOICE_ID_INVALID, MENU_VERSION },
{"RESET", VOICE_ID_INITIALISATION, MENU_RESET }, // might be better to move this to the hidden menu items ?
@ -356,6 +360,7 @@ const char g_sub_MENU_SCRAMBLERAMBLER[11][7] =
"3500Hz"
};
#ifdef ENABLE_SIDE_BUTT_MENU
const char g_sub_menu_SIDE_BUTT[9][16] =
//const char g_sub_menu_SIDE_BUTT[10][16] =
{
@ -370,6 +375,7 @@ const char g_sub_menu_SIDE_BUTT[9][16] =
"TX\n1750Hz",
// "2nd PTT",
};
#endif
// ***************************************************************************************
@ -712,12 +718,14 @@ void UI_DisplayMenu(void)
break;
#endif
#ifdef ENABLE_KEYLOCK
case MENU_AUTO_KEY_LOCK:
if (g_sub_menu_selection == 0)
strcpy(String, "OFF");
else
sprintf(String, "%u secs", key_lock_timeout_500ms / 2);
break;
#endif
case MENU_COMPAND:
strcpy(String, g_sub_menu_rx_tx[g_sub_menu_selection]);
@ -1025,12 +1033,14 @@ void UI_DisplayMenu(void)
g_usb_current);
break;
#ifdef ENABLE_SIDE_BUTT_MENU
case MENU_SIDE1_SHORT:
case MENU_SIDE1_LONG:
case MENU_SIDE2_SHORT:
case MENU_SIDE2_LONG:
strcpy(String, g_sub_menu_SIDE_BUTT[g_sub_menu_selection]);
break;
#endif
case MENU_VERSION:
{ // show the version string on multiple lines - if need be
@ -1098,15 +1108,15 @@ void UI_DisplayMenu(void)
case FREQ_LOCK_446:
strcpy(String, "446.00625\n~\n446.19375");
break;
#ifdef ENABLE_TX_UNLOCK
#ifdef ENABLE_TX_UNLOCK
case FREQ_LOCK_TX_UNLOCK:
sprintf(String, "UNLOCKED\n%u~%u", BX4819_BAND1.lower / 100000, BX4819_BAND2.upper / 100000);
break;
#endif
#endif
}
break;
#ifdef ENABLE_F_CAL_MENU
#ifdef ENABLE_F_CAL_MENU
case MENU_F_CALI:
{
const uint32_t value = 22656 + g_sub_menu_selection;
@ -1119,7 +1129,7 @@ void UI_DisplayMenu(void)
xtal_Hz / 1000000, xtal_Hz % 1000000);
}
break;
#endif
#endif
case MENU_BAT_CAL:
{

View File

@ -119,11 +119,15 @@ enum
#ifdef ENABLE_VOICE
MENU_VOICE,
#endif
#ifdef ENABLE_KEYLOCK
MENU_AUTO_KEY_LOCK,
#endif
#ifdef ENABLE_SIDE_BUTT_MENU
MENU_SIDE1_SHORT,
MENU_SIDE1_LONG,
MENU_SIDE2_SHORT,
MENU_SIDE2_LONG,
#endif
MENU_VERSION,
MENU_RESET,
@ -183,7 +187,9 @@ extern const char g_sub_menu_rx_tx[4][6];
extern const char g_sub_menu_BAT_TXT[3][8];
extern const char g_sub_menu_DIS_EN[2][9];
extern const char g_sub_MENU_SCRAMBLERAMBLER[11][7];
extern const char g_sub_menu_SIDE_BUTT[9][16];
#ifdef ENABLE_SIDE_BUTT_MENU
extern const char g_sub_menu_SIDE_BUTT[9][16];
#endif
extern bool g_is_in_sub_menu;

View File

@ -178,6 +178,7 @@ void UI_DisplayStatus(const bool test_display)
x += sizeof(BITMAP_VOX);
#endif
#ifdef ENABLE_KEYLOCK
// KEY-LOCK indicator
if (g_eeprom.key_lock || test_display)
{
@ -186,6 +187,7 @@ void UI_DisplayStatus(const bool test_display)
x1 = x;
}
else
#endif
if (g_fkey_pressed)
{
memmove(line + x, BITMAP_F_KEY, sizeof(BITMAP_F_KEY));