0
mirror of https://github.com/OneOfEleven/uv-k5-firmware-custom.git synced 2025-04-28 22:31:25 +03:00
This commit is contained in:
OneOfEleven 2023-11-07 08:48:32 +00:00
parent 4d88e8bad0
commit c64744e1c5
10 changed files with 78 additions and 52 deletions

View File

@ -124,7 +124,7 @@ void ACTION_Monitor(void)
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER); GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
if (g_scan_state_dir != SCAN_STATE_DIR_OFF) if (g_scan_state_dir != SCAN_STATE_DIR_OFF)
g_scan_pause_tick_10ms = g_eeprom.config.setting.scan_hold_time * 50; g_scan_tick_10ms = g_eeprom.config.setting.scan_hold_time * 50;
#ifdef g_power_save_expired #ifdef g_power_save_expired
if (g_eeprom.config.setting.dual_watch == DUAL_WATCH_OFF && g_noaa_mode) if (g_eeprom.config.setting.dual_watch == DUAL_WATCH_OFF && g_noaa_mode)
@ -230,7 +230,7 @@ void ACTION_Scan(bool bRestart)
// jump to the next channel // jump to the next channel
APP_channel_next(true, g_scan_state_dir); APP_channel_next(true, g_scan_state_dir);
g_scan_pause_tick_10ms = 0; g_scan_tick_10ms = 0;
g_scan_pause_time_mode = false; g_scan_pause_time_mode = false;
g_update_status = true; g_update_status = true;
@ -261,7 +261,7 @@ void ACTION_Scan(bool bRestart)
APP_channel_next(true, SCAN_STATE_DIR_FORWARD); APP_channel_next(true, SCAN_STATE_DIR_FORWARD);
g_scan_pause_tick_10ms = 0; // go NOW g_scan_tick_10ms = 0; // go NOW
g_scan_pause_time_mode = false; g_scan_pause_time_mode = false;
#ifdef ENABLE_VOICE #ifdef ENABLE_VOICE
@ -292,7 +292,7 @@ void ACTION_Scan(bool bRestart)
// jump to the next channel // jump to the next channel
APP_channel_next(true, g_scan_state_dir); APP_channel_next(true, g_scan_state_dir);
g_scan_pause_tick_10ms = 0; g_scan_tick_10ms = 0;
g_scan_pause_time_mode = false; g_scan_pause_time_mode = false;
g_update_status = true; g_update_status = true;

View File

