0
mirror of https://github.com/OneOfEleven/uv-k5-firmware-custom.git synced 2025-04-29 14:51:26 +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 # 0 = remove code
# 1 = include code # 1 = include code
# When testing the extra options, be careful not to exceed the
# 64 kb flash memory limit.
ENABLE_CLANG := 0 ENABLE_CLANG := 0
ENABLE_SWD := 0 ENABLE_SWD := 0
ENABLE_OVERLAY := 0 ENABLE_OVERLAY := 0
ENABLE_LTO := 1 ENABLE_LTO := 1
# UART Programming 2.9 kb
ENABLE_UART := 1 ENABLE_UART := 1
ENABLE_UART_DEBUG := 0 ENABLE_UART_DEBUG := 0
ENABLE_AIRCOPY := 1 ENABLE_AIRCOPY := 1
ENABLE_AIRCOPY_REMEMBER_FREQ := 1 ENABLE_AIRCOPY_REMEMBER_FREQ := 1
ENABLE_AIRCOPY_RX_REBOOT := 0 ENABLE_AIRCOPY_RX_REBOOT := 0
# FM Radio 4.2 kb
ENABLE_FMRADIO := 1 ENABLE_FMRADIO := 1
# NOAA 1.2 kb
ENABLE_NOAA := 0 ENABLE_NOAA := 0
# Voice 1.7 kb
ENABLE_VOICE := 0 ENABLE_VOICE := 0
ENABLE_MUTE_RADIO_FOR_VOICE := 1 ENABLE_MUTE_RADIO_FOR_VOICE := 1
# Tx on Voice 1.0 kb
ENABLE_VOX := 0 ENABLE_VOX := 0
ENABLE_REDUCE_LOW_MID_TX_POWER := 1 ENABLE_REDUCE_LOW_MID_TX_POWER := 1
# Tx Alarm 0.6 kb
ENABLE_ALARM := 0 ENABLE_ALARM := 0
ENABLE_TX1750 := 0 ENABLE_TX1750 := 0
ENABLE_PWRON_PASSWORD := 0 ENABLE_PWRON_PASSWORD := 0
@ -37,16 +46,25 @@ ENABLE_SHOW_CHARGE_LEVEL := 0
ENABLE_REVERSE_BAT_SYMBOL := 1 ENABLE_REVERSE_BAT_SYMBOL := 1
ENABLE_FREQ_SEARCH_TIMEOUT := 0 ENABLE_FREQ_SEARCH_TIMEOUT := 0
ENABLE_CODE_SEARCH_TIMEOUT := 0 ENABLE_CODE_SEARCH_TIMEOUT := 0
# Kill and Revive 0.4 kb
ENABLE_KILL_REVIVE := 0 ENABLE_KILL_REVIVE := 0
# AM Fix 0.8 kb
ENABLE_AM_FIX := 1 ENABLE_AM_FIX := 1
ENABLE_AM_FIX_SHOW_DATA := 0 ENABLE_AM_FIX_SHOW_DATA := 0
ENABLE_SQUELCH_MORE_SENSITIVE := 1 ENABLE_SQUELCH_MORE_SENSITIVE := 1
ENABLE_SQ_OPEN_WITH_UP_DN_BUTTS := 1 ENABLE_SQ_OPEN_WITH_UP_DN_BUTTS := 1
ENABLE_FASTER_CHANNEL_SCAN := 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 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_PANADAPTER := 0
#ENABLE_SINGLE_VFO_CHAN := 0 #ENABLE_SINGLE_VFO_CHAN := 0
@ -375,6 +393,12 @@ endif
ifeq ($(ENABLE_COPY_CHAN_TO_VFO_TO_CHAN),1) ifeq ($(ENABLE_COPY_CHAN_TO_VFO_TO_CHAN),1)
CFLAGS += -DENABLE_COPY_CHAN_TO_VFO_TO_CHAN CFLAGS += -DENABLE_COPY_CHAN_TO_VFO_TO_CHAN
endif 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) ifeq ($(ENABLE_SINGLE_VFO_CHAN),1)
CFLAGS += -DENABLE_SINGLE_VFO_CHAN CFLAGS += -DENABLE_SINGLE_VFO_CHAN
endif 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_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_SWD := 0 only needed if using CPU's SWD port (debugging/programming)
ENABLE_OVERLAY := 0 cpu FLASH stuff, not needed 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 := 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_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 := 1 clone radio-to-radio via RF
ENABLE_AIRCOPY_REMEMBER_FREQ := 1 remember the aircopy frequency ENABLE_AIRCOPY_REMEMBER_FREQ := 1 remember the aircopy frequency
ENABLE_AIRCOPY_RX_REBOOT := 0 auto reboot on an aircopy successful RX completion ENABLE_AIRCOPY_RX_REBOOT := 0 auto reboot on an aircopy successful RX completion
ENABLE_FMRADIO := 1 WBFM VHF broadcast band receiver 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_VOICE := 0 want to hear voices ?
ENABLE_MUTE_RADIO_FOR_VOICE := 1 mute the radios audio when a voice is playing 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_REDUCE_LOW_MID_TX_POWER := 1 reduce the low and mid TX power levels (high remains unchanged)
ENABLE_ALARM := 1 TX alarms ENABLE_ALARM := 0 TX alarms
ENABLE_1750HZ := 1 side key 1750Hz TX tone (older style repeater access) ENABLE_1750HZ := 0 side key 1750Hz TX tone (older style repeater access)
ENABLE_PWRON_PASSWORD := 0 include power-on password code 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_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) 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_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_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_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_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_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 := 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 := 0 show debug data for the AM fix (still tweaking it) 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_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_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_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_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_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_BAND_SCOPE := 0 not yet implemented - spectrum/pan-adapter
#ENABLE_SINGLE_VFO_CHAN := 0 not yet implemented - single VFO on display when possible #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++; g_flash_light_blink_counter++;
#ifdef ENABLE_UART
if (UART_IsCommandAvailable()) if (UART_IsCommandAvailable())
{ {
__disable_irq(); __disable_irq();
UART_HandleCommand(); UART_HandleCommand();
__enable_irq(); __enable_irq();
} }
#endif
// *********** // ***********
@ -2123,6 +2125,7 @@ void APP_time_slice_500ms(void)
g_search_css_state == SEARCH_CSS_STATE_REPEAT)) g_search_css_state == SEARCH_CSS_STATE_REPEAT))
{ {
#ifdef ENABLE_KEYLOCK
if (g_eeprom.auto_keypad_lock && if (g_eeprom.auto_keypad_lock &&
g_key_lock_count_down_500ms > 0 && g_key_lock_count_down_500ms > 0 &&
!g_dtmf_input_mode && !g_dtmf_input_mode &&
@ -2135,6 +2138,7 @@ void APP_time_slice_500ms(void)
g_update_status = true; g_update_status = true;
} }
} }
#endif
if (exit_menu) 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 // stay awake - for now
g_battery_save_count_down_10ms = battery_save_count_10ms; g_battery_save_count_down_10ms = battery_save_count_10ms;
#ifdef ENABLE_KEYLOCK
// keep the auto keylock at bay // keep the auto keylock at bay
if (g_eeprom.auto_keypad_lock) if (g_eeprom.auto_keypad_lock)
g_key_lock_count_down_500ms = key_lock_timeout_500ms; 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)) if (g_fkey_pressed && (Key == KEY_PTT || Key == KEY_EXIT || Key == KEY_SIDE1 || Key == KEY_SIDE2))
{ // cancel the F-key { // 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) if (g_eeprom.key_lock && g_current_function != FUNCTION_TRANSMIT && Key != KEY_PTT)
{ // keyboard is locked { // keyboard is locked
@ -2480,6 +2487,7 @@ static void APP_process_key(const key_code_t Key, const bool key_pressed, const
return; return;
} }
} }
#endif
// key beep // key beep
// if (Key != KEY_PTT && !key_held && key_pressed) // 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) if (key_held)
{ // f-key held { // f-key held
#ifdef ENABLE_KEYLOCK
if (key_pressed && g_screen_to_display != DISPLAY_MENU && g_current_function != FUNCTION_TRANSMIT) if (key_pressed && g_screen_to_display != DISPLAY_MENU && g_current_function != FUNCTION_TRANSMIT)
{ // toggle the keyboad lock { // 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_keypad_locked = 4; // 2 second pop-up
g_update_display = true; g_update_display = true;
} }
#endif
return; return;
} }

