diff --git a/Makefile b/Makefile index 73e943d..17bfad1 100644 --- a/Makefile +++ b/Makefile @@ -3,6 +3,9 @@ # 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 @@ -15,7 +18,7 @@ ENABLE_AIRCOPY := 1 ENABLE_AIRCOPY_REMEMBER_FREQ := 1 ENABLE_AIRCOPY_RX_REBOOT := 0 # FM Radio 4.2 kb -ENABLE_FMRADIO := 1 +ENABLE_FMRADIO := 0 # NOAA 1.2 kb ENABLE_NOAA := 0 # Voice 1.7 kb @@ -24,11 +27,13 @@ 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 ENABLE_RESET_AES_KEY := 1 ENABLE_BIG_FREQ := 0 +# Small Bold Font 0.6 kb ENABLE_SMALL_BOLD := 1 ENABLE_KEEP_MEM_NAME := 1 ENABLE_WIDE_RX := 1 @@ -43,17 +48,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 := 1 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 @@ -385,6 +398,9 @@ 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 diff --git a/README.md b/README.md index a5affbf..93dcbb7 100644 --- a/README.md +++ b/README.md @@ -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 ``` diff --git a/app/app.c b/app/app.c index 34c24ac..f01d644 100644 --- a/app/app.c +++ b/app/app.c @@ -2125,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 && @@ -2137,6 +2138,7 @@ void APP_time_slice_500ms(void) g_update_status = true; } } + #endif if (exit_menu) { @@ -2428,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 @@ -2440,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 @@ -2482,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) diff --git a/app/generic.c b/app/generic.c index c105850..aa23fbf 100644 --- a/app/generic.c +++ b/app/generic.c @@ -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; } diff --git a/app/menu.c b/app/menu.c index 9b269d4..44e161a 100644 --- a/app/menu.c +++ b/app/menu.c @@ -249,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: @@ -614,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; @@ -1091,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; diff --git a/bitmaps.c b/bitmaps.c index ee64868..8f3bfef 100644 --- a/bitmaps.c +++ b/bitmaps.c @@ -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 diff --git a/bitmaps.h b/bitmaps.h index c2a8def..b41c4a2 100644 --- a/bitmaps.h +++ b/bitmaps.h @@ -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]; diff --git a/board.c b/board.c index 3694c2c..c2e754f 100644 --- a/board.c +++ b/board.c @@ -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; diff --git a/firmware.bin b/firmware.bin index 3e0bf50..d55f7b5 100755 Binary files a/firmware.bin and b/firmware.bin differ diff --git a/firmware.packed.bin b/firmware.packed.bin index 0dd52dd..2ba5fcf 100644 Binary files a/firmware.packed.bin and b/firmware.packed.bin differ diff --git a/misc.c b/misc.c index 5046e77..6945693 100644 --- a/misc.c +++ b/misc.c @@ -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; diff --git a/misc.h b/misc.h index 4e1f806..8945ff1 100644 --- a/misc.h +++ b/misc.h @@ -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; diff --git a/settings.c b/settings.c index 66c0e7f..8832d11 100644 --- a/settings.c +++ b/settings.c @@ -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; diff --git a/settings.h b/settings.h index 81e1840..ace90f1 100644 --- a/settings.h +++ b/settings.h @@ -476,7 +476,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 diff --git a/ui/fmradio.c b/ui/fmradio.c index 6dfee76..b2830c4 100644 --- a/ui/fmradio.c +++ b/ui/fmradio.c @@ -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 diff --git a/ui/main.c b/ui/main.c index 9e0c757..4faa8df 100644 --- a/ui/main.c +++ b/ui/main.c @@ -262,8 +262,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 || @@ -370,8 +372,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 @@ -420,6 +424,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 @@ -428,6 +433,7 @@ void UI_DisplayMain(void) ST7565_BlitFullScreen(); return; } + #endif for (vfo_num = 0; vfo_num < 2; vfo_num++) { diff --git a/ui/menu.c b/ui/menu.c index d8ec3bb..70ccc9b 100644 --- a/ui/menu.c +++ b/ui/menu.c @@ -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 }, @@ -716,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]); diff --git a/ui/menu.h b/ui/menu.h index fdc52c3..207847f 100644 --- a/ui/menu.h +++ b/ui/menu.h @@ -119,7 +119,9 @@ 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, @@ -134,19 +136,19 @@ enum // ************************************ // items after here are normally hidden - MENU_BAT_CAL, // battery voltage calibration + MENU_BAT_CAL, // battery voltage calibration #ifdef ENABLE_F_CAL_MENU - MENU_F_CALI, // 26MHz reference xtal calibration + MENU_F_CALI, // 26MHz reference xtal calibration #endif MENU_SCRAMBLER_EN, // scrambler enable/disable - MENU_FREQ_LOCK, // lock to a selected region - MENU_350_EN, // 350~400MHz enable/disable - MENU_174_TX, // 174~350MHz TX enable/disable - MENU_350_TX, // 350~400MHz TX enable/disable - MENU_470_TX, // 470MHz and up TX enable/disable - MENU_TX_EN, // disable the TX entirely + MENU_FREQ_LOCK, // lock to a selected region + MENU_350_EN, // 350~400MHz enable/disable + MENU_174_TX, // 174~350MHz TX enable/disable + MENU_350_TX, // 350~400MHz TX enable/disable + MENU_470_TX, // 470MHz and up TX enable/disable + MENU_TX_EN, // disable the TX entirely // ************************************ // ************************************ diff --git a/ui/status.c b/ui/status.c index 5252907..7e44e21 100644 --- a/ui/status.c +++ b/ui/status.c @@ -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));