@ -115,7 +115,7 @@ static void APP_check_for_new_receive(void)
if (g_css_scan_mode != CSS_SCAN_MODE_OFF && g_rx_reception_mode == RX_MODE_NONE) if (g_css_scan_mode != CSS_SCAN_MODE_OFF && g_rx_reception_mode == RX_MODE_NONE)
{ // CTCSS/DTS scanning { // CTCSS/DTS scanning
g_scan_pause_tick_10ms = scan_pause_code_10ms; g_scan_tick_10ms = scan_pause_code_10ms;
g_scan_pause_time_mode = false; g_scan_pause_time_mode = false;
g_rx_reception_mode = RX_MODE_DETECTED; g_rx_reception_mode = RX_MODE_DETECTED;
} }
@ -149,7 +149,7 @@ static void APP_check_for_new_receive(void)
if (g_rx_reception_mode != RX_MODE_NONE) if (g_rx_reception_mode != RX_MODE_NONE)
goto done; goto done;
g_scan_pause_tick_10ms = scan_pause_chan_10ms; g_scan_tick_10ms = scan_pause_chan_10ms;
g_scan_pause_time_mode = false; g_scan_pause_time_mode = false;
} }
@ -274,7 +274,7 @@ static void APP_process_rx(void)
case SCAN_RESUME_TIME: // stay only for a limited time case SCAN_RESUME_TIME: // stay only for a limited time
break; break;
case SCAN_RESUME_CARRIER: // stay untill the carrier goes away case SCAN_RESUME_CARRIER: // stay untill the carrier goes away
g_scan_pause_tick_10ms = g_eeprom.config.setting.scan_hold_time * 50; g_scan_tick_10ms = g_eeprom.config.setting.scan_hold_time * 50;
g_scan_pause_time_mode = false; g_scan_pause_time_mode = false;
break; break;
case SCAN_RESUME_STOP: // stop scan once we find any signal case SCAN_RESUME_STOP: // stop scan once we find any signal
@ -438,7 +438,7 @@ Skip:
case SCAN_RESUME_TIME: // stay only for a limited time case SCAN_RESUME_TIME: // stay only for a limited time
break; break;
case SCAN_RESUME_CARRIER: // stay untill the carrier goes away case SCAN_RESUME_CARRIER: // stay untill the carrier goes away
g_scan_pause_tick_10ms = g_eeprom.config.setting.scan_hold_time * 50; g_scan_tick_10ms = g_eeprom.config.setting.scan_hold_time * 50;
g_scan_pause_time_mode = false; g_scan_pause_time_mode = false;
break; break;
case SCAN_RESUME_STOP: // stop scan once we find any signal case SCAN_RESUME_STOP: // stop scan once we find any signal
@ -484,18 +484,18 @@ bool APP_start_listening(void)
case SCAN_RESUME_TIME: case SCAN_RESUME_TIME:
if (!g_scan_pause_time_mode) if (!g_scan_pause_time_mode)
{ {
g_scan_pause_tick_10ms = g_eeprom.config.setting.scan_hold_time * 50; g_scan_tick_10ms = g_eeprom.config.setting.scan_hold_time * 50;
g_scan_pause_time_mode = true; g_scan_pause_time_mode = true;
} }
break; break;
case SCAN_RESUME_CARRIER: case SCAN_RESUME_CARRIER:
g_scan_pause_tick_10ms = g_eeprom.config.setting.scan_hold_time * 50; g_scan_tick_10ms = g_eeprom.config.setting.scan_hold_time * 50;
g_scan_pause_time_mode = false; g_scan_pause_time_mode = false;
break; break;
case SCAN_RESUME_STOP: case SCAN_RESUME_STOP:
g_scan_pause_tick_10ms = 0; g_scan_tick_10ms = 0;
g_scan_pause_time_mode = false; g_scan_pause_time_mode = false;
break; break;
} }
@ -579,7 +579,7 @@ void APP_stop_scan(void)
g_scan_state_dir = SCAN_STATE_DIR_OFF; g_scan_state_dir = SCAN_STATE_DIR_OFF;
if (g_scan_pause_time_mode || if (g_scan_pause_time_mode ||
g_scan_pause_tick_10ms > (200 / 10) || g_scan_tick_10ms > (200 / 10) ||
g_monitor_enabled || g_monitor_enabled ||
g_current_function == FUNCTION_RECEIVE || g_current_function == FUNCTION_RECEIVE ||
g_current_function == FUNCTION_NEW_RECEIVE) g_current_function == FUNCTION_NEW_RECEIVE)
@ -639,7 +639,7 @@ void APP_stop_scan(void)
g_another_voice_id = VOICE_ID_SCANNING_STOP; g_another_voice_id = VOICE_ID_SCANNING_STOP;
#endif #endif
g_scan_pause_tick_10ms = 0; g_scan_tick_10ms = 0;
g_scan_pause_time_mode = false; g_scan_pause_time_mode = false;
g_update_status = true; g_update_status = true;
@ -696,9 +696,9 @@ 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_tick_10ms = 10; // 100ms g_scan_tick_10ms = 10; // 100ms
#else #else
g_scan_pause_tick_10ms = scan_pause_freq_10ms; g_scan_tick_10ms = scan_pause_freq_10ms;
#endif #endif
#else #else
@ -711,10 +711,10 @@ static void APP_next_freq(void)
RADIO_ConfigureSquelchAndOutputPower(g_tx_vfo); RADIO_ConfigureSquelchAndOutputPower(g_tx_vfo);
#ifdef ENABLE_FASTER_CHANNEL_SCAN #ifdef ENABLE_FASTER_CHANNEL_SCAN
//g_scan_pause_tick_10ms = 10; // 100ms //g_scan_tick_10ms = 10; // 100ms
g_scan_pause_tick_10ms = 6; // 60ms g_scan_tick_10ms = 6; // 60ms
#else #else
g_scan_pause_tick_10ms = scan_pause_freq_10ms; g_scan_tick_10ms = scan_pause_freq_10ms;
#endif #endif
#endif #endif
@ -821,9 +821,9 @@ static void APP_next_channel(void)
} }
#ifdef ENABLE_FASTER_CHANNEL_SCAN #ifdef ENABLE_FASTER_CHANNEL_SCAN
g_scan_pause_tick_10ms = 9; // 90ms .. <= ~60ms it misses signals (squelch response and/or PLL lock time) ? g_scan_tick_10ms = 9; // 90ms .. <= ~60ms it misses signals (squelch response and/or PLL lock time) ?
#else #else
g_scan_pause_tick_10ms = scan_pause_chan_10ms; g_scan_tick_10ms = scan_pause_chan_10ms;
#endif #endif
g_scan_pause_time_mode = false; g_scan_pause_time_mode = false;
@ -1109,6 +1109,8 @@ void APP_end_tx(void)
RADIO_tx_eot(); RADIO_tx_eot();
ST7565_Init(false);
if (g_current_vfo->p_tx->code_type != CODE_TYPE_NONE) if (g_current_vfo->p_tx->code_type != CODE_TYPE_NONE)
{ // CTCSS/CDCSS is enabled { // CTCSS/CDCSS is enabled
@ -1527,7 +1529,7 @@ void APP_channel_next(const bool remember_current, const scan_state_dir_t scan_d
return; return;
} }
g_scan_pause_tick_10ms = scan_pause_css_10ms; g_scan_tick_10ms = scan_pause_css_10ms;
g_scan_pause_time_mode = false; g_scan_pause_time_mode = false;
g_rx_reception_mode = RX_MODE_NONE; g_rx_reception_mode = RX_MODE_NONE;
} }
@ -1602,7 +1604,7 @@ void APP_process_scan(void)
APP_start_listening(); APP_start_listening();
} }
else else
if (g_scan_pause_tick_10ms == 0) if (g_scan_tick_10ms == 0)
{ // switch to next channel { // switch to next channel
g_scan_pause_time_mode = false; g_scan_pause_time_mode = false;
g_rx_reception_mode = RX_MODE_NONE; g_rx_reception_mode = RX_MODE_NONE;
@ -1647,7 +1649,7 @@ void APP_process_scan(void)
} }
if (g_css_scan_mode == CSS_SCAN_MODE_SCANNING && g_scan_pause_tick_10ms == 0) if (g_css_scan_mode == CSS_SCAN_MODE_SCANNING && g_scan_tick_10ms == 0)
MENU_SelectNextCode(); MENU_SelectNextCode();
#ifdef ENABLE_NOAA #ifdef ENABLE_NOAA

