mirror of
https://github.com/OneOfEleven/uv-k5-firmware-custom.git
synced 2025-04-29 06:41:25 +03:00
Squelch and backlight adjustments
This commit is contained in:
parent
d95adde3a6
commit
613fc482cc
27
app/app.c
27
app/app.c
@ -437,6 +437,9 @@ Skip:
|
|||||||
|
|
||||||
static void APP_process_function(void)
|
static void APP_process_function(void)
|
||||||
{
|
{
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough="
|
||||||
|
|
||||||
switch (g_current_function)
|
switch (g_current_function)
|
||||||
{
|
{
|
||||||
case FUNCTION_FOREGROUND:
|
case FUNCTION_FOREGROUND:
|
||||||
@ -444,13 +447,16 @@ static void APP_process_function(void)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case FUNCTION_TRANSMIT:
|
case FUNCTION_TRANSMIT:
|
||||||
break;
|
if (g_setting_backlight_on_tx_rx == 1 || g_setting_backlight_on_tx_rx == 3)
|
||||||
|
backlight_turn_on(backlight_tx_rx_time_500ms);
|
||||||
case FUNCTION_MONITOR:
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FUNCTION_INCOMING:
|
case FUNCTION_INCOMING:
|
||||||
APP_process_incoming_rx();
|
APP_process_incoming_rx();
|
||||||
|
|
||||||
|
case FUNCTION_MONITOR:
|
||||||
|
if (g_setting_backlight_on_tx_rx >= 2)
|
||||||
|
backlight_turn_on(backlight_tx_rx_time_500ms);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FUNCTION_RECEIVE:
|
case FUNCTION_RECEIVE:
|
||||||
@ -465,6 +471,8 @@ static void APP_process_function(void)
|
|||||||
case FUNCTION_BAND_SCOPE:
|
case FUNCTION_BAND_SCOPE:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
}
|
}
|
||||||
|
|
||||||
void APP_start_listening(function_type_t Function, const bool reset_am_fix)
|
void APP_start_listening(function_type_t Function, const bool reset_am_fix)
|
||||||
@ -487,9 +495,6 @@ void APP_start_listening(function_type_t Function, const bool reset_am_fix)
|
|||||||
|
|
||||||
g_enable_speaker = true;
|
g_enable_speaker = true;
|
||||||
|
|
||||||
if (g_setting_backlight_on_tx_rx >= 2)
|
|
||||||
backlight_turn_on();
|
|
||||||
|
|
||||||
if (g_scan_state_dir != SCAN_STATE_DIR_OFF)
|
if (g_scan_state_dir != SCAN_STATE_DIR_OFF)
|
||||||
{ // we're scanning
|
{ // we're scanning
|
||||||
|
|
||||||
@ -690,7 +695,7 @@ static void APP_next_freq(void)
|
|||||||
RADIO_setup_registers(true);
|
RADIO_setup_registers(true);
|
||||||
|
|
||||||
#ifdef ENABLE_FASTER_CHANNEL_SCAN
|
#ifdef ENABLE_FASTER_CHANNEL_SCAN
|
||||||
g_scan_pause_delay_in_10ms = 9; // 90ms
|
g_scan_pause_delay_in_10ms = 7; // 70ms
|
||||||
#else
|
#else
|
||||||
g_scan_pause_delay_in_10ms = scan_pause_delay_in_6_10ms;
|
g_scan_pause_delay_in_10ms = scan_pause_delay_in_6_10ms;
|
||||||
#endif
|
#endif
|
||||||
@ -701,7 +706,7 @@ static void APP_next_freq(void)
|
|||||||
BK4819_set_rf_frequency(frequency, true);
|
BK4819_set_rf_frequency(frequency, true);
|
||||||
|
|
||||||
#ifdef ENABLE_FASTER_CHANNEL_SCAN
|
#ifdef ENABLE_FASTER_CHANNEL_SCAN
|
||||||
g_scan_pause_delay_in_10ms = 8; // 80ms
|
g_scan_pause_delay_in_10ms = 10; // 100ms
|
||||||
#else
|
#else
|
||||||
g_scan_pause_delay_in_10ms = scan_pause_delay_in_6_10ms;
|
g_scan_pause_delay_in_10ms = scan_pause_delay_in_6_10ms;
|
||||||
#endif
|
#endif
|
||||||
@ -2401,15 +2406,15 @@ static void APP_process_key(const key_code_t Key, const bool key_pressed, const
|
|||||||
|
|
||||||
if (Key == KEY_EXIT && !backlight_was_on && g_eeprom.backlight > 0)
|
if (Key == KEY_EXIT && !backlight_was_on && g_eeprom.backlight > 0)
|
||||||
{ // just turn the light on for now so the user can see what's what
|
{ // just turn the light on for now so the user can see what's what
|
||||||
backlight_turn_on();
|
backlight_turn_on(0);
|
||||||
g_beep_to_play = BEEP_NONE;
|
g_beep_to_play = BEEP_NONE;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
// turn the backlight on
|
// turn the backlight on
|
||||||
if (key_pressed)
|
if (key_pressed)
|
||||||
if (Key != KEY_PTT || g_setting_backlight_on_tx_rx == 1 || g_setting_backlight_on_tx_rx == 3)
|
if (Key != KEY_PTT)
|
||||||
backlight_turn_on();
|
backlight_turn_on(0);
|
||||||
|
|
||||||
if (g_current_function == FUNCTION_POWER_SAVE)
|
if (g_current_function == FUNCTION_POWER_SAVE)
|
||||||
FUNCTION_Select(FUNCTION_FOREGROUND);
|
FUNCTION_Select(FUNCTION_FOREGROUND);
|
||||||
|
@ -22,39 +22,48 @@
|
|||||||
// this is decremented once every 500ms
|
// this is decremented once every 500ms
|
||||||
uint16_t g_backlight_count_down = 0;
|
uint16_t g_backlight_count_down = 0;
|
||||||
|
|
||||||
void backlight_turn_on(void)
|
void backlight_turn_on(const uint16_t min_ticks)
|
||||||
{
|
{
|
||||||
if (g_eeprom.backlight == 0)
|
if (min_ticks > 0)
|
||||||
return;
|
|
||||||
|
|
||||||
// turn the backlight ON
|
|
||||||
GPIO_SetBit(&GPIOB->DATA, GPIOB_PIN_BACKLIGHT);
|
|
||||||
|
|
||||||
switch (g_eeprom.backlight)
|
|
||||||
{
|
{
|
||||||
default:
|
if (g_backlight_count_down < min_ticks)
|
||||||
case 1: // 5 sec
|
g_backlight_count_down = min_ticks;
|
||||||
g_backlight_count_down = 5;
|
|
||||||
break;
|
|
||||||
case 2: // 10 sec
|
|
||||||
g_backlight_count_down = 10;
|
|
||||||
break;
|
|
||||||
case 3: // 20 sec
|
|
||||||
g_backlight_count_down = 20;
|
|
||||||
break;
|
|
||||||
case 4: // 1 min
|
|
||||||
g_backlight_count_down = 60;
|
|
||||||
break;
|
|
||||||
case 5: // 2 min
|
|
||||||
g_backlight_count_down = 60 * 2;
|
|
||||||
break;
|
|
||||||
case 6: // 4 min
|
|
||||||
g_backlight_count_down = 60 * 4;
|
|
||||||
break;
|
|
||||||
case 7: // always on
|
|
||||||
g_backlight_count_down = 0;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
g_backlight_count_down *= 2;
|
// turn the backlight ON
|
||||||
|
GPIO_SetBit(&GPIOB->DATA, GPIOB_PIN_BACKLIGHT);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if (g_eeprom.backlight > 0)
|
||||||
|
{
|
||||||
|
// turn the backlight ON
|
||||||
|
GPIO_SetBit(&GPIOB->DATA, GPIOB_PIN_BACKLIGHT);
|
||||||
|
|
||||||
|
switch (g_eeprom.backlight)
|
||||||
|
{
|
||||||
|
default:
|
||||||
|
case 1: // 5 sec
|
||||||
|
g_backlight_count_down = 5;
|
||||||
|
break;
|
||||||
|
case 2: // 10 sec
|
||||||
|
g_backlight_count_down = 10;
|
||||||
|
break;
|
||||||
|
case 3: // 20 sec
|
||||||
|
g_backlight_count_down = 20;
|
||||||
|
break;
|
||||||
|
case 4: // 1 min
|
||||||
|
g_backlight_count_down = 60;
|
||||||
|
break;
|
||||||
|
case 5: // 2 min
|
||||||
|
g_backlight_count_down = 60 * 2;
|
||||||
|
break;
|
||||||
|
case 6: // 4 min
|
||||||
|
g_backlight_count_down = 60 * 4;
|
||||||
|
break;
|
||||||
|
case 7: // always on
|
||||||
|
g_backlight_count_down = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
g_backlight_count_down *= 2;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
|
|
||||||
extern uint16_t g_backlight_count_down;
|
extern uint16_t g_backlight_count_down;
|
||||||
|
|
||||||
void backlight_turn_on(void);
|
void backlight_turn_on(const uint16_t min_ticks);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -787,7 +787,9 @@ void BK4819_SetupSquelch(
|
|||||||
#else
|
#else
|
||||||
// faster (but twitchier)
|
// faster (but twitchier)
|
||||||
(1u << 14) | // 1 ???
|
(1u << 14) | // 1 ???
|
||||||
(2u << 11) | // *5 squelch = open delay .. 0 ~ 7
|
// (2u << 11) | // *5 squelch = open delay .. 0 ~ 7
|
||||||
|
// (1u << 9) | // *3 squelch = close delay .. 0 ~ 3
|
||||||
|
(1u << 11) | // *5 squelch = open delay .. 0 ~ 7
|
||||||
(1u << 9) | // *3 squelch = close delay .. 0 ~ 3
|
(1u << 9) | // *3 squelch = close delay .. 0 ~ 3
|
||||||
squelch_open_glitch_thresh); // 0 ~ 255
|
squelch_open_glitch_thresh); // 0 ~ 255
|
||||||
#endif
|
#endif
|
||||||
|
BIN
firmware.bin
BIN
firmware.bin
Binary file not shown.
Binary file not shown.
@ -256,7 +256,7 @@ void FUNCTION_Select(function_type_t Function)
|
|||||||
BK4819_DisableScramble();
|
BK4819_DisableScramble();
|
||||||
|
|
||||||
if (g_setting_backlight_on_tx_rx == 1 || g_setting_backlight_on_tx_rx == 3)
|
if (g_setting_backlight_on_tx_rx == 1 || g_setting_backlight_on_tx_rx == 3)
|
||||||
backlight_turn_on();
|
backlight_turn_on(backlight_tx_rx_time_500ms);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -125,7 +125,7 @@ void BATTERY_GetReadings(const bool bDisplayBatteryLevel)
|
|||||||
{
|
{
|
||||||
g_update_status = true;
|
g_update_status = true;
|
||||||
g_update_display = true;
|
g_update_display = true;
|
||||||
backlight_turn_on();
|
backlight_turn_on(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_charging_with_type_c = true;
|
g_charging_with_type_c = true;
|
||||||
|
4
main.c
4
main.c
@ -127,7 +127,7 @@ void Main(void)
|
|||||||
KEYBOARD_Poll() != KEY_INVALID ||
|
KEYBOARD_Poll() != KEY_INVALID ||
|
||||||
BootMode != BOOT_MODE_NORMAL)
|
BootMode != BOOT_MODE_NORMAL)
|
||||||
{
|
{
|
||||||
backlight_turn_on();
|
backlight_turn_on(0);
|
||||||
UI_DisplayReleaseKeys();
|
UI_DisplayReleaseKeys();
|
||||||
i = 0;
|
i = 0;
|
||||||
while (i < (500 / 10)) // 500ms
|
while (i < (500 / 10)) // 500ms
|
||||||
@ -152,7 +152,7 @@ void Main(void)
|
|||||||
{
|
{
|
||||||
UI_DisplayWelcome();
|
UI_DisplayWelcome();
|
||||||
|
|
||||||
backlight_turn_on();
|
backlight_turn_on(0);
|
||||||
|
|
||||||
#ifdef ENABLE_VOICE
|
#ifdef ENABLE_VOICE
|
||||||
// AUDIO_SetVoiceID(0, VOICE_ID_WELCOME);
|
// AUDIO_SetVoiceID(0, VOICE_ID_WELCOME);
|
||||||
|
72
misc.c
72
misc.c
@ -25,57 +25,59 @@ const uint8_t obfuscate_array[16] = {
|
|||||||
|
|
||||||
// ***********************************************
|
// ***********************************************
|
||||||
|
|
||||||
const uint8_t fm_resume_countdown_500ms = 2500 / 500; // 2.5 seconds
|
const uint8_t fm_resume_countdown_500ms = 2500 / 500; // 2.5 seconds
|
||||||
const uint8_t fm_radio_countdown_500ms = 2000 / 500; // 2 seconds
|
const uint8_t fm_radio_countdown_500ms = 2000 / 500; // 2 seconds
|
||||||
const uint16_t fm_play_countdown_scan_10ms = 100 / 10; // 100ms
|
const uint16_t fm_play_countdown_scan_10ms = 100 / 10; // 100ms
|
||||||
const uint16_t fm_play_countdown_noscan_10ms = 1200 / 10; // 1.2 seconds
|
const uint16_t fm_play_countdown_noscan_10ms = 1200 / 10; // 1.2 seconds
|
||||||
const uint16_t fm_restore_countdown_10ms = 5000 / 10; // 5 seconds
|
const uint16_t fm_restore_countdown_10ms = 5000 / 10; // 5 seconds
|
||||||
|
|
||||||
const uint8_t menu_timeout_500ms = 30000 / 500; // 30 seconds
|
const uint8_t menu_timeout_500ms = 30000 / 500; // 30 seconds
|
||||||
const uint16_t menu_timeout_long_500ms = 120000 / 500; // 2 minutes
|
const uint16_t menu_timeout_long_500ms = 120000 / 500; // 2 minutes
|
||||||
|
|
||||||
const uint8_t dtmf_rx_live_timeout_500ms = 6000 / 500; // 6 seconds live decoder on screen
|
const uint16_t backlight_tx_rx_time_500ms = 10000 / 500; // 10 seconds
|
||||||
const uint8_t dtmf_rx_timeout_500ms = 10000 / 500; // 10 seconds till we wipe the DTMF receiver
|
|
||||||
const uint8_t dtmf_decode_ring_countdown_500ms = 15000 / 500; // 15 seconds .. time we sound the ringing for
|
|
||||||
const uint8_t dtmf_txstop_countdown_500ms = 3000 / 500; // 6 seconds
|
|
||||||
|
|
||||||
const uint8_t serial_config_count_down_500ms = 3000 / 500; // 3 seconds
|
const uint8_t dtmf_rx_live_timeout_500ms = 6000 / 500; // 6 seconds live decoder on screen
|
||||||
|
const uint8_t dtmf_rx_timeout_500ms = 10000 / 500; // 10 seconds till we wipe the DTMF receiver
|
||||||
|
const uint8_t dtmf_decode_ring_countdown_500ms = 15000 / 500; // 15 seconds .. time we sound the ringing for
|
||||||
|
const uint8_t dtmf_txstop_countdown_500ms = 3000 / 500; // 6 seconds
|
||||||
|
|
||||||
const uint8_t key_input_timeout_500ms = 6000 / 500; // 6 seconds
|
const uint8_t serial_config_count_down_500ms = 3000 / 500; // 3 seconds
|
||||||
const uint8_t key_lock_timeout_500ms = 30000 / 500; // 30 seconds
|
|
||||||
|
|
||||||
const uint8_t key_debounce_10ms = 30 / 10; // 30ms
|
const uint8_t key_input_timeout_500ms = 6000 / 500; // 6 seconds
|
||||||
const uint8_t key_long_press_10ms = 300 / 10; // 300ms
|
const uint8_t key_lock_timeout_500ms = 30000 / 500; // 30 seconds
|
||||||
const uint8_t key_repeat_10ms = 50 / 10; // 50ms
|
|
||||||
|
|
||||||
const uint16_t scan_freq_css_timeout_10ms = 10000 / 10; // 10 seconds
|
const uint8_t key_debounce_10ms = 30 / 10; // 30ms
|
||||||
const uint8_t scan_freq_css_delay_10ms = 210 / 10; // 210ms .. don't reduce this
|
const uint8_t key_long_press_10ms = 300 / 10; // 300ms
|
||||||
|
const uint8_t key_repeat_10ms = 50 / 10; // 50ms
|
||||||
|
|
||||||
const uint16_t dual_watch_count_after_tx_10ms = 3600 / 10; // 3.6 sec after TX ends
|
const uint16_t scan_freq_css_timeout_10ms = 10000 / 10; // 10 seconds
|
||||||
const uint16_t dual_watch_count_after_rx_10ms = 1000 / 10; // 1 sec after RX ends ?
|
const uint8_t scan_freq_css_delay_10ms = 210 / 10; // 210ms .. don't reduce this
|
||||||
const uint16_t dual_watch_count_after_1_10ms = 5000 / 10; // 5 sec
|
|
||||||
const uint16_t dual_watch_count_after_2_10ms = 3600 / 10; // 3.6 sec
|
const uint16_t dual_watch_count_after_tx_10ms = 3600 / 10; // 3.6 sec after TX ends
|
||||||
const uint16_t dual_watch_count_noaa_10ms = 70 / 10; // 70ms
|
const uint16_t dual_watch_count_after_rx_10ms = 1000 / 10; // 1 sec after RX ends ?
|
||||||
|
const uint16_t dual_watch_count_after_1_10ms = 5000 / 10; // 5 sec
|
||||||
|
const uint16_t dual_watch_count_after_2_10ms = 3600 / 10; // 3.6 sec
|
||||||
|
const uint16_t dual_watch_count_noaa_10ms = 70 / 10; // 70ms
|
||||||
#ifdef ENABLE_VOX
|
#ifdef ENABLE_VOX
|
||||||
const uint16_t dual_watch_count_after_vox_10ms = 200 / 10; // 200ms
|
const uint16_t dual_watch_count_after_vox_10ms = 200 / 10; // 200ms
|
||||||
#endif
|
#endif
|
||||||
const uint16_t dual_watch_count_toggle_10ms = 100 / 10; // 100ms between VFO toggles
|
const uint16_t dual_watch_count_toggle_10ms = 100 / 10; // 100ms between VFO toggles
|
||||||
|
|
||||||
const uint16_t scan_pause_delay_in_1_10ms = 5000 / 10; // 5 seconds
|
const uint16_t scan_pause_delay_in_1_10ms = 5000 / 10; // 5 seconds
|
||||||
const uint16_t scan_pause_delay_in_2_10ms = 500 / 10; // 500ms
|
const uint16_t scan_pause_delay_in_2_10ms = 500 / 10; // 500ms
|
||||||
const uint16_t scan_pause_delay_in_3_10ms = 200 / 10; // 200ms
|
const uint16_t scan_pause_delay_in_3_10ms = 200 / 10; // 200ms
|
||||||
const uint16_t scan_pause_delay_in_4_10ms = 300 / 10; // 300ms
|
const uint16_t scan_pause_delay_in_4_10ms = 300 / 10; // 300ms
|
||||||
const uint16_t scan_pause_delay_in_5_10ms = 1000 / 10; // 1 sec
|
const uint16_t scan_pause_delay_in_5_10ms = 1000 / 10; // 1 sec
|
||||||
const uint16_t scan_pause_delay_in_6_10ms = 100 / 10; // 100ms
|
const uint16_t scan_pause_delay_in_6_10ms = 100 / 10; // 100ms
|
||||||
const uint16_t scan_pause_delay_in_7_10ms = 3600 / 10; // 3.6 seconds
|
const uint16_t scan_pause_delay_in_7_10ms = 3600 / 10; // 3.6 seconds
|
||||||
|
|
||||||
const uint16_t battery_save_count_10ms = 10000 / 10; // 10 seconds
|
const uint16_t battery_save_count_10ms = 10000 / 10; // 10 seconds
|
||||||
|
|
||||||
const uint16_t power_save1_10ms = 100 / 10; // 100ms
|
const uint16_t power_save1_10ms = 100 / 10; // 100ms
|
||||||
const uint16_t power_save2_10ms = 200 / 10; // 200ms
|
const uint16_t power_save2_10ms = 200 / 10; // 200ms
|
||||||
|
|
||||||
#ifdef ENABLE_VOX
|
#ifdef ENABLE_VOX
|
||||||
const uint16_t vox_stop_count_down_10ms = 1000 / 10; // 1 second
|
const uint16_t vox_stop_count_down_10ms = 1000 / 10; // 1 second
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const uint16_t noaa_count_down_10ms = 5000 / 10; // 5 seconds
|
const uint16_t noaa_count_down_10ms = 5000 / 10; // 5 seconds
|
||||||
|
2
misc.h
2
misc.h
@ -119,6 +119,8 @@ extern const uint16_t fm_restore_countdown_10ms;
|
|||||||
extern const uint8_t menu_timeout_500ms;
|
extern const uint8_t menu_timeout_500ms;
|
||||||
extern const uint16_t menu_timeout_long_500ms;
|
extern const uint16_t menu_timeout_long_500ms;
|
||||||
|
|
||||||
|
extern const uint16_t backlight_tx_rx_time_500ms;
|
||||||
|
|
||||||
extern const uint8_t dtmf_rx_live_timeout_500ms;
|
extern const uint8_t dtmf_rx_live_timeout_500ms;
|
||||||
extern const uint8_t dtmf_rx_timeout_500ms;
|
extern const uint8_t dtmf_rx_timeout_500ms;
|
||||||
extern const uint8_t dtmf_decode_ring_countdown_500ms;
|
extern const uint8_t dtmf_decode_ring_countdown_500ms;
|
||||||
|
91
radio.c
91
radio.c
@ -434,20 +434,23 @@ void RADIO_ConfigureSquelchAndOutputPower(vfo_info_t *pInfo)
|
|||||||
Band = FREQUENCY_GetBand(pInfo->p_rx->frequency);
|
Band = FREQUENCY_GetBand(pInfo->p_rx->frequency);
|
||||||
uint16_t Base = (Band < BAND4_174MHz) ? 0x1E60 : 0x1E00;
|
uint16_t Base = (Band < BAND4_174MHz) ? 0x1E60 : 0x1E00;
|
||||||
|
|
||||||
|
// note that 'noise' and 'glitch' values are inverted compared to 'rssi' values
|
||||||
|
|
||||||
if (g_eeprom.squelch_level == 0)
|
if (g_eeprom.squelch_level == 0)
|
||||||
{ // squelch == 0 (off)
|
{ // squelch == 0 (off)
|
||||||
pInfo->squelch_open_rssi_thresh = 0; // 0 ~ 255
|
pInfo->squelch_open_rssi_thresh = 0; // 0 ~ 255
|
||||||
pInfo->squelch_open_noise_thresh = 127; // 127 ~ 0
|
|
||||||
pInfo->squelch_close_glitch_thresh = 255; // 255 ~ 0
|
|
||||||
|
|
||||||
pInfo->squelch_close_rssi_thresh = 0; // 0 ~ 255
|
pInfo->squelch_close_rssi_thresh = 0; // 0 ~ 255
|
||||||
|
|
||||||
|
pInfo->squelch_open_noise_thresh = 127; // 127 ~ 0
|
||||||
pInfo->squelch_close_noise_thresh = 127; // 127 ~ 0
|
pInfo->squelch_close_noise_thresh = 127; // 127 ~ 0
|
||||||
|
|
||||||
|
pInfo->squelch_close_glitch_thresh = 255; // 255 ~ 0
|
||||||
pInfo->squelch_open_glitch_thresh = 255; // 255 ~ 0
|
pInfo->squelch_open_glitch_thresh = 255; // 255 ~ 0
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ // squelch >= 1
|
{ // squelch >= 1
|
||||||
Base += g_eeprom.squelch_level; // my eeprom squelch-1
|
Base += g_eeprom.squelch_level; // my eeprom squelch-1
|
||||||
// VHF UHF
|
// VHF UHF
|
||||||
EEPROM_ReadBuffer(Base + 0x00, &pInfo->squelch_open_rssi_thresh, 1); // 50 10
|
EEPROM_ReadBuffer(Base + 0x00, &pInfo->squelch_open_rssi_thresh, 1); // 50 10
|
||||||
EEPROM_ReadBuffer(Base + 0x10, &pInfo->squelch_close_rssi_thresh, 1); // 40 5
|
EEPROM_ReadBuffer(Base + 0x10, &pInfo->squelch_close_rssi_thresh, 1); // 40 5
|
||||||
|
|
||||||
@ -457,56 +460,78 @@ void RADIO_ConfigureSquelchAndOutputPower(vfo_info_t *pInfo)
|
|||||||
EEPROM_ReadBuffer(Base + 0x40, &pInfo->squelch_close_glitch_thresh, 1); // 90 90
|
EEPROM_ReadBuffer(Base + 0x40, &pInfo->squelch_close_glitch_thresh, 1); // 90 90
|
||||||
EEPROM_ReadBuffer(Base + 0x50, &pInfo->squelch_open_glitch_thresh, 1); // 100 100
|
EEPROM_ReadBuffer(Base + 0x50, &pInfo->squelch_open_glitch_thresh, 1); // 100 100
|
||||||
|
|
||||||
uint16_t rssi_open = pInfo->squelch_open_rssi_thresh;
|
// *********
|
||||||
uint16_t rssi_close = pInfo->squelch_close_rssi_thresh;
|
|
||||||
uint16_t noise_open = pInfo->squelch_open_noise_thresh;
|
// used in AM mode
|
||||||
uint16_t noise_close = pInfo->squelch_close_noise_thresh;
|
int16_t rssi_open = pInfo->squelch_open_rssi_thresh; // 0 ~ 255
|
||||||
uint16_t glitch_open = pInfo->squelch_open_glitch_thresh;
|
int16_t rssi_close = pInfo->squelch_close_rssi_thresh; // 0 ~ 255
|
||||||
uint16_t glitch_close = pInfo->squelch_close_glitch_thresh;
|
|
||||||
|
// used in FM mode
|
||||||
|
int16_t noise_open = pInfo->squelch_open_noise_thresh; // 127 ~ 0
|
||||||
|
int16_t noise_close = pInfo->squelch_close_noise_thresh; // 127 ~ 0
|
||||||
|
|
||||||
|
// used in both modes ?
|
||||||
|
int16_t glitch_open = pInfo->squelch_open_glitch_thresh; // 255 ~ 0
|
||||||
|
int16_t glitch_close = pInfo->squelch_close_glitch_thresh; // 255 ~ 0
|
||||||
|
|
||||||
|
// *********
|
||||||
|
|
||||||
#if ENABLE_SQUELCH_MORE_SENSITIVE
|
#if ENABLE_SQUELCH_MORE_SENSITIVE
|
||||||
// make squelch a little more sensitive
|
// make squelch a little more sensitive
|
||||||
//
|
//
|
||||||
// getting the best setting here is still experimental, bare with me
|
// getting the best general settings here is experimental, bare with me
|
||||||
//
|
|
||||||
// note that 'noise' and 'glitch' values are inverted compared to 'rssi' values
|
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
rssi_open = (rssi_open * 8) / 9;
|
// rssi_open = (rssi_open * 8) / 9;
|
||||||
noise_open = (noise_open * 9) / 8;
|
noise_open = (noise_open * 9) / 8;
|
||||||
glitch_open = (glitch_open * 9) / 8;
|
glitch_open = (glitch_open * 9) / 8;
|
||||||
#else
|
#else
|
||||||
// even more sensitive .. use when RX bandwidths are fixed (no weak signal auto adjust)
|
// even more sensitive .. use when RX bandwidths are fixed (no weak signal auto adjust)
|
||||||
rssi_open = (rssi_open * 1) / 2;
|
// rssi_open = (rssi_open * 1) / 2;
|
||||||
noise_open = (noise_open * 2) / 1;
|
noise_open = (noise_open * 2) / 1;
|
||||||
glitch_open = (glitch_open * 2) / 1;
|
glitch_open = (glitch_open * 2) / 1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#else
|
#else
|
||||||
// more sensitive .. use when RX bandwidths are fixed (no weak signal auto adjust)
|
// more sensitive .. use when RX bandwidths are fixed (no weak signal auto adjust)
|
||||||
rssi_open = (rssi_open * 3) / 4;
|
// rssi_open = (rssi_open * 3) / 4;
|
||||||
noise_open = (noise_open * 4) / 3;
|
noise_open = (noise_open * 4) / 3;
|
||||||
glitch_open = (glitch_open * 4) / 3;
|
glitch_open = (glitch_open * 4) / 3;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
rssi_close = (rssi_open * 9) / 10;
|
// *********
|
||||||
noise_close = (noise_open * 10) / 9;
|
|
||||||
glitch_close = (glitch_open * 10) / 9;
|
|
||||||
|
|
||||||
// ensure the 'close' threshold is lower than the 'open' threshold
|
// ensure the 'close' threshold is lower than the 'open' threshold
|
||||||
if (rssi_close == rssi_open && rssi_close >= 2)
|
// ie, maintain a minimum level of hysteresis
|
||||||
rssi_close -= 2;
|
|
||||||
if (noise_close == noise_open && noise_close <= 125)
|
|
||||||
noise_close += 2;
|
|
||||||
if (glitch_close == glitch_open && glitch_close <= 253)
|
|
||||||
glitch_close += 2;
|
|
||||||
|
|
||||||
pInfo->squelch_open_rssi_thresh = (rssi_open > 255) ? 255 : rssi_open;
|
// rssi_close = (rssi_open * 4) / 6;
|
||||||
pInfo->squelch_close_rssi_thresh = (rssi_close > 255) ? 255 : rssi_close;
|
noise_close = (noise_open * 6) / 4;
|
||||||
pInfo->squelch_open_noise_thresh = (noise_open > 127) ? 127 : noise_open;
|
glitch_close = (glitch_open * 6) / 4;
|
||||||
pInfo->squelch_close_noise_thresh = (noise_close > 127) ? 127 : noise_close;
|
|
||||||
pInfo->squelch_open_glitch_thresh = (glitch_open > 255) ? 255 : glitch_open;
|
// if (rssi_open < 8)
|
||||||
pInfo->squelch_close_glitch_thresh = (glitch_close > 255) ? 255 : glitch_close;
|
// rssi_open = 8;
|
||||||
|
// if (rssi_close > (rssi_open - 8))
|
||||||
|
// rssi_close = rssi_open - 8;
|
||||||
|
|
||||||
|
if (noise_open > (127 - 4))
|
||||||
|
noise_open = 127 - 4;
|
||||||
|
if (noise_close < (noise_open + 4))
|
||||||
|
noise_close = noise_open + 4;
|
||||||
|
|
||||||
|
if (glitch_open > (255 - 8))
|
||||||
|
glitch_open = 255 - 8;
|
||||||
|
if (glitch_close < (glitch_open + 8))
|
||||||
|
glitch_close = glitch_open + 8;
|
||||||
|
|
||||||
|
// *********
|
||||||
|
|
||||||
|
pInfo->squelch_open_rssi_thresh = (rssi_open > 255) ? 255 : (rssi_open < 0) ? 0 : rssi_open;
|
||||||
|
pInfo->squelch_close_rssi_thresh = (rssi_close > 255) ? 255 : (rssi_close < 0) ? 0 : rssi_close;
|
||||||
|
|
||||||
|
pInfo->squelch_open_noise_thresh = (noise_open > 127) ? 127 : (noise_open < 0) ? 0 : noise_open;
|
||||||
|
pInfo->squelch_close_noise_thresh = (noise_close > 127) ? 127 : (noise_close < 0) ? 0 : noise_close;
|
||||||
|
|
||||||
|
pInfo->squelch_open_glitch_thresh = (glitch_open > 255) ? 255 : (glitch_open < 0) ? 0 : glitch_open;
|
||||||
|
pInfo->squelch_close_glitch_thresh = (glitch_close > 255) ? 255 : (glitch_close < 0) ? 0 : glitch_close;
|
||||||
}
|
}
|
||||||
|
|
||||||
// *******************************
|
// *******************************
|
||||||
|
@ -36,7 +36,7 @@ void UI_DisplayFM(void)
|
|||||||
|
|
||||||
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();
|
backlight_turn_on(0);
|
||||||
UI_PrintString("Long press #", 0, LCD_WIDTH, 1, 8);
|
UI_PrintString("Long press #", 0, LCD_WIDTH, 1, 8);
|
||||||
UI_PrintString("to unlock", 0, LCD_WIDTH, 3, 8);
|
UI_PrintString("to unlock", 0, LCD_WIDTH, 3, 8);
|
||||||
ST7565_BlitFullScreen();
|
ST7565_BlitFullScreen();
|
||||||
|
@ -399,7 +399,7 @@ void UI_DisplayMain(void)
|
|||||||
|
|
||||||
if (g_serial_config_count_down_500ms > 0)
|
if (g_serial_config_count_down_500ms > 0)
|
||||||
{
|
{
|
||||||
backlight_turn_on();
|
backlight_turn_on(10); // 5 seconds
|
||||||
UI_PrintString("UART", 0, LCD_WIDTH, 1, 8);
|
UI_PrintString("UART", 0, LCD_WIDTH, 1, 8);
|
||||||
UI_PrintString("CONFIG COMMS", 0, LCD_WIDTH, 3, 8);
|
UI_PrintString("CONFIG COMMS", 0, LCD_WIDTH, 3, 8);
|
||||||
ST7565_BlitFullScreen();
|
ST7565_BlitFullScreen();
|
||||||
@ -408,7 +408,7 @@ void UI_DisplayMain(void)
|
|||||||
|
|
||||||
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();
|
backlight_turn_on(10); // 5 seconds
|
||||||
UI_PrintString("Long press #", 0, LCD_WIDTH, 1, 8);
|
UI_PrintString("Long press #", 0, LCD_WIDTH, 1, 8);
|
||||||
UI_PrintString("to unlock", 0, LCD_WIDTH, 3, 8);
|
UI_PrintString("to unlock", 0, LCD_WIDTH, 3, 8);
|
||||||
ST7565_BlitFullScreen();
|
ST7565_BlitFullScreen();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user