0
mirror of https://github.com/OneOfEleven/uv-k5-firmware-custom.git synced 2025-04-29 06:41: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

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

View File

@ -139,6 +139,7 @@ static void APP_check_for_incoming_rx(void)
} }
g_rx_reception_mode = RX_MODE_DETECTED; g_rx_reception_mode = RX_MODE_DETECTED;
g_scan_pause_mode = true; // 1of11
done: done:
if (g_current_function != FUNCTION_INCOMING) if (g_current_function != FUNCTION_INCOMING)
@ -486,8 +487,8 @@ void APP_start_listening(function_type_t Function, const bool reset_am_fix)
break; break;
} }
g_scan_restore_channel = 0xff; // g_scan_restore_channel = 0xff;
g_scan_restore_frequency = 0; // g_scan_restore_frequency = 0;
// g_scan_keep_frequency = true; // g_scan_keep_frequency = true;
} }
@ -603,15 +604,27 @@ void APP_stop_scan(void)
if (g_scan_state_dir == SCAN_STATE_DIR_OFF) if (g_scan_state_dir == SCAN_STATE_DIR_OFF)
return; // but, but, we weren't doing anything ! return; // but, but, we weren't doing anything !
// yes we were ;) // yes we were
g_scan_state_dir = SCAN_STATE_DIR_OFF; g_scan_state_dir = SCAN_STATE_DIR_OFF;
if (g_scan_restore_channel != 0xff || (g_scan_restore_frequency > 0 && g_scan_restore_frequency != 0xffffffff)) // 1of11
{ // revert to where we were before starting the scan 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) if (g_scan_next_channel <= USER_CHANNEL_LAST)
{ // we were channel scanning { // we were channel hopping
if (g_scan_restore_channel != 0xff) if (g_scan_restore_channel != 0xff)
{ {
@ -624,7 +637,8 @@ void APP_stop_scan(void)
} }
else else
if (g_scan_restore_frequency > 0 && g_scan_restore_frequency != 0xffffffff) 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; g_rx_vfo->freq_config_rx.frequency = g_scan_restore_frequency;
RADIO_ApplyOffset(g_rx_vfo); RADIO_ApplyOffset(g_rx_vfo);
@ -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) if (g_scan_next_channel <= USER_CHANNEL_LAST)
{ // channel mode { // channel mode
if (flag) if (flag)
{
g_scan_restore_frequency = 0xffffffff;
g_scan_restore_channel = g_scan_next_channel; g_scan_restore_channel = g_scan_next_channel;
}
APP_next_channel(); APP_next_channel();
} }
else else
{ // frequency mode { // frequency mode
if (flag) if (flag)
{
g_scan_restore_channel = 0xff;
g_scan_restore_frequency = g_rx_vfo->freq_config_rx.frequency; g_scan_restore_frequency = g_rx_vfo->freq_config_rx.frequency;
}
APP_next_freq(); 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 // jump to the next channel
APP_channel_next(false, Direction); APP_channel_next(false, Direction);
g_scan_pause_10ms = 0;
g_scan_pause_10ms = 0; // go NOW
g_ptt_was_released = true; 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 #endif
#ifdef ENABLE_RSSI_BAR #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) if (g_setting_rssi_bar)
{ {
@ -263,12 +263,12 @@ void UI_drawBars(uint8_t *p, const unsigned int level)
char s[16]; char s[16];
if (g_eeprom.key_lock && g_keypad_locked > 0) 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 || if (g_current_function == FUNCTION_TRANSMIT ||
g_screen_to_display != DISPLAY_MAIN || g_screen_to_display != DISPLAY_MAIN ||
g_dtmf_call_state != DTMF_CALL_STATE_NONE) g_dtmf_call_state != DTMF_CALL_STATE_NONE)
return; // display is in use return false; // display is in use
if (now) if (now)
memset(p_line, 0, LCD_WIDTH); memset(p_line, 0, LCD_WIDTH);
@ -290,31 +290,25 @@ void UI_drawBars(uint8_t *p, const unsigned int level)
if (now) if (now)
ST7565_BlitFullScreen(); ST7565_BlitFullScreen();
return true;
} }
return false;
} }
#endif #endif
void UI_update_rssi(const int16_t rssi, const int vfo) void UI_update_rssi(const int16_t rssi, const int vfo)
{ {
#ifdef ENABLE_RSSI_BAR if (center_line == CENTER_LINE_RSSI)
{ // optional larger RSSI dBm, S-point and bar level
(void)vfo; // unused if (g_current_function == FUNCTION_RECEIVE || g_current_function == FUNCTION_MONITOR)
// 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)
{ {
UI_DisplayRSSIBar(rssi, true); UI_DisplayRSSIBar(rssi, true);
} }
}
#else { // original little RS bars
// original little RS bars
// const int16_t dBm = (rssi / 2) - 160; // const int16_t dBm = (rssi / 2) - 160;
const uint8_t Line = (vfo == 0) ? 3 : 7; 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); UI_drawBars(p_line, rssi_level);
ST7565_DrawLine(0, Line, 23, p_line); ST7565_DrawLine(0, Line, 23, p_line);
#endif }
} }
// *************************************************************************** // ***************************************************************************
@ -874,7 +868,7 @@ void UI_DisplayMain(void)
#ifdef ENABLE_RSSI_BAR #ifdef ENABLE_RSSI_BAR
// show the RX RSSI dBm, S-point and signal strength bar graph // 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; center_line = CENTER_LINE_RSSI;
UI_DisplayRSSIBar(g_current_rssi[g_eeprom.rx_vfo], false); 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 NAM", VOICE_ID_INVALID, MENU_MEM_NAME },
{"CH DEL", VOICE_ID_DELETE_CHANNEL, MENU_DEL_CH }, // was "DEL-CH" {"CH DEL", VOICE_ID_DELETE_CHANNEL, MENU_DEL_CH }, // was "DEL-CH"
{"CH DIS", VOICE_ID_INVALID, MENU_MDF }, // was "MDF" {"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 #ifdef ENABLE_VOX
{"VOX", VOICE_ID_VOX, MENU_VOX }, {"VOX", VOICE_ID_VOX, MENU_VOX },
#endif #endif
@ -78,12 +78,12 @@ const t_menu_item g_menu_list[] =
{"VOICE", VOICE_ID_VOICE_PROMPT, MENU_VOICE }, {"VOICE", VOICE_ID_VOICE_PROMPT, MENU_VOICE },
#endif #endif
{"SC REV", VOICE_ID_INVALID, MENU_SC_REV }, // was "SC_REV" {"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 ADD1", VOICE_ID_INVALID, MENU_S_ADD1 },
{"S ADD2", VOICE_ID_INVALID, MENU_S_ADD2 }, {"S ADD2", VOICE_ID_INVALID, MENU_S_ADD2 },
{"STE", VOICE_ID_INVALID, MENU_STE }, {"STE", VOICE_ID_INVALID, MENU_STE },
{"RP STE", VOICE_ID_INVALID, MENU_RP_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 }, {"COMPND", VOICE_ID_INVALID, MENU_COMPAND },
#ifdef ENABLE_AUDIO_BAR #ifdef ENABLE_AUDIO_BAR
{"Tx BAR", VOICE_ID_INVALID, MENU_MIC_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" {"SOS AL", VOICE_ID_INVALID, MENU_AL_MOD }, // was "ALMODE"
#endif #endif
{"ANI ID", VOICE_ID_ANI_CODE, MENU_ANI_ID }, {"ANI ID", VOICE_ID_ANI_CODE, MENU_ANI_ID },
{"UPCODE", VOICE_ID_INVALID, MENU_UPCODE }, {"UpCODE", VOICE_ID_INVALID, MENU_UPCODE },
{"DWCODE", VOICE_ID_INVALID, MENU_DWCODE }, {"DnCODE", VOICE_ID_INVALID, MENU_DWCODE }, // was "DWCODE"
{"PTT ID", VOICE_ID_INVALID, MENU_PTT_ID }, {"PTT ID", VOICE_ID_INVALID, MENU_PTT_ID },
{"D ST", VOICE_ID_INVALID, MENU_D_ST }, {"D ST", VOICE_ID_INVALID, MENU_D_ST },
{"D RSP", VOICE_ID_INVALID, MENU_D_RSP }, {"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 DCD", VOICE_ID_INVALID, MENU_D_DCD },
{"D LIST", VOICE_ID_INVALID, MENU_D_LIST }, {"D LIST", VOICE_ID_INVALID, MENU_D_LIST },
{"D LIVE", VOICE_ID_INVALID, MENU_D_LIVE_DEC }, // live DTMF decoder {"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 }, {"ROGER", VOICE_ID_INVALID, MENU_ROGER },
{"BATVOL", VOICE_ID_INVALID, MENU_VOL }, // was "VOL" {"BatVOL", VOICE_ID_INVALID, MENU_VOL }, // was "VOL"
{"BATTXT", VOICE_ID_INVALID, MENU_BAT_TXT }, {"BatTXT", VOICE_ID_INVALID, MENU_BAT_TXT },
{"MODE", VOICE_ID_INVALID, MENU_AM }, // was "AM" {"MODE", VOICE_ID_INVALID, MENU_AM }, // was "AM"
#ifdef ENABLE_AM_FIX #ifdef ENABLE_AM_FIX
{"AM FIX", VOICE_ID_INVALID, MENU_AM_FIX }, {"AM FIX", VOICE_ID_INVALID, MENU_AM_FIX },
@ -123,10 +123,10 @@ const t_menu_item g_menu_list[] =
#ifdef ENABLE_NOAA #ifdef ENABLE_NOAA
{"NOAA-S", VOICE_ID_INVALID, MENU_NOAA_S }, {"NOAA-S", VOICE_ID_INVALID, MENU_NOAA_S },
#endif #endif
{"SIDE1S", VOICE_ID_INVALID, MENU_SIDE1_SHORT }, {"Side1S", VOICE_ID_INVALID, MENU_SIDE1_SHORT },
{"SIDE1L", VOICE_ID_INVALID, MENU_SIDE1_LONG }, {"Side1L", VOICE_ID_INVALID, MENU_SIDE1_LONG },
{"SIDE2S", VOICE_ID_INVALID, MENU_SIDE2_SHORT }, {"Side2S", VOICE_ID_INVALID, MENU_SIDE2_SHORT },
{"SIDE2L", VOICE_ID_INVALID, MENU_SIDE2_LONG }, {"Side2L", VOICE_ID_INVALID, MENU_SIDE2_LONG },
{"VER", VOICE_ID_INVALID, MENU_VERSION }, {"VER", VOICE_ID_INVALID, MENU_VERSION },
{"RESET", VOICE_ID_INITIALISATION, MENU_RESET }, // might be better to move this to the hidden menu items ? {"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" {"SCR EN", VOICE_ID_INVALID, MENU_SCREN }, // was "SCREN"
{"Tx EN", VOICE_ID_INVALID, MENU_TX_EN }, // enable TX {"Tx EN", VOICE_ID_INVALID, MENU_TX_EN }, // enable TX
#ifdef ENABLE_F_CAL_MENU #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 #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 // number of hidden menu items at the end of the list - KEEP THIS UP-TO-DATE