View File

@ -50,10 +50,18 @@ bool g_manual_scanning;
bool scanning_paused(void) bool scanning_paused(void)
{ {
if ((g_scan_state_dir != SCAN_STATE_DIR_OFF || g_eeprom.config.setting.dual_watch != DUAL_WATCH_OFF) && if (g_scan_state_dir != SCAN_STATE_DIR_OFF &&
g_scan_pause_tick_10ms > 0 && g_scan_pause_tick_10ms <= (200 / 10)) g_scan_tick_10ms > 0 &&
{ // scanning isn't paused g_scan_tick_10ms <= (400 / 10)) // 400ms
return false; {
return false; // busy RF scanning
}
if (g_eeprom.config.setting.dual_watch != DUAL_WATCH_OFF &&
g_dual_watch_tick_10ms > 0 &&
g_dual_watch_tick_10ms <= (400 / 10)) // 400ms
{
return false; // busy dual watch scanning
} }
return true; return true;
@ -107,6 +115,7 @@ void toggle_chan_scanlist(void)
} }
#ifdef ENABLE_COPY_CHAN_TO_VFO_TO_CHAN #ifdef ENABLE_COPY_CHAN_TO_VFO_TO_CHAN
void MAIN_copy_mem_vfo_mem(void) void MAIN_copy_mem_vfo_mem(void)
{ {
//const unsigned int vfo = get_RX_VFO(); //const unsigned int vfo = get_RX_VFO();
@ -192,6 +201,7 @@ void toggle_chan_scanlist(void)
g_beep_to_play = BEEP_880HZ_60MS_TRIPLE_BEEP; g_beep_to_play = BEEP_880HZ_60MS_TRIPLE_BEEP;
} }
} }
#endif #endif
void processFKeyFunction(const key_code_t Key) void processFKeyFunction(const key_code_t Key)
@ -858,7 +868,7 @@ void MAIN_Key_STAR(bool key_pressed, bool key_held)
FI_add_freq_ignored(g_rx_vfo->freq_config_rx.frequency); FI_add_freq_ignored(g_rx_vfo->freq_config_rx.frequency);
// immediately continue the scan // immediately continue the scan
g_scan_pause_tick_10ms = 0; g_scan_tick_10ms = 0;
g_scan_pause_time_mode = false; g_scan_pause_time_mode = false;
g_squelch_open = false; g_squelch_open = false;
g_rx_reception_mode = RX_MODE_NONE; g_rx_reception_mode = RX_MODE_NONE;
@ -1129,7 +1139,7 @@ void MAIN_Key_UP_DOWN(bool key_pressed, bool key_held, scan_state_dir_t directio
APP_channel_next(false, direction); APP_channel_next(false, direction);
// go NOW // go NOW
g_scan_pause_tick_10ms = 0; g_scan_tick_10ms = 0;
g_scan_pause_time_mode = false; g_scan_pause_time_mode = false;
g_squelch_open = false; g_squelch_open = false;
g_rx_reception_mode = RX_MODE_NONE; g_rx_reception_mode = RX_MODE_NONE;

View File

@ -75,7 +75,7 @@ void MENU_start_css_scan(int8_t Direction)
MENU_SelectNextCode(); MENU_SelectNextCode();
g_scan_pause_tick_10ms = scan_pause_css_10ms; g_scan_tick_10ms = scan_pause_css_10ms;
} }
void MENU_stop_css_scan(void) void MENU_stop_css_scan(void)
@ -923,7 +923,7 @@ void MENU_SelectNextCode(void)
RADIO_setup_registers(true); RADIO_setup_registers(true);
g_scan_pause_tick_10ms = (g_selected_code_type == CODE_TYPE_CONTINUOUS_TONE) ? scan_pause_ctcss_10ms : scan_pause_cdcss_10ms; g_scan_tick_10ms = (g_selected_code_type == CODE_TYPE_CONTINUOUS_TONE) ? scan_pause_ctcss_10ms : scan_pause_cdcss_10ms;
g_update_display = true; g_update_display = true;
} }