View File

@ -201,6 +201,7 @@ int MENU_GetLimits(uint8_t Cursor, int32_t *pMin, int32_t *pMax)
break; break;
#endif #endif
#ifdef ENABLE_SIDE_BUTT_MENU
case MENU_SIDE1_SHORT: case MENU_SIDE1_SHORT:
case MENU_SIDE1_LONG: case MENU_SIDE1_LONG:
case MENU_SIDE2_SHORT: case MENU_SIDE2_SHORT:
@ -208,6 +209,7 @@ int MENU_GetLimits(uint8_t Cursor, int32_t *pMin, int32_t *pMax)
*pMin = 0; *pMin = 0;
*pMax = ARRAY_SIZE(g_sub_menu_SIDE_BUTT) - 1; *pMax = ARRAY_SIZE(g_sub_menu_SIDE_BUTT) - 1;
break; break;
#endif
case MENU_RESET: case MENU_RESET:
*pMin = 0; *pMin = 0;
@ -247,7 +249,9 @@ int MENU_GetLimits(uint8_t Cursor, int32_t *pMin, int32_t *pMax)
#endif #endif
case MENU_BUSY_CHAN_LOCK: case MENU_BUSY_CHAN_LOCK:
case MENU_BEEP: case MENU_BEEP:
#ifdef ENABLE_KEYLOCK
case MENU_AUTO_KEY_LOCK: case MENU_AUTO_KEY_LOCK:
#endif
case MENU_S_ADD1: case MENU_S_ADD1:
case MENU_S_ADD2: case MENU_S_ADD2:
case MENU_STE: case MENU_STE:
@ -612,10 +616,12 @@ void MENU_AcceptSetting(void)
g_eeprom.channel_display_mode = g_sub_menu_selection; g_eeprom.channel_display_mode = g_sub_menu_selection;
break; break;
#ifdef ENABLE_KEYLOCK
case MENU_AUTO_KEY_LOCK: case MENU_AUTO_KEY_LOCK:
g_eeprom.auto_keypad_lock = g_sub_menu_selection; g_eeprom.auto_keypad_lock = g_sub_menu_selection;
g_key_lock_count_down_500ms = key_lock_timeout_500ms; g_key_lock_count_down_500ms = key_lock_timeout_500ms;
break; break;
#endif
case MENU_S_ADD1: case MENU_S_ADD1:
g_tx_vfo->scanlist_1_participation = g_sub_menu_selection; g_tx_vfo->scanlist_1_participation = g_sub_menu_selection;
@ -793,6 +799,7 @@ void MENU_AcceptSetting(void)
g_flag_reset_vfos = true; g_flag_reset_vfos = true;
return; return;
#ifdef ENABLE_SIDE_BUTT_MENU
case MENU_SIDE1_SHORT: case MENU_SIDE1_SHORT:
g_eeprom.key1_short_press_action = g_sub_menu_selection; g_eeprom.key1_short_press_action = g_sub_menu_selection;
break; break;
@ -808,6 +815,7 @@ void MENU_AcceptSetting(void)
case MENU_SIDE2_LONG: case MENU_SIDE2_LONG:
g_eeprom.key2_long_press_action = g_sub_menu_selection; g_eeprom.key2_long_press_action = g_sub_menu_selection;
break; break;
#endif
case MENU_RESET: case MENU_RESET:
BOARD_FactoryReset(g_sub_menu_selection); BOARD_FactoryReset(g_sub_menu_selection);
@ -1087,9 +1095,11 @@ void MENU_ShowCurrentSetting(void)
g_sub_menu_selection = g_eeprom.channel_display_mode; g_sub_menu_selection = g_eeprom.channel_display_mode;
break; break;
#ifdef ENABLE_KEYLOCK
case MENU_AUTO_KEY_LOCK: case MENU_AUTO_KEY_LOCK:
g_sub_menu_selection = g_eeprom.auto_keypad_lock; g_sub_menu_selection = g_eeprom.auto_keypad_lock;
break; break;
#endif
case MENU_S_ADD1: case MENU_S_ADD1:
g_sub_menu_selection = g_tx_vfo->scanlist_1_participation; g_sub_menu_selection = g_tx_vfo->scanlist_1_participation;
@ -1247,6 +1257,7 @@ void MENU_ShowCurrentSetting(void)
#endif #endif
break; break;
#ifdef ENABLE_SIDE_BUTT_MENU
case MENU_SIDE1_SHORT: case MENU_SIDE1_SHORT:
g_sub_menu_selection = g_eeprom.key1_short_press_action; g_sub_menu_selection = g_eeprom.key1_short_press_action;
break; break;
@ -1262,6 +1273,7 @@ void MENU_ShowCurrentSetting(void)
case MENU_SIDE2_LONG: case MENU_SIDE2_LONG:
g_sub_menu_selection = g_eeprom.key2_long_press_action; g_sub_menu_selection = g_eeprom.key2_long_press_action;
break; break;
#endif
case MENU_350_TX: case MENU_350_TX:
g_sub_menu_selection = g_setting_350_tx_enable; g_sub_menu_selection = g_setting_350_tx_enable;

