diff --git a/app/menu.c b/app/menu.c index 70be56e..76ad9e5 100644 --- a/app/menu.c +++ b/app/menu.c @@ -283,7 +283,7 @@ int MENU_GetLimits(uint8_t Cursor, int32_t *pMin, int32_t *pMax) case MENU_TX_TO: *pMin = 0; - *pMax = ARRAY_SIZE(g_sub_menu_tx_timeout) - 1; + *pMax = ARRAY_SIZE(tx_timeout_secs) - 1; break; #ifdef ENABLE_VOX diff --git a/firmware.bin b/firmware.bin index 5a615b4..4f691ef 100644 Binary files a/firmware.bin and b/firmware.bin differ diff --git a/firmware.packed.bin b/firmware.packed.bin index ea6722f..12d3964 100644 Binary files a/firmware.packed.bin and b/firmware.packed.bin differ diff --git a/functions.c b/functions.c index 54daaa8..e837142 100644 --- a/functions.c +++ b/functions.c @@ -189,13 +189,7 @@ void FUNCTION_Select(function_type_t Function) if (g_alarm_state == ALARM_STATE_OFF) #endif { - if (g_eeprom.config.setting.tx_timeout == 0) - g_tx_timer_tick_500ms = 60; // 30 sec - else - if (g_eeprom.config.setting.tx_timeout < (ARRAY_SIZE(g_sub_menu_tx_timeout) - 1)) - g_tx_timer_tick_500ms = 120 * g_eeprom.config.setting.tx_timeout; // minutes - else - g_tx_timer_tick_500ms = 120 * 15; // 15 minutes + g_tx_timer_tick_500ms = tx_timeout_secs[g_eeprom.config.setting.tx_timeout] * 2; } if (g_eeprom.config.setting.backlight_on_tx_rx == 1 || g_eeprom.config.setting.backlight_on_tx_rx == 3) diff --git a/misc.c b/misc.c index 6280f9c..85d4f79 100644 --- a/misc.c +++ b/misc.c @@ -21,6 +21,26 @@ const uint8_t obfuscate_array[16] = { 0x16, 0x6C, 0x14, 0xE6, 0x2E, 0x91, 0x0D, 0x40, 0x21, 0x35, 0xD5, 0x40, 0x13, 0x03, 0xE9, 0x80 }; +const uint16_t tx_timeout_secs[16] = +{ + (60 * 0) + 0, + (60 * 0) + 30, + (60 * 1) + 0, + (60 * 1) + 30, + (60 * 2) + 0, + (60 * 2) + 30, + (60 * 3) + 0, + (60 * 3) + 30, + (60 * 4) + 0, + (60 * 4) + 30, + (60 * 5) + 0, + (60 * 6) + 0, + (60 * 7) + 0, + (60 * 8) + 0, + (60 * 10) + 0, + (60 * 15) + 0 +}; + // *********************************************** const uint8_t fm_resume_500ms = 2500 / 500; // 2.5 seconds diff --git a/misc.h b/misc.h index 8a2d4fd..3917b6a 100644 --- a/misc.h +++ b/misc.h @@ -123,6 +123,8 @@ typedef enum scan_state_dir_e scan_state_dir_t; extern const uint8_t obfuscate_array[16]; +extern const uint16_t tx_timeout_secs[16]; + extern const uint8_t fm_resume_500ms; extern const uint8_t fm_radio_500ms; extern const uint16_t fm_play_scan_10ms; diff --git a/settings.c b/settings.c index ef6f173..8116d98 100644 --- a/settings.c +++ b/settings.c @@ -144,7 +144,7 @@ void SETTINGS_read_eeprom(void) g_eeprom.config.setting.call1 = IS_USER_CHANNEL(g_eeprom.config.setting.call1) ? g_eeprom.config.setting.call1 : USER_CHANNEL_FIRST; g_eeprom.config.setting.squelch_level = (g_eeprom.config.setting.squelch_level < 10) ? g_eeprom.config.setting.squelch_level : 1; - g_eeprom.config.setting.tx_timeout = (g_eeprom.config.setting.tx_timeout < 11) ? g_eeprom.config.setting.tx_timeout : 1; + g_eeprom.config.setting.tx_timeout = (g_eeprom.config.setting.tx_timeout < ARRAY_SIZE(tx_timeout_secs)) ? ARRAY_SIZE(tx_timeout_secs) : 1; g_eeprom.config.setting.noaa_auto_scan = (g_eeprom.config.setting.noaa_auto_scan < 2) ? g_eeprom.config.setting.noaa_auto_scan : 0; #ifdef ENABLE_KEYLOCK g_eeprom.config.setting.key_lock = (g_eeprom.config.setting.key_lock < 2) ? g_eeprom.config.setting.key_lock : 0; diff --git a/ui/menu.c b/ui/menu.c index b0feaf4..0a6c534 100644 --- a/ui/menu.c +++ b/ui/menu.c @@ -240,21 +240,6 @@ const char g_sub_menu_bat_save[5][9] = "1:4 80%" }; -const char g_sub_menu_tx_timeout[11][7] = -{ - "30 sec", - "1 min", - "2 min", - "3 min", - "4 min", - "5 min", - "6 min", - "7 min", - "8 min", - "9 min", - "15 min" -}; - const char g_sub_menu_dual_watch[3][10] = { "OFF", @@ -995,7 +980,23 @@ void UI_DisplayMenu(void) break; case MENU_TX_TO: - strcpy(str, g_sub_menu_tx_timeout[g_sub_menu_selection]); + { + const uint16_t ticks_500ms = tx_timeout_secs[g_sub_menu_selection]; + const unsigned int min = ticks_500ms / 60; + const unsigned int sec = ticks_500ms % 60; + if (sec > 0) + { + if (min > 0) + sprintf(str, "%um %us", min, sec); + else + sprintf(str, "%u sec", sec); + } + else + if (min > 0) + sprintf(str, "%u min", min); + else + strcat(str, "off"); + } break; #ifdef ENABLE_VOICE diff --git a/ui/menu.h b/ui/menu.h index 27cf5fa..fd660df 100644 --- a/ui/menu.h +++ b/ui/menu.h @@ -193,7 +193,6 @@ extern const char g_sub_menu_shift_dir[3][4]; extern const char g_sub_menu_bandwidth[2][7]; extern const char g_sub_menu_off_on[2][4]; extern const char g_sub_menu_bat_save[5][9]; -extern const char g_sub_menu_tx_timeout[11][7]; extern const char g_sub_menu_dual_watch[3][10]; extern const char g_sub_menu_cross_vfo[3][10]; #ifdef ENABLE_VOICE