Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f11d0fbcda | ||
|
|
96144af9e9 | ||
|
|
4dd2445833 | ||
|
|
6172d942be | ||
|
|
0c0cbb232c | ||
|
|
298ff29cf4 | ||
|
|
f70707e17f | ||
|
|
f1fc04591c | ||
|
|
a26c397417 | ||
|
|
d3a2a7bee9 |
2
Makefile
2
Makefile
@@ -209,7 +209,7 @@ endif
|
||||
#CFLAGS += -Wpadded
|
||||
|
||||
# catch any and all warnings
|
||||
#CFLAGS += -Wextra
|
||||
CFLAGS += -Wextra
|
||||
|
||||
CFLAGS += -DPRINTF_INCLUDE_CONFIG_H
|
||||
CFLAGS += -DGIT_HASH=\"$(GIT_HASH)\"
|
||||
|
||||
51
app/action.c
51
app/action.c
@@ -193,7 +193,7 @@ void ACTION_Scan(bool bRestart)
|
||||
gEeprom.SCAN_LIST_DEFAULT = (gEeprom.SCAN_LIST_DEFAULT + 1) % 3;
|
||||
|
||||
// jump to the next channel
|
||||
CHANNEL_Next(true, gScanStateDir);
|
||||
SCANNER_NextChannel(false, gScanStateDir);
|
||||
gScanPauseDelayIn_10ms = 1;
|
||||
gScheduleScanListen = false;
|
||||
|
||||
@@ -212,7 +212,7 @@ void ACTION_Scan(bool bRestart)
|
||||
else
|
||||
{ // start scanning
|
||||
|
||||
CHANNEL_Next(true, SCAN_FWD);
|
||||
SCANNER_NextChannel(true, SCAN_FWD);
|
||||
|
||||
#ifdef ENABLE_VOICE
|
||||
AUDIO_SetVoiceID(0, VOICE_ID_SCANNING_BEGIN);
|
||||
@@ -235,7 +235,7 @@ void ACTION_Scan(bool bRestart)
|
||||
gEeprom.SCAN_LIST_DEFAULT = (gEeprom.SCAN_LIST_DEFAULT + 1) % 3;
|
||||
|
||||
// jump to the next channel
|
||||
CHANNEL_Next(true, gScanStateDir);
|
||||
SCANNER_NextChannel(false, gScanStateDir);
|
||||
gScanPauseDelayIn_10ms = 1;
|
||||
gScheduleScanListen = false;
|
||||
|
||||
@@ -326,18 +326,15 @@ void ACTION_Scan(bool bRestart)
|
||||
|
||||
void ACTION_Handle(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
{
|
||||
uint8_t Short = ACTION_OPT_NONE;
|
||||
uint8_t Long = ACTION_OPT_NONE;
|
||||
|
||||
if (gScreenToDisplay == DISPLAY_MAIN && gDTMF_InputMode)
|
||||
if (gScreenToDisplay == DISPLAY_MAIN && gDTMF_InputMode) // entering DTMF code
|
||||
{
|
||||
if (Key == KEY_SIDE1 && !bKeyHeld && bKeyPressed)
|
||||
if (Key == KEY_SIDE1 && !bKeyHeld && bKeyPressed) // side1 btn pressed
|
||||
{
|
||||
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
||||
|
||||
if (gDTMF_InputBox_Index > 0)
|
||||
if (gDTMF_InputBox_Index > 0) // DTMF codes are in the input box
|
||||
{
|
||||
gDTMF_InputBox[--gDTMF_InputBox_Index] = '-';
|
||||
gDTMF_InputBox[--gDTMF_InputBox_Index] = '-'; // delete one code
|
||||
if (gDTMF_InputBox_Index > 0)
|
||||
{
|
||||
gPttWasReleased = true;
|
||||
@@ -351,43 +348,47 @@ void ACTION_Handle(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
#endif
|
||||
|
||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||
gDTMF_InputMode = false;
|
||||
gDTMF_InputMode = false; // turn off DTMF input box if no codes left
|
||||
}
|
||||
|
||||
gPttWasReleased = true;
|
||||
return;
|
||||
}
|
||||
|
||||
uint8_t funcShort = ACTION_OPT_NONE;
|
||||
uint8_t funcLong = ACTION_OPT_NONE;
|
||||
if (Key == KEY_SIDE1)
|
||||
{
|
||||
Short = gEeprom.KEY_1_SHORT_PRESS_ACTION;
|
||||
Long = gEeprom.KEY_1_LONG_PRESS_ACTION;
|
||||
funcShort = gEeprom.KEY_1_SHORT_PRESS_ACTION;
|
||||
funcLong = gEeprom.KEY_1_LONG_PRESS_ACTION;
|
||||
}
|
||||
else
|
||||
if (Key == KEY_SIDE2)
|
||||
else if (Key == KEY_SIDE2)
|
||||
{
|
||||
Short = gEeprom.KEY_2_SHORT_PRESS_ACTION;
|
||||
Long = gEeprom.KEY_2_LONG_PRESS_ACTION;
|
||||
funcShort = gEeprom.KEY_2_SHORT_PRESS_ACTION;
|
||||
funcLong = gEeprom.KEY_2_LONG_PRESS_ACTION;
|
||||
}
|
||||
|
||||
if (!bKeyHeld && bKeyPressed)
|
||||
if (!bKeyHeld && bKeyPressed) // button pushed
|
||||
{
|
||||
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
||||
return;
|
||||
}
|
||||
|
||||
if (bKeyHeld || bKeyPressed)
|
||||
// held or released beyond this point
|
||||
|
||||
|
||||
|
||||
if (bKeyHeld || bKeyPressed) // held
|
||||
{
|
||||
if (!bKeyHeld)
|
||||
return;
|
||||
funcShort = funcLong;
|
||||
|
||||
Short = Long;
|
||||
|
||||
if (!bKeyPressed)
|
||||
if (!bKeyPressed) //ignore release if held
|
||||
return;
|
||||
}
|
||||
|
||||
switch (Short)
|
||||
// held or released after short press beyond this point
|
||||
|
||||
switch (funcShort)
|
||||
{
|
||||
default:
|
||||
case ACTION_OPT_NONE:
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//static void ACTION_FlashLight(void)
|
||||
void ACTION_Power(void);
|
||||
void ACTION_Monitor(void);
|
||||
void ACTION_Scan(bool bFlag);
|
||||
void ACTION_Scan(bool bRestart);
|
||||
#ifdef ENABLE_VOX
|
||||
void ACTION_Vox(void);
|
||||
#endif
|
||||
|
||||
371
app/app.c
371
app/app.c
@@ -621,127 +621,6 @@ uint32_t APP_SetFrequencyByStep(VFO_Info_t *pInfo, int8_t Step)
|
||||
return Frequency;
|
||||
}
|
||||
|
||||
static void FREQ_NextChannel(void)
|
||||
{
|
||||
gRxVfo->freq_config_RX.Frequency = APP_SetFrequencyByStep(gRxVfo, gScanStateDir);
|
||||
|
||||
RADIO_ApplyOffset(gRxVfo);
|
||||
RADIO_ConfigureSquelchAndOutputPower(gRxVfo);
|
||||
RADIO_SetupRegisters(true);
|
||||
|
||||
#ifdef ENABLE_FASTER_CHANNEL_SCAN
|
||||
gScanPauseDelayIn_10ms = 9; // 90ms
|
||||
#else
|
||||
gScanPauseDelayIn_10ms = scan_pause_delay_in_6_10ms;
|
||||
#endif
|
||||
|
||||
bScanKeepFrequency = false;
|
||||
gUpdateDisplay = true;
|
||||
}
|
||||
|
||||
static void MR_NextChannel(void)
|
||||
{
|
||||
static unsigned int prev_mr_chan = 0;
|
||||
const bool enabled = (gEeprom.SCAN_LIST_DEFAULT < 2) ? gEeprom.SCAN_LIST_ENABLED[gEeprom.SCAN_LIST_DEFAULT] : true;
|
||||
const int chan1 = (gEeprom.SCAN_LIST_DEFAULT < 2) ? gEeprom.SCANLIST_PRIORITY_CH1[gEeprom.SCAN_LIST_DEFAULT] : -1;
|
||||
const int chan2 = (gEeprom.SCAN_LIST_DEFAULT < 2) ? gEeprom.SCANLIST_PRIORITY_CH2[gEeprom.SCAN_LIST_DEFAULT] : -1;
|
||||
const unsigned int prev_chan = gNextMrChannel;
|
||||
unsigned int chan = 0;
|
||||
|
||||
if (enabled)
|
||||
{
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough="
|
||||
|
||||
switch (gCurrentScanList)
|
||||
{
|
||||
case SCAN_NEXT_CHAN_SCANLIST1:
|
||||
prev_mr_chan = gNextMrChannel;
|
||||
|
||||
if (chan1 >= 0)
|
||||
{
|
||||
if (RADIO_CheckValidChannel(chan1, false, 0))
|
||||
{
|
||||
gCurrentScanList = SCAN_NEXT_CHAN_SCANLIST1;
|
||||
gNextMrChannel = chan1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
case SCAN_NEXT_CHAN_SCANLIST2:
|
||||
if (chan2 >= 0)
|
||||
{
|
||||
if (RADIO_CheckValidChannel(chan2, false, 0))
|
||||
{
|
||||
gCurrentScanList = SCAN_NEXT_CHAN_SCANLIST2;
|
||||
gNextMrChannel = chan2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// this bit doesn't yet work if the other VFO is a frequency
|
||||
case SCAN_NEXT_CHAN_DUAL_WATCH:
|
||||
// dual watch is enabled - include the other VFO in the scan
|
||||
// if (gEeprom.DUAL_WATCH != DUAL_WATCH_OFF)
|
||||
// {
|
||||
// chan = (gEeprom.RX_VFO + 1) & 1u;
|
||||
// chan = gEeprom.ScreenChannel[chan];
|
||||
// if (chan <= MR_CHANNEL_LAST)
|
||||
// {
|
||||
// gCurrentScanList = SCAN_NEXT_CHAN_DUAL_WATCH;
|
||||
// gNextMrChannel = chan;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
|
||||
default:
|
||||
case SCAN_NEXT_CHAN_MR:
|
||||
gCurrentScanList = SCAN_NEXT_CHAN_MR;
|
||||
gNextMrChannel = prev_mr_chan;
|
||||
chan = 0xff;
|
||||
break;
|
||||
}
|
||||
|
||||
#pragma GCC diagnostic pop
|
||||
}
|
||||
|
||||
if (!enabled || chan == 0xff)
|
||||
{
|
||||
chan = RADIO_FindNextChannel(gNextMrChannel + gScanStateDir, gScanStateDir, (gEeprom.SCAN_LIST_DEFAULT < 2) ? true : false, gEeprom.SCAN_LIST_DEFAULT);
|
||||
if (chan == 0xFF)
|
||||
{ // no valid channel found
|
||||
|
||||
chan = MR_CHANNEL_FIRST;
|
||||
// return;
|
||||
}
|
||||
|
||||
gNextMrChannel = chan;
|
||||
}
|
||||
|
||||
if (gNextMrChannel != prev_chan)
|
||||
{
|
||||
gEeprom.MrChannel[ gEeprom.RX_VFO] = gNextMrChannel;
|
||||
gEeprom.ScreenChannel[gEeprom.RX_VFO] = gNextMrChannel;
|
||||
|
||||
RADIO_ConfigureChannel(gEeprom.RX_VFO, VFO_CONFIGURE_RELOAD);
|
||||
RADIO_SetupRegisters(true);
|
||||
|
||||
gUpdateDisplay = true;
|
||||
}
|
||||
|
||||
#ifdef ENABLE_FASTER_CHANNEL_SCAN
|
||||
gScanPauseDelayIn_10ms = 9; // 90ms .. <= ~60ms it misses signals (squelch response and/or PLL lock time) ?
|
||||
#else
|
||||
gScanPauseDelayIn_10ms = scan_pause_delay_in_3_10ms;
|
||||
#endif
|
||||
|
||||
bScanKeepFrequency = false;
|
||||
|
||||
if (enabled)
|
||||
if (++gCurrentScanList >= SCAN_NEXT_NUM)
|
||||
gCurrentScanList = SCAN_NEXT_CHAN_SCANLIST1; // back round we go
|
||||
}
|
||||
|
||||
#ifdef ENABLE_NOAA
|
||||
static void NOAA_IncreaseChannel(void)
|
||||
{
|
||||
@@ -1064,56 +943,38 @@ void APP_Update(void)
|
||||
if (gCurrentFunction != FUNCTION_TRANSMIT)
|
||||
APP_HandleFunction();
|
||||
|
||||
#ifdef ENABLE_FMRADIO
|
||||
// if (gFmRadioCountdown_500ms > 0)
|
||||
if (gFmRadioMode && gFmRadioCountdown_500ms > 0) // 1of11
|
||||
return;
|
||||
#endif
|
||||
#ifdef ENABLE_FMRADIO
|
||||
// if (gFmRadioCountdown_500ms > 0)
|
||||
if (gFmRadioMode && gFmRadioCountdown_500ms > 0) // 1of11
|
||||
return;
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_VOICE
|
||||
if (gScreenToDisplay != DISPLAY_SCANNER && gScanStateDir != SCAN_OFF && gScheduleScanListen && !gPttIsPressed && gVoiceWriteIndex == 0)
|
||||
#else
|
||||
if (gScreenToDisplay != DISPLAY_SCANNER && gScanStateDir != SCAN_OFF && gScheduleScanListen && !gPttIsPressed)
|
||||
#endif
|
||||
#ifdef ENABLE_VOICE
|
||||
if (gScreenToDisplay != DISPLAY_SCANNER && gScanStateDir != SCAN_OFF && gScheduleScanListen && !gPttIsPressed && gVoiceWriteIndex == 0)
|
||||
#else
|
||||
if (gScreenToDisplay != DISPLAY_SCANNER && gScanStateDir != SCAN_OFF && gScheduleScanListen && !gPttIsPressed)
|
||||
#endif
|
||||
{ // scanning
|
||||
|
||||
if (IS_FREQ_CHANNEL(gNextMrChannel))
|
||||
{
|
||||
if (gCurrentFunction == FUNCTION_INCOMING)
|
||||
APP_StartListening(gMonitor ? FUNCTION_MONITOR : FUNCTION_RECEIVE, true);
|
||||
else
|
||||
FREQ_NextChannel(); // switch to next frequency
|
||||
}
|
||||
else
|
||||
{
|
||||
if (gCurrentCodeType == CODE_TYPE_OFF && gCurrentFunction == FUNCTION_INCOMING)
|
||||
APP_StartListening(gMonitor ? FUNCTION_MONITOR : FUNCTION_RECEIVE, true);
|
||||
else
|
||||
MR_NextChannel(); // switch to next channel
|
||||
}
|
||||
|
||||
gScanPauseMode = false;
|
||||
gRxReceptionMode = RX_MODE_NONE;
|
||||
gScheduleScanListen = false;
|
||||
SCANNER_ContinueScanning();
|
||||
}
|
||||
|
||||
#ifdef ENABLE_VOICE
|
||||
if (gCssScanMode == CSS_SCAN_MODE_SCANNING && gScheduleScanListen && gVoiceWriteIndex == 0)
|
||||
#else
|
||||
if (gCssScanMode == CSS_SCAN_MODE_SCANNING && gScheduleScanListen)
|
||||
#endif
|
||||
#ifdef ENABLE_VOICE
|
||||
if (gCssScanMode == CSS_SCAN_MODE_SCANNING && gScheduleScanListen && gVoiceWriteIndex == 0)
|
||||
#else
|
||||
if (gCssScanMode == CSS_SCAN_MODE_SCANNING && gScheduleScanListen)
|
||||
#endif
|
||||
{
|
||||
MENU_SelectNextCode();
|
||||
|
||||
gScheduleScanListen = false;
|
||||
}
|
||||
|
||||
#ifdef ENABLE_NOAA
|
||||
#ifdef ENABLE_VOICE
|
||||
if (gEeprom.DUAL_WATCH == DUAL_WATCH_OFF && gIsNoaaMode && gScheduleNOAA && gVoiceWriteIndex == 0)
|
||||
#else
|
||||
if (gEeprom.DUAL_WATCH == DUAL_WATCH_OFF && gIsNoaaMode && gScheduleNOAA)
|
||||
#endif
|
||||
#ifdef ENABLE_NOAA
|
||||
#ifdef ENABLE_VOICE
|
||||
if (gEeprom.DUAL_WATCH == DUAL_WATCH_OFF && gIsNoaaMode && gScheduleNOAA && gVoiceWriteIndex == 0)
|
||||
#else
|
||||
if (gEeprom.DUAL_WATCH == DUAL_WATCH_OFF && gIsNoaaMode && gScheduleNOAA)
|
||||
#endif
|
||||
{
|
||||
NOAA_IncreaseChannel();
|
||||
RADIO_SetupRegisters(false);
|
||||
@@ -1121,23 +982,23 @@ void APP_Update(void)
|
||||
gNOAA_Countdown_10ms = 7; // 70ms
|
||||
gScheduleNOAA = false;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// toggle between the VFO's if dual watch is enabled
|
||||
if (gScreenToDisplay != DISPLAY_SCANNER && gEeprom.DUAL_WATCH != DUAL_WATCH_OFF)
|
||||
{
|
||||
#ifdef ENABLE_VOICE
|
||||
if (gScheduleDualWatch && gVoiceWriteIndex == 0)
|
||||
#else
|
||||
if (gScheduleDualWatch)
|
||||
#endif
|
||||
#ifdef ENABLE_VOICE
|
||||
if (gScheduleDualWatch && gVoiceWriteIndex == 0)
|
||||
#else
|
||||
if (gScheduleDualWatch)
|
||||
#endif
|
||||
{
|
||||
if (gScanStateDir == SCAN_OFF && gCssScanMode == CSS_SCAN_MODE_OFF)
|
||||
{
|
||||
if (!gPttIsPressed &&
|
||||
#ifdef ENABLE_FMRADIO
|
||||
!gFmRadioMode &&
|
||||
#endif
|
||||
#ifdef ENABLE_FMRADIO
|
||||
!gFmRadioMode &&
|
||||
#endif
|
||||
gDTMF_CallState == DTMF_CALL_STATE_NONE &&
|
||||
gCurrentFunction != FUNCTION_POWER_SAVE)
|
||||
{
|
||||
@@ -1155,89 +1016,89 @@ void APP_Update(void)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef ENABLE_FMRADIO
|
||||
if (gScheduleFM &&
|
||||
gFM_ScanState != FM_SCAN_OFF &&
|
||||
gCurrentFunction != FUNCTION_MONITOR &&
|
||||
gCurrentFunction != FUNCTION_RECEIVE &&
|
||||
gCurrentFunction != FUNCTION_TRANSMIT)
|
||||
{ // switch to FM radio mode
|
||||
FM_Play();
|
||||
gScheduleFM = false;
|
||||
}
|
||||
#endif
|
||||
#ifdef ENABLE_FMRADIO
|
||||
if (gScheduleFM &&
|
||||
gFM_ScanState != FM_SCAN_OFF &&
|
||||
gCurrentFunction != FUNCTION_MONITOR &&
|
||||
gCurrentFunction != FUNCTION_RECEIVE &&
|
||||
gCurrentFunction != FUNCTION_TRANSMIT)
|
||||
{ // switch to FM radio mode
|
||||
FM_Play();
|
||||
gScheduleFM = false;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_VOX
|
||||
if (gEeprom.VOX_SWITCH)
|
||||
APP_HandleVox();
|
||||
#endif
|
||||
#ifdef ENABLE_VOX
|
||||
if (gEeprom.VOX_SWITCH)
|
||||
APP_HandleVox();
|
||||
#endif
|
||||
|
||||
if (gSchedulePowerSave)
|
||||
{
|
||||
#ifdef ENABLE_NOAA
|
||||
if (
|
||||
#ifdef ENABLE_FMRADIO
|
||||
gFmRadioMode ||
|
||||
#endif
|
||||
gPttIsPressed ||
|
||||
gKeyBeingHeld ||
|
||||
gEeprom.BATTERY_SAVE == 0 ||
|
||||
gScanStateDir != SCAN_OFF ||
|
||||
gCssScanMode != CSS_SCAN_MODE_OFF ||
|
||||
gScreenToDisplay != DISPLAY_MAIN ||
|
||||
gDTMF_CallState != DTMF_CALL_STATE_NONE)
|
||||
{
|
||||
gBatterySaveCountdown_10ms = battery_save_count_10ms;
|
||||
}
|
||||
else if ((IS_NOT_NOAA_CHANNEL(gEeprom.ScreenChannel[0]) && IS_NOT_NOAA_CHANNEL(gEeprom.ScreenChannel[1])) || !gIsNoaaMode)
|
||||
{
|
||||
//if (gCurrentFunction != FUNCTION_POWER_SAVE)
|
||||
FUNCTION_Select(FUNCTION_POWER_SAVE);
|
||||
}
|
||||
else
|
||||
{
|
||||
gBatterySaveCountdown_10ms = battery_save_count_10ms;
|
||||
}
|
||||
#else
|
||||
if (
|
||||
#ifdef ENABLE_FMRADIO
|
||||
gFmRadioMode ||
|
||||
#endif
|
||||
gPttIsPressed ||
|
||||
gKeyBeingHeld ||
|
||||
gEeprom.BATTERY_SAVE == 0 ||
|
||||
gScanStateDir != SCAN_OFF ||
|
||||
gCssScanMode != CSS_SCAN_MODE_OFF ||
|
||||
gScreenToDisplay != DISPLAY_MAIN ||
|
||||
gDTMF_CallState != DTMF_CALL_STATE_NONE)
|
||||
{
|
||||
gBatterySaveCountdown_10ms = battery_save_count_10ms;
|
||||
}
|
||||
else
|
||||
{
|
||||
//if (gCurrentFunction != FUNCTION_POWER_SAVE)
|
||||
FUNCTION_Select(FUNCTION_POWER_SAVE);
|
||||
}
|
||||
#ifdef ENABLE_NOAA
|
||||
if (
|
||||
#ifdef ENABLE_FMRADIO
|
||||
gFmRadioMode ||
|
||||
#endif
|
||||
gPttIsPressed ||
|
||||
gKeyBeingHeld ||
|
||||
gEeprom.BATTERY_SAVE == 0 ||
|
||||
gScanStateDir != SCAN_OFF ||
|
||||
gCssScanMode != CSS_SCAN_MODE_OFF ||
|
||||
gScreenToDisplay != DISPLAY_MAIN ||
|
||||
gDTMF_CallState != DTMF_CALL_STATE_NONE)
|
||||
{
|
||||
gBatterySaveCountdown_10ms = battery_save_count_10ms;
|
||||
}
|
||||
else if ((IS_NOT_NOAA_CHANNEL(gEeprom.ScreenChannel[0]) && IS_NOT_NOAA_CHANNEL(gEeprom.ScreenChannel[1])) || !gIsNoaaMode)
|
||||
{
|
||||
//if (gCurrentFunction != FUNCTION_POWER_SAVE)
|
||||
FUNCTION_Select(FUNCTION_POWER_SAVE);
|
||||
}
|
||||
else
|
||||
{
|
||||
gBatterySaveCountdown_10ms = battery_save_count_10ms;
|
||||
}
|
||||
#else
|
||||
if (
|
||||
#ifdef ENABLE_FMRADIO
|
||||
gFmRadioMode ||
|
||||
#endif
|
||||
gPttIsPressed ||
|
||||
gKeyBeingHeld ||
|
||||
gEeprom.BATTERY_SAVE == 0 ||
|
||||
gScanStateDir != SCAN_OFF ||
|
||||
gCssScanMode != CSS_SCAN_MODE_OFF ||
|
||||
gScreenToDisplay != DISPLAY_MAIN ||
|
||||
gDTMF_CallState != DTMF_CALL_STATE_NONE)
|
||||
{
|
||||
gBatterySaveCountdown_10ms = battery_save_count_10ms;
|
||||
}
|
||||
else
|
||||
{
|
||||
//if (gCurrentFunction != FUNCTION_POWER_SAVE)
|
||||
FUNCTION_Select(FUNCTION_POWER_SAVE);
|
||||
}
|
||||
|
||||
gSchedulePowerSave = false;
|
||||
#endif
|
||||
gSchedulePowerSave = false;
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef ENABLE_VOICE
|
||||
if (gPowerSaveCountdownExpired && gCurrentFunction == FUNCTION_POWER_SAVE && gVoiceWriteIndex == 0)
|
||||
#else
|
||||
if (gPowerSaveCountdownExpired && gCurrentFunction == FUNCTION_POWER_SAVE)
|
||||
#endif
|
||||
#ifdef ENABLE_VOICE
|
||||
if (gPowerSaveCountdownExpired && gCurrentFunction == FUNCTION_POWER_SAVE && gVoiceWriteIndex == 0)
|
||||
#else
|
||||
if (gPowerSaveCountdownExpired && gCurrentFunction == FUNCTION_POWER_SAVE)
|
||||
#endif
|
||||
{ // wake up, enable RX then go back to sleep
|
||||
|
||||
if (gRxIdleMode)
|
||||
{
|
||||
BK4819_Conditional_RX_TurnOn_and_GPIO6_Enable();
|
||||
|
||||
#ifdef ENABLE_VOX
|
||||
if (gEeprom.VOX_SWITCH)
|
||||
BK4819_EnableVox(gEeprom.VOX1_THRESHOLD, gEeprom.VOX0_THRESHOLD);
|
||||
#endif
|
||||
#ifdef ENABLE_VOX
|
||||
if (gEeprom.VOX_SWITCH)
|
||||
BK4819_EnableVox(gEeprom.VOX1_THRESHOLD, gEeprom.VOX0_THRESHOLD);
|
||||
#endif
|
||||
|
||||
if (gEeprom.DUAL_WATCH != DUAL_WATCH_OFF &&
|
||||
gScanStateDir == SCAN_OFF &&
|
||||
@@ -1788,7 +1649,7 @@ void APP_TimeSlice500ms(void)
|
||||
#endif
|
||||
|
||||
if (gBacklightCountdown > 0 && !gAskToSave && gCssScanMode == CSS_SCAN_MODE_OFF)
|
||||
if (gScreenToDisplay != DISPLAY_MENU || gMenuCursor != MENU_ABR) // don't turn off backlight if user is in backlight menu option
|
||||
if (gScreenToDisplay != DISPLAY_MENU || GetCurrentMenuId() != MENU_ABR) // don't turn off backlight if user is in backlight menu option
|
||||
if (--gBacklightCountdown == 0)
|
||||
if (gEeprom.BACKLIGHT < (ARRAY_SIZE(gSubMenu_BACKLIGHT) - 1))
|
||||
GPIO_ClearBit(&GPIOB->DATA, GPIOB_PIN_BACKLIGHT); // turn backlight off
|
||||
@@ -2079,33 +1940,7 @@ void APP_TimeSlice500ms(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
void CHANNEL_Next(const bool bFlag, const int8_t scan_direction)
|
||||
{
|
||||
RADIO_SelectVfos();
|
||||
|
||||
gNextMrChannel = gRxVfo->CHANNEL_SAVE;
|
||||
gCurrentScanList = SCAN_NEXT_CHAN_SCANLIST1;
|
||||
gScanStateDir = scan_direction;
|
||||
|
||||
if (gNextMrChannel <= MR_CHANNEL_LAST)
|
||||
{ // channel mode
|
||||
if (bFlag)
|
||||
gRestoreMrChannel = gNextMrChannel;
|
||||
MR_NextChannel();
|
||||
}
|
||||
else
|
||||
{ // frequency mode
|
||||
if (bFlag)
|
||||
gRestoreFrequency = gRxVfo->freq_config_RX.Frequency;
|
||||
FREQ_NextChannel();
|
||||
}
|
||||
|
||||
gScanPauseDelayIn_10ms = scan_pause_delay_in_2_10ms;
|
||||
gScheduleScanListen = false;
|
||||
gRxReceptionMode = RX_MODE_NONE;
|
||||
gScanPauseMode = false;
|
||||
bScanKeepFrequency = false;
|
||||
}
|
||||
|
||||
static void APP_ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
{
|
||||
@@ -2229,7 +2064,7 @@ static void APP_ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
}
|
||||
}
|
||||
|
||||
if ((Key >= KEY_0 && Key <= KEY_9) || Key == KEY_F)
|
||||
if (Key <= KEY_9 || Key == KEY_F)
|
||||
{
|
||||
if (gScanStateDir != SCAN_OFF || gCssScanMode != CSS_SCAN_MODE_OFF)
|
||||
{ // FREQ/CTCSS/DCS scanning
|
||||
|
||||
@@ -29,7 +29,6 @@ extern const uint8_t orig_mixer;
|
||||
extern const uint8_t orig_pga;
|
||||
|
||||
void APP_EndTransmission(void);
|
||||
void CHANNEL_Next(const bool bFlag, const int8_t scan_direction);
|
||||
void APP_StartListening(FUNCTION_Type_t Function, const bool reset_am_fix);
|
||||
uint32_t APP_SetFrequencyByStep(VFO_Info_t *pInfo, int8_t Step);
|
||||
void APP_Update(void);
|
||||
|
||||
@@ -356,13 +356,11 @@ void DTMF_HandleRequest(void)
|
||||
|
||||
gUpdateDisplay = true;
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough="
|
||||
|
||||
switch (gEeprom.DTMF_DECODE_RESPONSE)
|
||||
{
|
||||
case DTMF_DEC_RESPONSE_BOTH:
|
||||
gDTMF_DecodeRingCountdown_500ms = DTMF_decode_ring_countdown_500ms;
|
||||
[[fallthrough]];
|
||||
case DTMF_DEC_RESPONSE_REPLY:
|
||||
gDTMF_ReplyState = DTMF_REPLY_AAAAA;
|
||||
break;
|
||||
@@ -376,8 +374,6 @@ void DTMF_HandleRequest(void)
|
||||
break;
|
||||
}
|
||||
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
if (gDTMF_IsGroupCall)
|
||||
gDTMF_ReplyState = DTMF_REPLY_NONE;
|
||||
}
|
||||
|
||||
74
app/main.c
74
app/main.c
@@ -130,19 +130,12 @@ static void processFKeyFunction(const KEY_Code_t Key, const bool beep)
|
||||
break;
|
||||
|
||||
case KEY_2:
|
||||
if (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_CHAN_A)
|
||||
gEeprom.CROSS_BAND_RX_TX = CROSS_BAND_CHAN_B;
|
||||
else
|
||||
if (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_CHAN_B)
|
||||
gEeprom.CROSS_BAND_RX_TX = CROSS_BAND_CHAN_A;
|
||||
else
|
||||
if (gEeprom.DUAL_WATCH == DUAL_WATCH_CHAN_A)
|
||||
gEeprom.DUAL_WATCH = DUAL_WATCH_CHAN_B;
|
||||
else
|
||||
if (gEeprom.DUAL_WATCH == DUAL_WATCH_CHAN_B)
|
||||
gEeprom.DUAL_WATCH = DUAL_WATCH_CHAN_A;
|
||||
else
|
||||
gEeprom.TX_VFO = (Vfo + 1) & 1u;
|
||||
gEeprom.TX_VFO ^= 1;
|
||||
|
||||
if (gEeprom.CROSS_BAND_RX_TX != CROSS_BAND_OFF)
|
||||
gEeprom.CROSS_BAND_RX_TX = gEeprom.TX_VFO + 1;
|
||||
if (gEeprom.DUAL_WATCH != DUAL_WATCH_OFF)
|
||||
gEeprom.DUAL_WATCH = gEeprom.TX_VFO + 1;
|
||||
|
||||
gRequestSaveSettings = 1;
|
||||
gFlagReconfigureVfos = true;
|
||||
@@ -209,7 +202,7 @@ static void processFKeyFunction(const KEY_Code_t Key, const bool beep)
|
||||
|
||||
case KEY_5:
|
||||
if(beep) {
|
||||
#ifdef ENABLE_NOAA
|
||||
#ifdef ENABLE_NOAA
|
||||
|
||||
if (IS_NOT_NOAA_CHANNEL(gTxVfo->CHANNEL_SAVE))
|
||||
{
|
||||
@@ -218,9 +211,9 @@ static void processFKeyFunction(const KEY_Code_t Key, const bool beep)
|
||||
else
|
||||
{
|
||||
gEeprom.ScreenChannel[Vfo] = gEeprom.FreqChannel[gEeprom.TX_VFO];
|
||||
#ifdef ENABLE_VOICE
|
||||
#ifdef ENABLE_VOICE
|
||||
gAnotherVoiceID = VOICE_ID_FREQUENCY_MODE;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
gRequestSaveVFO = true;
|
||||
gVfoConfigureMode = VFO_CONFIGURE_RELOAD;
|
||||
@@ -230,9 +223,9 @@ static void processFKeyFunction(const KEY_Code_t Key, const bool beep)
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
#ifdef ENABLE_VOX
|
||||
#ifdef ENABLE_VOX
|
||||
toggle_chan_scanlist();
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -242,11 +235,11 @@ static void processFKeyFunction(const KEY_Code_t Key, const bool beep)
|
||||
break;
|
||||
|
||||
case KEY_7:
|
||||
#ifdef ENABLE_VOX
|
||||
ACTION_Vox();
|
||||
#else
|
||||
toggle_chan_scanlist();
|
||||
#endif
|
||||
#ifdef ENABLE_VOX
|
||||
ACTION_Vox();
|
||||
#else
|
||||
toggle_chan_scanlist();
|
||||
#endif
|
||||
break;
|
||||
|
||||
case KEY_8:
|
||||
@@ -259,11 +252,11 @@ static void processFKeyFunction(const KEY_Code_t Key, const bool beep)
|
||||
{
|
||||
gEeprom.MrChannel[Vfo] = gEeprom.CHAN_1_CALL;
|
||||
gEeprom.ScreenChannel[Vfo] = gEeprom.CHAN_1_CALL;
|
||||
#ifdef ENABLE_VOICE
|
||||
AUDIO_SetVoiceID(0, VOICE_ID_CHANNEL_MODE);
|
||||
AUDIO_SetDigitVoice(1, gEeprom.CHAN_1_CALL + 1);
|
||||
gAnotherVoiceID = (VOICE_ID_t)0xFE;
|
||||
#endif
|
||||
#ifdef ENABLE_VOICE
|
||||
AUDIO_SetVoiceID(0, VOICE_ID_CHANNEL_MODE);
|
||||
AUDIO_SetDigitVoice(1, gEeprom.CHAN_1_CALL + 1);
|
||||
gAnotherVoiceID = (VOICE_ID_t)0xFE;
|
||||
#endif
|
||||
gRequestSaveVFO = true;
|
||||
gVfoConfigureMode = VFO_CONFIGURE_RELOAD;
|
||||
break;
|
||||
@@ -513,6 +506,7 @@ static void MAIN_Key_EXIT(bool bKeyPressed, bool bKeyHeld)
|
||||
}
|
||||
else
|
||||
{
|
||||
bScanKeepFrequency = false;
|
||||
SCANNER_Stop();
|
||||
|
||||
#ifdef ENABLE_VOICE
|
||||
@@ -586,7 +580,7 @@ static void MAIN_Key_MENU(const bool bKeyPressed, const bool bKeyHeld)
|
||||
}
|
||||
}
|
||||
|
||||
const unsigned int vfo = get_rx_VFO();
|
||||
const uint8_t vfo = gEeprom.TX_VFO;
|
||||
|
||||
if (IS_MR_CHANNEL(gEeprom.ScreenChannel[vfo]))
|
||||
{ // copy channel to VFO, then swap to the VFO
|
||||
@@ -654,28 +648,28 @@ static void MAIN_Key_STAR(bool bKeyPressed, bool bKeyHeld)
|
||||
return;
|
||||
}
|
||||
|
||||
if (bKeyHeld && !gWasFKeyPressed)
|
||||
{ // long press .. toggle scanning
|
||||
if (!bKeyPressed)
|
||||
return; // released
|
||||
if (bKeyHeld && !gWasFKeyPressed) // long press
|
||||
{
|
||||
if (!bKeyPressed) // released
|
||||
return;
|
||||
|
||||
ACTION_Scan(false);
|
||||
ACTION_Scan(false);// toggle scanning
|
||||
|
||||
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
||||
return;
|
||||
}
|
||||
|
||||
if (bKeyPressed)
|
||||
{ // just pressed
|
||||
// gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
||||
if (bKeyPressed) // just pressed
|
||||
{
|
||||
// gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
||||
gBeepToPlay = BEEP_880HZ_40MS_OPTIONAL;
|
||||
return;
|
||||
}
|
||||
|
||||
// just released
|
||||
|
||||
if (!gWasFKeyPressed)
|
||||
{ // pressed without the F-key
|
||||
if (!gWasFKeyPressed) // pressed without the F-key
|
||||
{
|
||||
|
||||
#ifdef ENABLE_NOAA
|
||||
if (gScanStateDir == SCAN_OFF && IS_NOT_NOAA_CHANNEL(gTxVfo->CHANNEL_SAVE))
|
||||
@@ -810,7 +804,7 @@ static void MAIN_Key_UP_DOWN(bool bKeyPressed, bool bKeyHeld, int8_t Direction)
|
||||
}
|
||||
|
||||
// jump to the next channel
|
||||
CHANNEL_Next(false, Direction);
|
||||
SCANNER_NextChannel(false, Direction);
|
||||
gScanPauseDelayIn_10ms = 1;
|
||||
gScheduleScanListen = false;
|
||||
|
||||
|
||||
153
app/menu.c
153
app/menu.c
@@ -98,9 +98,9 @@ void MENU_StopCssScan(void)
|
||||
RADIO_SetupRegisters(true);
|
||||
}
|
||||
|
||||
int MENU_GetLimits(uint8_t Cursor, int32_t *pMin, int32_t *pMax)
|
||||
int MENU_GetLimits(uint8_t menu_id, int32_t *pMin, int32_t *pMax)
|
||||
{
|
||||
switch (Cursor)
|
||||
switch (menu_id)
|
||||
{
|
||||
case MENU_SQL:
|
||||
*pMin = 0;
|
||||
@@ -280,7 +280,6 @@ int MENU_GetLimits(uint8_t Cursor, int32_t *pMin, int32_t *pMax)
|
||||
|
||||
case MENU_S_LIST:
|
||||
*pMin = 0;
|
||||
// *pMax = 1;
|
||||
*pMax = 2;
|
||||
break;
|
||||
|
||||
@@ -326,6 +325,14 @@ int MENU_GetLimits(uint8_t Cursor, int32_t *pMin, int32_t *pMax)
|
||||
*pMax = 2200; // 2300
|
||||
break;
|
||||
|
||||
case MENU_F1SHRT:
|
||||
case MENU_F1LONG:
|
||||
case MENU_F2SHRT:
|
||||
case MENU_F2LONG:
|
||||
*pMin = 0;
|
||||
*pMax = gSubMenu_SIDEFUNCTIONS_size-1;
|
||||
break;
|
||||
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
@@ -340,14 +347,14 @@ void MENU_AcceptSetting(void)
|
||||
uint8_t Code;
|
||||
FREQ_Config_t *pConfig = &gTxVfo->freq_config_RX;
|
||||
|
||||
if (!MENU_GetLimits(gMenuCursor, &Min, &Max))
|
||||
if (!MENU_GetLimits(GetCurrentMenuId(), &Min, &Max))
|
||||
{
|
||||
if (gSubMenuSelection < Min) gSubMenuSelection = Min;
|
||||
else
|
||||
if (gSubMenuSelection > Max) gSubMenuSelection = Max;
|
||||
}
|
||||
|
||||
switch (gMenuCursor)
|
||||
switch (GetCurrentMenuId())
|
||||
{
|
||||
default:
|
||||
return;
|
||||
@@ -403,11 +410,9 @@ void MENU_AcceptSetting(void)
|
||||
gRequestSaveChannel = 1;
|
||||
return;
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough="
|
||||
|
||||
case MENU_T_CTCS:
|
||||
pConfig = &gTxVfo->freq_config_TX;
|
||||
[[fallthrough]];
|
||||
case MENU_R_CTCS:
|
||||
if (gSubMenuSelection == 0)
|
||||
{
|
||||
@@ -434,8 +439,6 @@ void MENU_AcceptSetting(void)
|
||||
gRequestSaveChannel = 1;
|
||||
return;
|
||||
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
case MENU_SFT_D:
|
||||
gTxVfo->TX_OFFSET_FREQUENCY_DIRECTION = gSubMenuSelection;
|
||||
gRequestSaveChannel = 1;
|
||||
@@ -749,23 +752,30 @@ void MENU_AcceptSetting(void)
|
||||
|
||||
case MENU_BATCAL:
|
||||
{
|
||||
uint16_t buf[4];
|
||||
|
||||
gBatteryCalibration[0] = (520ul * gSubMenuSelection) / 760; // 5.20V empty, blinking above this value, reduced functionality below
|
||||
gBatteryCalibration[1] = (700ul * gSubMenuSelection) / 760; // 7.00V, ~5%, 1 bars above this value
|
||||
gBatteryCalibration[2] = (745ul * gSubMenuSelection) / 760; // 7.45V, ~17%, 2 bars above this value
|
||||
gBatteryCalibration[3] = gSubMenuSelection; // 7.6V, ~29%, 3 bars above this value
|
||||
gBatteryCalibration[4] = (788ul * gSubMenuSelection) / 760; // 7.88V, ~65%, 4 bars above this value
|
||||
gBatteryCalibration[5] = 2300;
|
||||
EEPROM_WriteBuffer(0x1F40, gBatteryCalibration);
|
||||
|
||||
EEPROM_ReadBuffer( 0x1F48, buf, sizeof(buf));
|
||||
buf[0] = gBatteryCalibration[4];
|
||||
buf[1] = gBatteryCalibration[5];
|
||||
EEPROM_WriteBuffer(0x1F48, buf);
|
||||
|
||||
break;
|
||||
SETTINGS_SaveBatteryCalibration(gBatteryCalibration);
|
||||
return;
|
||||
}
|
||||
|
||||
case MENU_F1SHRT:
|
||||
case MENU_F1LONG:
|
||||
case MENU_F2SHRT:
|
||||
case MENU_F2LONG:
|
||||
{
|
||||
uint8_t * fun[]= {
|
||||
&gEeprom.KEY_1_SHORT_PRESS_ACTION,
|
||||
&gEeprom.KEY_1_LONG_PRESS_ACTION,
|
||||
&gEeprom.KEY_2_SHORT_PRESS_ACTION,
|
||||
&gEeprom.KEY_2_LONG_PRESS_ACTION};
|
||||
*fun[GetCurrentMenuId()-MENU_F1SHRT] = gSubMenu_SIDEFUNCTIONS[gSubMenuSelection].id;
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
gRequestSaveSettings = true;
|
||||
@@ -775,18 +785,17 @@ void MENU_SelectNextCode(void)
|
||||
{
|
||||
int32_t UpperLimit;
|
||||
|
||||
if (gMenuCursor == MENU_R_DCS)
|
||||
if (GetCurrentMenuId() == MENU_R_DCS)
|
||||
UpperLimit = 208;
|
||||
//UpperLimit = ARRAY_SIZE(DCS_Options);
|
||||
else
|
||||
if (gMenuCursor == MENU_R_CTCS)
|
||||
else if (GetCurrentMenuId() == MENU_R_CTCS)
|
||||
UpperLimit = ARRAY_SIZE(CTCSS_Options) - 1;
|
||||
else
|
||||
return;
|
||||
|
||||
gSubMenuSelection = NUMBER_AddWithWraparound(gSubMenuSelection, gMenuScrollDirection, 1, UpperLimit);
|
||||
|
||||
if (gMenuCursor == MENU_R_DCS)
|
||||
if (GetCurrentMenuId() == MENU_R_DCS)
|
||||
{
|
||||
if (gSubMenuSelection > 104)
|
||||
{
|
||||
@@ -818,7 +827,7 @@ static void MENU_ClampSelection(int8_t Direction)
|
||||
int32_t Min;
|
||||
int32_t Max;
|
||||
|
||||
if (!MENU_GetLimits(gMenuCursor, &Min, &Max))
|
||||
if (!MENU_GetLimits(GetCurrentMenuId(), &Min, &Max))
|
||||
{
|
||||
int32_t Selection = gSubMenuSelection;
|
||||
if (Selection < Min) Selection = Min;
|
||||
@@ -830,7 +839,7 @@ static void MENU_ClampSelection(int8_t Direction)
|
||||
|
||||
void MENU_ShowCurrentSetting(void)
|
||||
{
|
||||
switch (gMenuCursor)
|
||||
switch (GetCurrentMenuId())
|
||||
{
|
||||
case MENU_SQL:
|
||||
gSubMenuSelection = gEeprom.SQUELCH_LEVEL;
|
||||
@@ -1133,6 +1142,28 @@ void MENU_ShowCurrentSetting(void)
|
||||
gSubMenuSelection = gBatteryCalibration[3];
|
||||
break;
|
||||
|
||||
case MENU_F1SHRT:
|
||||
case MENU_F1LONG:
|
||||
case MENU_F2SHRT:
|
||||
case MENU_F2LONG:
|
||||
{
|
||||
uint8_t * fun[]= {
|
||||
&gEeprom.KEY_1_SHORT_PRESS_ACTION,
|
||||
&gEeprom.KEY_1_LONG_PRESS_ACTION,
|
||||
&gEeprom.KEY_2_SHORT_PRESS_ACTION,
|
||||
&gEeprom.KEY_2_LONG_PRESS_ACTION};
|
||||
uint8_t id = *fun[GetCurrentMenuId()-MENU_F1SHRT];
|
||||
|
||||
for(int i = 0; i < gSubMenu_SIDEFUNCTIONS_size; i++) {
|
||||
if(gSubMenu_SIDEFUNCTIONS[i].id==id) {
|
||||
gSubMenuSelection = i;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
return;
|
||||
}
|
||||
@@ -1150,12 +1181,12 @@ static void MENU_Key_0_to_9(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
|
||||
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
||||
|
||||
if (gMenuCursor == MENU_MEM_NAME && edit_index >= 0)
|
||||
if (GetCurrentMenuId() == MENU_MEM_NAME && edit_index >= 0)
|
||||
{ // currently editing the channel name
|
||||
|
||||
if (edit_index < 10)
|
||||
{
|
||||
if (Key >= KEY_0 && Key <= KEY_9)
|
||||
if (Key <= KEY_9)
|
||||
{
|
||||
edit[edit_index] = '0' + Key - KEY_0;
|
||||
|
||||
@@ -1178,9 +1209,6 @@ static void MENU_Key_0_to_9(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
|
||||
if (!gIsInSubMenu)
|
||||
{
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough="
|
||||
|
||||
switch (gInputBoxIndex)
|
||||
{
|
||||
case 2:
|
||||
@@ -1200,7 +1228,7 @@ static void MENU_Key_0_to_9(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
|
||||
gInputBox[0] = gInputBox[1];
|
||||
gInputBoxIndex = 1;
|
||||
|
||||
[[fallthrough]];
|
||||
case 1:
|
||||
Value = gInputBox[0];
|
||||
if (Value > 0 && Value <= gMenuListCount)
|
||||
@@ -1212,15 +1240,13 @@ static void MENU_Key_0_to_9(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
break;
|
||||
}
|
||||
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
gInputBoxIndex = 0;
|
||||
|
||||
gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
||||
return;
|
||||
}
|
||||
|
||||
if (gMenuCursor == MENU_OFFSET)
|
||||
if (GetCurrentMenuId() == MENU_OFFSET)
|
||||
{
|
||||
uint32_t Frequency;
|
||||
|
||||
@@ -1242,8 +1268,11 @@ static void MENU_Key_0_to_9(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
gInputBoxIndex = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
if (gMenuCursor == MENU_MEM_CH || gMenuCursor == MENU_DEL_CH || gMenuCursor == MENU_1_CALL || gMenuCursor == MENU_MEM_NAME)
|
||||
|
||||
if (GetCurrentMenuId() == MENU_MEM_CH ||
|
||||
GetCurrentMenuId() == MENU_DEL_CH ||
|
||||
GetCurrentMenuId() == MENU_1_CALL ||
|
||||
GetCurrentMenuId() == MENU_MEM_NAME)
|
||||
{ // enter 3-digit channel number
|
||||
|
||||
if (gInputBoxIndex < 3)
|
||||
@@ -1272,7 +1301,7 @@ static void MENU_Key_0_to_9(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
return;
|
||||
}
|
||||
|
||||
if (MENU_GetLimits(gMenuCursor, &Min, &Max))
|
||||
if (MENU_GetLimits(GetCurrentMenuId(), &Min, &Max))
|
||||
{
|
||||
gInputBoxIndex = 0;
|
||||
gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
||||
@@ -1317,7 +1346,7 @@ static void MENU_Key_EXIT(bool bKeyPressed, bool bKeyHeld)
|
||||
{
|
||||
if (gIsInSubMenu)
|
||||
{
|
||||
if (gInputBoxIndex == 0 || gMenuCursor != MENU_OFFSET)
|
||||
if (gInputBoxIndex == 0 || GetCurrentMenuId() != MENU_OFFSET)
|
||||
{
|
||||
gAskForConfirmation = 0;
|
||||
gIsInSubMenu = false;
|
||||
@@ -1374,12 +1403,12 @@ static void MENU_Key_MENU(const bool bKeyPressed, const bool bKeyHeld)
|
||||
if (!gIsInSubMenu)
|
||||
{
|
||||
#ifdef ENABLE_VOICE
|
||||
if (gMenuCursor != MENU_SCR)
|
||||
if (GetCurrentMenuId() != MENU_SCR)
|
||||
gAnotherVoiceID = MenuList[gMenuCursor].voice_id;
|
||||
#endif
|
||||
|
||||
#if 1
|
||||
if (gMenuCursor == MENU_DEL_CH || gMenuCursor == MENU_MEM_NAME)
|
||||
if (GetCurrentMenuId() == MENU_DEL_CH || GetCurrentMenuId() == MENU_MEM_NAME)
|
||||
if (!RADIO_CheckValidChannel(gSubMenuSelection, false, 0))
|
||||
return; // invalid channel
|
||||
#endif
|
||||
@@ -1387,7 +1416,7 @@ static void MENU_Key_MENU(const bool bKeyPressed, const bool bKeyHeld)
|
||||
gAskForConfirmation = 0;
|
||||
gIsInSubMenu = true;
|
||||
|
||||
// if (gMenuCursor != MENU_D_LIST)
|
||||
// if (GetCurrentMenuId() != MENU_D_LIST)
|
||||
{
|
||||
gInputBoxIndex = 0;
|
||||
edit_index = -1;
|
||||
@@ -1396,7 +1425,7 @@ static void MENU_Key_MENU(const bool bKeyPressed, const bool bKeyHeld)
|
||||
return;
|
||||
}
|
||||
|
||||
if (gMenuCursor == MENU_MEM_NAME)
|
||||
if (GetCurrentMenuId() == MENU_MEM_NAME)
|
||||
{
|
||||
if (edit_index < 0)
|
||||
{ // enter channel name edit mode
|
||||
@@ -1443,10 +1472,10 @@ static void MENU_Key_MENU(const bool bKeyPressed, const bool bKeyHeld)
|
||||
|
||||
if (gIsInSubMenu)
|
||||
{
|
||||
if (gMenuCursor == MENU_RESET ||
|
||||
gMenuCursor == MENU_MEM_CH ||
|
||||
gMenuCursor == MENU_DEL_CH ||
|
||||
gMenuCursor == MENU_MEM_NAME)
|
||||
if (GetCurrentMenuId() == MENU_RESET ||
|
||||
GetCurrentMenuId() == MENU_MEM_CH ||
|
||||
GetCurrentMenuId() == MENU_DEL_CH ||
|
||||
GetCurrentMenuId() == MENU_MEM_NAME)
|
||||
{
|
||||
switch (gAskForConfirmation)
|
||||
{
|
||||
@@ -1459,7 +1488,7 @@ static void MENU_Key_MENU(const bool bKeyPressed, const bool bKeyHeld)
|
||||
|
||||
UI_DisplayMenu();
|
||||
|
||||
if (gMenuCursor == MENU_RESET)
|
||||
if (GetCurrentMenuId() == MENU_RESET)
|
||||
{
|
||||
#ifdef ENABLE_VOICE
|
||||
AUDIO_SetVoiceID(0, VOICE_ID_CONFIRM);
|
||||
@@ -1494,7 +1523,7 @@ static void MENU_Key_MENU(const bool bKeyPressed, const bool bKeyHeld)
|
||||
}
|
||||
|
||||
#ifdef ENABLE_VOICE
|
||||
if (gMenuCursor == MENU_SCR)
|
||||
if (GetCurrentMenuId() == MENU_SCR)
|
||||
gAnotherVoiceID = (gSubMenuSelection == 0) ? VOICE_ID_SCRAMBLER_OFF : VOICE_ID_SCRAMBLER_ON;
|
||||
else
|
||||
gAnotherVoiceID = VOICE_ID_CONFIRM;
|
||||
@@ -1510,7 +1539,7 @@ static void MENU_Key_STAR(const bool bKeyPressed, const bool bKeyHeld)
|
||||
|
||||
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
||||
|
||||
if (gMenuCursor == MENU_MEM_NAME && edit_index >= 0)
|
||||
if (GetCurrentMenuId() == MENU_MEM_NAME && edit_index >= 0)
|
||||
{ // currently editing the channel name
|
||||
|
||||
if (edit_index < 10)
|
||||
@@ -1537,7 +1566,7 @@ static void MENU_Key_STAR(const bool bKeyPressed, const bool bKeyHeld)
|
||||
if (gRxVfo->AM_mode == 0)
|
||||
#endif
|
||||
{
|
||||
if (gMenuCursor == MENU_R_CTCS || gMenuCursor == MENU_R_DCS)
|
||||
if (GetCurrentMenuId() == MENU_R_CTCS || GetCurrentMenuId() == MENU_R_DCS)
|
||||
{ // scan CTCSS or DCS to find the tone/code of the incoming signal
|
||||
|
||||
if (gCssScanMode == CSS_SCAN_MODE_OFF)
|
||||
@@ -1572,7 +1601,7 @@ static void MENU_Key_UP_DOWN(bool bKeyPressed, bool bKeyHeld, int8_t Direction)
|
||||
uint8_t Channel;
|
||||
bool bCheckScanList;
|
||||
|
||||
if (gMenuCursor == MENU_MEM_NAME && gIsInSubMenu && edit_index >= 0)
|
||||
if (GetCurrentMenuId() == MENU_MEM_NAME && gIsInSubMenu && edit_index >= 0)
|
||||
{ // change the character
|
||||
if (bKeyPressed && edit_index < 10 && Direction != 0)
|
||||
{
|
||||
@@ -1624,7 +1653,7 @@ static void MENU_Key_UP_DOWN(bool bKeyPressed, bool bKeyHeld, int8_t Direction)
|
||||
|
||||
gRequestDisplayScreen = DISPLAY_MENU;
|
||||
|
||||
if (gMenuCursor != MENU_ABR && gEeprom.BACKLIGHT == 0)
|
||||
if (GetCurrentMenuId() != MENU_ABR && gEeprom.BACKLIGHT == 0)
|
||||
{
|
||||
gBacklightCountdown = 0;
|
||||
GPIO_ClearBit(&GPIOB->DATA, GPIOB_PIN_BACKLIGHT); // turn the backlight OFF
|
||||
@@ -1633,7 +1662,7 @@ static void MENU_Key_UP_DOWN(bool bKeyPressed, bool bKeyHeld, int8_t Direction)
|
||||
return;
|
||||
}
|
||||
|
||||
if (gMenuCursor == MENU_OFFSET)
|
||||
if (GetCurrentMenuId() == MENU_OFFSET)
|
||||
{
|
||||
int32_t Offset = (Direction * gTxVfo->StepFrequency) + gSubMenuSelection;
|
||||
if (Offset < 99999990)
|
||||
@@ -1651,10 +1680,7 @@ static void MENU_Key_UP_DOWN(bool bKeyPressed, bool bKeyHeld, int8_t Direction)
|
||||
|
||||
VFO = 0;
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough="
|
||||
|
||||
switch (gMenuCursor)
|
||||
switch (GetCurrentMenuId())
|
||||
{
|
||||
case MENU_DEL_CH:
|
||||
case MENU_1_CALL:
|
||||
@@ -1664,6 +1690,7 @@ static void MENU_Key_UP_DOWN(bool bKeyPressed, bool bKeyHeld, int8_t Direction)
|
||||
|
||||
case MENU_SLIST2:
|
||||
VFO = 1;
|
||||
[[fallthrough]];
|
||||
case MENU_SLIST1:
|
||||
bCheckScanList = true;
|
||||
break;
|
||||
@@ -1674,8 +1701,6 @@ static void MENU_Key_UP_DOWN(bool bKeyPressed, bool bKeyHeld, int8_t Direction)
|
||||
return;
|
||||
}
|
||||
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
Channel = RADIO_FindNextChannel(gSubMenuSelection + Direction, Direction, bCheckScanList, VFO);
|
||||
if (Channel != 0xFF)
|
||||
gSubMenuSelection = Channel;
|
||||
@@ -1715,7 +1740,7 @@ void MENU_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
MENU_Key_STAR(bKeyPressed, bKeyHeld);
|
||||
break;
|
||||
case KEY_F:
|
||||
if (gMenuCursor == MENU_MEM_NAME && edit_index >= 0)
|
||||
if (GetCurrentMenuId() == MENU_MEM_NAME && edit_index >= 0)
|
||||
{ // currently editing the channel name
|
||||
if (!bKeyHeld && bKeyPressed)
|
||||
{
|
||||
@@ -1747,11 +1772,11 @@ void MENU_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
|
||||
if (gScreenToDisplay == DISPLAY_MENU)
|
||||
{
|
||||
if (gMenuCursor == MENU_VOL ||
|
||||
if (GetCurrentMenuId() == MENU_VOL ||
|
||||
#ifdef ENABLE_F_CAL_MENU
|
||||
gMenuCursor == MENU_F_CALI ||
|
||||
GetCurrentMenuId() == MENU_F_CALI ||
|
||||
#endif
|
||||
gMenuCursor == MENU_BATCAL)
|
||||
GetCurrentMenuId() == MENU_BATCAL)
|
||||
{
|
||||
gMenuCountdown = menu_timeout_long_500ms;
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
void writeXtalFreqCal(const int32_t value, const bool update_eeprom);
|
||||
#endif
|
||||
|
||||
int MENU_GetLimits(uint8_t Cursor, int32_t *pMin, int32_t *pMax);
|
||||
int MENU_GetLimits(uint8_t menu_id, int32_t *pMin, int32_t *pMax);
|
||||
void MENU_AcceptSetting(void);
|
||||
void MENU_SelectNextCode(void);
|
||||
void MENU_ShowCurrentSetting(void);
|
||||
|
||||
204
app/scanner.c
204
app/scanner.c
@@ -14,6 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "app/app.h"
|
||||
#include "app/dtmf.h"
|
||||
#include "app/generic.h"
|
||||
#include "app/scanner.h"
|
||||
@@ -43,6 +44,8 @@ uint8_t gScanHitCount;
|
||||
bool gScanUseCssResult;
|
||||
int8_t gScanStateDir;
|
||||
bool bScanKeepFrequency;
|
||||
uint8_t gRestoreMrChannel;
|
||||
uint8_t gRestoreCROSS_BAND_RX_TX;
|
||||
|
||||
static void SCANNER_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
{
|
||||
@@ -362,10 +365,10 @@ void SCANNER_Start(void)
|
||||
|
||||
RADIO_SelectVfos();
|
||||
|
||||
#ifdef ENABLE_NOAA
|
||||
if (IS_NOAA_CHANNEL(gRxVfo->CHANNEL_SAVE))
|
||||
gRxVfo->CHANNEL_SAVE = FREQ_CHANNEL_FIRST + BAND6_400MHz;
|
||||
#endif
|
||||
#ifdef ENABLE_NOAA
|
||||
if (IS_NOAA_CHANNEL(gRxVfo->CHANNEL_SAVE))
|
||||
gRxVfo->CHANNEL_SAVE = FREQ_CHANNEL_FIRST + BAND6_400MHz;
|
||||
#endif
|
||||
|
||||
BackupStep = gRxVfo->STEP_SETTING;
|
||||
BackupFrequency = gRxVfo->StepFrequency;
|
||||
@@ -377,9 +380,9 @@ void SCANNER_Start(void)
|
||||
|
||||
RADIO_SetupRegisters(true);
|
||||
|
||||
#ifdef ENABLE_NOAA
|
||||
gIsNoaaMode = false;
|
||||
#endif
|
||||
#ifdef ENABLE_NOAA
|
||||
gIsNoaaMode = false;
|
||||
#endif
|
||||
|
||||
if (gScanSingleFrequency)
|
||||
{
|
||||
@@ -414,9 +417,9 @@ void SCANNER_Start(void)
|
||||
g_CDCSS_Lost = false;
|
||||
gCDCSSCodeType = 0;
|
||||
g_CTCSS_Lost = false;
|
||||
#ifdef ENABLE_VOX
|
||||
g_VOX_Lost = false;
|
||||
#endif
|
||||
#ifdef ENABLE_VOX
|
||||
g_VOX_Lost = false;
|
||||
#endif
|
||||
g_SquelchLost = false;
|
||||
gScannerEditState = 0;
|
||||
gScanProgressIndicator = 0;
|
||||
@@ -424,8 +427,11 @@ void SCANNER_Start(void)
|
||||
|
||||
void SCANNER_Stop(void)
|
||||
{
|
||||
const uint8_t Previous = gRestoreMrChannel;
|
||||
|
||||
if(gRestoreCROSS_BAND_RX_TX != CROSS_BAND_OFF) {
|
||||
gEeprom.CROSS_BAND_RX_TX = gRestoreCROSS_BAND_RX_TX;
|
||||
gRestoreCROSS_BAND_RX_TX = CROSS_BAND_OFF;
|
||||
}
|
||||
|
||||
gScanStateDir = SCAN_OFF;
|
||||
|
||||
if (!bScanKeepFrequency)
|
||||
@@ -433,7 +439,7 @@ void SCANNER_Stop(void)
|
||||
if (gNextMrChannel <= MR_CHANNEL_LAST)
|
||||
{
|
||||
gEeprom.MrChannel[gEeprom.RX_VFO] = gRestoreMrChannel;
|
||||
gEeprom.ScreenChannel[gEeprom.RX_VFO] = Previous;
|
||||
gEeprom.ScreenChannel[gEeprom.RX_VFO] = gRestoreMrChannel;
|
||||
|
||||
RADIO_ConfigureChannel(gEeprom.RX_VFO, VFO_CONFIGURE_RELOAD);
|
||||
}
|
||||
@@ -460,3 +466,175 @@ void SCANNER_Stop(void)
|
||||
|
||||
gUpdateStatus = true;
|
||||
}
|
||||
|
||||
static void SCANNER_NextFreqChannel(void)
|
||||
{
|
||||
gRxVfo->freq_config_RX.Frequency = APP_SetFrequencyByStep(gRxVfo, gScanStateDir);
|
||||
|
||||
RADIO_ApplyOffset(gRxVfo);
|
||||
RADIO_ConfigureSquelchAndOutputPower(gRxVfo);
|
||||
RADIO_SetupRegisters(true);
|
||||
|
||||
#ifdef ENABLE_FASTER_CHANNEL_SCAN
|
||||
gScanPauseDelayIn_10ms = 9; // 90ms
|
||||
#else
|
||||
gScanPauseDelayIn_10ms = scan_pause_delay_in_6_10ms;
|
||||
#endif
|
||||
|
||||
bScanKeepFrequency = false;
|
||||
gUpdateDisplay = true;
|
||||
}
|
||||
|
||||
static void SCANNER_NextMemChannel(void)
|
||||
{
|
||||
static unsigned int prev_mr_chan = 0;
|
||||
const bool enabled = (gEeprom.SCAN_LIST_DEFAULT < 2) ? gEeprom.SCAN_LIST_ENABLED[gEeprom.SCAN_LIST_DEFAULT] : true;
|
||||
const int chan1 = (gEeprom.SCAN_LIST_DEFAULT < 2) ? gEeprom.SCANLIST_PRIORITY_CH1[gEeprom.SCAN_LIST_DEFAULT] : -1;
|
||||
const int chan2 = (gEeprom.SCAN_LIST_DEFAULT < 2) ? gEeprom.SCANLIST_PRIORITY_CH2[gEeprom.SCAN_LIST_DEFAULT] : -1;
|
||||
const unsigned int prev_chan = gNextMrChannel;
|
||||
unsigned int chan = 0;
|
||||
|
||||
if (enabled)
|
||||
{
|
||||
switch (gCurrentScanList)
|
||||
{
|
||||
case SCAN_NEXT_CHAN_SCANLIST1:
|
||||
prev_mr_chan = gNextMrChannel;
|
||||
|
||||
if (chan1 >= 0)
|
||||
{
|
||||
if (RADIO_CheckValidChannel(chan1, false, 0))
|
||||
{
|
||||
gCurrentScanList = SCAN_NEXT_CHAN_SCANLIST1;
|
||||
gNextMrChannel = chan1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
[[fallthrough]];
|
||||
case SCAN_NEXT_CHAN_SCANLIST2:
|
||||
if (chan2 >= 0)
|
||||
{
|
||||
if (RADIO_CheckValidChannel(chan2, false, 0))
|
||||
{
|
||||
gCurrentScanList = SCAN_NEXT_CHAN_SCANLIST2;
|
||||
gNextMrChannel = chan2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
[[fallthrough]];
|
||||
|
||||
// this bit doesn't yet work if the other VFO is a frequency
|
||||
case SCAN_NEXT_CHAN_DUAL_WATCH:
|
||||
// dual watch is enabled - include the other VFO in the scan
|
||||
// if (gEeprom.DUAL_WATCH != DUAL_WATCH_OFF)
|
||||
// {
|
||||
// chan = (gEeprom.RX_VFO + 1) & 1u;
|
||||
// chan = gEeprom.ScreenChannel[chan];
|
||||
// if (chan <= MR_CHANNEL_LAST)
|
||||
// {
|
||||
// gCurrentScanList = SCAN_NEXT_CHAN_DUAL_WATCH;
|
||||
// gNextMrChannel = chan;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
|
||||
default:
|
||||
case SCAN_NEXT_CHAN_MR:
|
||||
gCurrentScanList = SCAN_NEXT_CHAN_MR;
|
||||
gNextMrChannel = prev_mr_chan;
|
||||
chan = 0xff;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!enabled || chan == 0xff)
|
||||
{
|
||||
chan = RADIO_FindNextChannel(gNextMrChannel + gScanStateDir, gScanStateDir, (gEeprom.SCAN_LIST_DEFAULT < 2) ? true : false, gEeprom.SCAN_LIST_DEFAULT);
|
||||
if (chan == 0xFF)
|
||||
{ // no valid channel found
|
||||
|
||||
chan = MR_CHANNEL_FIRST;
|
||||
// return;
|
||||
}
|
||||
|
||||
gNextMrChannel = chan;
|
||||
}
|
||||
|
||||
if (gNextMrChannel != prev_chan)
|
||||
{
|
||||
gEeprom.MrChannel[ gEeprom.RX_VFO] = gNextMrChannel;
|
||||
gEeprom.ScreenChannel[gEeprom.RX_VFO] = gNextMrChannel;
|
||||
|
||||
RADIO_ConfigureChannel(gEeprom.RX_VFO, VFO_CONFIGURE_RELOAD);
|
||||
RADIO_SetupRegisters(true);
|
||||
|
||||
gUpdateDisplay = true;
|
||||
}
|
||||
|
||||
#ifdef ENABLE_FASTER_CHANNEL_SCAN
|
||||
gScanPauseDelayIn_10ms = 9; // 90ms .. <= ~60ms it misses signals (squelch response and/or PLL lock time) ?
|
||||
#else
|
||||
gScanPauseDelayIn_10ms = scan_pause_delay_in_3_10ms;
|
||||
#endif
|
||||
|
||||
bScanKeepFrequency = false;
|
||||
|
||||
if (enabled)
|
||||
if (++gCurrentScanList >= SCAN_NEXT_NUM)
|
||||
gCurrentScanList = SCAN_NEXT_CHAN_SCANLIST1; // back round we go
|
||||
}
|
||||
|
||||
void SCANNER_NextChannel(const bool storeBackupSettings, const int8_t scan_direction)
|
||||
{
|
||||
if (storeBackupSettings) {
|
||||
gRestoreCROSS_BAND_RX_TX = gEeprom.CROSS_BAND_RX_TX;
|
||||
gEeprom.CROSS_BAND_RX_TX = CROSS_BAND_OFF;
|
||||
}
|
||||
|
||||
RADIO_SelectVfos();
|
||||
|
||||
gNextMrChannel = gRxVfo->CHANNEL_SAVE;
|
||||
gCurrentScanList = SCAN_NEXT_CHAN_SCANLIST1;
|
||||
gScanStateDir = scan_direction;
|
||||
|
||||
if (gNextMrChannel <= MR_CHANNEL_LAST)
|
||||
{ // channel mode
|
||||
if (storeBackupSettings)
|
||||
gRestoreMrChannel = gNextMrChannel;
|
||||
SCANNER_NextMemChannel();
|
||||
}
|
||||
else
|
||||
{ // frequency mode
|
||||
if (storeBackupSettings)
|
||||
gRestoreFrequency = gRxVfo->freq_config_RX.Frequency;
|
||||
SCANNER_NextFreqChannel();
|
||||
}
|
||||
|
||||
gScanPauseDelayIn_10ms = scan_pause_delay_in_2_10ms;
|
||||
gScheduleScanListen = false;
|
||||
gRxReceptionMode = RX_MODE_NONE;
|
||||
gScanPauseMode = false;
|
||||
bScanKeepFrequency = false;
|
||||
}
|
||||
|
||||
void SCANNER_ContinueScanning()
|
||||
{
|
||||
if (IS_FREQ_CHANNEL(gNextMrChannel))
|
||||
{
|
||||
if (gCurrentFunction == FUNCTION_INCOMING)
|
||||
APP_StartListening(gMonitor ? FUNCTION_MONITOR : FUNCTION_RECEIVE, true);
|
||||
else
|
||||
SCANNER_NextFreqChannel(); // switch to next frequency
|
||||
}
|
||||
else
|
||||
{
|
||||
if (gCurrentCodeType == CODE_TYPE_OFF && gCurrentFunction == FUNCTION_INCOMING)
|
||||
APP_StartListening(gMonitor ? FUNCTION_MONITOR : FUNCTION_RECEIVE, true);
|
||||
else
|
||||
SCANNER_NextMemChannel(); // switch to next channel
|
||||
}
|
||||
|
||||
gScanPauseMode = false;
|
||||
gRxReceptionMode = RX_MODE_NONE;
|
||||
gScheduleScanListen = false;
|
||||
}
|
||||
@@ -58,6 +58,8 @@ extern bool bScanKeepFrequency;
|
||||
void SCANNER_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld);
|
||||
void SCANNER_Start(void);
|
||||
void SCANNER_Stop(void);
|
||||
void SCANNER_NextChannel(const bool storeBackupSettings, const int8_t scan_direction);
|
||||
void SCANNER_ContinueScanning();
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
9
audio.c
9
audio.c
@@ -142,9 +142,6 @@ void AUDIO_PlayBeep(BEEP_Type_t Beep)
|
||||
|
||||
SYSTEM_DelayMs(60);
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough="
|
||||
|
||||
switch (Beep)
|
||||
{
|
||||
case BEEP_880HZ_60MS_TRIPLE_BEEP:
|
||||
@@ -152,14 +149,14 @@ void AUDIO_PlayBeep(BEEP_Type_t Beep)
|
||||
SYSTEM_DelayMs(60);
|
||||
BK4819_EnterTxMute();
|
||||
SYSTEM_DelayMs(20);
|
||||
|
||||
[[fallthrough]];
|
||||
case BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL:
|
||||
case BEEP_500HZ_60MS_DOUBLE_BEEP:
|
||||
BK4819_ExitTxMute();
|
||||
SYSTEM_DelayMs(60);
|
||||
BK4819_EnterTxMute();
|
||||
SYSTEM_DelayMs(20);
|
||||
|
||||
[[fallthrough]];
|
||||
case BEEP_1KHZ_60MS_OPTIONAL:
|
||||
BK4819_ExitTxMute();
|
||||
Duration = 60;
|
||||
@@ -184,8 +181,6 @@ void AUDIO_PlayBeep(BEEP_Type_t Beep)
|
||||
break;
|
||||
}
|
||||
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
SYSTEM_DelayMs(Duration);
|
||||
BK4819_EnterTxMute();
|
||||
SYSTEM_DelayMs(20);
|
||||
|
||||
@@ -106,7 +106,7 @@ void BATTERY_GetReadings(const bool bDisplayBatteryLevel)
|
||||
|
||||
gBatteryVoltageAverage = (Voltage * 760) / gBatteryCalibration[3];
|
||||
|
||||
if ((gScreenToDisplay == DISPLAY_MENU) && gMenuCursor == MENU_VOL)
|
||||
if ((gScreenToDisplay == DISPLAY_MENU) && GetCurrentMenuId() == MENU_VOL)
|
||||
gUpdateDisplay = true;
|
||||
|
||||
if (gBatteryCurrent < 501)
|
||||
|
||||
56
main.c
56
main.c
@@ -103,26 +103,21 @@ void Main(void)
|
||||
#endif
|
||||
|
||||
BootMode = BOOT_GetMode();
|
||||
|
||||
// count the number of menu items
|
||||
gMenuListCount = 0;
|
||||
while (MenuList[gMenuListCount].name[0] != '\0')
|
||||
gMenuListCount++;
|
||||
|
||||
if (BootMode == BOOT_MODE_F_LOCK)
|
||||
{
|
||||
gF_LOCK = true; // flag to say include the hidden menu items
|
||||
}
|
||||
else
|
||||
{ // hide the hidden menu items
|
||||
|
||||
gMenuListCount -= 9;
|
||||
// count the number of menu items
|
||||
gMenuListCount = 0;
|
||||
while (MenuList[gMenuListCount].name[0] != '\0') {
|
||||
if(!gF_LOCK && MenuList[gMenuListCount].menu_id == FIRST_HIDDEN_MENU_ITEM)
|
||||
break;
|
||||
|
||||
#ifndef ENABLE_F_CAL_MENU
|
||||
gMenuListCount++;
|
||||
#endif
|
||||
gMenuListCount++;
|
||||
}
|
||||
|
||||
|
||||
// wait for user to release all butts before moving on
|
||||
if (!GPIO_CheckBit(&GPIOC->DATA, GPIOC_PIN_PTT) ||
|
||||
KEYBOARD_Poll() != KEY_INVALID ||
|
||||
@@ -167,21 +162,21 @@ void Main(void)
|
||||
boot_counter_10ms = 0;
|
||||
break;
|
||||
}
|
||||
#ifdef ENABLE_BOOT_BEEPS
|
||||
if ((boot_counter_10ms % 25) == 0)
|
||||
AUDIO_PlayBeep(BEEP_880HZ_40MS_OPTIONAL);
|
||||
#endif
|
||||
#ifdef ENABLE_BOOT_BEEPS
|
||||
if ((boot_counter_10ms % 25) == 0)
|
||||
AUDIO_PlayBeep(BEEP_880HZ_40MS_OPTIONAL);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef ENABLE_PWRON_PASSWORD
|
||||
if (gEeprom.POWER_ON_PASSWORD < 1000000)
|
||||
{
|
||||
bIsInLockScreen = true;
|
||||
UI_DisplayLock();
|
||||
bIsInLockScreen = false;
|
||||
}
|
||||
#endif
|
||||
#ifdef ENABLE_PWRON_PASSWORD
|
||||
if (gEeprom.POWER_ON_PASSWORD < 1000000)
|
||||
{
|
||||
bIsInLockScreen = true;
|
||||
UI_DisplayLock();
|
||||
bIsInLockScreen = false;
|
||||
}
|
||||
#endif
|
||||
|
||||
BOOT_ProcessMode(BootMode);
|
||||
|
||||
@@ -189,7 +184,7 @@ void Main(void)
|
||||
|
||||
gUpdateStatus = true;
|
||||
|
||||
#ifdef ENABLE_VOICE
|
||||
#ifdef ENABLE_VOICE
|
||||
{
|
||||
uint8_t Channel;
|
||||
|
||||
@@ -201,17 +196,16 @@ void Main(void)
|
||||
AUDIO_SetVoiceID(1, VOICE_ID_CHANNEL_MODE);
|
||||
AUDIO_SetDigitVoice(2, Channel + 1);
|
||||
}
|
||||
else
|
||||
if (IS_FREQ_CHANNEL(Channel))
|
||||
else if (IS_FREQ_CHANNEL(Channel))
|
||||
AUDIO_SetVoiceID(1, VOICE_ID_FREQUENCY_MODE);
|
||||
|
||||
AUDIO_PlaySingleVoice(0);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_NOAA
|
||||
RADIO_ConfigureNOAA();
|
||||
#endif
|
||||
#ifdef ENABLE_NOAA
|
||||
RADIO_ConfigureNOAA();
|
||||
#endif
|
||||
|
||||
// ******************
|
||||
}
|
||||
|
||||
35
misc.c
35
misc.c
@@ -205,7 +205,6 @@ uint16_t gLowBatteryCountdown;
|
||||
uint8_t gNextMrChannel;
|
||||
ReceptionMode_t gRxReceptionMode;
|
||||
|
||||
uint8_t gRestoreMrChannel;
|
||||
enum scan_next_chan_t gCurrentScanList;
|
||||
uint32_t gRestoreFrequency;
|
||||
|
||||
@@ -258,40 +257,6 @@ int16_t gCurrentRSSI[2] = {0, 0}; // now one per VFO
|
||||
|
||||
uint8_t gIsLocked = 0xFF;
|
||||
|
||||
unsigned int get_rx_VFO(void)
|
||||
{
|
||||
unsigned int rx_vfo = gEeprom.TX_VFO;
|
||||
if (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_CHAN_B)
|
||||
rx_vfo = 0;
|
||||
else
|
||||
if (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_CHAN_A)
|
||||
rx_vfo = 1;
|
||||
else
|
||||
if (gEeprom.DUAL_WATCH == DUAL_WATCH_CHAN_B)
|
||||
rx_vfo = 1;
|
||||
else
|
||||
if (gEeprom.DUAL_WATCH == DUAL_WATCH_CHAN_A)
|
||||
rx_vfo = 0;
|
||||
return rx_vfo;
|
||||
}
|
||||
|
||||
unsigned int get_tx_VFO(void)
|
||||
{
|
||||
unsigned int tx_vfo = gEeprom.TX_VFO;
|
||||
if (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_CHAN_B)
|
||||
tx_vfo = 1;
|
||||
else
|
||||
if (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_CHAN_A)
|
||||
tx_vfo = 0;
|
||||
else
|
||||
if (gEeprom.DUAL_WATCH == DUAL_WATCH_CHAN_B)
|
||||
tx_vfo = 1;
|
||||
else
|
||||
if (gEeprom.DUAL_WATCH == DUAL_WATCH_CHAN_A)
|
||||
tx_vfo = 0;
|
||||
return tx_vfo;
|
||||
}
|
||||
|
||||
void NUMBER_Get(char *pDigits, uint32_t *pInteger)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
8
misc.h
8
misc.h
@@ -32,12 +32,12 @@
|
||||
#define MIN(a, b) ({ __typeof__ (a) _a = (a); __typeof__ (b) _b = (b); _a < _b ? _a : _b; })
|
||||
#endif
|
||||
|
||||
#define IS_MR_CHANNEL(x) ((x) >= MR_CHANNEL_FIRST && (x) <= MR_CHANNEL_LAST)
|
||||
#define IS_MR_CHANNEL(x) ((x) <= MR_CHANNEL_LAST)
|
||||
#define IS_FREQ_CHANNEL(x) ((x) >= FREQ_CHANNEL_FIRST && (x) <= FREQ_CHANNEL_LAST)
|
||||
#define IS_VALID_CHANNEL(x) ((x) < LAST_CHANNEL)
|
||||
|
||||
#define IS_NOAA_CHANNEL(x) ((x) >= NOAA_CHANNEL_FIRST && (x) <= NOAA_CHANNEL_LAST)
|
||||
#define IS_NOT_NOAA_CHANNEL(x) ((x) >= MR_CHANNEL_FIRST && (x) <= FREQ_CHANNEL_LAST)
|
||||
#define IS_NOT_NOAA_CHANNEL(x) ((x) <= FREQ_CHANNEL_LAST)
|
||||
|
||||
enum {
|
||||
MR_CHANNEL_FIRST = 0,
|
||||
@@ -277,7 +277,6 @@ extern uint16_t gLowBatteryCountdown;
|
||||
extern uint8_t gNextMrChannel;
|
||||
extern ReceptionMode_t gRxReceptionMode;
|
||||
|
||||
extern uint8_t gRestoreMrChannel;
|
||||
extern scan_next_chan_t gCurrentScanList;
|
||||
extern uint32_t gRestoreFrequency;
|
||||
|
||||
@@ -324,9 +323,6 @@ extern int16_t gCurrentRSSI[2]; // now one per VFO
|
||||
extern uint8_t gIsLocked;
|
||||
extern volatile uint8_t boot_counter_10ms;
|
||||
|
||||
unsigned int get_tx_VFO(void);
|
||||
unsigned int get_rx_VFO(void);
|
||||
|
||||
void NUMBER_Get(char *pDigits, uint32_t *pInteger);
|
||||
void NUMBER_ToDigits(uint32_t Value, char *pDigits);
|
||||
int32_t NUMBER_AddWithWraparound(int32_t Base, int32_t Add, int32_t LowerLimit, int32_t UpperLimit);
|
||||
|
||||
39
radio.c
39
radio.c
@@ -161,20 +161,20 @@ void RADIO_ConfigureChannel(const unsigned int VFO, const unsigned int configure
|
||||
|
||||
if (IS_VALID_CHANNEL(Channel))
|
||||
{
|
||||
#ifdef ENABLE_NOAA
|
||||
if (Channel >= NOAA_CHANNEL_FIRST)
|
||||
{
|
||||
RADIO_InitInfo(pRadio, gEeprom.ScreenChannel[VFO], NoaaFrequencyTable[Channel - NOAA_CHANNEL_FIRST]);
|
||||
#ifdef ENABLE_NOAA
|
||||
if (Channel >= NOAA_CHANNEL_FIRST)
|
||||
{
|
||||
RADIO_InitInfo(pRadio, gEeprom.ScreenChannel[VFO], NoaaFrequencyTable[Channel - NOAA_CHANNEL_FIRST]);
|
||||
|
||||
if (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF)
|
||||
return;
|
||||
|
||||
gEeprom.CROSS_BAND_RX_TX = CROSS_BAND_OFF;
|
||||
|
||||
gUpdateStatus = true;
|
||||
if (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF)
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
gEeprom.CROSS_BAND_RX_TX = CROSS_BAND_OFF;
|
||||
|
||||
gUpdateStatus = true;
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (Channel <= MR_CHANNEL_LAST)
|
||||
{
|
||||
@@ -560,8 +560,7 @@ static void RADIO_SelectCurrentVfo(void)
|
||||
|
||||
void RADIO_SelectVfos(void)
|
||||
{
|
||||
gEeprom.TX_VFO = get_tx_VFO();
|
||||
gEeprom.RX_VFO = (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF) ? gEeprom.TX_VFO : (gEeprom.TX_VFO + 1) & 1u;
|
||||
gEeprom.RX_VFO = (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF) ? gEeprom.TX_VFO : !gEeprom.TX_VFO;
|
||||
|
||||
gTxVfo = &gEeprom.VfoInfo[gEeprom.TX_VFO];
|
||||
gRxVfo = &gEeprom.VfoInfo[gEeprom.RX_VFO];
|
||||
@@ -581,13 +580,11 @@ void RADIO_SetupRegisters(bool bSwitchToFunction0)
|
||||
|
||||
BK4819_ToggleGpioOut(BK4819_GPIO0_PIN28_GREEN, false);
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough="
|
||||
|
||||
switch (Bandwidth)
|
||||
{
|
||||
default:
|
||||
Bandwidth = BK4819_FILTER_BW_WIDE;
|
||||
[[fallthrough]];
|
||||
case BK4819_FILTER_BW_WIDE:
|
||||
case BK4819_FILTER_BW_NARROW:
|
||||
#ifdef ENABLE_AM_FIX
|
||||
@@ -599,8 +596,6 @@ void RADIO_SetupRegisters(bool bSwitchToFunction0)
|
||||
break;
|
||||
}
|
||||
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
BK4819_ToggleGpioOut(BK4819_GPIO1_PIN29_RED, false);
|
||||
|
||||
BK4819_SetupPowerAmplifier(0, 0);
|
||||
@@ -835,13 +830,11 @@ void RADIO_SetTxParameters(void)
|
||||
|
||||
BK4819_ToggleGpioOut(BK4819_GPIO6_PIN2, false);
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough="
|
||||
|
||||
switch (Bandwidth)
|
||||
{
|
||||
default:
|
||||
Bandwidth = BK4819_FILTER_BW_WIDE;
|
||||
[[fallthrough]];
|
||||
case BK4819_FILTER_BW_WIDE:
|
||||
case BK4819_FILTER_BW_NARROW:
|
||||
#ifdef ENABLE_AM_FIX
|
||||
@@ -853,8 +846,6 @@ void RADIO_SetTxParameters(void)
|
||||
break;
|
||||
}
|
||||
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
BK4819_SetFrequency(gCurrentVfo->pTX->Frequency);
|
||||
|
||||
// TX compressor
|
||||
|
||||
10
settings.c
10
settings.c
@@ -251,6 +251,16 @@ void SETTINGS_SaveChannel(uint8_t Channel, uint8_t VFO, const VFO_Info_t *pVFO,
|
||||
}
|
||||
}
|
||||
|
||||
void SETTINGS_SaveBatteryCalibration(const uint16_t * batteryCalibration)
|
||||
{
|
||||
uint16_t buf[4];
|
||||
EEPROM_WriteBuffer(0x1F40, batteryCalibration);
|
||||
EEPROM_ReadBuffer( 0x1F48, buf, sizeof(buf));
|
||||
buf[0] = batteryCalibration[4];
|
||||
buf[1] = batteryCalibration[5];
|
||||
EEPROM_WriteBuffer(0x1F48, buf);
|
||||
}
|
||||
|
||||
void SETTINGS_UpdateChannel(uint8_t Channel, const VFO_Info_t *pVFO, bool keep)
|
||||
{
|
||||
#ifdef ENABLE_NOAA
|
||||
|
||||
@@ -220,6 +220,7 @@ typedef struct {
|
||||
|
||||
uint8_t _pad[1];
|
||||
} EEPROM_Config_t;
|
||||
|
||||
extern EEPROM_Config_t gEeprom;
|
||||
|
||||
#ifdef ENABLE_FMRADIO
|
||||
@@ -228,6 +229,7 @@ extern EEPROM_Config_t gEeprom;
|
||||
void SETTINGS_SaveVfoIndices(void);
|
||||
void SETTINGS_SaveSettings(void);
|
||||
void SETTINGS_SaveChannel(uint8_t Channel, uint8_t VFO, const VFO_Info_t *pVFO, uint8_t Mode);
|
||||
void SETTINGS_SaveBatteryCalibration(const uint16_t * batteryCalibration);
|
||||
void SETTINGS_UpdateChannel(uint8_t Channel, const VFO_Info_t *pVFO, bool keep);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -29,7 +29,7 @@ void INPUTBOX_Append(const KEY_Code_t Digit)
|
||||
if (gInputBoxIndex == 0)
|
||||
memset(gInputBox, 10, sizeof(gInputBox));
|
||||
|
||||
if (Digit >= KEY_0 && Digit != KEY_INVALID)
|
||||
if (Digit != KEY_INVALID)
|
||||
gInputBox[gInputBoxIndex++] = (char)(Digit - KEY_0);
|
||||
}
|
||||
|
||||
|
||||
27
ui/main.c
27
ui/main.c
@@ -14,10 +14,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough="
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h> // abs()
|
||||
|
||||
@@ -46,23 +42,18 @@ center_line_t center_line = CENTER_LINE_NONE;
|
||||
|
||||
void UI_drawBars(uint8_t *p, const unsigned int level)
|
||||
{
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough="
|
||||
|
||||
switch (level)
|
||||
{
|
||||
default:
|
||||
case 7: memmove(p + 20, BITMAP_AntennaLevel6, sizeof(BITMAP_AntennaLevel6));
|
||||
case 6: memmove(p + 17, BITMAP_AntennaLevel5, sizeof(BITMAP_AntennaLevel5));
|
||||
case 5: memmove(p + 14, BITMAP_AntennaLevel4, sizeof(BITMAP_AntennaLevel4));
|
||||
case 4: memmove(p + 11, BITMAP_AntennaLevel3, sizeof(BITMAP_AntennaLevel3));
|
||||
case 3: memmove(p + 8, BITMAP_AntennaLevel2, sizeof(BITMAP_AntennaLevel2));
|
||||
case 2: memmove(p + 5, BITMAP_AntennaLevel1, sizeof(BITMAP_AntennaLevel1));
|
||||
case 7: memmove(p + 20, BITMAP_AntennaLevel6, sizeof(BITMAP_AntennaLevel6)); [[fallthrough]];
|
||||
case 6: memmove(p + 17, BITMAP_AntennaLevel5, sizeof(BITMAP_AntennaLevel5)); [[fallthrough]];
|
||||
case 5: memmove(p + 14, BITMAP_AntennaLevel4, sizeof(BITMAP_AntennaLevel4)); [[fallthrough]];
|
||||
case 4: memmove(p + 11, BITMAP_AntennaLevel3, sizeof(BITMAP_AntennaLevel3)); [[fallthrough]];
|
||||
case 3: memmove(p + 8, BITMAP_AntennaLevel2, sizeof(BITMAP_AntennaLevel2)); [[fallthrough]];
|
||||
case 2: memmove(p + 5, BITMAP_AntennaLevel1, sizeof(BITMAP_AntennaLevel1)); [[fallthrough]];
|
||||
case 1: memmove(p + 0, BITMAP_Antenna, sizeof(BITMAP_Antenna)); break;
|
||||
case 0: memset( p + 0, 0, sizeof(BITMAP_Antenna)); break;
|
||||
}
|
||||
|
||||
#pragma GCC diagnostic pop
|
||||
}
|
||||
|
||||
#ifdef ENABLE_AUDIO_BAR
|
||||
@@ -454,7 +445,7 @@ void UI_DisplayMain(void)
|
||||
#ifdef ENABLE_ALARM
|
||||
if (gCurrentFunction == FUNCTION_TRANSMIT && gAlarmState == ALARM_STATE_ALARM)
|
||||
{
|
||||
channel = (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF) ? gEeprom.RX_VFO : gEeprom.TX_VFO;
|
||||
uint8_t channel = (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF) ? gEeprom.RX_VFO : gEeprom.TX_VFO;
|
||||
if (channel == vfo_num)
|
||||
state = VFO_STATE_ALARM;
|
||||
}
|
||||
@@ -501,8 +492,6 @@ void UI_DisplayMain(void)
|
||||
|
||||
#endif
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough="
|
||||
|
||||
switch (gEeprom.CHANNEL_DISPLAY_MODE)
|
||||
{
|
||||
@@ -553,8 +542,6 @@ void UI_DisplayMain(void)
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
#pragma GCC diagnostic pop
|
||||
}
|
||||
else
|
||||
{ // frequency mode
|
||||
|
||||
176
ui/menu.c
176
ui/menu.c
@@ -36,56 +36,61 @@
|
||||
#include "ui/menu.h"
|
||||
#include "ui/ui.h"
|
||||
|
||||
// NOTE. this menu list is half way through a change, what might seem
|
||||
// pointless at this time is for there for a reason.
|
||||
//
|
||||
const t_menu_item MenuList[] =
|
||||
{
|
||||
// text, voice ID, menu ID
|
||||
|
||||
{"Sql", VOICE_ID_SQUELCH, MENU_SQL },
|
||||
{"Step", VOICE_ID_FREQUENCY_STEP, MENU_STEP },
|
||||
{"TxPwr", VOICE_ID_POWER, MENU_TXP }, // was "TXP"
|
||||
{"RxDCS", VOICE_ID_DCS, MENU_R_DCS }, // was "R_DCS"
|
||||
{"RxCTCS", VOICE_ID_CTCSS, MENU_R_CTCS }, // was "R_CTCS"
|
||||
{"TxDCS", VOICE_ID_DCS, MENU_T_DCS }, // was "T_DCS"
|
||||
{"TxCTCS", VOICE_ID_CTCSS, MENU_T_CTCS }, // was "T_CTCS"
|
||||
{"TxODir", VOICE_ID_TX_OFFSET_FREQUENCY_DIRECTION, MENU_SFT_D }, // was "SFT_D"
|
||||
{"TxODir", VOICE_ID_TX_OFFSET_FREQUENCY_DIRECTION, MENU_SFT_D }, // was "SFT_D"
|
||||
{"TxOffs", VOICE_ID_TX_OFFSET_FREQUENCY, MENU_OFFSET }, // was "OFFSET"
|
||||
{"TxTOut", VOICE_ID_TRANSMIT_OVER_TIME, MENU_TOT }, // was "TOT"
|
||||
{"W/N", VOICE_ID_CHANNEL_BANDWIDTH, MENU_W_N },
|
||||
{"Scramb", VOICE_ID_SCRAMBLER_ON, MENU_SCR }, // was "SCR"
|
||||
{"BusyCL", VOICE_ID_BUSY_LOCKOUT, MENU_BCL }, // was "BCL"
|
||||
{"Compnd", VOICE_ID_INVALID, MENU_COMPAND },
|
||||
{"Demodu", VOICE_ID_INVALID, MENU_AM }, // was "AM"
|
||||
{"ScAdd1", VOICE_ID_INVALID, MENU_S_ADD1 },
|
||||
{"ScAdd2", VOICE_ID_INVALID, MENU_S_ADD2 },
|
||||
{"ChSave", VOICE_ID_MEMORY_CHANNEL, MENU_MEM_CH }, // was "MEM-CH"
|
||||
{"ChDele", VOICE_ID_DELETE_CHANNEL, MENU_DEL_CH }, // was "DEL-CH"
|
||||
{"ChName", VOICE_ID_INVALID, MENU_MEM_NAME },
|
||||
{"ChDisp", VOICE_ID_INVALID, MENU_MDF }, // was "MDF"
|
||||
{"BatSav", VOICE_ID_SAVE_MODE, MENU_SAVE }, // was "SAVE"
|
||||
#ifdef ENABLE_VOX
|
||||
{"VOX", VOICE_ID_VOX, MENU_VOX },
|
||||
{"ChDele", VOICE_ID_DELETE_CHANNEL, MENU_DEL_CH }, // was "DEL-CH"
|
||||
{"ChName", VOICE_ID_INVALID, MENU_MEM_NAME },
|
||||
|
||||
{"SList", VOICE_ID_INVALID, MENU_S_LIST },
|
||||
{"SList1", VOICE_ID_INVALID, MENU_SLIST1 },
|
||||
{"SList2", VOICE_ID_INVALID, MENU_SLIST2 },
|
||||
{"ScnRev", VOICE_ID_INVALID, MENU_SC_REV },
|
||||
#ifdef ENABLE_NOAA
|
||||
{"NOAA-S", VOICE_ID_INVALID, MENU_NOAA_S },
|
||||
#endif
|
||||
{"BackLt", VOICE_ID_INVALID, MENU_ABR }, // was "ABR"
|
||||
|
||||
{"F1Shrt", VOICE_ID_INVALID, MENU_F1SHRT },
|
||||
{"F1Long", VOICE_ID_INVALID, MENU_F1LONG },
|
||||
{"F2Shrt", VOICE_ID_INVALID, MENU_F2SHRT },
|
||||
{"F2Long", VOICE_ID_INVALID, MENU_F2LONG },
|
||||
|
||||
{"KeyLck", VOICE_ID_INVALID, MENU_AUTOLK }, // was "AUTOLk"
|
||||
{"TxTOut", VOICE_ID_TRANSMIT_OVER_TIME, MENU_TOT }, // was "TOT"
|
||||
{"BatSav", VOICE_ID_SAVE_MODE, MENU_SAVE }, // was "SAVE"
|
||||
{"Mic", VOICE_ID_INVALID, MENU_MIC },
|
||||
#ifdef ENABLE_AUDIO_BAR
|
||||
{"MicBar", VOICE_ID_INVALID, MENU_MIC_BAR },
|
||||
#endif
|
||||
{"ChDisp", VOICE_ID_INVALID, MENU_MDF }, // was "MDF"
|
||||
{"POnMsg", VOICE_ID_INVALID, MENU_PONMSG },
|
||||
{"BatTxt", VOICE_ID_INVALID, MENU_BAT_TXT },
|
||||
{"BackLt", VOICE_ID_INVALID, MENU_ABR }, // was "ABR"
|
||||
{"BltTRX", VOICE_ID_INVALID, MENU_ABR_ON_TX_RX },
|
||||
{"RxMode", VOICE_ID_DUAL_STANDBY, MENU_TDR },
|
||||
{"Beep", VOICE_ID_BEEP_PROMPT, MENU_BEEP },
|
||||
#ifdef ENABLE_VOICE
|
||||
{"Voice", VOICE_ID_VOICE_PROMPT, MENU_VOICE },
|
||||
#endif
|
||||
{"ScnRev", VOICE_ID_INVALID, MENU_SC_REV },
|
||||
{"KeyLck", VOICE_ID_INVALID, MENU_AUTOLK }, // was "AUTOLk"
|
||||
{"ScAdd1", VOICE_ID_INVALID, MENU_S_ADD1 },
|
||||
{"ScAdd2", VOICE_ID_INVALID, MENU_S_ADD2 },
|
||||
{"Roger", VOICE_ID_INVALID, MENU_ROGER },
|
||||
{"STE", VOICE_ID_INVALID, MENU_STE },
|
||||
{"RP STE", VOICE_ID_INVALID, MENU_RP_STE },
|
||||
{"Mic", VOICE_ID_INVALID, MENU_MIC },
|
||||
#ifdef ENABLE_AUDIO_BAR
|
||||
{"MicBar", VOICE_ID_INVALID, MENU_MIC_BAR },
|
||||
#endif
|
||||
{"Compnd", VOICE_ID_INVALID, MENU_COMPAND },
|
||||
{"1 Call", VOICE_ID_INVALID, MENU_1_CALL },
|
||||
{"SList", VOICE_ID_INVALID, MENU_S_LIST },
|
||||
{"SList1", VOICE_ID_INVALID, MENU_SLIST1 },
|
||||
{"SList2", VOICE_ID_INVALID, MENU_SLIST2 },
|
||||
#ifdef ENABLE_ALARM
|
||||
{"AlarmT", VOICE_ID_INVALID, MENU_AL_MOD },
|
||||
#endif
|
||||
@@ -94,47 +99,45 @@ const t_menu_item MenuList[] =
|
||||
{"DWCode", VOICE_ID_INVALID, MENU_DWCODE },
|
||||
{"PTT ID", VOICE_ID_INVALID, MENU_PTT_ID },
|
||||
{"D ST", VOICE_ID_INVALID, MENU_D_ST },
|
||||
{"D Resp", VOICE_ID_INVALID, MENU_D_RSP },
|
||||
{"D Resp", VOICE_ID_INVALID, MENU_D_RSP },
|
||||
{"D Hold", VOICE_ID_INVALID, MENU_D_HOLD },
|
||||
{"D Prel", VOICE_ID_INVALID, MENU_D_PRE },
|
||||
{"D Prel", VOICE_ID_INVALID, MENU_D_PRE },
|
||||
{"D Decd", 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 },
|
||||
{"Roger", VOICE_ID_INVALID, MENU_ROGER },
|
||||
{"BatVol", VOICE_ID_INVALID, MENU_VOL }, // was "VOL"
|
||||
{"BatTxt", VOICE_ID_INVALID, MENU_BAT_TXT },
|
||||
{"Demodu", VOICE_ID_INVALID, MENU_AM }, // was "AM"
|
||||
#ifdef ENABLE_AM_FIX
|
||||
{"AM Fix", VOICE_ID_INVALID, MENU_AM_FIX },
|
||||
#endif
|
||||
#ifdef ENABLE_AM_FIX_TEST1
|
||||
{"AM FT1", VOICE_ID_INVALID, MENU_AM_FIX_TEST1 },
|
||||
#endif
|
||||
#ifdef ENABLE_NOAA
|
||||
{"NOAA-S", VOICE_ID_INVALID, MENU_NOAA_S },
|
||||
#ifdef ENABLE_VOX
|
||||
{"VOX", VOICE_ID_VOX, MENU_VOX },
|
||||
#endif
|
||||
{"Reset", VOICE_ID_INITIALISATION, MENU_RESET }, // might be better to move this to the hidden menu items ?
|
||||
{"BatVol", VOICE_ID_INVALID, MENU_VOL }, // was "VOL"
|
||||
{"RxMode", VOICE_ID_DUAL_STANDBY, MENU_TDR },
|
||||
{"Sql", VOICE_ID_SQUELCH, MENU_SQL },
|
||||
|
||||
// hidden menu items from here on
|
||||
// enabled if pressing both the PTT and upper side button at power-on
|
||||
|
||||
{"F Lock", VOICE_ID_INVALID, MENU_F_LOCK },
|
||||
{"Tx 200", VOICE_ID_INVALID, MENU_200TX }, // was "200TX"
|
||||
{"Tx 350", VOICE_ID_INVALID, MENU_350TX }, // was "350TX"
|
||||
{"Tx 500", VOICE_ID_INVALID, MENU_500TX }, // was "500TX"
|
||||
{"350 En", VOICE_ID_INVALID, MENU_350EN }, // was "350EN"
|
||||
{"ScraEn", VOICE_ID_INVALID, MENU_SCREN }, // was "SCREN"
|
||||
|
||||
{"TxEnab", VOICE_ID_INVALID, MENU_TX_EN }, // enable TX
|
||||
{"TxEnab", VOICE_ID_INVALID, MENU_TX_EN }, // enable TX
|
||||
#ifdef ENABLE_F_CAL_MENU
|
||||
{"FrCali", VOICE_ID_INVALID, MENU_F_CALI }, // reference xtal calibration
|
||||
#endif
|
||||
{"BatCal", VOICE_ID_INVALID, MENU_BATCAL }, // battery voltage calibration
|
||||
{"Reset", VOICE_ID_INITIALISATION, MENU_RESET }, // might be better to move this to the hidden menu items ?
|
||||
|
||||
{"", VOICE_ID_INVALID, 0xff } // end of list - DO NOT delete or move this this
|
||||
};
|
||||
|
||||
const uint8_t FIRST_HIDDEN_MENU_ITEM = MENU_F_LOCK;
|
||||
|
||||
const char gSubMenu_TXP[3][5] =
|
||||
{
|
||||
"LOW",
|
||||
@@ -187,10 +190,10 @@ const char gSubMenu_TOT[11][7] =
|
||||
|
||||
const char* gSubMenu_RXMode[4] =
|
||||
{
|
||||
"MAIN\nONLY", // TX and RX on main only
|
||||
"MAIN\nONLY", // TX and RX on main only
|
||||
"DUAL RX\nRESPOND", // Watch both and respond
|
||||
"CROSS\nBAND", // TX on main, RX on secondary
|
||||
"MAIN TX\nDUAL RX" // always TX on main, but RX on both
|
||||
"CROSS\nBAND", // TX on main, RX on secondary
|
||||
"MAIN TX\nDUAL RX" // always TX on main, but RX on both
|
||||
};
|
||||
|
||||
#ifdef ENABLE_VOICE
|
||||
@@ -250,7 +253,7 @@ const char gSubMenu_PONMSG[4][8] =
|
||||
"NONE"
|
||||
};
|
||||
|
||||
const char gSubMenu_ROGER[3][9] =
|
||||
const char* gSubMenu_ROGER[3] =
|
||||
{
|
||||
"OFF",
|
||||
"ROGER",
|
||||
@@ -325,8 +328,38 @@ const char gSubMenu_SCRAMBLER[11][7] =
|
||||
"3500Hz"
|
||||
};
|
||||
|
||||
|
||||
const t_sidefunction SIDEFUNCTIONS[] =
|
||||
{
|
||||
{"NONE", ACTION_OPT_NONE},
|
||||
{"FLASH\nLIGHT", ACTION_OPT_FLASHLIGHT},
|
||||
{"POWER", ACTION_OPT_POWER},
|
||||
{"MONITOR", ACTION_OPT_MONITOR},
|
||||
{"SCAN", ACTION_OPT_SCAN},
|
||||
#ifdef ENABLE_VOX
|
||||
{"VOX", ACTION_OPT_VOX},
|
||||
#endif
|
||||
#ifdef ENABLE_ALARM
|
||||
{"ALARM", ACTION_OPT_ALARM},
|
||||
#endif
|
||||
#ifdef ENABLE_FMRADIO
|
||||
{"FM RADIO", ACTION_OPT_FM},
|
||||
#endif
|
||||
#ifdef ENABLE_TX1750
|
||||
{"1750HZ", ACTION_OPT_1750},
|
||||
#endif
|
||||
};
|
||||
const t_sidefunction* gSubMenu_SIDEFUNCTIONS = SIDEFUNCTIONS;
|
||||
const uint8_t gSubMenu_SIDEFUNCTIONS_size = ARRAY_SIZE(SIDEFUNCTIONS);
|
||||
|
||||
bool gIsInSubMenu;
|
||||
uint8_t gMenuCursor;
|
||||
int GetCurrentMenuId() {
|
||||
if(gMenuCursor < ARRAY_SIZE(MenuList))
|
||||
return MenuList[gMenuCursor].menu_id;
|
||||
else
|
||||
return MenuList[ARRAY_SIZE(MenuList)-1].menu_id;
|
||||
}
|
||||
int8_t gMenuScrollDirection;
|
||||
int32_t gSubMenuSelection;
|
||||
|
||||
@@ -430,10 +463,7 @@ void UI_DisplayMenu(void)
|
||||
|
||||
bool already_printed = false;
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough="
|
||||
|
||||
switch (gMenuCursor)
|
||||
switch (GetCurrentMenuId())
|
||||
{
|
||||
case MENU_SQL:
|
||||
sprintf(String, "%d", gSubMenuSelection);
|
||||
@@ -476,7 +506,7 @@ void UI_DisplayMenu(void)
|
||||
{
|
||||
#if 1
|
||||
unsigned int Code;
|
||||
FREQ_Config_t *pConfig = (gMenuCursor == MENU_R_CTCS) ? &gTxVfo->freq_config_RX : &gTxVfo->freq_config_TX;
|
||||
FREQ_Config_t *pConfig = (GetCurrentMenuId() == MENU_R_CTCS) ? &gTxVfo->freq_config_RX : &gTxVfo->freq_config_TX;
|
||||
if (gSubMenuSelection == 0)
|
||||
{
|
||||
strcpy(String, "OFF");
|
||||
@@ -797,9 +827,15 @@ void UI_DisplayMenu(void)
|
||||
sprintf(String, "%u.%02uV\n%u", vol / 100, vol % 100, gSubMenuSelection);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
case MENU_F1SHRT:
|
||||
case MENU_F1LONG:
|
||||
case MENU_F2SHRT:
|
||||
case MENU_F2LONG:
|
||||
strcpy(String, gSubMenu_SIDEFUNCTIONS[gSubMenuSelection].name);
|
||||
break;
|
||||
|
||||
#pragma GCC diagnostic pop
|
||||
}
|
||||
|
||||
if (!already_printed)
|
||||
{ // we now do multi-line text in a single string
|
||||
@@ -855,9 +891,9 @@ void UI_DisplayMenu(void)
|
||||
}
|
||||
}
|
||||
|
||||
if (gMenuCursor == MENU_SLIST1 || gMenuCursor == MENU_SLIST2)
|
||||
if (GetCurrentMenuId() == MENU_SLIST1 || GetCurrentMenuId() == MENU_SLIST2)
|
||||
{
|
||||
i = (gMenuCursor == MENU_SLIST1) ? 0 : 1;
|
||||
i = (GetCurrentMenuId() == MENU_SLIST1) ? 0 : 1;
|
||||
|
||||
// if (gSubMenuSelection == 0xFF)
|
||||
if (gSubMenuSelection < 0)
|
||||
@@ -902,9 +938,9 @@ void UI_DisplayMenu(void)
|
||||
}
|
||||
}
|
||||
|
||||
if (gMenuCursor == MENU_MEM_CH ||
|
||||
gMenuCursor == MENU_DEL_CH ||
|
||||
gMenuCursor == MENU_1_CALL)
|
||||
if (GetCurrentMenuId() == MENU_MEM_CH ||
|
||||
GetCurrentMenuId() == MENU_DEL_CH ||
|
||||
GetCurrentMenuId() == MENU_1_CALL)
|
||||
{ // display the channel name
|
||||
char s[11];
|
||||
BOARD_fetchChannelName(s, gSubMenuSelection);
|
||||
@@ -913,18 +949,18 @@ void UI_DisplayMenu(void)
|
||||
UI_PrintString(s, menu_item_x1, menu_item_x2, 2, 8);
|
||||
}
|
||||
|
||||
if ((gMenuCursor == MENU_R_CTCS || gMenuCursor == MENU_R_DCS) && gCssScanMode != CSS_SCAN_MODE_OFF)
|
||||
if ((GetCurrentMenuId() == MENU_R_CTCS || GetCurrentMenuId() == MENU_R_DCS) && gCssScanMode != CSS_SCAN_MODE_OFF)
|
||||
UI_PrintString("SCAN", menu_item_x1, menu_item_x2, 4, 8);
|
||||
|
||||
if (gMenuCursor == MENU_UPCODE)
|
||||
if (GetCurrentMenuId() == MENU_UPCODE)
|
||||
if (strlen(gEeprom.DTMF_UP_CODE) > 8)
|
||||
UI_PrintString(gEeprom.DTMF_UP_CODE + 8, menu_item_x1, menu_item_x2, 4, 8);
|
||||
|
||||
if (gMenuCursor == MENU_DWCODE)
|
||||
if (GetCurrentMenuId() == MENU_DWCODE)
|
||||
if (strlen(gEeprom.DTMF_DOWN_CODE) > 8)
|
||||
UI_PrintString(gEeprom.DTMF_DOWN_CODE + 8, menu_item_x1, menu_item_x2, 4, 8);
|
||||
|
||||
if (gMenuCursor == MENU_D_LIST && gIsDtmfContactValid)
|
||||
if (GetCurrentMenuId() == MENU_D_LIST && gIsDtmfContactValid)
|
||||
{
|
||||
Contact[11] = 0;
|
||||
memmove(&gDTMF_ID, Contact + 8, 4);
|
||||
@@ -932,22 +968,22 @@ void UI_DisplayMenu(void)
|
||||
UI_PrintString(String, menu_item_x1, menu_item_x2, 4, 8);
|
||||
}
|
||||
|
||||
if (gMenuCursor == MENU_R_CTCS ||
|
||||
gMenuCursor == MENU_T_CTCS ||
|
||||
gMenuCursor == MENU_R_DCS ||
|
||||
gMenuCursor == MENU_T_DCS ||
|
||||
gMenuCursor == MENU_D_LIST)
|
||||
if (GetCurrentMenuId() == MENU_R_CTCS ||
|
||||
GetCurrentMenuId() == MENU_T_CTCS ||
|
||||
GetCurrentMenuId() == MENU_R_DCS ||
|
||||
GetCurrentMenuId() == MENU_T_DCS ||
|
||||
GetCurrentMenuId() == MENU_D_LIST)
|
||||
{
|
||||
unsigned int Offset;
|
||||
NUMBER_ToDigits(gSubMenuSelection, String);
|
||||
Offset = (gMenuCursor == MENU_D_LIST) ? 2 : 3;
|
||||
Offset = (GetCurrentMenuId() == MENU_D_LIST) ? 2 : 3;
|
||||
UI_DisplaySmallDigits(Offset, String + (8 - Offset), 105, 0, false);
|
||||
}
|
||||
|
||||
if ((gMenuCursor == MENU_RESET ||
|
||||
gMenuCursor == MENU_MEM_CH ||
|
||||
gMenuCursor == MENU_MEM_NAME ||
|
||||
gMenuCursor == MENU_DEL_CH) && gAskForConfirmation)
|
||||
if ((GetCurrentMenuId() == MENU_RESET ||
|
||||
GetCurrentMenuId() == MENU_MEM_CH ||
|
||||
GetCurrentMenuId() == MENU_MEM_NAME ||
|
||||
GetCurrentMenuId() == MENU_DEL_CH) && gAskForConfirmation)
|
||||
{ // display confirmation
|
||||
strcpy(String, (gAskForConfirmation == 1) ? "SURE?" : "WAIT!");
|
||||
UI_PrintString(String, menu_item_x1, menu_item_x2, 5, 8);
|
||||
|
||||
17
ui/menu.h
17
ui/menu.h
@@ -102,9 +102,6 @@ enum
|
||||
MENU_NOAA_S,
|
||||
#endif
|
||||
MENU_RESET,
|
||||
|
||||
// items after here are normally hidden
|
||||
|
||||
MENU_F_LOCK,
|
||||
MENU_200TX,
|
||||
MENU_350TX,
|
||||
@@ -116,9 +113,14 @@ enum
|
||||
#ifdef ENABLE_F_CAL_MENU
|
||||
MENU_F_CALI, // reference xtal calibration
|
||||
#endif
|
||||
MENU_BATCAL // battery voltage calibration
|
||||
MENU_BATCAL, // battery voltage calibration
|
||||
MENU_F1SHRT,
|
||||
MENU_F1LONG,
|
||||
MENU_F2SHRT,
|
||||
MENU_F2LONG
|
||||
};
|
||||
|
||||
extern const uint8_t FIRST_HIDDEN_MENU_ITEM;
|
||||
extern const t_menu_item MenuList[];
|
||||
|
||||
extern const char gSubMenu_TXP[3][5];
|
||||
@@ -140,7 +142,7 @@ extern const char* gSubMenu_MDF[4];
|
||||
extern const char gSubMenu_D_RSP[4][11];
|
||||
extern const char* gSubMenu_PTT_ID[5];
|
||||
extern const char gSubMenu_PONMSG[4][8];
|
||||
extern const char gSubMenu_ROGER[3][9];
|
||||
extern const char* gSubMenu_ROGER[3];
|
||||
extern const char gSubMenu_RESET[2][4];
|
||||
extern const char gSubMenu_F_LOCK[6][4];
|
||||
extern const char gSubMenu_BACKLIGHT[8][7];
|
||||
@@ -151,10 +153,15 @@ extern const char gSubMenu_RX_TX[4][6];
|
||||
extern const char gSubMenu_BAT_TXT[3][8];
|
||||
|
||||
extern const char gSubMenu_SCRAMBLER[11][7];
|
||||
|
||||
typedef struct {char* name; uint8_t id;} t_sidefunction;
|
||||
extern const uint8_t gSubMenu_SIDEFUNCTIONS_size;
|
||||
extern const t_sidefunction* gSubMenu_SIDEFUNCTIONS;
|
||||
|
||||
extern bool gIsInSubMenu;
|
||||
|
||||
extern uint8_t gMenuCursor;
|
||||
int GetCurrentMenuId();
|
||||
extern int8_t gMenuScrollDirection;
|
||||
extern int32_t gSubMenuSelection;
|
||||
|
||||
|
||||
28
ui/status.c
28
ui/status.c
@@ -88,7 +88,7 @@ void UI_DisplayStatus(const bool test_display)
|
||||
// SCAN indicator
|
||||
if (gScanStateDir != SCAN_OFF || gScreenToDisplay == DISPLAY_SCANNER || test_display)
|
||||
{
|
||||
if (gNextMrChannel <= MR_CHANNEL_LAST)
|
||||
if (gNextMrChannel <= MR_CHANNEL_LAST && gScreenToDisplay != DISPLAY_SCANNER)
|
||||
{ // channel mode
|
||||
if (gEeprom.SCAN_LIST_DEFAULT == 0)
|
||||
UI_PrintStringSmallBuffer("1", line + x);
|
||||
@@ -114,22 +114,24 @@ void UI_DisplayStatus(const bool test_display)
|
||||
memmove(line + x, BITMAP_VoicePrompt, sizeof(BITMAP_VoicePrompt));
|
||||
x1 = x + sizeof(BITMAP_VoicePrompt);
|
||||
}
|
||||
x += sizeof(BITMAP_VoicePrompt) + 2;
|
||||
x += sizeof(BITMAP_VoicePrompt) + 1;
|
||||
#else
|
||||
// hmmm, what to put in it's place
|
||||
#endif
|
||||
|
||||
uint8_t dw = (gEeprom.DUAL_WATCH != DUAL_WATCH_OFF) + (gEeprom.CROSS_BAND_RX_TX != CROSS_BAND_OFF) * 2;
|
||||
if(dw == 1 || dw == 3 || test_display) { // DWR - dual watch + respond
|
||||
if(gDualWatchActive || test_display)
|
||||
memmove(line + x, BITMAP_TDR1, sizeof(BITMAP_TDR1) - (dw==1?0:5));
|
||||
else
|
||||
memmove(line + x + 3, BITMAP_TDR2, sizeof(BITMAP_TDR2));
|
||||
x++;
|
||||
if(gScreenToDisplay != DISPLAY_SCANNER) {
|
||||
uint8_t dw = (gEeprom.DUAL_WATCH != DUAL_WATCH_OFF) + (gEeprom.CROSS_BAND_RX_TX != CROSS_BAND_OFF) * 2;
|
||||
if(dw == 1 || dw == 3 || test_display) { // DWR - dual watch + respond
|
||||
if(gDualWatchActive || test_display)
|
||||
memmove(line + x, BITMAP_TDR1, sizeof(BITMAP_TDR1) - (dw==1?0:5));
|
||||
else
|
||||
memmove(line + x + 3, BITMAP_TDR2, sizeof(BITMAP_TDR2));
|
||||
}
|
||||
else if(dw == 2) { // XB - crossband
|
||||
memmove(line + x, BITMAP_XB, sizeof(BITMAP_XB));
|
||||
}
|
||||
}
|
||||
else if(dw == 2) { // XB - crossband
|
||||
memmove(line + x, BITMAP_XB, sizeof(BITMAP_XB));
|
||||
}
|
||||
|
||||
x += sizeof(BITMAP_TDR1) + 2;
|
||||
|
||||
#ifdef ENABLE_VOX
|
||||
@@ -142,7 +144,7 @@ void UI_DisplayStatus(const bool test_display)
|
||||
x += sizeof(BITMAP_VOX) + 2;
|
||||
#endif
|
||||
|
||||
x = MAX(x, 61);
|
||||
x = MAX(x, 61u);
|
||||
x1 = x;
|
||||
|
||||
// KEY-LOCK indicator
|
||||
|
||||
Reference in New Issue
Block a user