Binary file not shown.

Binary file not shown.

2
misc.c
View File

@ -185,7 +185,7 @@ scan_next_chan_t g_scan_current_scan_list;
uint8_t g_scan_restore_channel; uint8_t g_scan_restore_channel;
uint32_t g_scan_restore_frequency; uint32_t g_scan_restore_frequency;
bool g_scan_pause_time_mode; // set if we stopped in SCAN_RESUME_TIME mode bool g_scan_pause_time_mode; // set if we stopped in SCAN_RESUME_TIME mode
volatile uint16_t g_scan_pause_tick_10ms; volatile uint16_t g_scan_tick_10ms;
scan_state_dir_t g_scan_state_dir; scan_state_dir_t g_scan_state_dir;
uint8_t g_rx_vfo_num; uint8_t g_rx_vfo_num;

2
misc.h
View File

@ -279,7 +279,7 @@ extern scan_next_chan_t g_scan_current_scan_list; //
extern uint8_t g_scan_restore_channel; // the channel we were on before starting the RF scan extern uint8_t g_scan_restore_channel; // the channel we were on before starting the RF scan
extern uint32_t g_scan_restore_frequency; // the frequency we were on before starting the RF scan extern uint32_t g_scan_restore_frequency; // the frequency we were on before starting the RF scan
extern bool g_scan_pause_time_mode; // set if we stopped in SCAN_RESUME_TIME mode extern bool g_scan_pause_time_mode; // set if we stopped in SCAN_RESUME_TIME mode
extern volatile uint16_t g_scan_pause_tick_10ms; // ticks till we move to next channel/frequency extern volatile uint16_t g_scan_tick_10ms; // ticks till we move to next channel/frequency
extern scan_state_dir_t g_scan_state_dir; // the direction we're scanning in extern scan_state_dir_t g_scan_state_dir; // the direction we're scanning in
extern uint8_t g_rx_vfo_num; extern uint8_t g_rx_vfo_num;