View File

@ -111,6 +111,7 @@ const uint8_t BITMAP_USB_C[8] =
__extension__ 0b00011100 __extension__ 0b00011100
}; };
#ifdef ENABLE_KEYLOCK
const uint8_t BITMAP_KEYLOCK[6] = const uint8_t BITMAP_KEYLOCK[6] =
{ // teeny weeny padlock symbol { // teeny weeny padlock symbol
__extension__ 0b00000000, __extension__ 0b00000000,
@ -120,6 +121,7 @@ const uint8_t BITMAP_KEYLOCK[6] =
__extension__ 0b01000110, __extension__ 0b01000110,
__extension__ 0b01111100 __extension__ 0b01111100
}; };
#endif
const uint8_t BITMAP_F_KEY[6] = const uint8_t BITMAP_F_KEY[6] =
{ // F-Key symbol { // 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_USB_C[8];
#ifdef ENABLE_KEYLOCK
extern const uint8_t BITMAP_KEYLOCK[6]; extern const uint8_t BITMAP_KEYLOCK[6];
#endif
extern const uint8_t BITMAP_F_KEY[6]; extern const uint8_t BITMAP_F_KEY[6];

View File

@ -531,7 +531,9 @@ void BOARD_EEPROM_load(void)
#ifdef ENABLE_NOAA #ifdef ENABLE_NOAA
g_eeprom.noaa_auto_scan = (Data[3] < 2) ? Data[3] : false; g_eeprom.noaa_auto_scan = (Data[3] < 2) ? Data[3] : false;
#endif #endif
#ifdef ENABLE_KEYLOCK
g_eeprom.key_lock = (Data[4] < 2) ? Data[4] : false; g_eeprom.key_lock = (Data[4] < 2) ? Data[4] : false;
#endif
#ifdef ENABLE_VOX #ifdef ENABLE_VOX
g_eeprom.vox_switch = (Data[5] < 2) ? Data[5] : false; g_eeprom.vox_switch = (Data[5] < 2) ? Data[5] : false;
g_eeprom.vox_level = (Data[6] < 10) ? Data[6] : 1; 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; | SYSCON_DEV_CLK_GATE_AES_BITS_ENABLE;
SYSTICK_Init(); SYSTICK_Init();
#ifdef ENABLE_UART
UART_Init(); UART_Init();
#endif
BOARD_Init(); BOARD_Init();
#if defined(ENABLE_UART) #if defined(ENABLE_UART)

4
misc.c
View File

@ -44,7 +44,9 @@ 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 serial_config_count_down_500ms = 3000 / 500; // 3 seconds
const uint8_t key_input_timeout_500ms = 6000 / 500; // 6 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 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_debounce_10ms = 30 / 10; // 30ms
const uint8_t key_long_press_10ms = 300 / 10; // 300ms const uint8_t key_long_press_10ms = 300 / 10; // 300ms
@ -160,7 +162,9 @@ volatile uint16_t g_tail_tone_elimination_count_down_10ms;
bool g_enable_speaker; bool g_enable_speaker;
uint8_t g_key_input_count_down; uint8_t g_key_input_count_down;
#ifdef ENABLE_KEYLOCK
uint8_t g_key_lock_count_down_500ms; uint8_t g_key_lock_count_down_500ms;
#endif
uint8_t g_rtte_count_down; uint8_t g_rtte_count_down;
bool g_password_locked; bool g_password_locked;
uint8_t g_update_status; uint8_t g_update_status;

7
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 serial_config_count_down_500ms;
extern const uint8_t key_input_timeout_500ms; extern const uint8_t key_input_timeout_500ms;
#ifdef ENABLE_KEYLOCK
extern const uint8_t key_lock_timeout_500ms; extern const uint8_t key_lock_timeout_500ms;
#endif
extern const uint8_t key_debounce_10ms; extern const uint8_t key_debounce_10ms;
extern const uint8_t key_long_press_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 #endif
extern bool g_enable_speaker; extern bool g_enable_speaker;
extern uint8_t g_key_input_count_down; extern uint8_t g_key_input_count_down;
#ifdef ENABLE_KEYLOCK
extern uint8_t g_key_lock_count_down_500ms; extern uint8_t g_key_lock_count_down_500ms;
#endif
extern uint8_t g_rtte_count_down; extern uint8_t g_rtte_count_down;
extern bool g_password_locked; extern bool g_password_locked;
extern uint8_t g_update_status; 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 && !g_fm_radio_mode &&
#endif #endif
g_eeprom.vox_switch && g_eeprom.vox_switch &&
!g_fm_radio_mode &&
IS_NOT_NOAA_CHANNEL(g_current_vfo->channel_save) && IS_NOT_NOAA_CHANNEL(g_current_vfo->channel_save) &&
g_current_vfo->am_mode == 0) g_current_vfo->am_mode == 0)
{ {

View File

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

View File

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

View File

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

View File

@ -263,8 +263,10 @@ void UI_drawBars(uint8_t *p, const unsigned int level)
char s[16]; char s[16];
#ifdef ENABLE_KEYLOCK
if (g_eeprom.key_lock && g_keypad_locked > 0) if (g_eeprom.key_lock && g_keypad_locked > 0)
return false; // display is in use return false; // display is in use
#endif
if (g_current_function == FUNCTION_TRANSMIT || if (g_current_function == FUNCTION_TRANSMIT ||
g_screen_to_display != DISPLAY_MAIN || 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) if (g_eeprom.key_lock && g_keypad_locked > 0)
return; // display is in use return; // display is in use
#endif
if (g_current_function == FUNCTION_TRANSMIT || g_screen_to_display != DISPLAY_MAIN) if (g_current_function == FUNCTION_TRANSMIT || g_screen_to_display != DISPLAY_MAIN)
return; // display is in use return; // display is in use
@ -422,6 +426,7 @@ void UI_DisplayMain(void)
return; return;
} }
#ifdef ENABLE_KEYLOCK
if (g_eeprom.key_lock && g_keypad_locked > 0) if (g_eeprom.key_lock && g_keypad_locked > 0)
{ // tell user how to unlock the keyboard { // tell user how to unlock the keyboard
backlight_turn_on(10); // 5 seconds backlight_turn_on(10); // 5 seconds
@ -430,6 +435,7 @@ void UI_DisplayMain(void)
ST7565_BlitFullScreen(); ST7565_BlitFullScreen();
return; return;
} }
#endif
for (vfo_num = 0; vfo_num < 2; vfo_num++) 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 }, {"VOICE", VOICE_ID_VOICE_PROMPT, MENU_VOICE },
#endif #endif
{"SC REV", VOICE_ID_INVALID, MENU_SCAN_CAR_RESUME }, // was "SC_REV" {"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" {"KeyLOC", VOICE_ID_INVALID, MENU_AUTO_KEY_LOCK }, // was "AUTOLk"
#endif
{"S ADD1", VOICE_ID_INVALID, MENU_S_ADD1 }, {"S ADD1", VOICE_ID_INVALID, MENU_S_ADD1 },
{"S ADD2", VOICE_ID_INVALID, MENU_S_ADD2 }, {"S ADD2", VOICE_ID_INVALID, MENU_S_ADD2 },
{"STE", VOICE_ID_INVALID, MENU_STE }, {"STE", VOICE_ID_INVALID, MENU_STE },
@ -127,10 +129,12 @@ const t_menu_item g_menu_list[] =
#ifdef ENABLE_NOAA #ifdef ENABLE_NOAA
{"NOAA-S", VOICE_ID_INVALID, MENU_NOAA_SCAN }, {"NOAA-S", VOICE_ID_INVALID, MENU_NOAA_SCAN },
#endif #endif
#ifdef ENABLE_SIDE_BUTT_MENU
{"Side1S", VOICE_ID_INVALID, MENU_SIDE1_SHORT }, {"Side1S", VOICE_ID_INVALID, MENU_SIDE1_SHORT },
{"Side1L", VOICE_ID_INVALID, MENU_SIDE1_LONG }, {"Side1L", VOICE_ID_INVALID, MENU_SIDE1_LONG },
{"Side2S", VOICE_ID_INVALID, MENU_SIDE2_SHORT }, {"Side2S", VOICE_ID_INVALID, MENU_SIDE2_SHORT },
{"Side2L", VOICE_ID_INVALID, MENU_SIDE2_LONG }, {"Side2L", VOICE_ID_INVALID, MENU_SIDE2_LONG },
#endif
{"VER", VOICE_ID_INVALID, MENU_VERSION }, {"VER", VOICE_ID_INVALID, MENU_VERSION },
{"RESET", VOICE_ID_INITIALISATION, MENU_RESET }, // might be better to move this to the hidden menu items ? {"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" "3500Hz"
}; };
#ifdef ENABLE_SIDE_BUTT_MENU
const char g_sub_menu_SIDE_BUTT[9][16] = const char g_sub_menu_SIDE_BUTT[9][16] =
//const char g_sub_menu_SIDE_BUTT[10][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", "TX\n1750Hz",
// "2nd PTT", // "2nd PTT",
}; };
#endif
// *************************************************************************************** // ***************************************************************************************
@ -712,12 +718,14 @@ void UI_DisplayMenu(void)
break; break;
#endif #endif
#ifdef ENABLE_KEYLOCK
case MENU_AUTO_KEY_LOCK: case MENU_AUTO_KEY_LOCK:
if (g_sub_menu_selection == 0) if (g_sub_menu_selection == 0)
strcpy(String, "OFF"); strcpy(String, "OFF");
else else
sprintf(String, "%u secs", key_lock_timeout_500ms / 2); sprintf(String, "%u secs", key_lock_timeout_500ms / 2);
break; break;
#endif
case MENU_COMPAND: case MENU_COMPAND:
strcpy(String, g_sub_menu_rx_tx[g_sub_menu_selection]); strcpy(String, g_sub_menu_rx_tx[g_sub_menu_selection]);
@ -1025,12 +1033,14 @@ void UI_DisplayMenu(void)
g_usb_current); g_usb_current);
break; break;
#ifdef ENABLE_SIDE_BUTT_MENU
case MENU_SIDE1_SHORT: case MENU_SIDE1_SHORT:
case MENU_SIDE1_LONG: case MENU_SIDE1_LONG:
case MENU_SIDE2_SHORT: case MENU_SIDE2_SHORT:
case MENU_SIDE2_LONG: case MENU_SIDE2_LONG:
strcpy(String, g_sub_menu_SIDE_BUTT[g_sub_menu_selection]); strcpy(String, g_sub_menu_SIDE_BUTT[g_sub_menu_selection]);
break; break;
#endif
case MENU_VERSION: case MENU_VERSION:
{ // show the version string on multiple lines - if need be { // show the version string on multiple lines - if need be

View File

@ -119,11 +119,15 @@ enum
#ifdef ENABLE_VOICE #ifdef ENABLE_VOICE
MENU_VOICE, MENU_VOICE,
#endif #endif
#ifdef ENABLE_KEYLOCK
MENU_AUTO_KEY_LOCK, MENU_AUTO_KEY_LOCK,
#endif
#ifdef ENABLE_SIDE_BUTT_MENU
MENU_SIDE1_SHORT, MENU_SIDE1_SHORT,
MENU_SIDE1_LONG, MENU_SIDE1_LONG,
MENU_SIDE2_SHORT, MENU_SIDE2_SHORT,
MENU_SIDE2_LONG, MENU_SIDE2_LONG,
#endif
MENU_VERSION, MENU_VERSION,
MENU_RESET, 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_BAT_TXT[3][8];
extern const char g_sub_menu_DIS_EN[2][9]; 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_SCRAMBLERAMBLER[11][7];
#ifdef ENABLE_SIDE_BUTT_MENU
extern const char g_sub_menu_SIDE_BUTT[9][16]; extern const char g_sub_menu_SIDE_BUTT[9][16];
#endif
extern bool g_is_in_sub_menu; extern bool g_is_in_sub_menu;

View File

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