0
mirror of https://github.com/OneOfEleven/uv-k5-firmware-custom.git synced 2025-04-28 14:21:25 +03:00

Chan/Freq scan stays where you stop it - IF it's paused there

This commit is contained in:
OneOfEleven 2023-10-17 14:49:17 +01:00
parent ef313ceb57
commit 0908ff9bc0
7 changed files with 63 additions and 46 deletions

View File

@ -222,6 +222,8 @@ void ACTION_Scan(bool bRestart)
// start scanning
APP_channel_next(true, SCAN_STATE_DIR_FORWARD);
g_scan_pause_10ms = 0; // go NOW
#ifdef ENABLE_VOICE
AUDIO_SetVoiceID(0, VOICE_ID_SCANNING_BEGIN);

View File

@ -139,6 +139,7 @@ static void APP_check_for_incoming_rx(void)
}
g_rx_reception_mode = RX_MODE_DETECTED;
g_scan_pause_mode = true; // 1of11
done:
if (g_current_function != FUNCTION_INCOMING)
@ -486,8 +487,8 @@ void APP_start_listening(function_type_t Function, const bool reset_am_fix)
break;
}
g_scan_restore_channel = 0xff;
g_scan_restore_frequency = 0;
// g_scan_restore_channel = 0xff;
// g_scan_restore_frequency = 0;
// g_scan_keep_frequency = true;
}
@ -603,15 +604,27 @@ void APP_stop_scan(void)
if (g_scan_state_dir == SCAN_STATE_DIR_OFF)
return; // but, but, we weren't doing anything !
// yes we were ;)
// yes we were
g_scan_state_dir = SCAN_STATE_DIR_OFF;
if (g_scan_restore_channel != 0xff || (g_scan_restore_frequency > 0 && g_scan_restore_frequency != 0xffffffff))
{ // revert to where we were before starting the scan
// 1of11
if (g_scan_pause_mode ||
g_current_function == FUNCTION_RECEIVE ||
g_current_function == FUNCTION_MONITOR ||
g_current_function == FUNCTION_INCOMING)
{ // stay where we are
g_scan_pause_mode = false;
g_scan_restore_frequency = 0xffffffff;
g_scan_restore_channel = 0xff;
}
if (g_scan_restore_channel != 0xff ||
(g_scan_restore_frequency > 0 && g_scan_restore_frequency != 0xffffffff))
{ // revert to where we were when starting the scan
if (g_scan_next_channel <= USER_CHANNEL_LAST)
{ // we were channel scanning
{ // we were channel hopping
if (g_scan_restore_channel != 0xff)
{
@ -624,7 +637,8 @@ void APP_stop_scan(void)
}
else
if (g_scan_restore_frequency > 0 && g_scan_restore_frequency != 0xffffffff)
{
{ // we were frequency scanning
g_rx_vfo->freq_config_rx.frequency = g_scan_restore_frequency;
RADIO_ApplyOffset(g_rx_vfo);
@ -747,7 +761,7 @@ static void APP_next_channel(void)
default:
case SCAN_NEXT_CHAN_USER:
g_scan_current_scan_list = SCAN_NEXT_CHAN_USER;
g_scan_next_channel = prevChannel;
g_scan_next_channel = prevChannel;
chan = 0xff;
break;
}
@ -770,7 +784,7 @@ static void APP_next_channel(void)
if (g_scan_next_channel != prev_chan)
{
g_eeprom.user_channel[g_eeprom.rx_vfo] = g_scan_next_channel;
g_eeprom.user_channel[g_eeprom.rx_vfo] = g_scan_next_channel;
g_eeprom.screen_channel[g_eeprom.rx_vfo] = g_scan_next_channel;
RADIO_configure_channel(g_eeprom.rx_vfo, VFO_CONFIGURE_RELOAD);
@ -1103,7 +1117,7 @@ void APP_process(void)
g_current_function == FUNCTION_INCOMING) && // TODO: check me
g_screen_to_display != DISPLAY_SEARCH &&
g_scan_state_dir != SCAN_STATE_DIR_OFF &&
g_scan_pause_10ms == 0 &&
g_scan_pause_10ms == 0 &&
!g_ptt_is_pressed)
{ // RF scanning
@ -2344,13 +2358,19 @@ void APP_channel_next(const bool flag, const scan_state_dir_t scan_direction)
if (g_scan_next_channel <= USER_CHANNEL_LAST)
{ // channel mode
if (flag)
g_scan_restore_channel = g_scan_next_channel;
{
g_scan_restore_frequency = 0xffffffff;
g_scan_restore_channel = g_scan_next_channel;
}
APP_next_channel();
}
else
{ // frequency mode
if (flag)
{
g_scan_restore_channel = 0xff;
g_scan_restore_frequency = g_rx_vfo->freq_config_rx.frequency;
}
APP_next_freq();
}

View File

@ -919,7 +919,8 @@ static void MAIN_Key_UP_DOWN(bool key_pressed, bool key_held, scan_state_dir_t D
// jump to the next channel
APP_channel_next(false, Direction);
g_scan_pause_10ms = 0;
g_scan_pause_10ms = 0; // go NOW
g_ptt_was_released = true;
}

Binary file not shown.

Binary file not shown.

View File

@ -234,7 +234,7 @@ void UI_drawBars(uint8_t *p, const unsigned int level)
#endif
#ifdef ENABLE_RSSI_BAR
void UI_DisplayRSSIBar(const int16_t rssi, const bool now)
bool UI_DisplayRSSIBar(const int16_t rssi, const bool now)
{
if (g_setting_rssi_bar)
{
@ -263,12 +263,12 @@ void UI_drawBars(uint8_t *p, const unsigned int level)
char s[16];
if (g_eeprom.key_lock && g_keypad_locked > 0)
return; // display is in use
return false; // display is in use
if (g_current_function == FUNCTION_TRANSMIT ||
g_screen_to_display != DISPLAY_MAIN ||
g_dtmf_call_state != DTMF_CALL_STATE_NONE)
return; // display is in use
return false; // display is in use
if (now)
memset(p_line, 0, LCD_WIDTH);
@ -290,31 +290,25 @@ void UI_drawBars(uint8_t *p, const unsigned int level)
if (now)
ST7565_BlitFullScreen();
return true;
}
return false;
}
#endif
void UI_update_rssi(const int16_t rssi, const int vfo)
{
#ifdef ENABLE_RSSI_BAR
(void)vfo; // unused
// optional larger RSSI dBm, S-point and bar level
if (center_line != CENTER_LINE_RSSI)
return;
if (g_current_function == FUNCTION_RECEIVE ||
g_current_function == FUNCTION_MONITOR ||
g_current_function == FUNCTION_INCOMING)
if (center_line == CENTER_LINE_RSSI)
{ // optional larger RSSI dBm, S-point and bar level
if (g_current_function == FUNCTION_RECEIVE || g_current_function == FUNCTION_MONITOR)
{
UI_DisplayRSSIBar(rssi, true);
}
}
#else
// original little RS bars
{ // original little RS bars
// const int16_t dBm = (rssi / 2) - 160;
const uint8_t Line = (vfo == 0) ? 3 : 7;
@ -392,7 +386,7 @@ void UI_update_rssi(const int16_t rssi, const int vfo)
UI_drawBars(p_line, rssi_level);
ST7565_DrawLine(0, Line, 23, p_line);
#endif
}
}
// ***************************************************************************
@ -874,7 +868,7 @@ void UI_DisplayMain(void)
#ifdef ENABLE_RSSI_BAR
// show the RX RSSI dBm, S-point and signal strength bar graph
if (rx)
if (rx && g_setting_rssi_bar)
{
center_line = CENTER_LINE_RSSI;
UI_DisplayRSSIBar(g_current_rssi[g_eeprom.rx_vfo], false);

View File

@ -66,7 +66,7 @@ const t_menu_item g_menu_list[] =
{"CH NAM", VOICE_ID_INVALID, MENU_MEM_NAME },
{"CH DEL", VOICE_ID_DELETE_CHANNEL, MENU_DEL_CH }, // was "DEL-CH"
{"CH DIS", VOICE_ID_INVALID, MENU_MDF }, // was "MDF"
{"BATSAV", VOICE_ID_SAVE_MODE, MENU_SAVE }, // was "SAVE"
{"BatSAV", VOICE_ID_SAVE_MODE, MENU_SAVE }, // was "SAVE"
#ifdef ENABLE_VOX
{"VOX", VOICE_ID_VOX, MENU_VOX },
#endif
@ -78,12 +78,12 @@ const t_menu_item g_menu_list[] =
{"VOICE", VOICE_ID_VOICE_PROMPT, MENU_VOICE },
#endif
{"SC REV", VOICE_ID_INVALID, MENU_SC_REV }, // was "SC_REV"
{"KEYLOC", VOICE_ID_INVALID, MENU_AUTOLK }, // was "AUTOLk"
{"KeyLOC", VOICE_ID_INVALID, MENU_AUTOLK }, // was "AUTOLk"
{"S ADD1", VOICE_ID_INVALID, MENU_S_ADD1 },
{"S ADD2", VOICE_ID_INVALID, MENU_S_ADD2 },
{"STE", VOICE_ID_INVALID, MENU_STE },
{"RP STE", VOICE_ID_INVALID, MENU_RP_STE },
{"MIC", VOICE_ID_INVALID, MENU_MIC },
{"MIC GN", VOICE_ID_INVALID, MENU_MIC },
{"COMPND", VOICE_ID_INVALID, MENU_COMPAND },
#ifdef ENABLE_AUDIO_BAR
{"Tx BAR", VOICE_ID_INVALID, MENU_MIC_BAR },
@ -99,8 +99,8 @@ const t_menu_item g_menu_list[] =
{"SOS AL", VOICE_ID_INVALID, MENU_AL_MOD }, // was "ALMODE"
#endif
{"ANI ID", VOICE_ID_ANI_CODE, MENU_ANI_ID },
{"UPCODE", VOICE_ID_INVALID, MENU_UPCODE },
{"DWCODE", VOICE_ID_INVALID, MENU_DWCODE },
{"UpCODE", VOICE_ID_INVALID, MENU_UPCODE },
{"DnCODE", VOICE_ID_INVALID, MENU_DWCODE }, // was "DWCODE"
{"PTT ID", VOICE_ID_INVALID, MENU_PTT_ID },
{"D ST", VOICE_ID_INVALID, MENU_D_ST },
{"D RSP", VOICE_ID_INVALID, MENU_D_RSP },
@ -109,10 +109,10 @@ const t_menu_item g_menu_list[] =
{"D DCD", VOICE_ID_INVALID, MENU_D_DCD },
{"D LIST", VOICE_ID_INVALID, MENU_D_LIST },
{"D LIVE", VOICE_ID_INVALID, MENU_D_LIVE_DEC }, // live DTMF decoder
{"PONMSG", VOICE_ID_INVALID, MENU_PONMSG },
{"PonMSG", VOICE_ID_INVALID, MENU_PONMSG },
{"ROGER", VOICE_ID_INVALID, MENU_ROGER },
{"BATVOL", VOICE_ID_INVALID, MENU_VOL }, // was "VOL"
{"BATTXT", VOICE_ID_INVALID, MENU_BAT_TXT },
{"BatVOL", VOICE_ID_INVALID, MENU_VOL }, // was "VOL"
{"BatTXT", VOICE_ID_INVALID, MENU_BAT_TXT },
{"MODE", VOICE_ID_INVALID, MENU_AM }, // was "AM"
#ifdef ENABLE_AM_FIX
{"AM FIX", VOICE_ID_INVALID, MENU_AM_FIX },
@ -123,10 +123,10 @@ const t_menu_item g_menu_list[] =
#ifdef ENABLE_NOAA
{"NOAA-S", VOICE_ID_INVALID, MENU_NOAA_S },
#endif
{"SIDE1S", VOICE_ID_INVALID, MENU_SIDE1_SHORT },
{"SIDE1L", VOICE_ID_INVALID, MENU_SIDE1_LONG },
{"SIDE2S", VOICE_ID_INVALID, MENU_SIDE2_SHORT },
{"SIDE2L", VOICE_ID_INVALID, MENU_SIDE2_LONG },
{"Side1S", VOICE_ID_INVALID, MENU_SIDE1_SHORT },
{"Side1L", VOICE_ID_INVALID, MENU_SIDE1_LONG },
{"Side2S", VOICE_ID_INVALID, MENU_SIDE2_SHORT },
{"Side2L", VOICE_ID_INVALID, MENU_SIDE2_LONG },
{"VER", VOICE_ID_INVALID, MENU_VERSION },
{"RESET", VOICE_ID_INITIALISATION, MENU_RESET }, // might be better to move this to the hidden menu items ?
@ -141,9 +141,9 @@ const t_menu_item g_menu_list[] =
{"SCR EN", VOICE_ID_INVALID, MENU_SCREN }, // was "SCREN"
{"Tx EN", VOICE_ID_INVALID, MENU_TX_EN }, // enable TX
#ifdef ENABLE_F_CAL_MENU
{"F CALI", VOICE_ID_INVALID, MENU_F_CALI }, // reference xtal calibration
{"F CAL", VOICE_ID_INVALID, MENU_F_CALI }, // reference xtal calibration
#endif
{"BATCAL", VOICE_ID_INVALID, MENU_BATCAL }, // battery voltage calibration
{"BatCAL", VOICE_ID_INVALID, MENU_BATCAL }, // battery voltage calibration
};
// number of hidden menu items at the end of the list - KEEP THIS UP-TO-DATE