View File

@ -101,7 +101,7 @@ void SystickHandler(void)
if (g_scan_state_dir != SCAN_STATE_DIR_OFF || g_css_scan_mode == CSS_SCAN_MODE_SCANNING) if (g_scan_state_dir != SCAN_STATE_DIR_OFF || g_css_scan_mode == CSS_SCAN_MODE_SCANNING)
if (!g_monitor_enabled && g_current_function != FUNCTION_TRANSMIT) if (!g_monitor_enabled && g_current_function != FUNCTION_TRANSMIT)
DECREMENT(g_scan_pause_tick_10ms); DECREMENT(g_scan_tick_10ms);
DECREMENT_AND_TRIGGER(g_tail_tone_elimination_tick_10ms, g_flag_tail_tone_elimination_complete); DECREMENT_AND_TRIGGER(g_tail_tone_elimination_tick_10ms, g_flag_tail_tone_elimination_complete);

View File

@ -65,7 +65,7 @@ void draw_small_antenna_bars(uint8_t *p, unsigned int level)
for (i = 1; i <= level; i++) for (i = 1; i <= level; i++)
{ {
const char bar = (0xff << (6 - i)) & 0x7F; const uint8_t bar = (0xff << (6 - i)) & 0x7F;
memset(p + 2 + (i * 3), bar, 2); memset(p + 2 + (i * 3), bar, 2);
} }
} }
@ -400,10 +400,10 @@ void UI_DisplayMain(void)
#endif #endif
const unsigned int line0 = 0; // text screen line const unsigned int line0 = 0; // text screen line
const unsigned int line1 = 4; const unsigned int line1 = 4;
char str[22];
int vfo_num;
int single_vfo = -1; int single_vfo = -1;
int channel = g_eeprom.config.setting.tx_vfo_num; int channel = g_eeprom.config.setting.tx_vfo_num;
char str[22];
int vfo_num;
g_center_line = CENTER_LINE_NONE; g_center_line = CENTER_LINE_NONE;
@ -784,6 +784,19 @@ void UI_DisplayMain(void)
} }
#else #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)
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 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 = g_vfo_info[vfo_num].freq_in_channel;
// const uint8_t freq_in_channel = SETTINGS_find_channel(frequency); // currently way to slow // const uint8_t freq_in_channel = SETTINGS_find_channel(frequency); // currently way to slow
@ -802,6 +815,7 @@ void UI_DisplayMain(void)
str[2] = 'C'; // compander is enabled str[2] = 'C'; // compander is enabled
UI_PrintStringSmall(str, LCD_WIDTH - (7 * 3), 0, line + 1); UI_PrintStringSmall(str, LCD_WIDTH - (7 * 3), 0, line + 1);
#endif
} }
#endif #endif
} }