Compare commits
22 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f11d0fbcda | ||
|
|
96144af9e9 | ||
|
|
4dd2445833 | ||
|
|
6172d942be | ||
|
|
0c0cbb232c | ||
|
|
298ff29cf4 | ||
|
|
f70707e17f | ||
|
|
f1fc04591c | ||
|
|
a26c397417 | ||
|
|
d3a2a7bee9 | ||
|
|
d817ff7e6a | ||
|
|
ec4bec5b1f | ||
|
|
d7c458839c | ||
|
|
cff2f25e56 | ||
|
|
63ac84883e | ||
|
|
f8252df281 | ||
|
|
be00bb99ad | ||
|
|
7e6a78ab6c | ||
|
|
06c2ddf543 | ||
|
|
47f1e80252 | ||
|
|
64bc29d362 | ||
|
|
8d17f5922c |
4
Makefile
4
Makefile
@@ -25,7 +25,7 @@ ENABLE_F_CAL_MENU := 0
|
||||
ENABLE_CTCSS_TAIL_PHASE_SHIFT := 1
|
||||
ENABLE_BOOT_BEEPS := 0
|
||||
ENABLE_SHOW_CHARGE_LEVEL := 1
|
||||
ENABLE_REVERSE_BAT_SYMBOL := 1
|
||||
ENABLE_REVERSE_BAT_SYMBOL := 0
|
||||
ENABLE_CODE_SCAN_TIMEOUT := 0
|
||||
ENABLE_AM_FIX := 1
|
||||
ENABLE_AM_FIX_SHOW_DATA := 0
|
||||
@@ -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)\"
|
||||
|
||||
52
app/action.c
52
app/action.c
@@ -45,6 +45,7 @@ static void ACTION_FlashLight(void)
|
||||
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_FLASHLIGHT);
|
||||
break;
|
||||
case 1:
|
||||
case 2:
|
||||
gFlashLightState++;
|
||||
break;
|
||||
default:
|
||||
@@ -192,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;
|
||||
|
||||
@@ -211,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);
|
||||
@@ -234,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;
|
||||
|
||||
@@ -325,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;
|
||||
@@ -350,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
|
||||
|
||||
517
app/app.c
517
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,90 +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 &&
|
||||
@@ -1288,16 +1148,15 @@ void APP_Update(void)
|
||||
// called every 10ms
|
||||
void APP_CheckKeys(void)
|
||||
{
|
||||
KEY_Code_t Key;
|
||||
|
||||
#ifdef ENABLE_AIRCOPY
|
||||
if (gSetting_KILLED || (gScreenToDisplay == DISPLAY_AIRCOPY && gAircopyState != AIRCOPY_READY))
|
||||
return;
|
||||
#else
|
||||
if (gSetting_KILLED)
|
||||
return;
|
||||
#endif
|
||||
#ifdef ENABLE_AIRCOPY
|
||||
if (gSetting_KILLED || (gScreenToDisplay == DISPLAY_AIRCOPY && gAircopyState != AIRCOPY_READY))
|
||||
return;
|
||||
#else
|
||||
if (gSetting_KILLED)
|
||||
return;
|
||||
#endif
|
||||
|
||||
// -------------------- PTT ------------------------
|
||||
if (gPttIsPressed)
|
||||
{
|
||||
if (GPIO_CheckBit(&GPIOC->DATA, GPIOC_PIN_PTT) || gSerialConfigCountDown_500ms > 0)
|
||||
@@ -1313,8 +1172,7 @@ void APP_CheckKeys(void)
|
||||
else
|
||||
gPttDebounceCounter = 0;
|
||||
}
|
||||
else
|
||||
if (!GPIO_CheckBit(&GPIOC->DATA, GPIOC_PIN_PTT) && gSerialConfigCountDown_500ms == 0)
|
||||
else if (!GPIO_CheckBit(&GPIOC->DATA, GPIOC_PIN_PTT) && gSerialConfigCountDown_500ms == 0)
|
||||
{ // PTT pressed
|
||||
if (++gPttDebounceCounter >= 3) // 30ms
|
||||
{ // start transmitting
|
||||
@@ -1327,16 +1185,16 @@ void APP_CheckKeys(void)
|
||||
else
|
||||
gPttDebounceCounter = 0;
|
||||
|
||||
// *****************
|
||||
// --------------------- OTHER KEYS ----------------------------
|
||||
|
||||
// scan the hardware keys
|
||||
Key = KEYBOARD_Poll();
|
||||
KEY_Code_t Key = KEYBOARD_Poll();
|
||||
|
||||
if (Key != KEY_INVALID)
|
||||
if (Key != KEY_INVALID) // any key pressed
|
||||
boot_counter_10ms = 0; // cancel boot screen/beeps if any key pressed
|
||||
|
||||
if (gKeyReading0 != Key)
|
||||
{ // new key pressed
|
||||
if (gKeyReading0 != Key) // new key pressed
|
||||
{
|
||||
|
||||
if (gKeyReading0 != KEY_INVALID && Key != KEY_INVALID)
|
||||
APP_ProcessKey(gKeyReading1, false, gKeyBeingHeld); // key pressed without releasing previous key
|
||||
@@ -1346,18 +1204,19 @@ void APP_CheckKeys(void)
|
||||
return;
|
||||
}
|
||||
|
||||
if (++gDebounceCounter == key_debounce_10ms)
|
||||
{ // debounced new key pressed
|
||||
gDebounceCounter++;
|
||||
|
||||
if (Key == KEY_INVALID)
|
||||
if (gDebounceCounter == key_debounce_10ms) // debounced new key pressed
|
||||
{
|
||||
if (Key == KEY_INVALID) //all PTT keys released
|
||||
{
|
||||
if (gKeyReading1 != KEY_INVALID)
|
||||
if (gKeyReading1 != KEY_INVALID) // some button was pressed before
|
||||
{
|
||||
APP_ProcessKey(gKeyReading1, false, gKeyBeingHeld);
|
||||
APP_ProcessKey(gKeyReading1, false, gKeyBeingHeld); // process last button released event
|
||||
gKeyReading1 = KEY_INVALID;
|
||||
}
|
||||
}
|
||||
else
|
||||
else // process new key pressed
|
||||
{
|
||||
gKeyReading1 = Key;
|
||||
APP_ProcessKey(Key, true, false);
|
||||
@@ -1367,21 +1226,19 @@ void APP_CheckKeys(void)
|
||||
return;
|
||||
}
|
||||
|
||||
if (gDebounceCounter < key_repeat_delay_10ms)
|
||||
if (gDebounceCounter < key_repeat_delay_10ms || Key == KEY_INVALID) // the button is not held long enough for repeat yet, or not really pressed
|
||||
return;
|
||||
|
||||
// key is being held pressed
|
||||
|
||||
if (gDebounceCounter == key_repeat_delay_10ms)
|
||||
{ // initial key repeat delay after pressed
|
||||
if (gDebounceCounter == key_repeat_delay_10ms) //initial key repeat with longer delay
|
||||
{
|
||||
if (Key != KEY_PTT)
|
||||
{
|
||||
gKeyBeingHeld = true;
|
||||
APP_ProcessKey(Key, true, true);
|
||||
}
|
||||
}
|
||||
else
|
||||
{ // key repeat
|
||||
else //subsequent fast key repeats
|
||||
{
|
||||
if (Key == KEY_UP || Key == KEY_DOWN)
|
||||
{
|
||||
gKeyBeingHeld = true;
|
||||
@@ -1392,7 +1249,7 @@ void APP_CheckKeys(void)
|
||||
if (gDebounceCounter < 0xFFFF)
|
||||
return;
|
||||
|
||||
gDebounceCounter = key_repeat_delay_10ms;
|
||||
gDebounceCounter = key_repeat_delay_10ms+1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1451,6 +1308,35 @@ void APP_TimeSlice10ms(void)
|
||||
|
||||
if (gFlashLightState == FLASHLIGHT_BLINK && (gFlashLightBlinkCounter & 15u) == 0)
|
||||
GPIO_FlipBit(&GPIOC->DATA, GPIOC_PIN_FLASHLIGHT);
|
||||
else if(gFlashLightState == FLASHLIGHT_SOS) {
|
||||
const uint16_t u = 15;
|
||||
static uint8_t c;
|
||||
static uint16_t next;
|
||||
|
||||
if(gFlashLightBlinkCounter - next > 7*u) {
|
||||
c = 0;
|
||||
next = gFlashLightBlinkCounter+1;
|
||||
}
|
||||
else if(gFlashLightBlinkCounter == next) {
|
||||
if(c==0) {
|
||||
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_FLASHLIGHT);
|
||||
}
|
||||
else
|
||||
GPIO_FlipBit(&GPIOC->DATA, GPIOC_PIN_FLASHLIGHT);
|
||||
|
||||
if(c == 18) {
|
||||
next += 7*u;
|
||||
c = 0;
|
||||
}
|
||||
else if(c==7 || c==9 || c==11)
|
||||
next += 3*u;
|
||||
else
|
||||
next += u;
|
||||
|
||||
c++;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#ifdef ENABLE_VOX
|
||||
if (gVoxResumeCountdown > 0)
|
||||
@@ -1763,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
|
||||
@@ -1827,7 +1713,7 @@ void APP_TimeSlice500ms(void)
|
||||
if (gScanStateDir == SCAN_OFF && (gScreenToDisplay != DISPLAY_SCANNER || gScanCssState >= SCAN_CSS_STATE_FOUND))
|
||||
#endif
|
||||
{
|
||||
if (gEeprom.AUTO_KEYPAD_LOCK && gKeyLockCountdown > 0 && !gDTMF_InputMode)
|
||||
if (gEeprom.AUTO_KEYPAD_LOCK && gKeyLockCountdown > 0 && !gDTMF_InputMode && gScreenToDisplay != DISPLAY_MENU)
|
||||
{
|
||||
if (--gKeyLockCountdown == 0)
|
||||
gEeprom.KEY_LOCK = true; // lock the keyboard
|
||||
@@ -1899,24 +1785,24 @@ void APP_TimeSlice500ms(void)
|
||||
if (gCurrentFunction != FUNCTION_POWER_SAVE && gCurrentFunction != FUNCTION_TRANSMIT)
|
||||
updateRSSI(gEeprom.RX_VFO);
|
||||
|
||||
#ifdef ENABLE_FMRADIO
|
||||
if (!gPttIsPressed && gFM_ResumeCountdown_500ms > 0)
|
||||
if (!gPttIsPressed && gVFOStateResumeCountdown_500ms > 0)
|
||||
{
|
||||
if (--gVFOStateResumeCountdown_500ms == 0)
|
||||
{
|
||||
if (--gFM_ResumeCountdown_500ms == 0)
|
||||
{
|
||||
RADIO_SetVfoState(VFO_STATE_NORMAL);
|
||||
|
||||
if (gCurrentFunction != FUNCTION_RECEIVE &&
|
||||
gCurrentFunction != FUNCTION_TRANSMIT &&
|
||||
gCurrentFunction != FUNCTION_MONITOR &&
|
||||
gFmRadioMode)
|
||||
{ // switch back to FM radio mode
|
||||
FM_Start();
|
||||
GUI_SelectNextDisplay(DISPLAY_FM);
|
||||
}
|
||||
RADIO_SetVfoState(VFO_STATE_NORMAL);
|
||||
#ifdef ENABLE_FMRADIO
|
||||
if (gCurrentFunction != FUNCTION_RECEIVE &&
|
||||
gCurrentFunction != FUNCTION_TRANSMIT &&
|
||||
gCurrentFunction != FUNCTION_MONITOR &&
|
||||
gFmRadioMode)
|
||||
{ // switch back to FM radio mode
|
||||
FM_Start();
|
||||
GUI_SelectNextDisplay(DISPLAY_FM);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
if (gLowBattery)
|
||||
{
|
||||
@@ -2054,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)
|
||||
{
|
||||
@@ -2204,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
|
||||
@@ -2226,8 +2086,7 @@ static void APP_ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
if (gPttWasReleased)
|
||||
else if (gPttWasReleased)
|
||||
{
|
||||
if (bKeyHeld)
|
||||
bFlag = true;
|
||||
@@ -2249,9 +2108,9 @@ static void APP_ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
if (gCurrentFunction == FUNCTION_TRANSMIT)
|
||||
{ // transmitting
|
||||
|
||||
#if defined(ENABLE_ALARM) || defined(ENABLE_TX1750)
|
||||
if (gAlarmState == ALARM_STATE_OFF)
|
||||
#endif
|
||||
#if defined(ENABLE_ALARM) || defined(ENABLE_TX1750)
|
||||
if (gAlarmState == ALARM_STATE_OFF)
|
||||
#endif
|
||||
{
|
||||
char Code;
|
||||
|
||||
@@ -2306,7 +2165,7 @@ static void APP_ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
BK4819_PlayDTMFEx(gEeprom.DTMF_SIDE_TONE, Code);
|
||||
}
|
||||
}
|
||||
#if defined(ENABLE_ALARM) || defined(ENABLE_TX1750)
|
||||
#if defined(ENABLE_ALARM) || defined(ENABLE_TX1750)
|
||||
else
|
||||
if ((!bKeyHeld && bKeyPressed) || (gAlarmState == ALARM_STATE_TX1750 && bKeyHeld && !bKeyPressed))
|
||||
{
|
||||
@@ -2323,7 +2182,7 @@ static void APP_ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
if (!bKeyHeld)
|
||||
gPttWasReleased = true;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
else
|
||||
if (Key != KEY_SIDE1 && Key != KEY_SIDE2)
|
||||
@@ -2331,6 +2190,7 @@ static void APP_ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
switch (gScreenToDisplay)
|
||||
{
|
||||
case DISPLAY_MAIN:
|
||||
|
||||
MAIN_ProcessKeys(Key, bKeyPressed, bKeyHeld);
|
||||
// bKeyHeld = false; // allow the channel setting to be saved
|
||||
break;
|
||||
@@ -2361,16 +2221,15 @@ static void APP_ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
}
|
||||
}
|
||||
else
|
||||
#ifdef ENABLE_AIRCOPY
|
||||
if (gScreenToDisplay != DISPLAY_SCANNER && gScreenToDisplay != DISPLAY_AIRCOPY)
|
||||
#else
|
||||
if (gScreenToDisplay != DISPLAY_SCANNER)
|
||||
#endif
|
||||
#ifdef ENABLE_AIRCOPY
|
||||
if (gScreenToDisplay != DISPLAY_SCANNER && gScreenToDisplay != DISPLAY_AIRCOPY)
|
||||
#else
|
||||
if (gScreenToDisplay != DISPLAY_SCANNER)
|
||||
#endif
|
||||
{
|
||||
ACTION_Handle(Key, bKeyPressed, bKeyHeld);
|
||||
}
|
||||
else
|
||||
if (!bKeyHeld && bKeyPressed)
|
||||
else if (!bKeyHeld && bKeyPressed)
|
||||
gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
1
app/fm.c
1
app/fm.c
@@ -45,7 +45,6 @@ bool gFM_AutoScan;
|
||||
uint8_t gFM_ChannelPosition;
|
||||
bool gFM_FoundFrequency;
|
||||
bool gFM_AutoScan;
|
||||
uint8_t gFM_ResumeCountdown_500ms;
|
||||
uint16_t gFM_RestoreCountdown_10ms;
|
||||
|
||||
bool FM_CheckValidChannel(uint8_t Channel)
|
||||
|
||||
1
app/fm.h
1
app/fm.h
@@ -39,7 +39,6 @@ extern uint8_t gFM_ChannelPosition;
|
||||
extern uint16_t gFM_FrequencyDeviation;
|
||||
extern bool gFM_FoundFrequency;
|
||||
extern bool gFM_AutoScan;
|
||||
extern uint8_t gFM_ResumeCountdown_500ms;
|
||||
extern uint16_t gFM_RestoreCountdown_10ms;
|
||||
|
||||
bool FM_CheckValidChannel(uint8_t Channel);
|
||||
|
||||
@@ -37,26 +37,22 @@ void GENERIC_Key_F(bool bKeyPressed, bool bKeyHeld)
|
||||
{
|
||||
if (gInputBoxIndex > 0)
|
||||
{
|
||||
if (!bKeyHeld && bKeyPressed)
|
||||
if (!bKeyHeld && bKeyPressed) // short pressed
|
||||
gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
||||
return;
|
||||
}
|
||||
|
||||
if (bKeyHeld || !bKeyPressed)
|
||||
if (bKeyHeld || !bKeyPressed) // held or released
|
||||
{
|
||||
if (bKeyHeld || bKeyPressed)
|
||||
if (bKeyHeld || bKeyPressed) // held or pressed (cannot be held and not pressed I guess, so it checks only if HELD?)
|
||||
{
|
||||
if (!bKeyHeld)
|
||||
if (!bKeyHeld) // won't ever pass
|
||||
return;
|
||||
|
||||
if (!bKeyPressed)
|
||||
if (!bKeyPressed) // won't ever pass
|
||||
return;
|
||||
|
||||
if (gScreenToDisplay != DISPLAY_MENU &&
|
||||
gScreenToDisplay != DISPLAY_FM &&
|
||||
#ifdef ENABLE_FMRADIO
|
||||
!gFmRadioMode &&
|
||||
#endif
|
||||
gCurrentFunction != FUNCTION_TRANSMIT)
|
||||
{ // toggle the keyboad lock
|
||||
|
||||
@@ -69,7 +65,7 @@ void GENERIC_Key_F(bool bKeyPressed, bool bKeyHeld)
|
||||
gRequestSaveSettings = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
else // released
|
||||
{
|
||||
#ifdef ENABLE_FMRADIO
|
||||
if ((gFmRadioMode || gScreenToDisplay != DISPLAY_MAIN) && gScreenToDisplay != DISPLAY_FM)
|
||||
@@ -79,7 +75,7 @@ void GENERIC_Key_F(bool bKeyPressed, bool bKeyHeld)
|
||||
return;
|
||||
#endif
|
||||
|
||||
gWasFKeyPressed = !gWasFKeyPressed;
|
||||
gWasFKeyPressed = !gWasFKeyPressed; // toggle F function
|
||||
|
||||
if (gWasFKeyPressed)
|
||||
gKeyInputCountdown = key_input_timeout_500ms;
|
||||
@@ -92,7 +88,7 @@ void GENERIC_Key_F(bool bKeyPressed, bool bKeyHeld)
|
||||
gUpdateStatus = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
else // short pressed
|
||||
{
|
||||
if (gScreenToDisplay != DISPLAY_FM)
|
||||
{
|
||||
@@ -101,7 +97,7 @@ void GENERIC_Key_F(bool bKeyPressed, bool bKeyHeld)
|
||||
}
|
||||
|
||||
#ifdef ENABLE_FMRADIO
|
||||
if (gFM_ScanState == FM_SCAN_OFF)
|
||||
if (gFM_ScanState == FM_SCAN_OFF) // not scanning
|
||||
{
|
||||
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
||||
return;
|
||||
@@ -120,7 +116,6 @@ void GENERIC_Key_PTT(bool bKeyPressed)
|
||||
|
||||
if (!bKeyPressed || gSerialConfigCountDown_500ms > 0)
|
||||
{ // PTT released
|
||||
|
||||
if (gCurrentFunction == FUNCTION_TRANSMIT)
|
||||
{ // we are transmitting .. stop
|
||||
|
||||
@@ -185,22 +180,22 @@ void GENERIC_Key_PTT(bool bKeyPressed)
|
||||
goto cancel_tx;
|
||||
}
|
||||
|
||||
#ifdef ENABLE_FMRADIO
|
||||
if (gFM_ScanState != FM_SCAN_OFF)
|
||||
{ // FM radio is scanning .. stop
|
||||
FM_PlayAndUpdate();
|
||||
#ifdef ENABLE_VOICE
|
||||
gAnotherVoiceID = VOICE_ID_SCANNING_STOP;
|
||||
#endif
|
||||
gRequestDisplayScreen = DISPLAY_FM;
|
||||
goto cancel_tx;
|
||||
}
|
||||
#endif
|
||||
#ifdef ENABLE_FMRADIO
|
||||
if (gFM_ScanState != FM_SCAN_OFF)
|
||||
{ // FM radio is scanning .. stop
|
||||
FM_PlayAndUpdate();
|
||||
#ifdef ENABLE_VOICE
|
||||
gAnotherVoiceID = VOICE_ID_SCANNING_STOP;
|
||||
#endif
|
||||
gRequestDisplayScreen = DISPLAY_FM;
|
||||
goto cancel_tx;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_FMRADIO
|
||||
if (gScreenToDisplay == DISPLAY_FM)
|
||||
goto start_tx; // listening to the FM radio .. start TX'ing
|
||||
#endif
|
||||
#ifdef ENABLE_FMRADIO
|
||||
if (gScreenToDisplay == DISPLAY_FM)
|
||||
goto start_tx; // listening to the FM radio .. start TX'ing
|
||||
#endif
|
||||
|
||||
if (gCurrentFunction == FUNCTION_TRANSMIT && gRTTECountdown == 0)
|
||||
{ // already transmitting
|
||||
@@ -259,7 +254,6 @@ start_tx:
|
||||
cancel_tx:
|
||||
if (gPttIsPressed)
|
||||
{
|
||||
gPttIsPressed = false;
|
||||
gPttWasPressed = true;
|
||||
}
|
||||
|
||||
|
||||
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;
|
||||
|
||||
|
||||
187
app/menu.c
187
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;
|
||||
@@ -139,12 +139,7 @@ int MENU_GetLimits(uint8_t Cursor, int32_t *pMin, int32_t *pMax)
|
||||
|
||||
case MENU_TDR:
|
||||
*pMin = 0;
|
||||
*pMax = ARRAY_SIZE(gSubMenu_CHAN) - 1;
|
||||
break;
|
||||
|
||||
case MENU_XB:
|
||||
*pMin = 0;
|
||||
*pMax = ARRAY_SIZE(gSubMenu_XB) - 1;
|
||||
*pMax = ARRAY_SIZE(gSubMenu_RXMode) - 1;
|
||||
break;
|
||||
|
||||
#ifdef ENABLE_VOICE
|
||||
@@ -285,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;
|
||||
|
||||
@@ -331,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;
|
||||
}
|
||||
@@ -345,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;
|
||||
@@ -408,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)
|
||||
{
|
||||
@@ -439,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;
|
||||
@@ -510,7 +508,7 @@ void MENU_AcceptSetting(void)
|
||||
gEeprom.VOX_SWITCH = gSubMenuSelection != 0;
|
||||
if (gEeprom.VOX_SWITCH)
|
||||
gEeprom.VOX_LEVEL = gSubMenuSelection - 1;
|
||||
BOARD_EEPROM_LoadMoreSettings();
|
||||
BOARD_EEPROM_LoadCalibration();
|
||||
gFlagReconfigureVfos = true;
|
||||
gUpdateStatus = true;
|
||||
break;
|
||||
@@ -525,24 +523,13 @@ void MENU_AcceptSetting(void)
|
||||
break;
|
||||
|
||||
case MENU_TDR:
|
||||
gEeprom.DUAL_WATCH = gSubMenuSelection;
|
||||
gEeprom.DUAL_WATCH = (gEeprom.TX_VFO + 1) * (gSubMenuSelection & 1);
|
||||
gEeprom.CROSS_BAND_RX_TX = (gEeprom.TX_VFO + 1) * ((gSubMenuSelection & 2) > 0);
|
||||
|
||||
gFlagReconfigureVfos = true;
|
||||
gUpdateStatus = true;
|
||||
break;
|
||||
|
||||
case MENU_XB:
|
||||
#ifdef ENABLE_NOAA
|
||||
if (IS_NOAA_CHANNEL(gEeprom.ScreenChannel[0]))
|
||||
return;
|
||||
if (IS_NOAA_CHANNEL(gEeprom.ScreenChannel[1]))
|
||||
return;
|
||||
#endif
|
||||
|
||||
gEeprom.CROSS_BAND_RX_TX = gSubMenuSelection;
|
||||
gFlagReconfigureVfos = true;
|
||||
gUpdateStatus = true;
|
||||
break;
|
||||
|
||||
case MENU_BEEP:
|
||||
gEeprom.BEEP_CONTROL = gSubMenuSelection;
|
||||
break;
|
||||
@@ -595,7 +582,7 @@ void MENU_AcceptSetting(void)
|
||||
|
||||
case MENU_MIC:
|
||||
gEeprom.MIC_SENSITIVITY = gSubMenuSelection;
|
||||
BOARD_EEPROM_LoadMoreSettings();
|
||||
BOARD_EEPROM_LoadCalibration();
|
||||
gFlagReconfigureVfos = true;
|
||||
break;
|
||||
|
||||
@@ -765,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;
|
||||
@@ -791,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)
|
||||
{
|
||||
@@ -834,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;
|
||||
@@ -846,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;
|
||||
@@ -956,11 +949,7 @@ void MENU_ShowCurrentSetting(void)
|
||||
break;
|
||||
|
||||
case MENU_TDR:
|
||||
gSubMenuSelection = gEeprom.DUAL_WATCH;
|
||||
break;
|
||||
|
||||
case MENU_XB:
|
||||
gSubMenuSelection = gEeprom.CROSS_BAND_RX_TX;
|
||||
gSubMenuSelection = (gEeprom.DUAL_WATCH != DUAL_WATCH_OFF) + (gEeprom.CROSS_BAND_RX_TX != CROSS_BAND_OFF) * 2;
|
||||
break;
|
||||
|
||||
case MENU_BEEP:
|
||||
@@ -1153,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;
|
||||
}
|
||||
@@ -1170,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;
|
||||
|
||||
@@ -1198,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:
|
||||
@@ -1220,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)
|
||||
@@ -1232,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;
|
||||
|
||||
@@ -1262,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)
|
||||
@@ -1292,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;
|
||||
@@ -1337,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;
|
||||
@@ -1394,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
|
||||
@@ -1407,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;
|
||||
@@ -1416,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
|
||||
@@ -1463,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)
|
||||
{
|
||||
@@ -1479,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);
|
||||
@@ -1514,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;
|
||||
@@ -1530,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)
|
||||
@@ -1557,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)
|
||||
@@ -1592,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)
|
||||
{
|
||||
@@ -1644,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
|
||||
@@ -1653,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)
|
||||
@@ -1671,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:
|
||||
@@ -1684,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;
|
||||
@@ -1694,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;
|
||||
@@ -1735,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)
|
||||
{
|
||||
@@ -1767,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);
|
||||
|
||||
41
bitmaps.c
41
bitmaps.c
@@ -197,26 +197,27 @@ const uint8_t BITMAP_F_Key[6] =
|
||||
};
|
||||
#endif
|
||||
|
||||
const uint8_t BITMAP_TDR1[12] =
|
||||
{ // "DW"
|
||||
0b00000000,
|
||||
const uint8_t BITMAP_TDR1[15] =
|
||||
{ // "DWR"
|
||||
0b01111111,
|
||||
0b01000001,
|
||||
0b01000001,
|
||||
0b01000001,
|
||||
0b00111110,
|
||||
0b00000000,
|
||||
0b01111111,
|
||||
0b00100000,
|
||||
0b00011000,
|
||||
0b00100000,
|
||||
0b01111111
|
||||
0b01111111,
|
||||
0b00000000,
|
||||
0b01111111,
|
||||
0b00011001,
|
||||
0b00101001,
|
||||
0b01000110
|
||||
};
|
||||
|
||||
const uint8_t BITMAP_TDR2[12] =
|
||||
const uint8_t BITMAP_TDR2[9] =
|
||||
{ // "><" .. DW on hold
|
||||
0b00000000,
|
||||
0b00000000,
|
||||
0b00100010,
|
||||
0b00110110,
|
||||
0b00011100,
|
||||
@@ -226,7 +227,6 @@ const uint8_t BITMAP_TDR2[12] =
|
||||
0b00011100,
|
||||
0b00110110,
|
||||
0b00100010,
|
||||
0b00000000
|
||||
};
|
||||
|
||||
#ifdef ENABLE_VOICE
|
||||
@@ -244,27 +244,8 @@ const uint8_t BITMAP_TDR2[12] =
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_FMRADIO
|
||||
const uint8_t BITMAP_FM[12] =
|
||||
{ // "FM"
|
||||
0b00000000,
|
||||
0b01111111,
|
||||
0b00001001,
|
||||
0b00001001,
|
||||
0b00001001,
|
||||
0b00000001,
|
||||
|
||||
0b00000000,
|
||||
0b01111111,
|
||||
0b00000010,
|
||||
0b00001100,
|
||||
0b00000010,
|
||||
0b01111111
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_NOAA
|
||||
const uint8_t BITMAP_NOAA[12] =
|
||||
const uint8_t BITMAP_NOAA[11] =
|
||||
{ // "NS"
|
||||
0b00000000,
|
||||
0b01111111,
|
||||
@@ -272,12 +253,10 @@ const uint8_t BITMAP_TDR2[12] =
|
||||
0b00001000,
|
||||
0b00010000,
|
||||
0b01111111,
|
||||
|
||||
0b00000000,
|
||||
0b01000110,
|
||||
0b01001001,
|
||||
0b01001001,
|
||||
0b01001001,
|
||||
0b00110001
|
||||
};
|
||||
#endif
|
||||
|
||||
16
bitmaps.h
16
bitmaps.h
@@ -25,25 +25,17 @@ extern const uint8_t BITMAP_F_Key[6];
|
||||
extern const uint8_t BITMAP_VOX[18];
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
extern const uint8_t BITMAP_WX[12];
|
||||
#else
|
||||
extern const uint8_t BITMAP_XB[12];
|
||||
#endif
|
||||
extern const uint8_t BITMAP_XB[12];
|
||||
|
||||
extern const uint8_t BITMAP_TDR1[12];
|
||||
extern const uint8_t BITMAP_TDR2[12];
|
||||
extern const uint8_t BITMAP_TDR1[15];
|
||||
extern const uint8_t BITMAP_TDR2[9];
|
||||
|
||||
#ifdef ENABLE_VOICE
|
||||
extern const uint8_t BITMAP_VoicePrompt[9];
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_FMRADIO
|
||||
extern const uint8_t BITMAP_FM[12];
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_NOAA
|
||||
extern const uint8_t BITMAP_NOAA[12];
|
||||
extern const uint8_t BITMAP_NOAA[11];
|
||||
#endif
|
||||
|
||||
extern const uint8_t BITMAP_Antenna[5];
|
||||
|
||||
10
board.c
10
board.c
@@ -739,14 +739,14 @@ void BOARD_EEPROM_Init(void)
|
||||
}
|
||||
}
|
||||
|
||||
void BOARD_EEPROM_LoadMoreSettings(void)
|
||||
void BOARD_EEPROM_LoadCalibration(void)
|
||||
{
|
||||
// uint8_t Mic;
|
||||
|
||||
EEPROM_ReadBuffer(0x1EC0, gEEPROM_1EC0_0, 8);
|
||||
memmove(gEEPROM_1EC0_1, gEEPROM_1EC0_0, 8);
|
||||
memmove(gEEPROM_1EC0_2, gEEPROM_1EC0_0, 8);
|
||||
memmove(gEEPROM_1EC0_3, gEEPROM_1EC0_0, 8);
|
||||
EEPROM_ReadBuffer(0x1EC0, gEEPROM_RSSI_CALIB[3], 8);
|
||||
memcpy(gEEPROM_RSSI_CALIB[4], gEEPROM_RSSI_CALIB[3], 8);
|
||||
memcpy(gEEPROM_RSSI_CALIB[5], gEEPROM_RSSI_CALIB[3], 8);
|
||||
memcpy(gEEPROM_RSSI_CALIB[6], gEEPROM_RSSI_CALIB[3], 8);
|
||||
|
||||
// 8 * 16-bit values
|
||||
EEPROM_ReadBuffer(0x1EC0, gEEPROM_RSSI_CALIB[0], 8);
|
||||
|
||||
2
board.h
2
board.h
@@ -27,7 +27,7 @@ void BOARD_ADC_Init(void);
|
||||
void BOARD_ADC_GetBatteryInfo(uint16_t *pVoltage, uint16_t *pCurrent);
|
||||
void BOARD_Init(void);
|
||||
void BOARD_EEPROM_Init(void);
|
||||
void BOARD_EEPROM_LoadMoreSettings(void);
|
||||
void BOARD_EEPROM_LoadCalibration(void);
|
||||
uint32_t BOARD_fetchChannelFrequency(const int channel);
|
||||
void BOARD_fetchChannelName(char *s, const int channel);
|
||||
void BOARD_FactoryReset(bool bIsAll);
|
||||
|
||||
2
compile-with-docker.sh
Normal file → Executable file
2
compile-with-docker.sh
Normal file → Executable file
@@ -1,3 +1,3 @@
|
||||
#!/bin/sh
|
||||
docker build -t uvk5 .
|
||||
docker run -v $(PWD)/compiled-firmware:/app/compiled-firmware uvk5 /bin/bash -c "cd /app && make && cp firmware* compiled-firmware/"
|
||||
docker run -v ${PWD}/compiled-firmware:/app/compiled-firmware uvk5 /bin/bash -c "cd /app && make && cp firmware* compiled-firmware/"
|
||||
|
||||
@@ -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)
|
||||
|
||||
58
main.c
58
main.c
@@ -84,7 +84,7 @@ void Main(void)
|
||||
|
||||
BOARD_EEPROM_Init();
|
||||
|
||||
BOARD_EEPROM_LoadMoreSettings();
|
||||
BOARD_EEPROM_LoadCalibration();
|
||||
|
||||
RADIO_ConfigureChannel(0, VFO_CONFIGURE_RELOAD);
|
||||
RADIO_ConfigureChannel(1, VFO_CONFIGURE_RELOAD);
|
||||
@@ -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
|
||||
|
||||
// ******************
|
||||
}
|
||||
|
||||
47
misc.c
47
misc.c
@@ -19,12 +19,13 @@
|
||||
#include "misc.h"
|
||||
#include "settings.h"
|
||||
|
||||
const uint8_t fm_resume_countdown_500ms = 2500 / 500; // 2.5 seconds
|
||||
const uint8_t fm_radio_countdown_500ms = 2000 / 500; // 2 seconds
|
||||
const uint16_t fm_play_countdown_scan_10ms = 100 / 10; // 100ms
|
||||
const uint16_t fm_play_countdown_noscan_10ms = 1200 / 10; // 1.2 seconds
|
||||
const uint16_t fm_restore_countdown_10ms = 5000 / 10; // 5 seconds
|
||||
|
||||
const uint8_t vfo_state_resume_countdown_500ms = 2500 / 500; // 2.5 seconds
|
||||
|
||||
const uint8_t menu_timeout_500ms = 20000 / 500; // 20 seconds
|
||||
const uint16_t menu_timeout_long_500ms = 120000 / 500; // 2 minutes
|
||||
|
||||
@@ -109,12 +110,7 @@ bool bHasCustomAesKey;
|
||||
uint32_t gChallenge[4];
|
||||
uint8_t gTryCount;
|
||||
|
||||
uint8_t gEEPROM_1EC0_0[8];
|
||||
uint8_t gEEPROM_1EC0_1[8];
|
||||
uint8_t gEEPROM_1EC0_2[8];
|
||||
uint8_t gEEPROM_1EC0_3[8];
|
||||
|
||||
uint16_t gEEPROM_RSSI_CALIB[2][4];
|
||||
uint16_t gEEPROM_RSSI_CALIB[7][4];
|
||||
|
||||
uint16_t gEEPROM_1F8A;
|
||||
uint16_t gEEPROM_1F8C;
|
||||
@@ -141,6 +137,8 @@ volatile bool gTxTimeoutReached;
|
||||
|
||||
volatile uint16_t gTailNoteEliminationCountdown_10ms;
|
||||
|
||||
volatile uint8_t gVFOStateResumeCountdown_500ms;
|
||||
|
||||
#ifdef ENABLE_NOAA
|
||||
volatile uint16_t gNOAA_Countdown_10ms;
|
||||
#endif
|
||||
@@ -207,7 +205,6 @@ uint16_t gLowBatteryCountdown;
|
||||
uint8_t gNextMrChannel;
|
||||
ReceptionMode_t gRxReceptionMode;
|
||||
|
||||
uint8_t gRestoreMrChannel;
|
||||
enum scan_next_chan_t gCurrentScanList;
|
||||
uint32_t gRestoreFrequency;
|
||||
|
||||
@@ -260,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;
|
||||
|
||||
22
misc.h
22
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,
|
||||
@@ -52,7 +52,8 @@ enum {
|
||||
enum {
|
||||
FLASHLIGHT_OFF = 0,
|
||||
FLASHLIGHT_ON,
|
||||
FLASHLIGHT_BLINK
|
||||
FLASHLIGHT_BLINK,
|
||||
FLASHLIGHT_SOS
|
||||
};
|
||||
|
||||
enum {
|
||||
@@ -93,12 +94,13 @@ enum scan_next_chan_t {
|
||||
};
|
||||
typedef enum scan_next_chan_t scan_next_chan_t;
|
||||
|
||||
extern const uint8_t fm_resume_countdown_500ms;
|
||||
extern const uint8_t fm_radio_countdown_500ms;
|
||||
extern const uint16_t fm_play_countdown_scan_10ms;
|
||||
extern const uint16_t fm_play_countdown_noscan_10ms;
|
||||
extern const uint16_t fm_restore_countdown_10ms;
|
||||
|
||||
extern const uint8_t vfo_state_resume_countdown_500ms;
|
||||
|
||||
extern const uint8_t menu_timeout_500ms;
|
||||
extern const uint16_t menu_timeout_long_500ms;
|
||||
|
||||
@@ -182,12 +184,7 @@ extern bool bHasCustomAesKey;
|
||||
extern uint32_t gChallenge[4];
|
||||
extern uint8_t gTryCount;
|
||||
|
||||
extern uint8_t gEEPROM_1EC0_0[8];
|
||||
extern uint8_t gEEPROM_1EC0_1[8];
|
||||
extern uint8_t gEEPROM_1EC0_2[8];
|
||||
extern uint8_t gEEPROM_1EC0_3[8];
|
||||
|
||||
extern uint16_t gEEPROM_RSSI_CALIB[2][4];
|
||||
extern uint16_t gEEPROM_RSSI_CALIB[7][4];
|
||||
|
||||
extern uint16_t gEEPROM_1F8A;
|
||||
extern uint16_t gEEPROM_1F8C;
|
||||
@@ -280,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;
|
||||
|
||||
@@ -319,6 +315,7 @@ extern volatile bool gNextTimeslice40ms;
|
||||
extern volatile bool gScheduleNOAA;
|
||||
#endif
|
||||
extern volatile bool gFlagTailNoteEliminationComplete;
|
||||
extern volatile uint8_t gVFOStateResumeCountdown_500ms;
|
||||
#ifdef ENABLE_FMRADIO
|
||||
extern volatile bool gScheduleFM;
|
||||
#endif
|
||||
@@ -326,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);
|
||||
|
||||
48
radio.c
48
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
|
||||
@@ -898,10 +889,7 @@ void RADIO_SetVfoState(VfoState_t State)
|
||||
{
|
||||
VfoState[0] = VFO_STATE_NORMAL;
|
||||
VfoState[1] = VFO_STATE_NORMAL;
|
||||
|
||||
#ifdef ENABLE_FMRADIO
|
||||
gFM_ResumeCountdown_500ms = 0;
|
||||
#endif
|
||||
gVFOStateResumeCountdown_500ms = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -916,9 +904,7 @@ void RADIO_SetVfoState(VfoState_t State)
|
||||
VfoState[vfo] = State;
|
||||
}
|
||||
|
||||
#ifdef ENABLE_FMRADIO
|
||||
gFM_ResumeCountdown_500ms = fm_resume_countdown_500ms;
|
||||
#endif
|
||||
gVFOStateResumeCountdown_500ms = vfo_state_resume_countdown_500ms;
|
||||
}
|
||||
|
||||
gUpdateDisplay = true;
|
||||
|
||||
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
|
||||
|
||||
43
ui/battery.c
43
ui/battery.c
@@ -24,34 +24,33 @@
|
||||
|
||||
void UI_DrawBattery(uint8_t* bitmap, uint8_t level, uint8_t blink)
|
||||
{
|
||||
memmove(bitmap, BITMAP_BatteryLevel1, sizeof(BITMAP_BatteryLevel1));
|
||||
|
||||
if (level >= 1)
|
||||
if (level < 2 && blink == 1) {
|
||||
memset(bitmap, 0, sizeof(BITMAP_BatteryLevel1));
|
||||
}
|
||||
else
|
||||
{
|
||||
unsigned int i;
|
||||
uint8_t bars = level > 0 ? level - 1 : 0;
|
||||
if(bars>4) bars = 4;
|
||||
for (i = 0; i < bars; i++)
|
||||
memmove(bitmap, BITMAP_BatteryLevel1, sizeof(BITMAP_BatteryLevel1));
|
||||
if (level > 1)
|
||||
{
|
||||
#ifndef ENABLE_REVERSE_BAT_SYMBOL
|
||||
memcpy(bitmap + sizeof(bitmap) - 4 - (i * 3), BITMAP_BatteryLevel, 2);
|
||||
#else
|
||||
memcpy(bitmap + 3 + (i * 3) + 0, BITMAP_BatteryLevel, 2);
|
||||
#endif
|
||||
unsigned int i;
|
||||
uint8_t bars = level - 1;
|
||||
if (bars > 4)
|
||||
bars = 4;
|
||||
for (i = 0; i < bars; i++)
|
||||
{
|
||||
#ifndef ENABLE_REVERSE_BAT_SYMBOL
|
||||
memcpy(bitmap + sizeof(BITMAP_BatteryLevel1) - 4 - (i * 3), BITMAP_BatteryLevel, 2);
|
||||
#else
|
||||
memcpy(bitmap + 3 + (i * 3) + 0, BITMAP_BatteryLevel, 2);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
if (blink == 0)
|
||||
memset(bitmap, 0, sizeof(bitmap));
|
||||
}
|
||||
|
||||
void UI_DisplayBattery(uint8_t level, uint8_t blink)
|
||||
{
|
||||
if (gCurrentFunction != FUNCTION_TRANSMIT) {
|
||||
uint8_t bitmap[sizeof(BITMAP_BatteryLevel1)];
|
||||
|
||||
UI_DrawBattery(bitmap, level, blink);
|
||||
memmove(bitmap, BITMAP_BatteryLevel1, sizeof(BITMAP_BatteryLevel1));
|
||||
ST7565_DrawLine(LCD_WIDTH - sizeof(bitmap), 0, sizeof(bitmap), bitmap);
|
||||
}
|
||||
uint8_t bitmap[sizeof(BITMAP_BatteryLevel1)];
|
||||
UI_DrawBattery(bitmap, level, blink);
|
||||
ST7565_DrawLine(LCD_WIDTH - sizeof(bitmap), 0, sizeof(bitmap), bitmap);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
92
ui/main.c
92
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 1: memmove(p + 0, BITMAP_Antenna, sizeof(BITMAP_Antenna));
|
||||
case 0: break;
|
||||
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
|
||||
@@ -218,24 +209,13 @@ void UI_UpdateRSSI(const int16_t rssi, const int vfo)
|
||||
const uint8_t Line = (vfo == 0) ? 3 : 7;
|
||||
uint8_t *p_line = gFrameBuffer[Line - 1];
|
||||
|
||||
// TODO: sort out all 8 values from the eeprom
|
||||
|
||||
#if 0
|
||||
// dBm -105 -100 -95 -90 -70 -65 -60 -55
|
||||
// RSSI 110 120 130 140 180 190 200 210
|
||||
// 0000C0 6E 00 78 00 82 00 8C 00 B4 00 BE 00 C8 00 D2 00
|
||||
//
|
||||
const unsigned int band = 1;
|
||||
const int16_t level0 = gEEPROM_RSSI_CALIB[band][0];
|
||||
const int16_t level1 = gEEPROM_RSSI_CALIB[band][1];
|
||||
const int16_t level2 = gEEPROM_RSSI_CALIB[band][2];
|
||||
const int16_t level3 = gEEPROM_RSSI_CALIB[band][3];
|
||||
#else
|
||||
const int16_t level0 = (-115 + 160) * 2; // dB
|
||||
const int16_t level1 = ( -89 + 160) * 2; // dB
|
||||
const int16_t level2 = ( -64 + 160) * 2; // dB
|
||||
const int16_t level3 = ( -39 + 160) * 2; // dB
|
||||
#endif
|
||||
const unsigned int band = gRxVfo->Band;
|
||||
const int16_t level0 = gEEPROM_RSSI_CALIB[band][0];
|
||||
const int16_t level1 = gEEPROM_RSSI_CALIB[band][1];
|
||||
const int16_t level2 = gEEPROM_RSSI_CALIB[band][2];
|
||||
const int16_t level3 = gEEPROM_RSSI_CALIB[band][3];
|
||||
|
||||
const int16_t level01 = (level0 + level1) / 2;
|
||||
const int16_t level12 = (level1 + level2) / 2;
|
||||
const int16_t level23 = (level2 + level3) / 2;
|
||||
@@ -314,30 +294,23 @@ void UI_DisplayMain(void)
|
||||
return;
|
||||
}
|
||||
|
||||
unsigned int activeTxVFO = (gEeprom.DUAL_WATCH != DUAL_WATCH_OFF && gRxVfoIsActive) ? gEeprom.RX_VFO : gEeprom.TX_VFO;
|
||||
|
||||
for (vfo_num = 0; vfo_num < 2; vfo_num++)
|
||||
{
|
||||
const unsigned int line = (vfo_num == 0) ? line0 : line1;
|
||||
unsigned int channel = gEeprom.TX_VFO;
|
||||
// unsigned int tx_channel = (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF) ? gEeprom.RX_VFO : gEeprom.TX_VFO;
|
||||
const bool same_vfo = (channel == vfo_num) ? true : false;
|
||||
const bool isTxVFO = (vfo_num == gEeprom.TX_VFO);
|
||||
uint8_t *p_line0 = gFrameBuffer[line + 0];
|
||||
uint8_t *p_line1 = gFrameBuffer[line + 1];
|
||||
unsigned int mode = 0;
|
||||
unsigned int state;
|
||||
|
||||
if (single_vfo)
|
||||
{ // we're in single VFO mode - screen is dedicated to just one VFO
|
||||
|
||||
if (!same_vfo)
|
||||
if (!isTxVFO)
|
||||
continue; // skip the unused vfo
|
||||
|
||||
|
||||
}
|
||||
|
||||
if (gEeprom.DUAL_WATCH != DUAL_WATCH_OFF && gRxVfoIsActive)
|
||||
channel = gEeprom.RX_VFO; // we're currently monitoring the other VFO
|
||||
|
||||
if (channel != vfo_num)
|
||||
if (activeTxVFO != vfo_num)
|
||||
{
|
||||
if (gDTMF_CallState != DTMF_CALL_STATE_NONE || gDTMF_IsTx || gDTMF_InputMode)
|
||||
{ // show DTMF stuff
|
||||
@@ -382,19 +355,14 @@ void UI_DisplayMain(void)
|
||||
}
|
||||
|
||||
// highlight the selected/used VFO with a marker
|
||||
if (!single_vfo && same_vfo)
|
||||
if (!single_vfo && isTxVFO)
|
||||
memmove(p_line0 + 0, BITMAP_VFO_Default, sizeof(BITMAP_VFO_Default));
|
||||
else
|
||||
if (gEeprom.CROSS_BAND_RX_TX != CROSS_BAND_OFF)
|
||||
memmove(p_line0 + 0, BITMAP_VFO_NotDefault, sizeof(BITMAP_VFO_NotDefault));
|
||||
}
|
||||
else
|
||||
if (!single_vfo)
|
||||
else if (!single_vfo)
|
||||
{ // highlight the selected/used VFO with a marker
|
||||
if (same_vfo)
|
||||
if (isTxVFO)
|
||||
memmove(p_line0 + 0, BITMAP_VFO_Default, sizeof(BITMAP_VFO_Default));
|
||||
else
|
||||
//if (gEeprom.CROSS_BAND_RX_TX != CROSS_BAND_OFF)
|
||||
memmove(p_line0 + 0, BITMAP_VFO_NotDefault, sizeof(BITMAP_VFO_NotDefault));
|
||||
}
|
||||
|
||||
@@ -407,8 +375,8 @@ void UI_DisplayMain(void)
|
||||
else
|
||||
#endif
|
||||
{
|
||||
channel = (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF) ? gEeprom.RX_VFO : gEeprom.TX_VFO;
|
||||
if (channel == vfo_num)
|
||||
activeTxVFO = (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF) ? gEeprom.RX_VFO : gEeprom.TX_VFO;
|
||||
if (activeTxVFO == vfo_num)
|
||||
{ // show the TX symbol
|
||||
mode = 1;
|
||||
#ifdef ENABLE_SMALL_BOLD
|
||||
@@ -472,12 +440,12 @@ void UI_DisplayMain(void)
|
||||
|
||||
// ************
|
||||
|
||||
state = VfoState[vfo_num];
|
||||
unsigned int state = VfoState[vfo_num];
|
||||
|
||||
#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 +469,8 @@ void UI_DisplayMain(void)
|
||||
uint32_t frequency = gEeprom.VfoInfo[vfo_num].pRX->Frequency;
|
||||
if (gCurrentFunction == FUNCTION_TRANSMIT)
|
||||
{ // transmitting
|
||||
channel = (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF) ? gEeprom.RX_VFO : gEeprom.TX_VFO;
|
||||
if (channel == vfo_num)
|
||||
activeTxVFO = (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF) ? gEeprom.RX_VFO : gEeprom.TX_VFO;
|
||||
if (activeTxVFO == vfo_num)
|
||||
frequency = gEeprom.VfoInfo[vfo_num].pTX->Frequency;
|
||||
}
|
||||
|
||||
@@ -524,8 +492,6 @@ void UI_DisplayMain(void)
|
||||
|
||||
#endif
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough="
|
||||
|
||||
switch (gEeprom.CHANNEL_DISPLAY_MODE)
|
||||
{
|
||||
@@ -576,8 +542,6 @@ void UI_DisplayMain(void)
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
#pragma GCC diagnostic pop
|
||||
}
|
||||
else
|
||||
{ // frequency mode
|
||||
|
||||
259
ui/menu.c
259
ui/menu.c
@@ -36,106 +36,108 @@
|
||||
#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 },
|
||||
{"T PWR", VOICE_ID_POWER, MENU_TXP }, // was "TXP"
|
||||
{"R DCS", VOICE_ID_DCS, MENU_R_DCS }, // was "R_DCS"
|
||||
{"R CTCS", VOICE_ID_CTCSS, MENU_R_CTCS }, // was "R_CTCS"
|
||||
{"T DCS", VOICE_ID_DCS, MENU_T_DCS }, // was "T_DCS"
|
||||
{"T CTCS", VOICE_ID_CTCSS, MENU_T_CTCS }, // was "T_CTCS"
|
||||
{"T DIR", VOICE_ID_TX_OFFSET_FREQUENCY_DIRECTION, MENU_SFT_D }, // was "SFT_D"
|
||||
{"T OFFS", VOICE_ID_TX_OFFSET_FREQUENCY, MENU_OFFSET }, // was "OFFSET"
|
||||
{"T VFO", VOICE_ID_INVALID, MENU_XB }, // was "WX"
|
||||
{"T TOUT", VOICE_ID_TRANSMIT_OVER_TIME, MENU_TOT }, // was "TOT"
|
||||
{"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"
|
||||
{"TxOffs", VOICE_ID_TX_OFFSET_FREQUENCY, MENU_OFFSET }, // was "OFFSET"
|
||||
{"W/N", VOICE_ID_CHANNEL_BANDWIDTH, MENU_W_N },
|
||||
{"SCRAM", VOICE_ID_SCRAMBLER_ON, MENU_SCR }, // was "SCR"
|
||||
{"BUSYCL", VOICE_ID_BUSY_LOCKOUT, MENU_BCL }, // was "BCL"
|
||||
{"CH SAV", VOICE_ID_MEMORY_CHANNEL, MENU_MEM_CH }, // was "MEM-CH"
|
||||
{"CH DEL", VOICE_ID_DELETE_CHANNEL, MENU_DEL_CH }, // was "DEL-CH"
|
||||
{"CH NAM", VOICE_ID_INVALID, MENU_MEM_NAME },
|
||||
{"CH DIS", 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 },
|
||||
{"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 },
|
||||
|
||||
{"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
|
||||
{"BLT", VOICE_ID_INVALID, MENU_ABR }, // was "ABR"
|
||||
{"BLTTRX", VOICE_ID_INVALID, MENU_ABR_ON_TX_RX },
|
||||
{"DUALRX", VOICE_ID_DUAL_STANDBY, MENU_TDR }, // was "TDR"
|
||||
{"BEEP", VOICE_ID_BEEP_PROMPT, MENU_BEEP },
|
||||
|
||||
{"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 },
|
||||
{"Beep", VOICE_ID_BEEP_PROMPT, MENU_BEEP },
|
||||
#ifdef ENABLE_VOICE
|
||||
{"VOICE", VOICE_ID_VOICE_PROMPT, MENU_VOICE },
|
||||
{"Voice", VOICE_ID_VOICE_PROMPT, MENU_VOICE },
|
||||
#endif
|
||||
{"SC REV", VOICE_ID_INVALID, MENU_SC_REV },
|
||||
{"KEYLOC", VOICE_ID_INVALID, MENU_AUTOLK }, // was "AUTOLk"
|
||||
{"S ADD1", VOICE_ID_INVALID, MENU_S_ADD1 },
|
||||
{"S ADD2", 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 },
|
||||
{"1 Call", VOICE_ID_INVALID, MENU_1_CALL },
|
||||
#ifdef ENABLE_ALARM
|
||||
{"AL-MOD", VOICE_ID_INVALID, MENU_AL_MOD },
|
||||
{"AlarmT", VOICE_ID_INVALID, MENU_AL_MOD },
|
||||
#endif
|
||||
{"ANI ID", VOICE_ID_ANI_CODE, MENU_ANI_ID },
|
||||
{"UPCODE", VOICE_ID_INVALID, MENU_UPCODE },
|
||||
{"DWCODE", VOICE_ID_INVALID, MENU_DWCODE },
|
||||
{"UPCode", VOICE_ID_INVALID, MENU_UPCODE },
|
||||
{"DWCode", VOICE_ID_INVALID, MENU_DWCODE },
|
||||
{"PTT ID", VOICE_ID_INVALID, MENU_PTT_ID },
|
||||
{"D ST", VOICE_ID_INVALID, MENU_D_ST },
|
||||
{"D RSP", VOICE_ID_INVALID, MENU_D_RSP },
|
||||
{"D HOLD", VOICE_ID_INVALID, MENU_D_HOLD },
|
||||
{"D PRE", VOICE_ID_INVALID, MENU_D_PRE },
|
||||
{"D DCD", VOICE_ID_INVALID, MENU_D_DCD },
|
||||
{"D LIST", VOICE_ID_INVALID, MENU_D_LIST },
|
||||
{"D LIVE", VOICE_ID_INVALID, MENU_D_LIVE_DEC }, // live DTMF decoder
|
||||
{"PONMSG", VOICE_ID_INVALID, MENU_PONMSG },
|
||||
{"ROGER", VOICE_ID_INVALID, MENU_ROGER },
|
||||
{"BATVOL", VOICE_ID_INVALID, MENU_VOL }, // was "VOL"
|
||||
{"BATTXT", VOICE_ID_INVALID, MENU_BAT_TXT },
|
||||
{"MODE", VOICE_ID_INVALID, MENU_AM }, // was "AM"
|
||||
{"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 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
|
||||
#ifdef ENABLE_AM_FIX
|
||||
{"AM FIX", VOICE_ID_INVALID, MENU_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"
|
||||
{"SCR EN", VOICE_ID_INVALID, MENU_SCREN }, // was "SCREN"
|
||||
|
||||
{"TX EN", VOICE_ID_INVALID, MENU_TX_EN }, // enable TX
|
||||
{"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
|
||||
#ifdef ENABLE_F_CAL_MENU
|
||||
{"F CALI", VOICE_ID_INVALID, MENU_F_CALI }, // reference xtal calibration
|
||||
{"FrCali", VOICE_ID_INVALID, MENU_F_CALI }, // reference xtal calibration
|
||||
#endif
|
||||
{"BATCAL", VOICE_ID_INVALID, MENU_BATCAL }, // battery voltage calibration
|
||||
{"BatCal", VOICE_ID_INVALID, MENU_BATCAL }, // battery voltage calibration
|
||||
{"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",
|
||||
@@ -186,18 +188,12 @@ const char gSubMenu_TOT[11][7] =
|
||||
"15 min"
|
||||
};
|
||||
|
||||
const char gSubMenu_CHAN[3][10] =
|
||||
const char* gSubMenu_RXMode[4] =
|
||||
{
|
||||
"OFF",
|
||||
"UPPER\nVFO",
|
||||
"LOWER\nVFO"
|
||||
};
|
||||
|
||||
const char gSubMenu_XB[3][10] =
|
||||
{
|
||||
"RX\nVFO",
|
||||
"UPPER\nVFO",
|
||||
"LOWER\nVFO"
|
||||
"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
|
||||
};
|
||||
|
||||
#ifdef ENABLE_VOICE
|
||||
@@ -209,14 +205,14 @@ const char gSubMenu_XB[3][10] =
|
||||
};
|
||||
#endif
|
||||
|
||||
const char gSubMenu_SC_REV[3][13] =
|
||||
const char gSubMenu_SC_REV[3][8] =
|
||||
{
|
||||
"TIME",
|
||||
"CARRIER",
|
||||
"SEARCH"
|
||||
};
|
||||
|
||||
const char gSubMenu_MDF[4][15] =
|
||||
const char* gSubMenu_MDF[4] =
|
||||
{
|
||||
"FREQ",
|
||||
"CHANNEL\nNUMBER",
|
||||
@@ -240,7 +236,7 @@ const char gSubMenu_D_RSP[4][11] =
|
||||
"BOTH"
|
||||
};
|
||||
|
||||
const char gSubMenu_PTT_ID[5][15] =
|
||||
const char* gSubMenu_PTT_ID[5] =
|
||||
{
|
||||
"OFF",
|
||||
"KEY\nUP",
|
||||
@@ -257,7 +253,7 @@ const char gSubMenu_PONMSG[4][8] =
|
||||
"NONE"
|
||||
};
|
||||
|
||||
const char gSubMenu_ROGER[3][9] =
|
||||
const char* gSubMenu_ROGER[3] =
|
||||
{
|
||||
"OFF",
|
||||
"ROGER",
|
||||
@@ -332,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;
|
||||
|
||||
@@ -437,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);
|
||||
@@ -483,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");
|
||||
@@ -680,11 +703,7 @@ void UI_DisplayMenu(void)
|
||||
break;
|
||||
|
||||
case MENU_TDR:
|
||||
strcpy(String, gSubMenu_CHAN[gSubMenuSelection]);
|
||||
break;
|
||||
|
||||
case MENU_XB:
|
||||
strcpy(String, gSubMenu_XB[gSubMenuSelection]);
|
||||
strcpy(String, gSubMenu_RXMode[gSubMenuSelection]);
|
||||
break;
|
||||
|
||||
case MENU_TOT:
|
||||
@@ -808,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
|
||||
@@ -866,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)
|
||||
@@ -913,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);
|
||||
@@ -924,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);
|
||||
@@ -943,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);
|
||||
|
||||
28
ui/menu.h
28
ui/menu.h
@@ -39,7 +39,6 @@ enum
|
||||
MENU_T_CTCS,
|
||||
MENU_SFT_D,
|
||||
MENU_OFFSET,
|
||||
MENU_XB,
|
||||
MENU_TOT,
|
||||
MENU_W_N,
|
||||
MENU_SCR,
|
||||
@@ -103,9 +102,6 @@ enum
|
||||
MENU_NOAA_S,
|
||||
#endif
|
||||
MENU_RESET,
|
||||
|
||||
// items after here are normally hidden
|
||||
|
||||
MENU_F_LOCK,
|
||||
MENU_200TX,
|
||||
MENU_350TX,
|
||||
@@ -117,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];
|
||||
@@ -128,20 +129,20 @@ extern const char gSubMenu_W_N[2][7];
|
||||
extern const char gSubMenu_OFF_ON[2][4];
|
||||
extern const char gSubMenu_SAVE[5][4];
|
||||
extern const char gSubMenu_TOT[11][7];
|
||||
extern const char gSubMenu_CHAN[3][10];
|
||||
extern const char gSubMenu_XB[3][10];
|
||||
extern const char* gSubMenu_RXMode[4];
|
||||
|
||||
#ifdef ENABLE_VOICE
|
||||
extern const char gSubMenu_VOICE[3][4];
|
||||
#endif
|
||||
extern const char gSubMenu_SC_REV[3][13];
|
||||
extern const char gSubMenu_MDF[4][15];
|
||||
extern const char gSubMenu_SC_REV[3][8];
|
||||
extern const char* gSubMenu_MDF[4];
|
||||
#ifdef ENABLE_ALARM
|
||||
extern const char gSubMenu_AL_MOD[2][5];
|
||||
#endif
|
||||
extern const char gSubMenu_D_RSP[4][11];
|
||||
extern const char gSubMenu_PTT_ID[5][15];
|
||||
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];
|
||||
@@ -152,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;
|
||||
|
||||
|
||||
49
ui/status.c
49
ui/status.c
@@ -85,19 +85,10 @@ void UI_DisplayStatus(const bool test_display)
|
||||
x1 = x + 10;
|
||||
}
|
||||
else
|
||||
#ifdef ENABLE_FMRADIO
|
||||
// FM indicator
|
||||
if (gFmRadioMode || test_display)
|
||||
{
|
||||
memmove(line + x, BITMAP_FM, sizeof(BITMAP_FM));
|
||||
x1 = x + sizeof(BITMAP_FM);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
// 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);
|
||||
@@ -123,28 +114,25 @@ void UI_DisplayStatus(const bool test_display)
|
||||
memmove(line + x, BITMAP_VoicePrompt, sizeof(BITMAP_VoicePrompt));
|
||||
x1 = x + sizeof(BITMAP_VoicePrompt);
|
||||
}
|
||||
x += sizeof(BITMAP_VoicePrompt);
|
||||
x += sizeof(BITMAP_VoicePrompt) + 1;
|
||||
#else
|
||||
// hmmm, what to put in it's place
|
||||
#endif
|
||||
|
||||
// DUAL-WATCH indicator
|
||||
if (gEeprom.DUAL_WATCH != DUAL_WATCH_OFF || test_display)
|
||||
{
|
||||
if (gDualWatchActive || test_display)
|
||||
memmove(line + x, BITMAP_TDR1, sizeof(BITMAP_TDR1));
|
||||
else
|
||||
memmove(line + x, 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));
|
||||
}
|
||||
}
|
||||
x += sizeof(BITMAP_TDR1);
|
||||
|
||||
// CROSS-VFO indicator
|
||||
if (gEeprom.CROSS_BAND_RX_TX != CROSS_BAND_OFF || test_display)
|
||||
{
|
||||
memmove(line + x, BITMAP_XB, sizeof(BITMAP_XB));
|
||||
x1 = x + sizeof(BITMAP_XB);
|
||||
}
|
||||
x += sizeof(BITMAP_XB);
|
||||
x += sizeof(BITMAP_TDR1) + 2;
|
||||
|
||||
#ifdef ENABLE_VOX
|
||||
// VOX indicator
|
||||
@@ -153,9 +141,12 @@ void UI_DisplayStatus(const bool test_display)
|
||||
memmove(line + x, BITMAP_VOX, sizeof(BITMAP_VOX));
|
||||
x1 = x + sizeof(BITMAP_VOX);
|
||||
}
|
||||
x += sizeof(BITMAP_VOX);
|
||||
x += sizeof(BITMAP_VOX) + 2;
|
||||
#endif
|
||||
|
||||
x = MAX(x, 61u);
|
||||
x1 = x;
|
||||
|
||||
// KEY-LOCK indicator
|
||||
if (gEeprom.KEY_LOCK || test_display)
|
||||
{
|
||||
@@ -218,7 +209,7 @@ void UI_DisplayStatus(const bool test_display)
|
||||
x += sizeof(BITMAP_USB_C);
|
||||
|
||||
// BATTERY LEVEL indicator
|
||||
UI_DrawBattery(line + x, gBatteryDisplayLevel, gLowBattery);
|
||||
UI_DrawBattery(line + x, gBatteryDisplayLevel, gLowBatteryBlink);
|
||||
|
||||
// **************
|
||||
|
||||
|
||||
Reference in New Issue
Block a user