diff --git a/Makefile b/Makefile index 59c24e2..adacfa7 100644 --- a/Makefile +++ b/Makefile @@ -41,7 +41,8 @@ ENABLE_PWRON_PASSWORD := 0 ENABLE_RESET_AES_KEY := 0 ENABLE_BIG_FREQ := 0 ENABLE_DTMF_LIVE_DECODER := 0 -ENABLE_SHOW_FREQS_CHAN := 1 +ENABLE_DTMF_TIMING_SETTINGS := 1 +ENABLE_SHOW_FREQ_IN_CHAN := 1 # smaa bolf 580 B ENABLE_SMALL_BOLD := 0 # smallest font 2 kB @@ -335,8 +336,8 @@ endif ifeq ($(ENABLE_DTMF_LIVE_DECODER),1) CFLAGS += -DENABLE_DTMF_LIVE_DECODER endif -ifeq ($(ENABLE_SHOW_FREQS_CHAN),1) - CFLAGS += -DENABLE_SHOW_FREQS_CHAN +ifeq ($(ENABLE_SHOW_FREQ_IN_CHAN),1) + CFLAGS += -DENABLE_SHOW_FREQ_IN_CHAN endif ifeq ($(ENABLE_SMALL_BOLD),1) CFLAGS += -DENABLE_SMALL_BOLD diff --git a/README.md b/README.md index 95f26a1..e506512 100644 --- a/README.md +++ b/README.md @@ -65,7 +65,8 @@ 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) ENABLE_DTMF_LIVE_DECODER := 0 enable the live DTMF display/decoder .. adds a menu option -ENABLE_SHOW_FREQS_CHAN := 0 show the channel name under the frequency if the frequency is found in a channel +ENABLE_DTMF_TIMING_SETTINGS := 0 enable the DTMF timing settings in the menu +ENABLE_SHOW_FREQ_IN_CHAN := 0 indicate if frequency found in a channel ENABLE_SMALL_BOLD := 0 bold channel name/no. (when name + freq channel display mode) ENABLE_TRIM_TRAILING_ZEROS := 0 trim away any trailing zeros on frequencies ENABLE_WIDE_RX := 1 full 18MHz to 1300MHz RX (though front-end/PA not designed for full range) diff --git a/app/menu.c b/app/menu.c index bb1af8a..d657bdd 100644 --- a/app/menu.c +++ b/app/menu.c @@ -354,10 +354,22 @@ int MENU_GetLimits(uint8_t Cursor, int32_t *pMin, int32_t *pMax) *pMax = DTMF_HOLD_MAX; break; - case MENU_DTMF_PRE: - *pMin = 3; - *pMax = 99; - break; + #ifdef ENABLE_DTMF_TIMING_SETTINGS + case MENU_DTMF_PRE: + *pMin = 3; + *pMax = 99; + break; + +// MENU_DTMF_1ST_PERSIST, +// MENU_DTMF_HASH_PERSIST, +// MENU_DTMF_PERSIST, +// MENU_DTMF_INTERVAL, + +// g_eeprom.config.setting.dtmf.first_code_persist_time = (g_eeprom.config.setting.dtmf.first_code_persist_time < 8 || g_eeprom.config.setting.dtmf.first_code_persist_time > 20) ? 10 : g_eeprom.config.setting.dtmf.first_code_persist_time; +// g_eeprom.config.setting.dtmf.hash_code_persist_time = (g_eeprom.config.setting.dtmf.hash_code_persist_time < 8 || g_eeprom.config.setting.dtmf.hash_code_persist_time > 20) ? 10 : g_eeprom.config.setting.dtmf.hash_code_persist_time; +// g_eeprom.config.setting.dtmf.code_persist_time = (g_eeprom.config.setting.dtmf.code_persist_time < 8 || g_eeprom.config.setting.dtmf.code_persist_time > 20) ? 10 : g_eeprom.config.setting.dtmf.code_persist_time; +// g_eeprom.config.setting.dtmf.code_interval_time = (g_eeprom.config.setting.dtmf.code_interval_time < 8 || g_eeprom.config.setting.dtmf.code_interval_time > 20) ? 10 : g_eeprom.config.setting.dtmf.code_interval_time; + #endif case MENU_DTMF_LIST: *pMin = 1; @@ -739,9 +751,21 @@ void MENU_AcceptSetting(void) g_eeprom.config.setting.dtmf.auto_reset_time = g_sub_menu_selection; break; - case MENU_DTMF_PRE: - g_eeprom.config.setting.dtmf.preload_time = g_sub_menu_selection; - break; + #ifdef ENABLE_DTMF_TIMING_SETTINGS + case MENU_DTMF_PRE: + g_eeprom.config.setting.dtmf.preload_time = g_sub_menu_selection; + break; + +// MENU_DTMF_1ST_PERSIST, +// MENU_DTMF_HASH_PERSIST, +// MENU_DTMF_PERSIST, +// MENU_DTMF_INTERVAL, + +// g_eeprom.config.setting.dtmf.first_code_persist_time +// g_eeprom.config.setting.dtmf.hash_code_persist_time +// g_eeprom.config.setting.dtmf.code_persist_time +// g_eeprom.config.setting.dtmf.code_interval_time + #endif #ifdef ENABLE_MDC1200 case MENU_MDC1200_MODE: @@ -1271,9 +1295,21 @@ void MENU_ShowCurrentSetting(void) break; - case MENU_DTMF_PRE: - g_sub_menu_selection = g_eeprom.config.setting.dtmf.preload_time; - break; + #ifdef ENABLE_DTMF_TIMING_SETTINGS + case MENU_DTMF_PRE: + g_sub_menu_selection = g_eeprom.config.setting.dtmf.preload_time; + break; + +// MENU_DTMF_1ST_PERSIST, +// MENU_DTMF_HASH_PERSIST, +// MENU_DTMF_PERSIST, +// MENU_DTMF_INTERVAL, + +// g_eeprom.config.setting.dtmf.first_code_persist_time +// g_eeprom.config.setting.dtmf.hash_code_persist_time +// g_eeprom.config.setting.dtmf.code_persist_time +// g_eeprom.config.setting.dtmf.code_interval_time + #endif #ifdef ENABLE_MDC1200 case MENU_MDC1200_MODE: diff --git a/firmware.bin b/firmware.bin index 63ee283..02e6cc1 100644 Binary files a/firmware.bin and b/firmware.bin differ diff --git a/firmware.packed.bin b/firmware.packed.bin index 23415bf..ffcf602 100644 Binary files a/firmware.packed.bin and b/firmware.packed.bin differ diff --git a/settings.c b/settings.c index ec735de..0a988c6 100644 --- a/settings.c +++ b/settings.c @@ -229,11 +229,13 @@ void SETTINGS_read_eeprom(void) g_eeprom.config.setting.dtmf.group_call_code = DTMF_ValidateCodes((char *)(&g_eeprom.config.setting.dtmf.group_call_code), 1) ? g_eeprom.config.setting.dtmf.group_call_code : '#'; g_eeprom.config.setting.dtmf.decode_response = (g_eeprom.config.setting.dtmf.decode_response < 4) ? g_eeprom.config.setting.dtmf.decode_response : DTMF_DEC_RESPONSE_RING; g_eeprom.config.setting.dtmf.auto_reset_time = (g_eeprom.config.setting.dtmf.auto_reset_time <= DTMF_HOLD_MAX) ? g_eeprom.config.setting.dtmf.auto_reset_time : (g_eeprom.config.setting.dtmf.auto_reset_time >= DTMF_HOLD_MIN) ? g_eeprom.config.setting.dtmf.auto_reset_time : DTMF_HOLD_MAX; - g_eeprom.config.setting.dtmf.preload_time = (g_eeprom.config.setting.dtmf.preload_time < 10) ? g_eeprom.config.setting.dtmf.preload_time : 20; - g_eeprom.config.setting.dtmf.first_code_persist_time = (g_eeprom.config.setting.dtmf.first_code_persist_time < 10) ? g_eeprom.config.setting.dtmf.first_code_persist_time : 7; - g_eeprom.config.setting.dtmf.hash_code_persist_time = (g_eeprom.config.setting.dtmf.hash_code_persist_time < 10) ? g_eeprom.config.setting.dtmf.hash_code_persist_time : 7; - g_eeprom.config.setting.dtmf.code_persist_time = (g_eeprom.config.setting.dtmf.code_persist_time < 10) ? g_eeprom.config.setting.dtmf.code_persist_time : 7; - g_eeprom.config.setting.dtmf.code_interval_time = (g_eeprom.config.setting.dtmf.code_interval_time < 10) ? g_eeprom.config.setting.dtmf.code_interval_time : 7; +#endif + g_eeprom.config.setting.dtmf.preload_time = (g_eeprom.config.setting.dtmf.preload_time < 3 || g_eeprom.config.setting.dtmf.preload_time > 99) ? 30 : g_eeprom.config.setting.dtmf.preload_time; + g_eeprom.config.setting.dtmf.first_code_persist_time = (g_eeprom.config.setting.dtmf.first_code_persist_time < 8 || g_eeprom.config.setting.dtmf.first_code_persist_time > 20) ? 10 : g_eeprom.config.setting.dtmf.first_code_persist_time; + g_eeprom.config.setting.dtmf.hash_code_persist_time = (g_eeprom.config.setting.dtmf.hash_code_persist_time < 8 || g_eeprom.config.setting.dtmf.hash_code_persist_time > 20) ? 10 : g_eeprom.config.setting.dtmf.hash_code_persist_time; + g_eeprom.config.setting.dtmf.code_persist_time = (g_eeprom.config.setting.dtmf.code_persist_time < 8 || g_eeprom.config.setting.dtmf.code_persist_time > 20) ? 10 : g_eeprom.config.setting.dtmf.code_persist_time; + g_eeprom.config.setting.dtmf.code_interval_time = (g_eeprom.config.setting.dtmf.code_interval_time < 8 || g_eeprom.config.setting.dtmf.code_interval_time > 20) ? 10 : g_eeprom.config.setting.dtmf.code_interval_time; +#if 0 #ifdef ENABLE_KILL_REVIVE g_eeprom.config.setting.dtmf.permit_remote_kill = (g_eeprom.config.setting.dtmf.permit_remote_kill < 2) ? g_eeprom.config.setting.dtmf.permit_remote_kill : 0; #else diff --git a/ui/main.c b/ui/main.c index e201842..19456f2 100644 --- a/ui/main.c +++ b/ui/main.c @@ -649,6 +649,11 @@ const char *state_list[] = {"", "BUSY", "BAT LOW", "TX DISABLE", "TIMEOUT", "ALA uint8_t *p_line1 = g_frame_buffer[1]; char str[22]; + #ifdef ENABLE_SHOW_FREQ_IN_CHAN + const uint8_t freq_in_channel = g_vfo_info[vfo_num].freq_in_channel; + //const uint8_t freq_in_channel = SETTINGS_find_channel(frequency); // was way to slow + #endif + #ifdef ENABLE_ALARM if (g_current_function == FUNCTION_TRANSMIT && g_alarm_state == ALARM_STATE_ALARM) state = VFO_STATE_ALARM; @@ -812,41 +817,28 @@ const char *state_list[] = {"", "BUSY", "BAT LOW", "TX DISABLE", "TIMEOUT", "ALA big_freq(frequency, x, y); #else - #ifdef ENABLE_SHOW_FREQS_CHAN -// const unsigned int chan = g_vfo_info[vfo_num].freq_in_channel; - #endif - //sprintf(str, "%03u.%05u", frequency / 100000, frequency % 100000); sprintf(str, "%u.%05u", frequency / 100000, frequency % 100000); #ifdef ENABLE_TRIM_TRAILING_ZEROS NUMBER_trim_trailing_zeros(str); #endif -/* - #ifdef ENABLE_SHOW_FREQS_CHAN - //g_vfo_info[vfo_num].freq_in_channel = SETTINGS_find_channel(frequency); - if (chan <= USER_CHANNEL_LAST) - { // the frequency has a channel - show the channel name below the frequency - // frequency - #ifdef ENABLE_SMALL_BOLD - UI_PrintStringSmallBold(str, x + 4, 0, line + 0); - #else - UI_PrintStringSmall(str, x + 4, 0, y); - #endif + #ifdef ENABLE_SHOW_FREQ_IN_CHAN + UI_PrintString(str, x, 0, y, 8); - // channel name, if not then channel number - SETTINGS_fetch_channel_name(str, chan); + if (IS_FREQ_CHANNEL(scrn_chan) && freq_in_channel <= USER_CHANNEL_LAST) + { + SETTINGS_fetch_channel_name(str, freq_in_channel); if (str[0] == 0) - //sprintf(str, "CH-%03u", 1 + chan); - sprintf(str, "CH-%u", 1 + chan); - UI_PrintStringSmall(str, x + 4, 0, y + 1); + //sprintf(str, "CH-%03u", 1 + freq_in_channel); + sprintf(str, "CH-%u", 1 + freq_in_channel); + //UI_PrintString(str, x, 0, y + 2, 8); + UI_PrintStringSmall(str, x, 0, y + 2); } - else - #endif -*/ { // show the frequency in the main font -// UI_PrintString(str, x, 0, y, 8); + #else UI_PrintString(str, x, 0, y + 1, 8); - } + #endif + #endif } @@ -868,41 +860,22 @@ const char *state_list[] = {"", "BUSY", "BAT LOW", "TX DISABLE", "TIMEOUT", "ALA } { - const bool is_freq_chan = IS_FREQ_CHANNEL(scrn_chan); - const uint8_t freq_in_channel = g_vfo_info[vfo_num].freq_in_channel; -// const uint8_t freq_in_channel = SETTINGS_find_channel(frequency); // was way to slow - - #ifdef ENABLE_SHOW_FREQS_CHAN - strcpy(str, " "); - - if (is_freq_chan && freq_in_channel <= USER_CHANNEL_LAST) - sprintf(str, "%3u", 1 + freq_in_channel); - - #ifdef ENABLE_SCAN_IGNORE_LIST - if (FI_freq_ignored(frequency) >= 0) - str[4] = 'I'; // frequency is in the ignore list - #endif - - if (g_vfo_info[vfo_num].channel.compand != COMPAND_OFF) - str[5] = 'C'; // compander is enabled - - UI_PrintStringSmall(str, LCD_WIDTH - (7 * 6), 0, y + 1); - #else - strcpy(str, " "); - - if (is_freq_chan && freq_in_channel <= USER_CHANNEL_LAST) + strcpy(str, " "); +/* + #ifdef ENABLE_SHOW_FREQ_IN_CHAN + if (IS_FREQ_CHANNEL(scrn_chan) && freq_in_channel <= USER_CHANNEL_LAST) str[0] = 'F'; // this VFO frequency is also found in a channel - - #ifdef ENABLE_SCAN_IGNORE_LIST - if (FI_freq_ignored(frequency) >= 0) - str[1] = 'I'; // frequency is in the ignore list - #endif - - if (g_vfo_info[vfo_num].channel.compand != COMPAND_OFF) - str[2] = 'C'; // compander is enabled - - UI_PrintStringSmall(str, LCD_WIDTH - (7 * 3), 0, y + 1); #endif +*/ + #ifdef ENABLE_SCAN_IGNORE_LIST + if (FI_freq_ignored(frequency) >= 0) + str[1] = 'I'; // frequency is in the ignore list + #endif + + if (g_vfo_info[vfo_num].channel.compand != COMPAND_OFF) + str[2] = 'C'; // compander is enabled + + UI_PrintStringSmall(str, LCD_WIDTH - (7 * 3), 0, y + 1); } } @@ -1326,9 +1299,9 @@ void UI_DisplayMain(void) // name #ifdef ENABLE_SMALL_BOLD - UI_PrintStringSmallBold(str, x + 4, 0, line + 0); + UI_PrintStringSmallBold(str, x + 4, 0, line); #else - UI_PrintStringSmall(str, x + 4, 0, line + 0); + UI_PrintStringSmall(str, x + 4, 0, line); #endif // frequency @@ -1350,40 +1323,39 @@ void UI_DisplayMain(void) big_freq(frequency, x, line); #else - #ifdef ENABLE_SHOW_FREQS_CHAN - const unsigned int chan = g_vfo_info[vfo_num].freq_in_channel; - #endif - // sprintf(str, "%03u.%05u", frequency / 100000, frequency % 100000); sprintf(str, "%u.%05u", frequency / 100000, frequency % 100000); #ifdef ENABLE_TRIM_TRAILING_ZEROS NUMBER_trim_trailing_zeros(str); #endif - #ifdef ENABLE_SHOW_FREQS_CHAN + #ifdef ENABLE_SHOW_FREQ_IN_CHAN + { //g_vfo_info[vfo_num].freq_in_channel = SETTINGS_find_channel(frequency); - if (chan <= USER_CHANNEL_LAST) + const unsigned int freq_in_channel = g_vfo_info[vfo_num].freq_in_channel; + + if (freq_in_channel <= USER_CHANNEL_LAST) { // the frequency has a channel - show the channel name below the frequency - // frequency #ifdef ENABLE_SMALL_BOLD - UI_PrintStringSmallBold(str, x + 4, 0, line + 0); + UI_PrintStringSmallBold(str, x, 0, line); #else - UI_PrintStringSmall(str, x + 4, 0, line + 0); + UI_PrintStringSmall(str, x, 0, line); #endif // channel name, if not then channel number - SETTINGS_fetch_channel_name(str, chan); + SETTINGS_fetch_channel_name(str, freq_in_channel); if (str[0] == 0) -// sprintf(str, "CH-%03u", 1 + chan); - sprintf(str, "CH-%u", 1 + chan); - UI_PrintStringSmall(str, x + 4, 0, line + 1); + //sprintf(str, "CH-%03u", 1 + freq_in_channel); + sprintf(str, "CH-%u", 1 + freq_in_channel); + UI_PrintStringSmall(str, x, 0, line + 1); } else - #endif - { // show the frequency in the main font - UI_PrintString(str, x, 0, line, 8); + UI_PrintString(str, x, 0, line, 8); } + #else + UI_PrintString(str, x, 0, line, 8); + #endif #endif } @@ -1430,38 +1402,27 @@ void UI_DisplayMain(void) } #else { - #ifdef ENABLE_SHOW_FREQS_CHAN - strcpy(str, " "); - - #ifdef ENABLE_SCAN_IGNORE_LIST - if (FI_freq_ignored(frequency) >= 0) - str[0] = 'I'; // frequency is in the ignore list - #endif - - if (g_vfo_info[vfo_num].channel.compand != COMPAND_OFF) - str[1] = 'C'; // compander is enabled - - UI_PrintStringSmall(str, LCD_WIDTH - (7 * 2), 0, line + 1); - #else - const bool is_freq_chan = IS_FREQ_CHANNEL(scrn_chan); - const uint8_t freq_in_channel = g_vfo_info[vfo_num].freq_in_channel; -// const uint8_t freq_in_channel = SETTINGS_find_channel(frequency); // was way to slow - - strcpy(str, " "); - - #ifdef ENABLE_SCAN_IGNORE_LIST - if (FI_freq_ignored(frequency) >= 0) - str[0] = 'I'; // frequency is in the ignore list - #endif - - if (is_freq_chan && freq_in_channel <= USER_CHANNEL_LAST) - str[1] = 'F'; // this VFO frequency is also found in a channel - - if (g_vfo_info[vfo_num].channel.compand != COMPAND_OFF) - str[2] = 'C'; // compander is enabled - - UI_PrintStringSmall(str, LCD_WIDTH - (7 * 3), 0, line + 1); + strcpy(str, " "); +/* + #ifdef ENABLE_SHOW_FREQ_IN_CHAN + if (IS_FREQ_CHANNEL(scrn_chan)) + { + const uint8_t freq_in_channel = g_vfo_info[vfo_num].freq_in_channel; + //const uint8_t freq_in_channel = SETTINGS_find_channel(frequency); // was way to slow + if (freq_in_channel <= USER_CHANNEL_LAST) + str[0] = 'F'; // this VFO frequency is also found in a channel + } #endif +*/ + #ifdef ENABLE_SCAN_IGNORE_LIST + if (FI_freq_ignored(frequency) >= 0) + str[1] = 'I'; // frequency is in the ignore list + #endif + + if (g_vfo_info[vfo_num].channel.compand != COMPAND_OFF) + str[2] = 'C'; // compander is enabled + + UI_PrintStringSmall(str, LCD_WIDTH - (7 * 3), 0, line + 1); } #endif } diff --git a/ui/menu.c b/ui/menu.c index 07a3f95..18fbe9c 100644 --- a/ui/menu.c +++ b/ui/menu.c @@ -120,11 +120,21 @@ const t_menu_item g_menu_list[] = {"D ST", VOICE_ID_INVALID, MENU_DTMF_ST }, {"D RSP", VOICE_ID_INVALID, MENU_DTMF_RSP }, {"D HOLD", VOICE_ID_INVALID, MENU_DTMF_HOLD }, - {"D PRE", VOICE_ID_INVALID, MENU_DTMF_PRE }, {"D DCD", VOICE_ID_INVALID, MENU_DTMF_DCD }, {"D LIST", VOICE_ID_INVALID, MENU_DTMF_LIST }, #ifdef ENABLE_DTMF_LIVE_DECODER {"D LIVE", VOICE_ID_INVALID, MENU_DTMF_LIVE_DEC }, // live DTMF decoder +#endif +#ifdef ENABLE_DTMF_TIMING_SETTINGS + {"D PRE", VOICE_ID_INVALID, MENU_DTMF_PRE }, +// MENU_DTMF_1ST_PERSIST, +// MENU_DTMF_HASH_PERSIST, +// MENU_DTMF_PERSIST, +// MENU_DTMF_INTERVAL, +// g_eeprom.config.setting.dtmf.first_code_persist_time +// g_eeprom.config.setting.dtmf.hash_code_persist_time +// g_eeprom.config.setting.dtmf.code_persist_time +// g_eeprom.config.setting.dtmf.code_interval_time #endif {"PonMSG", VOICE_ID_INVALID, MENU_PON_MSG }, {"ROGER", VOICE_ID_INVALID, MENU_ROGER_MODE }, @@ -1073,10 +1083,22 @@ void UI_DisplayMenu(void) break; - case MENU_DTMF_PRE: - strcpy(str, "DTMF BOT\nDELAY\n"); - sprintf(str + strlen(str), "%dms", 10 * g_sub_menu_selection); - break; + #ifdef ENABLE_DTMF_TIMING_SETTINGS + case MENU_DTMF_PRE: + strcpy(str, "DTMF BOT\nDELAY\n"); + sprintf(str + strlen(str), "%dms", 10 * g_sub_menu_selection); + break; + +// MENU_DTMF_1ST_PERSIST, +// MENU_DTMF_HASH_PERSIST, +// MENU_DTMF_PERSIST, +// MENU_DTMF_INTERVAL, + +// g_eeprom.config.setting.dtmf.first_code_persist_time +// g_eeprom.config.setting.dtmf.hash_code_persist_time +// g_eeprom.config.setting.dtmf.code_persist_time +// g_eeprom.config.setting.dtmf.code_interval_time + #endif #ifdef ENABLE_MDC1200 case MENU_MDC1200_MODE: diff --git a/ui/menu.h b/ui/menu.h index 2bb5ea6..a2f934c 100644 --- a/ui/menu.h +++ b/ui/menu.h @@ -100,13 +100,23 @@ enum MENU_DN_CODE, MENU_DTMF_ST, MENU_DTMF_HOLD, - MENU_DTMF_PRE, MENU_DTMF_LIST, MENU_DTMF_RSP, MENU_DTMF_DCD, #ifdef ENABLE_DTMF_LIVE_DECODER MENU_DTMF_LIVE_DEC, #endif +#ifdef ENABLE_DTMF_TIMING_SETTINGS + MENU_DTMF_PRE, +// MENU_DTMF_1ST_PERSIST, +// MENU_DTMF_HASH_PERSIST, +// MENU_DTMF_PERSIST, +// MENU_DTMF_INTERVAL, +// g_eeprom.config.setting.dtmf.first_code_persist_time +// g_eeprom.config.setting.dtmf.hash_code_persist_time +// g_eeprom.config.setting.dtmf.code_persist_time +// g_eeprom.config.setting.dtmf.code_interval_time +#endif #ifdef ENABLE_MDC1200 MENU_MDC1200_MODE, MENU_MDC1200_ID,