diff --git a/app/action.c b/app/action.c index d06ac50..0498f42 100644 --- a/app/action.c +++ b/app/action.c @@ -124,7 +124,7 @@ void ACTION_Monitor(void) GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER); 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 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 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_update_status = true; @@ -261,7 +261,7 @@ void ACTION_Scan(bool bRestart) 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; #ifdef ENABLE_VOICE @@ -292,7 +292,7 @@ void ACTION_Scan(bool bRestart) // jump to the next channel 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_update_status = true; diff --git a/app/app.c b/app/app.c index c4e8510..a0d04c0 100644 --- a/app/app.c +++ b/app/app.c @@ -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) { // 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_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) 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; } @@ -274,7 +274,7 @@ static void APP_process_rx(void) case SCAN_RESUME_TIME: // stay only for a limited time break; 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; break; 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 break; 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; break; case SCAN_RESUME_STOP: // stop scan once we find any signal @@ -484,18 +484,18 @@ bool APP_start_listening(void) case SCAN_RESUME_TIME: 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; } break; 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; break; case SCAN_RESUME_STOP: - g_scan_pause_tick_10ms = 0; + g_scan_tick_10ms = 0; g_scan_pause_time_mode = false; break; } @@ -579,7 +579,7 @@ void APP_stop_scan(void) g_scan_state_dir = SCAN_STATE_DIR_OFF; if (g_scan_pause_time_mode || - g_scan_pause_tick_10ms > (200 / 10) || + g_scan_tick_10ms > (200 / 10) || g_monitor_enabled || g_current_function == FUNCTION_RECEIVE || g_current_function == FUNCTION_NEW_RECEIVE) @@ -639,7 +639,7 @@ void APP_stop_scan(void) g_another_voice_id = VOICE_ID_SCANNING_STOP; #endif - g_scan_pause_tick_10ms = 0; + g_scan_tick_10ms = 0; g_scan_pause_time_mode = false; g_update_status = true; @@ -696,9 +696,9 @@ static void APP_next_freq(void) RADIO_setup_registers(true); #ifdef ENABLE_FASTER_CHANNEL_SCAN - g_scan_pause_tick_10ms = 10; // 100ms + g_scan_tick_10ms = 10; // 100ms #else - g_scan_pause_tick_10ms = scan_pause_freq_10ms; + g_scan_tick_10ms = scan_pause_freq_10ms; #endif #else @@ -711,10 +711,10 @@ static void APP_next_freq(void) RADIO_ConfigureSquelchAndOutputPower(g_tx_vfo); #ifdef ENABLE_FASTER_CHANNEL_SCAN - //g_scan_pause_tick_10ms = 10; // 100ms - g_scan_pause_tick_10ms = 6; // 60ms + //g_scan_tick_10ms = 10; // 100ms + g_scan_tick_10ms = 6; // 60ms #else - g_scan_pause_tick_10ms = scan_pause_freq_10ms; + g_scan_tick_10ms = scan_pause_freq_10ms; #endif #endif @@ -821,9 +821,9 @@ static void APP_next_channel(void) } #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 - g_scan_pause_tick_10ms = scan_pause_chan_10ms; + g_scan_tick_10ms = scan_pause_chan_10ms; #endif g_scan_pause_time_mode = false; @@ -1109,6 +1109,8 @@ void APP_end_tx(void) RADIO_tx_eot(); + ST7565_Init(false); + if (g_current_vfo->p_tx->code_type != CODE_TYPE_NONE) { // CTCSS/CDCSS is enabled @@ -1527,7 +1529,7 @@ void APP_channel_next(const bool remember_current, const scan_state_dir_t scan_d 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_rx_reception_mode = RX_MODE_NONE; } @@ -1602,7 +1604,7 @@ void APP_process_scan(void) APP_start_listening(); } else - if (g_scan_pause_tick_10ms == 0) + if (g_scan_tick_10ms == 0) { // switch to next channel g_scan_pause_time_mode = false; 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(); #ifdef ENABLE_NOAA diff --git a/app/main.c b/app/main.c index f8b073d..bc0b8ab 100644 --- a/app/main.c +++ b/app/main.c @@ -50,10 +50,18 @@ bool g_manual_scanning; bool scanning_paused(void) { - if ((g_scan_state_dir != SCAN_STATE_DIR_OFF || g_eeprom.config.setting.dual_watch != DUAL_WATCH_OFF) && - g_scan_pause_tick_10ms > 0 && g_scan_pause_tick_10ms <= (200 / 10)) - { // scanning isn't paused - return false; + if (g_scan_state_dir != SCAN_STATE_DIR_OFF && + g_scan_tick_10ms > 0 && + g_scan_tick_10ms <= (400 / 10)) // 400ms + { + 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; @@ -107,6 +115,7 @@ void toggle_chan_scanlist(void) } #ifdef ENABLE_COPY_CHAN_TO_VFO_TO_CHAN + void MAIN_copy_mem_vfo_mem(void) { //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; } } + #endif 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); // immediately continue the scan - g_scan_pause_tick_10ms = 0; + g_scan_tick_10ms = 0; g_scan_pause_time_mode = false; g_squelch_open = false; 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); // go NOW - g_scan_pause_tick_10ms = 0; + g_scan_tick_10ms = 0; g_scan_pause_time_mode = false; g_squelch_open = false; g_rx_reception_mode = RX_MODE_NONE; diff --git a/app/menu.c b/app/menu.c index f0e05c3..3eb9d29 100644 --- a/app/menu.c +++ b/app/menu.c @@ -75,7 +75,7 @@ void MENU_start_css_scan(int8_t Direction) 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) @@ -923,7 +923,7 @@ void MENU_SelectNextCode(void) 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; } diff --git a/firmware.bin b/firmware.bin index a295d4c..314a5e5 100644 Binary files a/firmware.bin and b/firmware.bin differ diff --git a/firmware.packed.bin b/firmware.packed.bin index 8a6ee85..908c8ea 100644 Binary files a/firmware.packed.bin and b/firmware.packed.bin differ diff --git a/misc.c b/misc.c index f24d733..a31a186 100644 --- a/misc.c +++ b/misc.c @@ -185,7 +185,7 @@ scan_next_chan_t g_scan_current_scan_list; uint8_t g_scan_restore_channel; uint32_t g_scan_restore_frequency; 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; uint8_t g_rx_vfo_num; diff --git a/misc.h b/misc.h index 309305b..54558dc 100644 --- a/misc.h +++ b/misc.h @@ -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 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 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 uint8_t g_rx_vfo_num; diff --git a/scheduler.c b/scheduler.c index b119627..a5fb3ed 100644 --- a/scheduler.c +++ b/scheduler.c @@ -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_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); diff --git a/ui/main.c b/ui/main.c index 5ff1aec..357142c 100644 --- a/ui/main.c +++ b/ui/main.c @@ -65,7 +65,7 @@ void draw_small_antenna_bars(uint8_t *p, unsigned int level) 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); } } @@ -400,10 +400,10 @@ void UI_DisplayMain(void) #endif const unsigned int line0 = 0; // text screen line const unsigned int line1 = 4; - char str[22]; - int vfo_num; int single_vfo = -1; int channel = g_eeprom.config.setting.tx_vfo_num; + char str[22]; + int vfo_num; g_center_line = CENTER_LINE_NONE; @@ -784,24 +784,38 @@ void UI_DisplayMain(void) } #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); // currently way to slow + #ifdef ENABLE_SHOW_FREQS_CHAN + strcpy(str, " "); - strcpy(str, " "); + #ifdef ENABLE_SCAN_IGNORE_LIST + if (FI_freq_ignored(frequency) >= 0) + str[0] = 'I'; // frequency is in the ignore list + #endif - #ifdef ENABLE_SCAN_IGNORE_LIST - if (FI_freq_ignored(frequency) >= 0) - str[0] = 'I'; // frequency is in the ignore list + 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 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 + + 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) + str[2] = 'C'; // compander is enabled + + UI_PrintStringSmall(str, LCD_WIDTH - (7 * 3), 0, line + 1); #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) - str[2] = 'C'; // compander is enabled - - UI_PrintStringSmall(str, LCD_WIDTH - (7 * 3), 0, line + 1); } #endif }