forked from mirror/uv-k5-firmware
Various renames/cleanups.
This commit is contained in:
parent
c353774df2
commit
6bef8d4f75
22
app/action.c
22
app/action.c
@ -48,8 +48,8 @@ static void ACTION_FlashLight(void)
|
||||
|
||||
void ACTION_Power(void)
|
||||
{
|
||||
if (++gTxInfo->OUTPUT_POWER > OUTPUT_POWER_HIGH) {
|
||||
gTxInfo->OUTPUT_POWER = OUTPUT_POWER_LOW;
|
||||
if (++gTxVfo->OUTPUT_POWER > OUTPUT_POWER_HIGH) {
|
||||
gTxVfo->OUTPUT_POWER = OUTPUT_POWER_LOW;
|
||||
}
|
||||
|
||||
gRequestSaveChannel = 1;
|
||||
@ -60,9 +60,9 @@ void ACTION_Power(void)
|
||||
static void ACTION_Monitor(void)
|
||||
{
|
||||
if (gCurrentFunction != FUNCTION_MONITOR) {
|
||||
RADIO_ConfigureTX();
|
||||
if (gRxInfo->CHANNEL_SAVE >= NOAA_CHANNEL_FIRST && gIsNoaaMode) {
|
||||
gNoaaChannel = gRxInfo->CHANNEL_SAVE - NOAA_CHANNEL_FIRST;
|
||||
RADIO_SelectVfos();
|
||||
if (gRxVfo->CHANNEL_SAVE >= NOAA_CHANNEL_FIRST && gIsNoaaMode) {
|
||||
gNoaaChannel = gRxVfo->CHANNEL_SAVE - NOAA_CHANNEL_FIRST;
|
||||
}
|
||||
RADIO_SetupRegisters(true);
|
||||
APP_StartListening(FUNCTION_MONITOR);
|
||||
@ -114,8 +114,8 @@ void ACTION_Scan(bool bFlag)
|
||||
return;
|
||||
}
|
||||
} else if (gScreenToDisplay != DISPLAY_SCANNER) {
|
||||
RADIO_ConfigureTX();
|
||||
if (IS_NOT_NOAA_CHANNEL(gRxInfo->CHANNEL_SAVE)) {
|
||||
RADIO_SelectVfos();
|
||||
if (IS_NOT_NOAA_CHANNEL(gRxVfo->CHANNEL_SAVE)) {
|
||||
GUI_SelectNextDisplay(DISPLAY_MAIN);
|
||||
if (gStepDirection) {
|
||||
FUN_0000773c();
|
||||
@ -133,7 +133,7 @@ void ACTION_Vox(void)
|
||||
{
|
||||
gEeprom.VOX_SWITCH = !gEeprom.VOX_SWITCH;
|
||||
gRequestSaveSettings = true;
|
||||
g_20000398 = 1;
|
||||
g_20000398 = true;
|
||||
gAnotherVoiceID = VOICE_ID_VOX;
|
||||
gUpdateStatus = true;
|
||||
}
|
||||
@ -157,12 +157,12 @@ void ACTION_FM(void)
|
||||
if (gFmRadioMode) {
|
||||
FM_TurnOff();
|
||||
gInputBoxIndex = 0;
|
||||
g_200003B6 = 0x50;
|
||||
g_20000398 = 1;
|
||||
g_200003B6 = 80;
|
||||
g_20000398 = true;
|
||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||
return;
|
||||
}
|
||||
RADIO_ConfigureTX();
|
||||
RADIO_SelectVfos();
|
||||
RADIO_SetupRegisters(true);
|
||||
FM_Start();
|
||||
gInputBoxIndex = 0;
|
||||
|
@ -48,7 +48,7 @@ void AIRCOPY_SendMessage(void)
|
||||
if (++gAirCopyBlockNumber >= 0x78) {
|
||||
gAircopyState = AIRCOPY_COMPLETE;
|
||||
}
|
||||
RADIO_PrepareTransmit();
|
||||
RADIO_SetTxParameters();
|
||||
BK4819_SendFSKData(g_FSK_Buffer);
|
||||
BK4819_SetupPowerAmplifier(0, 0);
|
||||
BK4819_ToggleGpioOut(BK4819_GPIO5_PIN1, false);
|
||||
@ -117,13 +117,13 @@ static void AIRCOPY_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
for (i = 0; i < 7; i++) {
|
||||
if (Frequency >= gLowerLimitFrequencyBandTable[i] && Frequency <= gUpperLimitFrequencyBandTable[i]) {
|
||||
gAnotherVoiceID = (VOICE_ID_t)Key;
|
||||
gRxInfo->Band = i;
|
||||
gRxVfo->Band = i;
|
||||
Frequency += 75;
|
||||
Frequency = FREQUENCY_FloorToStep(Frequency, gRxInfo->StepFrequency, 0);
|
||||
gRxInfo->ConfigRX.Frequency = Frequency;
|
||||
gRxInfo->ConfigTX.Frequency = Frequency;
|
||||
RADIO_ConfigureSquelchAndOutputPower(gRxInfo);
|
||||
gCrossTxRadioInfo = gRxInfo;
|
||||
Frequency = FREQUENCY_FloorToStep(Frequency, gRxVfo->StepFrequency, 0);
|
||||
gRxVfo->ConfigRX.Frequency = Frequency;
|
||||
gRxVfo->ConfigTX.Frequency = Frequency;
|
||||
RADIO_ConfigureSquelchAndOutputPower(gRxVfo);
|
||||
gCurrentVfo = gRxVfo;
|
||||
RADIO_SetupRegisters(true);
|
||||
BK4819_SetupAircopy();
|
||||
BK4819_ResetFSK();
|
||||
|
211
app/app.c
211
app/app.c
@ -60,10 +60,10 @@ static void FUN_00005144(void)
|
||||
return;
|
||||
}
|
||||
if (gStepDirection == 0) {
|
||||
if (g_20000381 && g_20000411 == 0) {
|
||||
if (gCssScanMode != CSS_SCAN_MODE_OFF && gRxReceptionMode == RX_MODE_NONE) {
|
||||
ScanPauseDelayIn10msec = 100;
|
||||
gScheduleScanListen = false;
|
||||
g_20000411 = 1;
|
||||
gRxReceptionMode = RX_MODE_DETECTED;
|
||||
}
|
||||
if (gEeprom.DUAL_WATCH == DUAL_WATCH_OFF) {
|
||||
if (gIsNoaaMode) {
|
||||
@ -73,21 +73,21 @@ static void FUN_00005144(void)
|
||||
FUNCTION_Select(FUNCTION_3);
|
||||
return;
|
||||
}
|
||||
if (g_20000411) {
|
||||
if (gRxReceptionMode != RX_MODE_NONE) {
|
||||
FUNCTION_Select(FUNCTION_3);
|
||||
return;
|
||||
}
|
||||
gDualWatchCountdown = 100;
|
||||
gScheduleDualWatch = false;
|
||||
} else {
|
||||
if (g_20000411) {
|
||||
if (gRxReceptionMode != RX_MODE_NONE) {
|
||||
FUNCTION_Select(FUNCTION_3);
|
||||
return;
|
||||
}
|
||||
ScanPauseDelayIn10msec = 20;
|
||||
gScheduleScanListen = false;
|
||||
}
|
||||
g_20000411 = 1;
|
||||
gRxReceptionMode = RX_MODE_DETECTED;
|
||||
FUNCTION_Select(FUNCTION_3);
|
||||
}
|
||||
|
||||
@ -102,7 +102,7 @@ void FUN_000051e8(void)
|
||||
}
|
||||
|
||||
bFlag = (gStepDirection == 0 && gCopyOfCodeType == CODE_TYPE_OFF);
|
||||
if (gRxInfo->CHANNEL_SAVE >= NOAA_CHANNEL_FIRST && gSystickCountdown2) {
|
||||
if (gRxVfo->CHANNEL_SAVE >= NOAA_CHANNEL_FIRST && gSystickCountdown2) {
|
||||
bFlag = true;
|
||||
gSystickCountdown2 = 0;
|
||||
}
|
||||
@ -118,13 +118,13 @@ void FUN_000051e8(void)
|
||||
|
||||
DTMF_HandleRequest();
|
||||
|
||||
if (gStepDirection == 0 && g_20000381 == 0) {
|
||||
if (gRxInfo->DTMF_DECODING_ENABLE || gSetting_KILLED) {
|
||||
if (gStepDirection == 0 && gCssScanMode == CSS_SCAN_MODE_OFF) {
|
||||
if (gRxVfo->DTMF_DECODING_ENABLE || gSetting_KILLED) {
|
||||
if (gDTMF_CallState == DTMF_CALL_STATE_NONE) {
|
||||
if (g_20000411 == 0x01) {
|
||||
if (gRxReceptionMode == RX_MODE_DETECTED) {
|
||||
gDualWatchCountdown = 500;
|
||||
gScheduleDualWatch = false;
|
||||
g_20000411 = 2;
|
||||
gRxReceptionMode = RX_MODE_LISTENING;
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -142,24 +142,24 @@ void FUN_0000773c(void)
|
||||
gStepDirection = 0;
|
||||
|
||||
if (!g_20000413) {
|
||||
if (IS_MR_CHANNEL(g_20000410)) {
|
||||
if (IS_MR_CHANNEL(gNextMrChannel)) {
|
||||
gEeprom.MrChannel[gEeprom.RX_CHANNEL] = gRestoreMrChannel;
|
||||
gEeprom.ScreenChannel[gEeprom.RX_CHANNEL] = Previous;
|
||||
RADIO_ConfigureChannel(gEeprom.RX_CHANNEL, 2);
|
||||
} else {
|
||||
gRxInfo->ConfigRX.Frequency = gRestoreFrequency;
|
||||
RADIO_ApplyOffset(gRxInfo);
|
||||
RADIO_ConfigureSquelchAndOutputPower(gRxInfo);
|
||||
gRxVfo->ConfigRX.Frequency = gRestoreFrequency;
|
||||
RADIO_ApplyOffset(gRxVfo);
|
||||
RADIO_ConfigureSquelchAndOutputPower(gRxVfo);
|
||||
}
|
||||
RADIO_SetupRegisters(true);
|
||||
gUpdateDisplay = true;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!IS_MR_CHANNEL(gRxInfo->CHANNEL_SAVE)) {
|
||||
RADIO_ApplyOffset(gRxInfo);
|
||||
RADIO_ConfigureSquelchAndOutputPower(gRxInfo);
|
||||
SETTINGS_SaveChannel(gRxInfo->CHANNEL_SAVE, gEeprom.RX_CHANNEL, gRxInfo, 1);
|
||||
if (!IS_MR_CHANNEL(gRxVfo->CHANNEL_SAVE)) {
|
||||
RADIO_ApplyOffset(gRxVfo);
|
||||
RADIO_ConfigureSquelchAndOutputPower(gRxVfo);
|
||||
SETTINGS_SaveChannel(gRxVfo->CHANNEL_SAVE, gEeprom.RX_CHANNEL, gRxVfo, 1);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -174,7 +174,7 @@ void FUN_000052f0(void)
|
||||
|
||||
if (gSystickFlag10) {
|
||||
Value = 1;
|
||||
} else if (gStepDirection && IS_FREQ_CHANNEL(g_20000410)) {
|
||||
} else if (gStepDirection && IS_FREQ_CHANNEL(gNextMrChannel)) {
|
||||
if (g_SquelchLost) {
|
||||
return;
|
||||
}
|
||||
@ -189,7 +189,7 @@ void FUN_000052f0(void)
|
||||
Value = 1;
|
||||
} else {
|
||||
if (g_SquelchLost) {
|
||||
if (g_20000377 == 0 && IS_NOT_NOAA_CHANNEL(gRxInfo->CHANNEL_SAVE)) {
|
||||
if (!gEndOfRxDetectedMaybe && IS_NOT_NOAA_CHANNEL(gRxVfo->CHANNEL_SAVE)) {
|
||||
switch (gCopyOfCodeType) {
|
||||
case CODE_TYPE_OFF:
|
||||
if (gEeprom.SQUELCH_LEVEL) {
|
||||
@ -238,7 +238,7 @@ void FUN_000052f0(void)
|
||||
}
|
||||
}
|
||||
|
||||
if (!g_20000377 && !Value && gNextTimeslice40ms && gEeprom.TAIL_NOTE_ELIMINATION && (gCopyOfCodeType == CODE_TYPE_DIGITAL || gCopyOfCodeType == CODE_TYPE_REVERSE_DIGITAL)) {
|
||||
if (!gEndOfRxDetectedMaybe && !Value && gNextTimeslice40ms && gEeprom.TAIL_NOTE_ELIMINATION && (gCopyOfCodeType == CODE_TYPE_DIGITAL || gCopyOfCodeType == CODE_TYPE_REVERSE_DIGITAL)) {
|
||||
if (BK4819_GetCTCType() == 1) {
|
||||
Value = 2;
|
||||
}
|
||||
@ -249,7 +249,7 @@ void FUN_000052f0(void)
|
||||
switch (Value) {
|
||||
case 1:
|
||||
RADIO_SetupRegisters(true);
|
||||
if (IS_NOAA_CHANNEL(gRxInfo->CHANNEL_SAVE)) {
|
||||
if (IS_NOAA_CHANNEL(gRxVfo->CHANNEL_SAVE)) {
|
||||
gSystickCountdown2 = 300;
|
||||
}
|
||||
gUpdateDisplay = true;
|
||||
@ -271,7 +271,7 @@ void FUN_000052f0(void)
|
||||
g_20000342 = 20;
|
||||
gSystickFlag10 = false;
|
||||
gEnableSpeaker = false;
|
||||
g_20000377 = 1;
|
||||
gEndOfRxDetectedMaybe = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -284,7 +284,7 @@ void FUN_0000510c(void)
|
||||
FUN_00005144();
|
||||
break;
|
||||
case FUNCTION_POWER_SAVE:
|
||||
if (!gThisCanEnable_BK4819_Rxon) {
|
||||
if (!gRxIdleMode) {
|
||||
FUN_00005144();
|
||||
}
|
||||
break;
|
||||
@ -326,23 +326,23 @@ void APP_StartListening(FUNCTION_Type_t Function)
|
||||
}
|
||||
g_20000413 = true;
|
||||
}
|
||||
if (IS_NOAA_CHANNEL(gRxInfo->CHANNEL_SAVE) && gIsNoaaMode) {
|
||||
gRxInfo->CHANNEL_SAVE = gNoaaChannel + NOAA_CHANNEL_FIRST;
|
||||
gRxInfo->pCurrent->Frequency = NoaaFrequencyTable[gNoaaChannel];
|
||||
gRxInfo->pReverse->Frequency = NoaaFrequencyTable[gNoaaChannel];
|
||||
gEeprom.ScreenChannel[gEeprom.RX_CHANNEL] = gRxInfo->CHANNEL_SAVE;
|
||||
if (IS_NOAA_CHANNEL(gRxVfo->CHANNEL_SAVE) && gIsNoaaMode) {
|
||||
gRxVfo->CHANNEL_SAVE = gNoaaChannel + NOAA_CHANNEL_FIRST;
|
||||
gRxVfo->pCurrent->Frequency = NoaaFrequencyTable[gNoaaChannel];
|
||||
gRxVfo->pReverse->Frequency = NoaaFrequencyTable[gNoaaChannel];
|
||||
gEeprom.ScreenChannel[gEeprom.RX_CHANNEL] = gRxVfo->CHANNEL_SAVE;
|
||||
gNOAA_Countdown = 500;
|
||||
gScheduleNOAA = false;
|
||||
}
|
||||
if (g_20000381) {
|
||||
g_20000381 = 2;
|
||||
if (gCssScanMode != CSS_SCAN_MODE_OFF) {
|
||||
gCssScanMode = CSS_SCAN_MODE_FOUND;
|
||||
}
|
||||
if ((gStepDirection == 0 || g_20000381 == 0) && gEeprom.DUAL_WATCH != DUAL_WATCH_OFF) {
|
||||
if ((gStepDirection == 0 || gCssScanMode == CSS_SCAN_MODE_OFF) && gEeprom.DUAL_WATCH != DUAL_WATCH_OFF) {
|
||||
g_2000041F = 1;
|
||||
gDualWatchCountdown = 360;
|
||||
gScheduleDualWatch = false;
|
||||
}
|
||||
if (gRxInfo->IsAM) {
|
||||
if (gRxVfo->IsAM) {
|
||||
BK4819_WriteRegister(BK4819_REG_48, 0xB3A8);
|
||||
g_20000474 = 0;
|
||||
} else {
|
||||
@ -352,7 +352,7 @@ void APP_StartListening(FUNCTION_Type_t Function)
|
||||
);
|
||||
}
|
||||
if (gVoiceWriteIndex == 0) {
|
||||
if (gRxInfo->IsAM) {
|
||||
if (gRxVfo->IsAM) {
|
||||
BK4819_SetAF(BK4819_AF_AM);
|
||||
} else {
|
||||
BK4819_SetAF(BK4819_AF_OPEN);
|
||||
@ -383,9 +383,9 @@ void APP_SetFrequencyByStep(VFO_Info_t *pInfo, int8_t Step)
|
||||
|
||||
void APP_MoreRadioStuff(void)
|
||||
{
|
||||
APP_SetFrequencyByStep(gRxInfo, gStepDirection);
|
||||
RADIO_ApplyOffset(gRxInfo);
|
||||
RADIO_ConfigureSquelchAndOutputPower(gRxInfo);
|
||||
APP_SetFrequencyByStep(gRxVfo, gStepDirection);
|
||||
RADIO_ApplyOffset(gRxVfo);
|
||||
RADIO_ConfigureSquelchAndOutputPower(gRxVfo);
|
||||
RADIO_SetupRegisters(true);
|
||||
gUpdateDisplay = true;
|
||||
ScanPauseDelayIn10msec = 10;
|
||||
@ -399,38 +399,38 @@ void FUN_00007dd4(void)
|
||||
uint8_t PreviousCh, Ch;
|
||||
bool bEnabled;
|
||||
|
||||
PreviousCh = g_20000410;
|
||||
PreviousCh = gNextMrChannel;
|
||||
bEnabled = gEeprom.SCAN_LIST_ENABLED[gEeprom.SCAN_LIST_DEFAULT];
|
||||
if (bEnabled) {
|
||||
if (gCurrentScanList == 0) {
|
||||
g_20000416 = g_20000410;
|
||||
gPreviousMrChannel = gNextMrChannel;
|
||||
if (RADIO_CheckValidChannel(Ch1, false, 0)) {
|
||||
g_20000410 = Ch1;
|
||||
gNextMrChannel = Ch1;
|
||||
} else {
|
||||
gCurrentScanList = 1;
|
||||
}
|
||||
}
|
||||
if (gCurrentScanList == 1) {
|
||||
if (RADIO_CheckValidChannel(Ch2, false, 0)) {
|
||||
g_20000410 = Ch2;
|
||||
gNextMrChannel = Ch2;
|
||||
} else {
|
||||
gCurrentScanList = 2;
|
||||
}
|
||||
}
|
||||
if (gCurrentScanList == 2) {
|
||||
g_20000410 = g_20000416;
|
||||
gNextMrChannel = gPreviousMrChannel;
|
||||
}
|
||||
}
|
||||
|
||||
Ch = RADIO_FindNextChannel(g_20000410 + gStepDirection, gStepDirection, true, gEeprom.SCAN_LIST_DEFAULT);
|
||||
Ch = RADIO_FindNextChannel(gNextMrChannel + gStepDirection, gStepDirection, true, gEeprom.SCAN_LIST_DEFAULT);
|
||||
if (Ch == 0xFF) {
|
||||
return;
|
||||
}
|
||||
|
||||
g_20000410 = Ch;
|
||||
if (PreviousCh != g_20000410) {
|
||||
gEeprom.MrChannel[gEeprom.RX_CHANNEL] = g_20000410;
|
||||
gEeprom.ScreenChannel[gEeprom.RX_CHANNEL] = g_20000410;
|
||||
gNextMrChannel = Ch;
|
||||
if (PreviousCh != gNextMrChannel) {
|
||||
gEeprom.MrChannel[gEeprom.RX_CHANNEL] = gNextMrChannel;
|
||||
gEeprom.ScreenChannel[gEeprom.RX_CHANNEL] = gNextMrChannel;
|
||||
RADIO_ConfigureChannel(gEeprom.RX_CHANNEL, 2);
|
||||
RADIO_SetupRegisters(true);
|
||||
gUpdateDisplay = true;
|
||||
@ -461,13 +461,13 @@ void DUALWATCH_Alternate(void)
|
||||
} else {
|
||||
gEeprom.RX_CHANNEL = 0;
|
||||
}
|
||||
gRxInfo = &gEeprom.VfoInfo[gEeprom.RX_CHANNEL];
|
||||
gRxVfo = &gEeprom.VfoInfo[gEeprom.RX_CHANNEL];
|
||||
if (gEeprom.VfoInfo[0].CHANNEL_SAVE >= NOAA_CHANNEL_FIRST) {
|
||||
NOAA_IncreaseChannel();
|
||||
}
|
||||
} else {
|
||||
gEeprom.RX_CHANNEL = gEeprom.RX_CHANNEL == 0;
|
||||
gRxInfo = &gEeprom.VfoInfo[gEeprom.RX_CHANNEL];
|
||||
gRxVfo = &gEeprom.VfoInfo[gEeprom.RX_CHANNEL];
|
||||
}
|
||||
RADIO_SetupRegisters(false);
|
||||
if (gIsNoaaMode) {
|
||||
@ -523,7 +523,7 @@ void APP_CheckRadioInterrupts(void)
|
||||
g_VOX_Lost = true;
|
||||
gVoxPauseCountdown = 10;
|
||||
if (gEeprom.VOX_SWITCH) {
|
||||
if (gCurrentFunction == FUNCTION_POWER_SAVE && !gThisCanEnable_BK4819_Rxon) {
|
||||
if (gCurrentFunction == FUNCTION_POWER_SAVE && !gRxIdleMode) {
|
||||
gBatterySave = 20;
|
||||
gBatterySaveCountdownExpired = 0;
|
||||
}
|
||||
@ -574,7 +574,7 @@ static void FUN_00008334(void)
|
||||
g_VOX_Lost = false;
|
||||
gVoxPauseCountdown = 0;
|
||||
}
|
||||
if (gCurrentFunction != FUNCTION_RECEIVE && gCurrentFunction != FUNCTION_MONITOR && gStepDirection == 0 && g_20000381 == 0 && !gFmRadioMode) {
|
||||
if (gCurrentFunction != FUNCTION_RECEIVE && gCurrentFunction != FUNCTION_MONITOR && gStepDirection == 0 && gCssScanMode == CSS_SCAN_MODE_OFF && !gFmRadioMode) {
|
||||
if (gVOX_NoiseDetected) {
|
||||
if (g_VOX_Lost) {
|
||||
gVoxStopCountdown = 100;
|
||||
@ -603,7 +603,7 @@ static void FUN_00008334(void)
|
||||
}
|
||||
if (gCurrentFunction != FUNCTION_TRANSMIT) {
|
||||
gDTMF_ReplyState = DTMF_REPLY_UP_CODE;
|
||||
RADIO_SomethingWithTransmit();
|
||||
RADIO_PrepareTX();
|
||||
gUpdateDisplay = true;
|
||||
}
|
||||
}
|
||||
@ -637,7 +637,7 @@ void APP_Update(void)
|
||||
}
|
||||
|
||||
if (gScreenToDisplay != DISPLAY_SCANNER && gStepDirection && gScheduleScanListen && !gPttIsPressed && gVoiceWriteIndex == 0) {
|
||||
if (IS_FREQ_CHANNEL(g_20000410)) {
|
||||
if (IS_FREQ_CHANNEL(gNextMrChannel)) {
|
||||
if (gCurrentFunction == FUNCTION_3) {
|
||||
APP_StartListening(FUNCTION_RECEIVE);
|
||||
} else {
|
||||
@ -651,11 +651,11 @@ void APP_Update(void)
|
||||
}
|
||||
}
|
||||
gScanPauseMode = 0;
|
||||
g_20000411 = 0;
|
||||
gRxReceptionMode = RX_MODE_NONE;
|
||||
gScheduleScanListen = false;
|
||||
}
|
||||
|
||||
if (g_20000381 == 1 && gScheduleScanListen && gVoiceWriteIndex == 0) {
|
||||
if (gCssScanMode == CSS_SCAN_MODE_SCANNING && gScheduleScanListen && gVoiceWriteIndex == 0) {
|
||||
MENU_SelectNextDCS();
|
||||
gScheduleScanListen = false;
|
||||
}
|
||||
@ -669,7 +669,7 @@ void APP_Update(void)
|
||||
|
||||
if (gScreenToDisplay != DISPLAY_SCANNER && gEeprom.DUAL_WATCH != DUAL_WATCH_OFF) {
|
||||
if (gScheduleDualWatch && gVoiceWriteIndex == 0) {
|
||||
if (gStepDirection == 0 && g_20000381 == 0) {
|
||||
if (gStepDirection == 0 && gCssScanMode == CSS_SCAN_MODE_OFF) {
|
||||
if (!gPttIsPressed && !gFmRadioMode && gDTMF_CallState == DTMF_CALL_STATE_NONE && gCurrentFunction != FUNCTION_POWER_SAVE) {
|
||||
DUALWATCH_Alternate();
|
||||
if (g_2000041F == 1 && gScreenToDisplay == DISPLAY_MAIN) {
|
||||
@ -677,7 +677,7 @@ void APP_Update(void)
|
||||
}
|
||||
g_2000041F = 0;
|
||||
gScanPauseMode = 0;
|
||||
g_20000411 = 0;
|
||||
gRxReceptionMode = RX_MODE_NONE;
|
||||
gScheduleDualWatch = false;
|
||||
}
|
||||
}
|
||||
@ -694,7 +694,7 @@ void APP_Update(void)
|
||||
}
|
||||
|
||||
if (gSchedulePowerSave) {
|
||||
if (gEeprom.BATTERY_SAVE == 0 || gStepDirection || g_20000381 || gFmRadioMode || gPttIsPressed || gScreenToDisplay != DISPLAY_MAIN || gKeyBeingHeld || gDTMF_CallState != DTMF_CALL_STATE_NONE) {
|
||||
if (gEeprom.BATTERY_SAVE == 0 || gStepDirection || gCssScanMode != CSS_SCAN_MODE_OFF || gFmRadioMode || gPttIsPressed || gScreenToDisplay != DISPLAY_MAIN || gKeyBeingHeld || gDTMF_CallState != DTMF_CALL_STATE_NONE) {
|
||||
gBatterySaveCountdown = 1000;
|
||||
} else {
|
||||
if ((IS_NOT_NOAA_CHANNEL(gEeprom.ScreenChannel[0]) && IS_NOT_NOAA_CHANNEL(gEeprom.ScreenChannel[1])) || !gIsNoaaMode) {
|
||||
@ -707,23 +707,23 @@ void APP_Update(void)
|
||||
}
|
||||
|
||||
if (gBatterySaveCountdownExpired && gCurrentFunction == FUNCTION_POWER_SAVE && gVoiceWriteIndex == 0) {
|
||||
if (gThisCanEnable_BK4819_Rxon) {
|
||||
if (gRxIdleMode) {
|
||||
BK4819_Conditional_RX_TurnOn_and_GPIO6_Enable();
|
||||
if (gEeprom.VOX_SWITCH) {
|
||||
BK4819_EnableVox(gEeprom.VOX1_THRESHOLD, gEeprom.VOX0_THRESHOLD);
|
||||
}
|
||||
if (gEeprom.DUAL_WATCH != DUAL_WATCH_OFF && gStepDirection == 0 && g_20000381 == 0) {
|
||||
if (gEeprom.DUAL_WATCH != DUAL_WATCH_OFF && gStepDirection == 0 && gCssScanMode == CSS_SCAN_MODE_OFF) {
|
||||
DUALWATCH_Alternate();
|
||||
g_20000382 = 0;
|
||||
}
|
||||
FUNCTION_Init();
|
||||
gBatterySave = 10;
|
||||
gThisCanEnable_BK4819_Rxon = false;
|
||||
} else if (gEeprom.DUAL_WATCH == DUAL_WATCH_OFF || gStepDirection || g_20000381 || g_20000382) {
|
||||
gRxIdleMode = false;
|
||||
} else if (gEeprom.DUAL_WATCH == DUAL_WATCH_OFF || gStepDirection || gCssScanMode != CSS_SCAN_MODE_OFF || g_20000382) {
|
||||
gCurrentRSSI = BK4819_GetRSSI();
|
||||
UI_UpdateRSSI(gCurrentRSSI);
|
||||
gBatterySave = gEeprom.BATTERY_SAVE * 10;
|
||||
gThisCanEnable_BK4819_Rxon = true;
|
||||
gRxIdleMode = true;
|
||||
BK4819_DisableVox();
|
||||
BK4819_Sleep();
|
||||
BK4819_ToggleGpioOut(BK4819_GPIO6_PIN2, false);
|
||||
@ -821,7 +821,7 @@ void APP_TimeSlice10ms(void)
|
||||
return;
|
||||
}
|
||||
|
||||
if (gCurrentFunction != FUNCTION_POWER_SAVE || !gThisCanEnable_BK4819_Rxon) {
|
||||
if (gCurrentFunction != FUNCTION_POWER_SAVE || !gRxIdleMode) {
|
||||
APP_CheckRadioInterrupts();
|
||||
}
|
||||
|
||||
@ -878,7 +878,7 @@ void APP_TimeSlice10ms(void)
|
||||
gAlarmState = ALARM_STATE_TXALARM;
|
||||
GUI_DisplayScreen();
|
||||
BK4819_ToggleGpioOut(BK4819_GPIO1_PIN29_RED, true);
|
||||
RADIO_PrepareTransmit();
|
||||
RADIO_SetTxParameters();
|
||||
BK4819_TransmitTone(true, 500);
|
||||
SYSTEM_DelayMs(2);
|
||||
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
|
||||
@ -1054,7 +1054,7 @@ void APP_TimeSlice500ms(void)
|
||||
goto LAB_00004b08;
|
||||
}
|
||||
}
|
||||
if ((gFM_Step == 0 || gAskToSave) && gStepDirection == 0 && g_20000381 == 0) {
|
||||
if ((gFM_Step == 0 || gAskToSave) && gStepDirection == 0 && gCssScanMode == CSS_SCAN_MODE_OFF) {
|
||||
if (gBacklightCountdown) {
|
||||
gBacklightCountdown--;
|
||||
if (gBacklightCountdown == 0) {
|
||||
@ -1207,24 +1207,24 @@ void FUN_000075b0(void)
|
||||
uint16_t StepFrequency;
|
||||
|
||||
BK4819_StopScan();
|
||||
RADIO_ConfigureTX();
|
||||
RADIO_SelectVfos();
|
||||
|
||||
if (IS_NOAA_CHANNEL(gRxInfo->CHANNEL_SAVE)) {
|
||||
gRxInfo->CHANNEL_SAVE = FREQ_CHANNEL_FIRST + 5;
|
||||
if (IS_NOAA_CHANNEL(gRxVfo->CHANNEL_SAVE)) {
|
||||
gRxVfo->CHANNEL_SAVE = FREQ_CHANNEL_FIRST + 5;
|
||||
}
|
||||
StepSetting = gRxInfo->STEP_SETTING;
|
||||
StepFrequency = gRxInfo->StepFrequency;
|
||||
RADIO_InitInfo(gRxInfo, gRxInfo->CHANNEL_SAVE, gRxInfo->Band, gRxInfo->pCurrent->Frequency);
|
||||
StepSetting = gRxVfo->STEP_SETTING;
|
||||
StepFrequency = gRxVfo->StepFrequency;
|
||||
RADIO_InitInfo(gRxVfo, gRxVfo->CHANNEL_SAVE, gRxVfo->Band, gRxVfo->pCurrent->Frequency);
|
||||
|
||||
gRxInfo->STEP_SETTING = StepSetting;
|
||||
gRxInfo->StepFrequency = StepFrequency;
|
||||
gRxVfo->STEP_SETTING = StepSetting;
|
||||
gRxVfo->StepFrequency = StepFrequency;
|
||||
RADIO_SetupRegisters(true);
|
||||
|
||||
gIsNoaaMode = false;
|
||||
if (gScanSingleFrequency) {
|
||||
gScanCssState = SCAN_CSS_STATE_SCANNING;
|
||||
gScanFrequency = gRxInfo->pCurrent->Frequency;
|
||||
gStepSetting = gRxInfo->STEP_SETTING;
|
||||
gScanFrequency = gRxVfo->pCurrent->Frequency;
|
||||
gStepSetting = gRxVfo->STEP_SETTING;
|
||||
BK4819_PickRXFilterPathBasedOnFrequency(gScanFrequency);
|
||||
BK4819_SetScanFrequency(gScanFrequency);
|
||||
} else {
|
||||
@ -1251,24 +1251,24 @@ void FUN_000075b0(void)
|
||||
|
||||
void APP_SetStepDirection(bool bFlag, int8_t Direction)
|
||||
{
|
||||
RADIO_ConfigureTX();
|
||||
g_20000410 = gRxInfo->CHANNEL_SAVE;
|
||||
RADIO_SelectVfos();
|
||||
gNextMrChannel = gRxVfo->CHANNEL_SAVE;
|
||||
gCurrentScanList = 0;
|
||||
gStepDirection = Direction;
|
||||
if (IS_MR_CHANNEL(g_20000410)) {
|
||||
if (IS_MR_CHANNEL(gNextMrChannel)) {
|
||||
if (bFlag) {
|
||||
gRestoreMrChannel = g_20000410;
|
||||
gRestoreMrChannel = gNextMrChannel;
|
||||
}
|
||||
FUN_00007dd4();
|
||||
} else {
|
||||
if (bFlag) {
|
||||
gRestoreFrequency = gRxInfo->ConfigRX.Frequency;
|
||||
gRestoreFrequency = gRxVfo->ConfigRX.Frequency;
|
||||
}
|
||||
APP_MoreRadioStuff();
|
||||
}
|
||||
ScanPauseDelayIn10msec = 50;
|
||||
gScheduleScanListen = false;
|
||||
g_20000411 = 0;
|
||||
gRxReceptionMode = RX_MODE_NONE;
|
||||
gScanPauseMode = 0;
|
||||
g_20000413 = false;
|
||||
}
|
||||
@ -1299,9 +1299,9 @@ static void APP_ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
}
|
||||
if (gFlagSaveChannel) {
|
||||
SETTINGS_SaveChannel(
|
||||
gTxInfo->CHANNEL_SAVE,
|
||||
gTxVfo->CHANNEL_SAVE,
|
||||
gEeprom.TX_CHANNEL,
|
||||
gTxInfo,
|
||||
gTxVfo,
|
||||
gFlagSaveChannel);
|
||||
gFlagSaveChannel = false;
|
||||
RADIO_ConfigureChannel(gEeprom.TX_CHANNEL, 1);
|
||||
@ -1355,7 +1355,7 @@ static void APP_ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
}
|
||||
|
||||
if ((gStepDirection && Key != KEY_PTT && Key != KEY_UP && Key != KEY_DOWN && Key != KEY_EXIT && Key != KEY_STAR) ||
|
||||
(g_20000381 && Key != KEY_PTT && Key != KEY_UP && Key != KEY_DOWN && Key != KEY_EXIT && Key != KEY_STAR && Key != KEY_MENU)) {
|
||||
(gCssScanMode != CSS_SCAN_MODE_OFF && Key != KEY_PTT && Key != KEY_UP && Key != KEY_DOWN && Key != KEY_EXIT && Key != KEY_STAR && Key != KEY_MENU)) {
|
||||
if (!bKeyPressed || bKeyHeld) {
|
||||
return;
|
||||
}
|
||||
@ -1422,10 +1422,10 @@ static void APP_ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
|
||||
gEnableSpeaker = false;
|
||||
BK4819_ExitDTMF_TX(false);
|
||||
if (gCrossTxRadioInfo->SCRAMBLING_TYPE == 0 || !gSetting_ScrambleEnable) {
|
||||
if (gCurrentVfo->SCRAMBLING_TYPE == 0 || !gSetting_ScrambleEnable) {
|
||||
BK4819_DisableScramble();
|
||||
} else {
|
||||
BK4819_EnableScramble(gCrossTxRadioInfo->SCRAMBLING_TYPE - 1);
|
||||
BK4819_EnableScramble(gCurrentVfo->SCRAMBLING_TYPE - 1);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@ -1523,7 +1523,7 @@ Skip:
|
||||
}
|
||||
if (gRequestSaveChannel) {
|
||||
if (!bKeyHeld) {
|
||||
SETTINGS_SaveChannel(gTxInfo->CHANNEL_SAVE, gEeprom.TX_CHANNEL, gTxInfo, gRequestSaveChannel);
|
||||
SETTINGS_SaveChannel(gTxVfo->CHANNEL_SAVE, gEeprom.TX_CHANNEL, gTxVfo, gRequestSaveChannel);
|
||||
if (gScreenToDisplay != DISPLAY_SCANNER) {
|
||||
gVfoConfigureMode = VFO_CONFIGURE_1;
|
||||
}
|
||||
@ -1536,11 +1536,8 @@ Skip:
|
||||
gRequestSaveChannel = 0;
|
||||
}
|
||||
|
||||
if (gVfoConfigureMode == VFO_CONFIGURE_0) {
|
||||
if (g_20000398 == 0) {
|
||||
goto LAB_00002aae;
|
||||
}
|
||||
} else {
|
||||
|
||||
if (gVfoConfigureMode != VFO_CONFIGURE_0) {
|
||||
if (gFlagRetuneVfos) {
|
||||
RADIO_ConfigureChannel(0, gVfoConfigureMode);
|
||||
RADIO_ConfigureChannel(1, gVfoConfigureMode);
|
||||
@ -1550,22 +1547,24 @@ Skip:
|
||||
if (gRequestDisplayScreen == DISPLAY_INVALID) {
|
||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||
}
|
||||
g_20000398 = 1;
|
||||
g_20000398 = true;
|
||||
gVfoConfigureMode = VFO_CONFIGURE_0;
|
||||
gFlagRetuneVfos = false;
|
||||
}
|
||||
RADIO_ConfigureTX();
|
||||
RADIO_ConfigureNOAA();
|
||||
RADIO_SetupRegisters(true);
|
||||
gDTMF_AUTO_RESET_TIME = 0;
|
||||
gDTMF_CallState = DTMF_CALL_STATE_NONE;
|
||||
gDTMF_TxStopCountdown = 0;
|
||||
gDTMF_IsTx = false;
|
||||
gVFO_RSSI_Level[0] = 0;
|
||||
gVFO_RSSI_Level[1] = 0;
|
||||
g_20000398 = 0;
|
||||
|
||||
LAB_00002aae:
|
||||
if (g_20000398) {
|
||||
RADIO_SelectVfos();
|
||||
RADIO_ConfigureNOAA();
|
||||
RADIO_SetupRegisters(true);
|
||||
gDTMF_AUTO_RESET_TIME = 0;
|
||||
gDTMF_CallState = DTMF_CALL_STATE_NONE;
|
||||
gDTMF_TxStopCountdown = 0;
|
||||
gDTMF_IsTx = false;
|
||||
gVFO_RSSI_Level[0] = 0;
|
||||
gVFO_RSSI_Level[1] = 0;
|
||||
g_20000398 = false;
|
||||
}
|
||||
|
||||
if (gFlagRefreshSetting) {
|
||||
MENU_ShowCurrentSetting();
|
||||
gFlagRefreshSetting = false;
|
||||
@ -1578,7 +1577,7 @@ LAB_00002aae:
|
||||
gFlagStartScan = false;
|
||||
}
|
||||
if (g_200003A0 == 1) {
|
||||
RADIO_SomethingWithTransmit();
|
||||
RADIO_PrepareTX();
|
||||
g_200003A0 = 0;
|
||||
}
|
||||
if (gAnotherVoiceID != VOICE_ID_INVALID) {
|
||||
|
@ -183,11 +183,11 @@ void DTMF_HandleRequest(void)
|
||||
|
||||
gDTMF_RequestPending = false;
|
||||
|
||||
if (gStepDirection || g_20000381) {
|
||||
if (gStepDirection || gCssScanMode != CSS_SCAN_MODE_OFF) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!gRxInfo->DTMF_DECODING_ENABLE && !gSetting_KILLED) {
|
||||
if (!gRxVfo->DTMF_DECODING_ENABLE && !gSetting_KILLED) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -305,7 +305,7 @@ void DTMF_Reply(void)
|
||||
break;
|
||||
|
||||
default:
|
||||
if (gDTMF_CallState != DTMF_CALL_STATE_NONE || (gCrossTxRadioInfo->DTMF_PTT_ID_TX_MODE != PTT_ID_BOT && gCrossTxRadioInfo->DTMF_PTT_ID_TX_MODE != PTT_ID_BOTH)) {
|
||||
if (gDTMF_CallState != DTMF_CALL_STATE_NONE || (gCurrentVfo->DTMF_PTT_ID_TX_MODE != PTT_ID_BOT && gCurrentVfo->DTMF_PTT_ID_TX_MODE != PTT_ID_BOTH)) {
|
||||
gDTMF_ReplyState = DTMF_REPLY_UP_CODE;
|
||||
return;
|
||||
}
|
||||
|
@ -114,7 +114,7 @@ void GENERIC_Key_PTT(bool bKeyPressed)
|
||||
}
|
||||
|
||||
if (gFM_Step == 0) {
|
||||
if (g_20000381 == 0) {
|
||||
if (gCssScanMode == CSS_SCAN_MODE_OFF) {
|
||||
if (gScreenToDisplay == DISPLAY_MENU || gScreenToDisplay == DISPLAY_FM) {
|
||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||
gInputBoxIndex = 0;
|
||||
@ -161,7 +161,7 @@ void GENERIC_Key_PTT(bool bKeyPressed)
|
||||
gVfoConfigureMode = VFO_CONFIGURE_RELOAD;
|
||||
gFlagRetuneVfos = true;
|
||||
} else {
|
||||
RADIO_Whatever();
|
||||
RADIO_StopCssScan();
|
||||
gRequestDisplayScreen = DISPLAY_MENU;
|
||||
}
|
||||
} else {
|
||||
|
38
app/main.c
38
app/main.c
@ -51,7 +51,7 @@ static void MAIN_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
if (!gWasFKeyPressed) {
|
||||
INPUTBOX_Append(Key);
|
||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||
if (IS_MR_CHANNEL(gTxInfo->CHANNEL_SAVE)) {
|
||||
if (IS_MR_CHANNEL(gTxVfo->CHANNEL_SAVE)) {
|
||||
uint16_t Channel;
|
||||
|
||||
if (gInputBoxIndex != 3) {
|
||||
@ -72,7 +72,7 @@ static void MAIN_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
gVfoConfigureMode = VFO_CONFIGURE_RELOAD;
|
||||
return;
|
||||
}
|
||||
if (IS_NOT_NOAA_CHANNEL(gTxInfo->CHANNEL_SAVE)) {
|
||||
if (IS_NOT_NOAA_CHANNEL(gTxVfo->CHANNEL_SAVE)) {
|
||||
uint32_t Frequency;
|
||||
|
||||
if (gInputBoxIndex < 6) {
|
||||
@ -87,18 +87,18 @@ static void MAIN_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
for (i = 0; i < 7; i++) {
|
||||
if (Frequency <= gUpperLimitFrequencyBandTable[i] && (gLowerLimitFrequencyBandTable[i] <= Frequency)) {
|
||||
gAnotherVoiceID = (VOICE_ID_t)Key;
|
||||
if (gTxInfo->Band != i) {
|
||||
gTxInfo->Band = i;
|
||||
if (gTxVfo->Band != i) {
|
||||
gTxVfo->Band = i;
|
||||
gEeprom.ScreenChannel[Vfo] = i + FREQ_CHANNEL_FIRST;
|
||||
gEeprom.FreqChannel[Vfo] = i + FREQ_CHANNEL_FIRST;
|
||||
SETTINGS_SaveVfoIndices();
|
||||
RADIO_ConfigureChannel(Vfo, 2);
|
||||
}
|
||||
Frequency += 75;
|
||||
gTxInfo->ConfigRX.Frequency = FREQUENCY_FloorToStep(
|
||||
gTxVfo->ConfigRX.Frequency = FREQUENCY_FloorToStep(
|
||||
Frequency,
|
||||
gTxInfo->StepFrequency,
|
||||
gLowerLimitFrequencyBandTable[gTxInfo->Band]
|
||||
gTxVfo->StepFrequency,
|
||||
gLowerLimitFrequencyBandTable[gTxVfo->Band]
|
||||
);
|
||||
gRequestSaveChannel = 1;
|
||||
return;
|
||||
@ -137,13 +137,13 @@ static void MAIN_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
break;
|
||||
|
||||
case KEY_1:
|
||||
if (!IS_FREQ_CHANNEL(gTxInfo->CHANNEL_SAVE)) {
|
||||
if (!IS_FREQ_CHANNEL(gTxVfo->CHANNEL_SAVE)) {
|
||||
gWasFKeyPressed = false;
|
||||
gUpdateStatus = true;
|
||||
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
||||
return;
|
||||
}
|
||||
Band = gTxInfo->Band + 1;
|
||||
Band = gTxVfo->Band + 1;
|
||||
if (gSetting_350EN || Band != BAND5_350MHz) {
|
||||
if (BAND7_470MHz < Band) {
|
||||
Band = BAND1_50MHz;
|
||||
@ -151,7 +151,7 @@ static void MAIN_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
} else {
|
||||
Band = BAND6_400MHz;
|
||||
}
|
||||
gTxInfo->Band = Band;
|
||||
gTxVfo->Band = Band;
|
||||
gEeprom.ScreenChannel[Vfo] = FREQ_CHANNEL_FIRST + Band;
|
||||
gEeprom.FreqChannel[Vfo] = FREQ_CHANNEL_FIRST + Band;
|
||||
gRequestSaveVFO = true;
|
||||
@ -173,16 +173,16 @@ static void MAIN_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
gEeprom.TX_CHANNEL = (Vfo == 0);
|
||||
}
|
||||
gRequestSaveSettings = 1;
|
||||
g_20000398 = 1;
|
||||
g_20000398 = true;
|
||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
||||
break;
|
||||
|
||||
case KEY_3:
|
||||
if (gEeprom.VFO_OPEN && IS_NOT_NOAA_CHANNEL(gTxInfo->CHANNEL_SAVE)) {
|
||||
if (gEeprom.VFO_OPEN && IS_NOT_NOAA_CHANNEL(gTxVfo->CHANNEL_SAVE)) {
|
||||
uint8_t Channel;
|
||||
|
||||
if (IS_MR_CHANNEL(gTxInfo->CHANNEL_SAVE)) {
|
||||
if (IS_MR_CHANNEL(gTxVfo->CHANNEL_SAVE)) {
|
||||
gEeprom.ScreenChannel[Vfo] = gEeprom.FreqChannel[gEeprom.TX_CHANNEL];
|
||||
gAnotherVoiceID = VOICE_ID_FREQUENCY_MODE;
|
||||
gRequestSaveVFO = true;
|
||||
@ -214,7 +214,7 @@ static void MAIN_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
break;
|
||||
|
||||
case KEY_5:
|
||||
if (IS_NOT_NOAA_CHANNEL(gTxInfo->CHANNEL_SAVE)) {
|
||||
if (IS_NOT_NOAA_CHANNEL(gTxVfo->CHANNEL_SAVE)) {
|
||||
gEeprom.ScreenChannel[Vfo] = gEeprom.NoaaChannel[gEeprom.TX_CHANNEL];
|
||||
} else {
|
||||
gEeprom.ScreenChannel[Vfo] = gEeprom.FreqChannel[gEeprom.TX_CHANNEL];
|
||||
@ -233,7 +233,7 @@ static void MAIN_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
break;
|
||||
|
||||
case KEY_8:
|
||||
gTxInfo->FrequencyReverse = gTxInfo->FrequencyReverse == false;
|
||||
gTxVfo->FrequencyReverse = gTxVfo->FrequencyReverse == false;
|
||||
gRequestSaveChannel = 1;
|
||||
break;
|
||||
|
||||
@ -321,7 +321,7 @@ static void MAIN_Key_STAR(bool bKeyPressed, bool bKeyHeld)
|
||||
ACTION_Scan(false);
|
||||
return;
|
||||
}
|
||||
if (gStepDirection == 0 && IS_NOT_NOAA_CHANNEL(gTxInfo->CHANNEL_SAVE)) {
|
||||
if (gStepDirection == 0 && IS_NOT_NOAA_CHANNEL(gTxVfo->CHANNEL_SAVE)) {
|
||||
gDTMF_InputMode = true;
|
||||
memcpy(gDTMF_InputBox, gDTMF_String, 15);
|
||||
gDTMF_InputIndex = 0;
|
||||
@ -336,7 +336,7 @@ static void MAIN_Key_STAR(bool bKeyPressed, bool bKeyHeld)
|
||||
}
|
||||
gWasFKeyPressed = false;
|
||||
gUpdateStatus = true;
|
||||
if (IS_NOT_NOAA_CHANNEL(gTxInfo->CHANNEL_SAVE)) {
|
||||
if (IS_NOT_NOAA_CHANNEL(gTxVfo->CHANNEL_SAVE)) {
|
||||
gFlagStartScan = true;
|
||||
gScanSingleFrequency = true;
|
||||
gBackupCROSS_BAND_RX_TX = gEeprom.CROSS_BAND_RX_TX;
|
||||
@ -364,7 +364,7 @@ static void MAIN_Key_UP_DOWN(bool bKeyPressed, bool bKeyHeld, int8_t Direction)
|
||||
if (IS_FREQ_CHANNEL(Channel)) {
|
||||
return;
|
||||
}
|
||||
AUDIO_SetDigitVoice(0, gTxInfo->CHANNEL_SAVE + 1);
|
||||
AUDIO_SetDigitVoice(0, gTxVfo->CHANNEL_SAVE + 1);
|
||||
gAnotherVoiceID = (VOICE_ID_t)0xFE;
|
||||
return;
|
||||
}
|
||||
@ -381,7 +381,7 @@ static void MAIN_Key_UP_DOWN(bool bKeyPressed, bool bKeyHeld, int8_t Direction)
|
||||
uint8_t Next;
|
||||
|
||||
if (IS_FREQ_CHANNEL(Channel)) {
|
||||
APP_SetFrequencyByStep(gTxInfo, Direction);
|
||||
APP_SetFrequencyByStep(gTxVfo, Direction);
|
||||
gRequestSaveChannel = 1;
|
||||
return;
|
||||
}
|
||||
|
124
app/menu.c
124
app/menu.c
@ -95,9 +95,9 @@ static const VOICE_ID_t MenuVoices[] = {
|
||||
|
||||
static void FUN_000074f8(int8_t Direction)
|
||||
{
|
||||
g_20000381 = 1;
|
||||
gCssScanMode = CSS_SCAN_MODE_SCANNING;
|
||||
gMenuScrollDirection = Direction;
|
||||
RADIO_ConfigureTX();
|
||||
RADIO_SelectVfos();
|
||||
MENU_SelectNextDCS();
|
||||
ScanPauseDelayIn10msec = 50;
|
||||
gScheduleScanListen = false;
|
||||
@ -111,7 +111,7 @@ int MENU_GetLimits(uint8_t Cursor, uint8_t *pMin, uint8_t *pMax)
|
||||
*pMax = 9;
|
||||
break;
|
||||
case MENU_STEP:
|
||||
if (gTxInfo->Band == BAND2_108MHz) {
|
||||
if (gTxVfo->Band == BAND2_108MHz) {
|
||||
*pMin = 0;
|
||||
*pMax = 6;
|
||||
break;
|
||||
@ -195,7 +195,7 @@ void MENU_AcceptSetting(void)
|
||||
{
|
||||
uint8_t Min, Max;
|
||||
uint8_t Code;
|
||||
FREQ_Config_t *pConfig = &gTxInfo->ConfigRX;
|
||||
FREQ_Config_t *pConfig = &gTxVfo->ConfigRX;
|
||||
|
||||
if (!MENU_GetLimits(gMenuCursor, &Min, &Max)) {
|
||||
if (gSubMenuSelection < Min) {
|
||||
@ -213,21 +213,21 @@ void MENU_AcceptSetting(void)
|
||||
return;
|
||||
|
||||
case MENU_STEP:
|
||||
if (IS_FREQ_CHANNEL(gTxInfo->CHANNEL_SAVE)) {
|
||||
gTxInfo->STEP_SETTING = gSubMenuSelection;
|
||||
if (IS_FREQ_CHANNEL(gTxVfo->CHANNEL_SAVE)) {
|
||||
gTxVfo->STEP_SETTING = gSubMenuSelection;
|
||||
gRequestSaveChannel = 1;
|
||||
return;
|
||||
}
|
||||
gSubMenuSelection = gTxInfo->STEP_SETTING;
|
||||
gSubMenuSelection = gTxVfo->STEP_SETTING;
|
||||
return;
|
||||
|
||||
case MENU_TXP:
|
||||
gTxInfo->OUTPUT_POWER = gSubMenuSelection;
|
||||
gTxVfo->OUTPUT_POWER = gSubMenuSelection;
|
||||
gRequestSaveChannel = 1;
|
||||
return;
|
||||
|
||||
case MENU_T_DCS:
|
||||
pConfig = &gTxInfo->ConfigTX;
|
||||
pConfig = &gTxVfo->ConfigTX;
|
||||
// Fallthrough
|
||||
case MENU_R_DCS:
|
||||
if (gSubMenuSelection == 0) {
|
||||
@ -249,7 +249,7 @@ void MENU_AcceptSetting(void)
|
||||
return;
|
||||
|
||||
case MENU_T_CTCS:
|
||||
pConfig = &gTxInfo->ConfigTX;
|
||||
pConfig = &gTxVfo->ConfigTX;
|
||||
// Fallthrough
|
||||
case MENU_R_CTCS:
|
||||
if (gSubMenuSelection == 0) {
|
||||
@ -268,32 +268,32 @@ void MENU_AcceptSetting(void)
|
||||
return;
|
||||
|
||||
case MENU_SFT_D:
|
||||
gTxInfo->FREQUENCY_DEVIATION_SETTING = gSubMenuSelection;
|
||||
gTxVfo->FREQUENCY_DEVIATION_SETTING = gSubMenuSelection;
|
||||
gRequestSaveChannel = 1;
|
||||
return;
|
||||
|
||||
case MENU_OFFSET:
|
||||
gTxInfo->FREQUENCY_OF_DEVIATION = gSubMenuSelection;
|
||||
gTxVfo->FREQUENCY_OF_DEVIATION = gSubMenuSelection;
|
||||
gRequestSaveChannel = 1;
|
||||
return;
|
||||
|
||||
case MENU_W_N:
|
||||
gTxInfo->CHANNEL_BANDWIDTH = gSubMenuSelection;
|
||||
gTxVfo->CHANNEL_BANDWIDTH = gSubMenuSelection;
|
||||
gRequestSaveChannel = 1;
|
||||
return;
|
||||
|
||||
case MENU_SCR:
|
||||
gTxInfo->SCRAMBLING_TYPE = gSubMenuSelection;
|
||||
gTxVfo->SCRAMBLING_TYPE = gSubMenuSelection;
|
||||
gRequestSaveChannel = 1;
|
||||
return;
|
||||
|
||||
case MENU_BCL:
|
||||
gTxInfo->BUSY_CHANNEL_LOCK = gSubMenuSelection;
|
||||
gTxVfo->BUSY_CHANNEL_LOCK = gSubMenuSelection;
|
||||
gRequestSaveChannel = 1;
|
||||
return;
|
||||
|
||||
case MENU_MEM_CH:
|
||||
gTxInfo->CHANNEL_SAVE = gSubMenuSelection;
|
||||
gTxVfo->CHANNEL_SAVE = gSubMenuSelection;
|
||||
gRequestSaveChannel = 2;
|
||||
gEeprom.MrChannel[0] = gSubMenuSelection;
|
||||
return;
|
||||
@ -308,7 +308,7 @@ void MENU_AcceptSetting(void)
|
||||
gEeprom.VOX_LEVEL = gSubMenuSelection - 1;
|
||||
}
|
||||
BOARD_EEPROM_LoadMoreSettings();
|
||||
g_20000398 = 1;
|
||||
g_20000398 = true;
|
||||
gRequestSaveSettings = true;
|
||||
gUpdateStatus = true;
|
||||
return;
|
||||
@ -324,7 +324,7 @@ void MENU_AcceptSetting(void)
|
||||
|
||||
case MENU_TDR:
|
||||
gEeprom.DUAL_WATCH = gSubMenuSelection;
|
||||
g_20000398 = 1;
|
||||
g_20000398 = true;
|
||||
gRequestSaveSettings = true;
|
||||
gUpdateStatus = true;
|
||||
return;
|
||||
@ -337,7 +337,7 @@ void MENU_AcceptSetting(void)
|
||||
return;
|
||||
}
|
||||
gEeprom.CROSS_BAND_RX_TX = gSubMenuSelection;
|
||||
g_20000398 = 1;
|
||||
g_20000398 = true;
|
||||
gRequestSaveSettings = true;
|
||||
gUpdateStatus = true;
|
||||
return;
|
||||
@ -370,15 +370,15 @@ void MENU_AcceptSetting(void)
|
||||
break;
|
||||
|
||||
case MENU_S_ADD1:
|
||||
gTxInfo->SCANLIST1_PARTICIPATION = gSubMenuSelection;
|
||||
SETTINGS_UpdateChannel(gTxInfo->CHANNEL_SAVE, gTxInfo, true);
|
||||
gTxVfo->SCANLIST1_PARTICIPATION = gSubMenuSelection;
|
||||
SETTINGS_UpdateChannel(gTxVfo->CHANNEL_SAVE, gTxVfo, true);
|
||||
gVfoConfigureMode = VFO_CONFIGURE_1;
|
||||
gFlagRetuneVfos = true;
|
||||
return;
|
||||
|
||||
case MENU_S_ADD2:
|
||||
gTxInfo->SCANLIST2_PARTICIPATION = gSubMenuSelection;
|
||||
SETTINGS_UpdateChannel(gTxInfo->CHANNEL_SAVE, gTxInfo, true);
|
||||
gTxVfo->SCANLIST2_PARTICIPATION = gSubMenuSelection;
|
||||
SETTINGS_UpdateChannel(gTxVfo->CHANNEL_SAVE, gTxVfo, true);
|
||||
gVfoConfigureMode = VFO_CONFIGURE_1;
|
||||
gFlagRetuneVfos = true;
|
||||
return;
|
||||
@ -395,7 +395,7 @@ void MENU_AcceptSetting(void)
|
||||
gEeprom.MIC_SENSITIVITY = gSubMenuSelection;
|
||||
BOARD_EEPROM_LoadMoreSettings();
|
||||
gRequestSaveSettings = true;
|
||||
g_20000398 = 1;
|
||||
g_20000398 = true;
|
||||
return;
|
||||
|
||||
case MENU_1_CALL:
|
||||
@ -427,12 +427,12 @@ void MENU_AcceptSetting(void)
|
||||
break;
|
||||
|
||||
case MENU_PTT_ID:
|
||||
gTxInfo->DTMF_PTT_ID_TX_MODE = gSubMenuSelection;
|
||||
gTxVfo->DTMF_PTT_ID_TX_MODE = gSubMenuSelection;
|
||||
gRequestSaveChannel = 1;
|
||||
return;
|
||||
|
||||
case MENU_D_DCD:
|
||||
gTxInfo->DTMF_DECODING_ENABLE = gSubMenuSelection;
|
||||
gTxVfo->DTMF_DECODING_ENABLE = gSubMenuSelection;
|
||||
gRequestSaveChannel = 1;
|
||||
return;
|
||||
|
||||
@ -456,14 +456,14 @@ void MENU_AcceptSetting(void)
|
||||
break;
|
||||
|
||||
case MENU_AM:
|
||||
gTxInfo->AM_CHANNEL_MODE = gSubMenuSelection;
|
||||
gTxVfo->AM_CHANNEL_MODE = gSubMenuSelection;
|
||||
gRequestSaveChannel = 1;
|
||||
return;
|
||||
|
||||
case MENU_NOAA_S:
|
||||
gEeprom.NOAA_AUTO_SCAN = gSubMenuSelection;
|
||||
gRequestSaveSettings = true;
|
||||
g_20000398 = 1;
|
||||
g_20000398 = true;
|
||||
return;
|
||||
|
||||
case MENU_DEL_CH:
|
||||
@ -502,7 +502,7 @@ void MENU_AcceptSetting(void)
|
||||
case MENU_SCREN:
|
||||
gSetting_ScrambleEnable = gSubMenuSelection;
|
||||
gRequestSaveSettings = true;
|
||||
g_20000398 = 1;
|
||||
g_20000398 = true;
|
||||
return;
|
||||
|
||||
default:
|
||||
@ -574,20 +574,20 @@ void MENU_ShowCurrentSetting(void)
|
||||
break;
|
||||
|
||||
case MENU_STEP:
|
||||
gSubMenuSelection = gTxInfo->STEP_SETTING;
|
||||
gSubMenuSelection = gTxVfo->STEP_SETTING;
|
||||
break;
|
||||
|
||||
case MENU_TXP:
|
||||
gSubMenuSelection = gTxInfo->OUTPUT_POWER;
|
||||
gSubMenuSelection = gTxVfo->OUTPUT_POWER;
|
||||
break;
|
||||
|
||||
case MENU_R_DCS:
|
||||
switch (gTxInfo->ConfigRX.CodeType) {
|
||||
switch (gTxVfo->ConfigRX.CodeType) {
|
||||
case CODE_TYPE_DIGITAL:
|
||||
gSubMenuSelection = gTxInfo->ConfigRX.Code + 1;
|
||||
gSubMenuSelection = gTxVfo->ConfigRX.Code + 1;
|
||||
break;
|
||||
case CODE_TYPE_REVERSE_DIGITAL:
|
||||
gSubMenuSelection = gTxInfo->ConfigRX.Code + 105;
|
||||
gSubMenuSelection = gTxVfo->ConfigRX.Code + 105;
|
||||
break;
|
||||
default:
|
||||
gSubMenuSelection = 0;
|
||||
@ -600,20 +600,20 @@ void MENU_ShowCurrentSetting(void)
|
||||
break;
|
||||
|
||||
case MENU_R_CTCS:
|
||||
if (gTxInfo->ConfigRX.CodeType == CODE_TYPE_CONTINUOUS_TONE) {
|
||||
gSubMenuSelection = gTxInfo->ConfigRX.Code + 1;
|
||||
if (gTxVfo->ConfigRX.CodeType == CODE_TYPE_CONTINUOUS_TONE) {
|
||||
gSubMenuSelection = gTxVfo->ConfigRX.Code + 1;
|
||||
} else {
|
||||
gSubMenuSelection = 0;
|
||||
}
|
||||
break;
|
||||
|
||||
case MENU_T_DCS:
|
||||
switch (gTxInfo->ConfigTX.CodeType) {
|
||||
switch (gTxVfo->ConfigTX.CodeType) {
|
||||
case CODE_TYPE_DIGITAL:
|
||||
gSubMenuSelection = gTxInfo->ConfigTX.Code + 1;
|
||||
gSubMenuSelection = gTxVfo->ConfigTX.Code + 1;
|
||||
break;
|
||||
case CODE_TYPE_REVERSE_DIGITAL:
|
||||
gSubMenuSelection = gTxInfo->ConfigTX.Code + 105;
|
||||
gSubMenuSelection = gTxVfo->ConfigTX.Code + 105;
|
||||
break;
|
||||
default:
|
||||
gSubMenuSelection = 0;
|
||||
@ -622,31 +622,31 @@ void MENU_ShowCurrentSetting(void)
|
||||
break;
|
||||
|
||||
case MENU_T_CTCS:
|
||||
if (gTxInfo->ConfigTX.CodeType == CODE_TYPE_CONTINUOUS_TONE) {
|
||||
gSubMenuSelection = gTxInfo->ConfigTX.Code + 1;
|
||||
if (gTxVfo->ConfigTX.CodeType == CODE_TYPE_CONTINUOUS_TONE) {
|
||||
gSubMenuSelection = gTxVfo->ConfigTX.Code + 1;
|
||||
} else {
|
||||
gSubMenuSelection = 0;
|
||||
}
|
||||
break;
|
||||
|
||||
case MENU_SFT_D:
|
||||
gSubMenuSelection = gTxInfo->FREQUENCY_DEVIATION_SETTING;
|
||||
gSubMenuSelection = gTxVfo->FREQUENCY_DEVIATION_SETTING;
|
||||
break;
|
||||
|
||||
case MENU_OFFSET:
|
||||
gSubMenuSelection = gTxInfo->FREQUENCY_OF_DEVIATION;
|
||||
gSubMenuSelection = gTxVfo->FREQUENCY_OF_DEVIATION;
|
||||
break;
|
||||
|
||||
case MENU_W_N:
|
||||
gSubMenuSelection = gTxInfo->CHANNEL_BANDWIDTH;
|
||||
gSubMenuSelection = gTxVfo->CHANNEL_BANDWIDTH;
|
||||
break;
|
||||
|
||||
case MENU_SCR:
|
||||
gSubMenuSelection = gTxInfo->SCRAMBLING_TYPE;
|
||||
gSubMenuSelection = gTxVfo->SCRAMBLING_TYPE;
|
||||
break;
|
||||
|
||||
case MENU_BCL:
|
||||
gSubMenuSelection = gTxInfo->BUSY_CHANNEL_LOCK;
|
||||
gSubMenuSelection = gTxVfo->BUSY_CHANNEL_LOCK;
|
||||
break;
|
||||
|
||||
case MENU_MEM_CH:
|
||||
@ -702,11 +702,11 @@ void MENU_ShowCurrentSetting(void)
|
||||
break;
|
||||
|
||||
case MENU_S_ADD1:
|
||||
gSubMenuSelection = gTxInfo->SCANLIST1_PARTICIPATION;
|
||||
gSubMenuSelection = gTxVfo->SCANLIST1_PARTICIPATION;
|
||||
break;
|
||||
|
||||
case MENU_S_ADD2:
|
||||
gSubMenuSelection = gTxInfo->SCANLIST2_PARTICIPATION;
|
||||
gSubMenuSelection = gTxVfo->SCANLIST2_PARTICIPATION;
|
||||
break;
|
||||
|
||||
case MENU_STE:
|
||||
@ -758,11 +758,11 @@ void MENU_ShowCurrentSetting(void)
|
||||
break;
|
||||
|
||||
case MENU_PTT_ID:
|
||||
gSubMenuSelection = gTxInfo->DTMF_PTT_ID_TX_MODE;
|
||||
gSubMenuSelection = gTxVfo->DTMF_PTT_ID_TX_MODE;
|
||||
break;
|
||||
|
||||
case MENU_D_DCD:
|
||||
gSubMenuSelection = gTxInfo->DTMF_DECODING_ENABLE;
|
||||
gSubMenuSelection = gTxVfo->DTMF_DECODING_ENABLE;
|
||||
break;
|
||||
|
||||
case MENU_D_LIST:
|
||||
@ -778,7 +778,7 @@ void MENU_ShowCurrentSetting(void)
|
||||
break;
|
||||
|
||||
case MENU_AM:
|
||||
gSubMenuSelection = gTxInfo->AM_CHANNEL_MODE;
|
||||
gSubMenuSelection = gTxVfo->AM_CHANNEL_MODE;
|
||||
break;
|
||||
|
||||
case MENU_NOAA_S:
|
||||
@ -864,7 +864,7 @@ static void MENU_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
NUMBER_Get(gInputBox, &Frequency);
|
||||
Frequency += 75;
|
||||
gAnotherVoiceID = (VOICE_ID_t)Key;
|
||||
gSubMenuSelection = FREQUENCY_FloorToStep(Frequency, gTxInfo->StepFrequency, 0);
|
||||
gSubMenuSelection = FREQUENCY_FloorToStep(Frequency, gTxVfo->StepFrequency, 0);
|
||||
return;
|
||||
}
|
||||
if (gMenuCursor == MENU_MEM_CH || gMenuCursor == MENU_DEL_CH || gMenuCursor == MENU_1_CALL) {
|
||||
@ -925,7 +925,7 @@ static void MENU_Key_EXIT(bool bKeyPressed, bool bKeyHeld)
|
||||
{
|
||||
if (!bKeyHeld && bKeyPressed) {
|
||||
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
||||
if (g_20000381 == 0) {
|
||||
if (gCssScanMode == CSS_SCAN_MODE_OFF) {
|
||||
if (gIsInSubMenu) {
|
||||
if (gInputBoxIndex == 0 || gMenuCursor != MENU_OFFSET) {
|
||||
gIsInSubMenu = false;
|
||||
@ -942,7 +942,7 @@ static void MENU_Key_EXIT(bool bKeyPressed, bool bKeyHeld)
|
||||
gAnotherVoiceID = VOICE_ID_CANCEL;
|
||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||
} else {
|
||||
RADIO_Whatever();
|
||||
RADIO_StopCssScan();
|
||||
gAnotherVoiceID = VOICE_ID_SCANNING_STOP;
|
||||
gRequestDisplayScreen = DISPLAY_MENU;
|
||||
}
|
||||
@ -984,7 +984,7 @@ static void MENU_Key_MENU(bool bKeyPressed, bool bKeyHeld)
|
||||
gFlagAcceptSetting = true;
|
||||
gIsInSubMenu = false;
|
||||
}
|
||||
g_20000381 = 0;
|
||||
gCssScanMode = CSS_SCAN_MODE_OFF;
|
||||
if (gMenuCursor == MENU_SCR) {
|
||||
if (gSubMenuSelection == 0) {
|
||||
gAnotherVoiceID = VOICE_ID_SCRAMBLER_OFF;
|
||||
@ -1003,16 +1003,16 @@ static void MENU_Key_STAR(bool bKeyPressed, bool bKeyHeld)
|
||||
{
|
||||
if (!bKeyHeld && bKeyPressed) {
|
||||
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
||||
RADIO_ConfigureTX();
|
||||
if (IS_NOT_NOAA_CHANNEL(gRxInfo->CHANNEL_SAVE) && !gRxInfo->IsAM) {
|
||||
RADIO_SelectVfos();
|
||||
if (IS_NOT_NOAA_CHANNEL(gRxVfo->CHANNEL_SAVE) && !gRxVfo->IsAM) {
|
||||
if (gMenuCursor == MENU_R_CTCS || gMenuCursor == MENU_R_DCS) {
|
||||
if (g_20000381 == 0) {
|
||||
if (gCssScanMode == CSS_SCAN_MODE_OFF) {
|
||||
FUN_000074f8(1);
|
||||
gRequestDisplayScreen = DISPLAY_MENU;
|
||||
AUDIO_SetVoiceID(0, VOICE_ID_SCANNING_BEGIN);
|
||||
AUDIO_PlaySingleVoice(1);
|
||||
} else {
|
||||
RADIO_Whatever();
|
||||
RADIO_StopCssScan();
|
||||
gRequestDisplayScreen = DISPLAY_MENU;
|
||||
gAnotherVoiceID = VOICE_ID_SCANNING_STOP;
|
||||
}
|
||||
@ -1040,7 +1040,7 @@ static void MENU_Key_UP_DOWN(bool bKeyPressed, bool bKeyHeld, int8_t Direction)
|
||||
return;
|
||||
}
|
||||
|
||||
if (g_20000381) {
|
||||
if (gCssScanMode != CSS_SCAN_MODE_OFF) {
|
||||
FUN_000074f8(Direction);
|
||||
gPttWasReleased = true;
|
||||
gRequestDisplayScreen = DISPLAY_MENU;
|
||||
@ -1057,7 +1057,7 @@ static void MENU_Key_UP_DOWN(bool bKeyPressed, bool bKeyHeld, int8_t Direction)
|
||||
if (gMenuCursor == MENU_OFFSET) {
|
||||
int32_t Offset;
|
||||
|
||||
Offset = (Direction * gTxInfo->StepFrequency) + gSubMenuSelection;
|
||||
Offset = (Direction * gTxVfo->StepFrequency) + gSubMenuSelection;
|
||||
if (Offset < 99999990) {
|
||||
if (Offset < 0) {
|
||||
Offset = 99999990;
|
||||
@ -1065,7 +1065,7 @@ static void MENU_Key_UP_DOWN(bool bKeyPressed, bool bKeyHeld, int8_t Direction)
|
||||
} else {
|
||||
Offset = 0;
|
||||
}
|
||||
gSubMenuSelection = FREQUENCY_FloorToStep(Offset, gTxInfo->StepFrequency, 0);
|
||||
gSubMenuSelection = FREQUENCY_FloorToStep(Offset, gTxVfo->StepFrequency, 0);
|
||||
gRequestDisplayScreen = DISPLAY_MENU;
|
||||
return;
|
||||
}
|
||||
|
@ -157,10 +157,10 @@ static void SCANNER_Key_MENU(bool bKeyPressed, bool bKeyHeld)
|
||||
gScanFrequency = Freq250;
|
||||
}
|
||||
}
|
||||
if (IS_MR_CHANNEL(gTxInfo->CHANNEL_SAVE)) {
|
||||
if (IS_MR_CHANNEL(gTxVfo->CHANNEL_SAVE)) {
|
||||
gScannerEditState = 1;
|
||||
gScanChannel = gTxInfo->CHANNEL_SAVE;
|
||||
gShowChPrefix = RADIO_CheckValidChannel(gTxInfo->CHANNEL_SAVE, false, 0);
|
||||
gScanChannel = gTxVfo->CHANNEL_SAVE;
|
||||
gShowChPrefix = RADIO_CheckValidChannel(gTxVfo->CHANNEL_SAVE, false, 0);
|
||||
} else {
|
||||
gScannerEditState = 2;
|
||||
}
|
||||
@ -179,30 +179,30 @@ static void SCANNER_Key_MENU(bool bKeyPressed, bool bKeyHeld)
|
||||
|
||||
case 2:
|
||||
if (!gScanSingleFrequency) {
|
||||
RADIO_InitInfo(gTxInfo, gTxInfo->CHANNEL_SAVE, FREQUENCY_GetBand(gScanFrequency), gScanFrequency);
|
||||
RADIO_InitInfo(gTxVfo, gTxVfo->CHANNEL_SAVE, FREQUENCY_GetBand(gScanFrequency), gScanFrequency);
|
||||
if (gScanUseCssResult) {
|
||||
gTxInfo->ConfigRX.CodeType = gScanCssResultType;
|
||||
gTxInfo->ConfigRX.Code = gScanCssResultIndex;
|
||||
gTxVfo->ConfigRX.CodeType = gScanCssResultType;
|
||||
gTxVfo->ConfigRX.Code = gScanCssResultIndex;
|
||||
}
|
||||
gTxInfo->ConfigTX = gTxInfo->ConfigRX;
|
||||
gTxInfo->STEP_SETTING = gStepSetting;
|
||||
gTxVfo->ConfigTX = gTxVfo->ConfigRX;
|
||||
gTxVfo->STEP_SETTING = gStepSetting;
|
||||
} else {
|
||||
RADIO_ConfigureChannel(0, 2);
|
||||
RADIO_ConfigureChannel(1, 2);
|
||||
gTxInfo->ConfigRX.CodeType = gScanCssResultType;
|
||||
gTxInfo->ConfigRX.Code = gScanCssResultIndex;
|
||||
gTxInfo->ConfigTX.CodeType = gScanCssResultType;
|
||||
gTxInfo->ConfigTX.Code = gScanCssResultIndex;
|
||||
gTxVfo->ConfigRX.CodeType = gScanCssResultType;
|
||||
gTxVfo->ConfigRX.Code = gScanCssResultIndex;
|
||||
gTxVfo->ConfigTX.CodeType = gScanCssResultType;
|
||||
gTxVfo->ConfigTX.Code = gScanCssResultIndex;
|
||||
}
|
||||
|
||||
if (IS_MR_CHANNEL(gTxInfo->CHANNEL_SAVE)) {
|
||||
if (IS_MR_CHANNEL(gTxVfo->CHANNEL_SAVE)) {
|
||||
Channel = gScanChannel;
|
||||
gEeprom.MrChannel[gEeprom.TX_CHANNEL] = Channel;
|
||||
} else {
|
||||
Channel = gTxInfo->Band + FREQ_CHANNEL_FIRST;
|
||||
Channel = gTxVfo->Band + FREQ_CHANNEL_FIRST;
|
||||
gEeprom.FreqChannel[gEeprom.TX_CHANNEL] = Channel;
|
||||
}
|
||||
gTxInfo->CHANNEL_SAVE = Channel;
|
||||
gTxVfo->CHANNEL_SAVE = Channel;
|
||||
gEeprom.ScreenChannel[gEeprom.TX_CHANNEL] = Channel;
|
||||
gAnotherVoiceID = VOICE_ID_CONFIRM;
|
||||
gRequestDisplayScreen = DISPLAY_SCANNER;
|
||||
|
8
audio.c
8
audio.c
@ -83,7 +83,7 @@ void AUDIO_PlayBeep(BEEP_Type_t Beep)
|
||||
|
||||
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
|
||||
|
||||
if (gCurrentFunction == FUNCTION_POWER_SAVE && gThisCanEnable_BK4819_Rxon) {
|
||||
if (gCurrentFunction == FUNCTION_POWER_SAVE && gRxIdleMode) {
|
||||
BK4819_RX_TurnOn();
|
||||
}
|
||||
|
||||
@ -144,7 +144,7 @@ void AUDIO_PlayBeep(BEEP_Type_t Beep)
|
||||
if (gFmRadioMode) {
|
||||
BK1080_Mute(false);
|
||||
}
|
||||
if (gCurrentFunction == FUNCTION_POWER_SAVE && gThisCanEnable_BK4819_Rxon) {
|
||||
if (gCurrentFunction == FUNCTION_POWER_SAVE && gRxIdleMode) {
|
||||
BK4819_Sleep();
|
||||
}
|
||||
}
|
||||
@ -209,7 +209,7 @@ void AUDIO_PlaySingleVoice(bool bFlag)
|
||||
if (bFlag) {
|
||||
SYSTEM_DelayMs(Delay * 10);
|
||||
if (gCurrentFunction == FUNCTION_RECEIVE || gCurrentFunction == FUNCTION_MONITOR) {
|
||||
if (gRxInfo->IsAM) {
|
||||
if (gRxVfo->IsAM) {
|
||||
BK4819_SetAF(BK4819_AF_AM);
|
||||
} else {
|
||||
BK4819_SetAF(BK4819_AF_OPEN);
|
||||
@ -324,7 +324,7 @@ void AUDIO_PlayQueuedVoice(void)
|
||||
}
|
||||
|
||||
if (gCurrentFunction == FUNCTION_RECEIVE || gCurrentFunction == FUNCTION_MONITOR) {
|
||||
if (gRxInfo->IsAM) {
|
||||
if (gRxVfo->IsAM) {
|
||||
BK4819_SetAF(BK4819_AF_AM);
|
||||
} else {
|
||||
BK4819_SetAF(BK4819_AF_OPEN);
|
||||
|
@ -28,7 +28,7 @@ static const uint16_t FSK_RogerTable[7] = {
|
||||
|
||||
static uint16_t gBK4819_GpioOutState;
|
||||
|
||||
bool gThisCanEnable_BK4819_Rxon;
|
||||
bool gRxIdleMode;
|
||||
|
||||
void BK4819_Init(void)
|
||||
{
|
||||
@ -541,7 +541,7 @@ void BK4819_ExitSubAu(void)
|
||||
|
||||
void BK4819_Conditional_RX_TurnOn_and_GPIO6_Enable(void)
|
||||
{
|
||||
if (gThisCanEnable_BK4819_Rxon) {
|
||||
if (gRxIdleMode) {
|
||||
BK4819_ToggleGpioOut(BK4819_GPIO6_PIN2, true);
|
||||
BK4819_RX_TurnOn();
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ enum BK4819_CssScanResult_t {
|
||||
|
||||
typedef enum BK4819_CssScanResult_t BK4819_CssScanResult_t;
|
||||
|
||||
extern bool gThisCanEnable_BK4819_Rxon;
|
||||
extern bool gRxIdleMode;
|
||||
|
||||
void BK4819_Init(void);
|
||||
uint16_t BK4819_GetRegister(BK4819_REGISTER_t Register);
|
||||
|
22
functions.c
22
functions.c
@ -36,13 +36,13 @@ FUNCTION_Type_t gCurrentFunction;
|
||||
|
||||
void FUNCTION_Init(void)
|
||||
{
|
||||
if (IS_NOT_NOAA_CHANNEL(gRxInfo->CHANNEL_SAVE)) {
|
||||
if (IS_NOT_NOAA_CHANNEL(gRxVfo->CHANNEL_SAVE)) {
|
||||
gCopyOfCodeType = gCodeType;
|
||||
if (g_20000381 == 0) {
|
||||
if (gRxInfo->IsAM) {
|
||||
if (gCssScanMode == CSS_SCAN_MODE_OFF) {
|
||||
if (gRxVfo->IsAM) {
|
||||
gCopyOfCodeType = CODE_TYPE_OFF;
|
||||
} else {
|
||||
gCopyOfCodeType = gRxInfo->pCurrent->CodeType;
|
||||
gCopyOfCodeType = gRxVfo->pCurrent->CodeType;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@ -62,7 +62,7 @@ void FUNCTION_Init(void)
|
||||
gFoundCDCSS = false;
|
||||
gFoundCTCSSCountdown = 0;
|
||||
gFoundCDCSSCountdown = 0;
|
||||
g_20000377 = 0;
|
||||
gEndOfRxDetectedMaybe = false;
|
||||
gSystickCountdown2 = 0;
|
||||
}
|
||||
|
||||
@ -78,14 +78,14 @@ void FUNCTION_Select(FUNCTION_Type_t Function)
|
||||
if (bWasPowerSave) {
|
||||
if (Function != FUNCTION_POWER_SAVE) {
|
||||
BK4819_Conditional_RX_TurnOn_and_GPIO6_Enable();
|
||||
gThisCanEnable_BK4819_Rxon = false;
|
||||
gRxIdleMode = false;
|
||||
UI_DisplayStatus();
|
||||
}
|
||||
}
|
||||
|
||||
if (Function == FUNCTION_0) {
|
||||
if (gDTMF_ReplyState) {
|
||||
RADIO_Something();
|
||||
RADIO_PrepareCssTX();
|
||||
}
|
||||
if (PreviousFunction == FUNCTION_TRANSMIT) {
|
||||
gVFO_RSSI_Level[0] = 0;
|
||||
@ -118,7 +118,7 @@ void FUNCTION_Select(FUNCTION_Type_t Function)
|
||||
|
||||
if (Function == FUNCTION_POWER_SAVE) {
|
||||
gBatterySave = gEeprom.BATTERY_SAVE * 10;
|
||||
gThisCanEnable_BK4819_Rxon = true;
|
||||
gRxIdleMode = true;
|
||||
BK4819_DisableVox();
|
||||
BK4819_Sleep();
|
||||
BK4819_ToggleGpioOut(BK4819_GPIO6_PIN2, false);
|
||||
@ -155,7 +155,7 @@ void FUNCTION_Select(FUNCTION_Type_t Function)
|
||||
}
|
||||
|
||||
GUI_DisplayScreen();
|
||||
RADIO_PrepareTransmit();
|
||||
RADIO_SetTxParameters();
|
||||
BK4819_ToggleGpioOut(BK4819_GPIO1_PIN29_RED, true);
|
||||
|
||||
DTMF_Reply();
|
||||
@ -175,8 +175,8 @@ void FUNCTION_Select(FUNCTION_Type_t Function)
|
||||
gBatterySaveCountdown = 1000;
|
||||
return;
|
||||
}
|
||||
if (gCrossTxRadioInfo->SCRAMBLING_TYPE && gSetting_ScrambleEnable) {
|
||||
BK4819_EnableScramble(gCrossTxRadioInfo->SCRAMBLING_TYPE - 1U);
|
||||
if (gCurrentVfo->SCRAMBLING_TYPE && gSetting_ScrambleEnable) {
|
||||
BK4819_EnableScramble(gCurrentVfo->SCRAMBLING_TYPE - 1U);
|
||||
gBatterySaveCountdown = 1000;
|
||||
gSchedulePowerSave = false;
|
||||
g_2000038E = 0;
|
||||
|
@ -73,11 +73,11 @@ void BOOT_ProcessMode(BOOT_Mode_t Mode)
|
||||
gEeprom.KEY_2_SHORT_PRESS_ACTION = 0;
|
||||
gEeprom.KEY_2_LONG_PRESS_ACTION = 0;
|
||||
|
||||
RADIO_InitInfo(gRxInfo, 205, 5, 41002500);
|
||||
gRxInfo->CHANNEL_BANDWIDTH = BANDWIDTH_NARROW;
|
||||
gRxInfo->OUTPUT_POWER = 0;
|
||||
RADIO_ConfigureSquelchAndOutputPower(gRxInfo);
|
||||
gCrossTxRadioInfo = gRxInfo;
|
||||
RADIO_InitInfo(gRxVfo, 205, 5, 41002500);
|
||||
gRxVfo->CHANNEL_BANDWIDTH = BANDWIDTH_NARROW;
|
||||
gRxVfo->OUTPUT_POWER = 0;
|
||||
RADIO_ConfigureSquelchAndOutputPower(gRxVfo);
|
||||
gCurrentVfo = gRxVfo;
|
||||
RADIO_SetupRegisters(true);
|
||||
BK4819_SetupAircopy();
|
||||
BK4819_ResetFSK();
|
||||
|
2
main.c
2
main.c
@ -89,7 +89,7 @@ void Main(void)
|
||||
|
||||
RADIO_ConfigureChannel(0, 2);
|
||||
RADIO_ConfigureChannel(1, 2);
|
||||
RADIO_ConfigureTX();
|
||||
RADIO_SelectVfos();
|
||||
RADIO_SetupRegisters(true);
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
|
12
misc.c
12
misc.c
@ -67,11 +67,11 @@ uint8_t gUpdateStatus;
|
||||
uint8_t g_20000370;
|
||||
uint8_t gFoundCTCSS;
|
||||
uint8_t gFoundCDCSS;
|
||||
uint8_t g_20000377;
|
||||
bool gEndOfRxDetectedMaybe;
|
||||
uint8_t gVFO_RSSI_Level[2];
|
||||
uint8_t gReducedService;
|
||||
uint8_t gBatteryVoltageIndex;
|
||||
volatile uint8_t g_20000381;
|
||||
CssScanMode_t gCssScanMode;
|
||||
uint8_t g_20000382;
|
||||
AlarmState_t gAlarmState;
|
||||
uint16_t g_2000038E;
|
||||
@ -79,7 +79,7 @@ uint8_t g_20000393;
|
||||
bool gPttWasReleased;
|
||||
bool gPttWasPressed;
|
||||
uint8_t gKeypadLocked;
|
||||
uint8_t g_20000398;
|
||||
bool g_20000398;
|
||||
uint8_t gVfoConfigureMode;
|
||||
bool gFlagRetuneVfos;
|
||||
bool gRequestSaveVFO;
|
||||
@ -107,12 +107,12 @@ uint16_t gVoxPauseCountdown;
|
||||
volatile uint16_t gFlashLightBlinkCounter;
|
||||
bool gFlagEndTransmission;
|
||||
uint8_t gLowBatteryCountdown;
|
||||
uint8_t g_20000410;
|
||||
uint8_t g_20000411;
|
||||
uint8_t gNextMrChannel;
|
||||
ReceptionMode_t gRxReceptionMode;
|
||||
bool g_20000413;
|
||||
uint8_t gRestoreMrChannel;
|
||||
uint8_t gCurrentScanList;
|
||||
uint8_t g_20000416;
|
||||
uint8_t gPreviousMrChannel;
|
||||
uint32_t gRestoreFrequency;
|
||||
uint8_t g_2000041F;
|
||||
uint8_t gAlarmToneCounter;
|
||||
|
28
misc.h
28
misc.h
@ -56,6 +56,22 @@ enum AlarmState_t {
|
||||
|
||||
typedef enum AlarmState_t AlarmState_t;
|
||||
|
||||
enum ReceptionMode_t {
|
||||
RX_MODE_NONE = 0U,
|
||||
RX_MODE_DETECTED = 1U,
|
||||
RX_MODE_LISTENING = 2U,
|
||||
};
|
||||
|
||||
typedef enum ReceptionMode_t ReceptionMode_t;
|
||||
|
||||
enum CssScanMode_t {
|
||||
CSS_SCAN_MODE_OFF = 0U,
|
||||
CSS_SCAN_MODE_SCANNING = 1U,
|
||||
CSS_SCAN_MODE_FOUND = 2U,
|
||||
};
|
||||
|
||||
typedef enum CssScanMode_t CssScanMode_t;
|
||||
|
||||
extern const uint32_t *gUpperLimitFrequencyBandTable;
|
||||
extern const uint32_t *gLowerLimitFrequencyBandTable;
|
||||
|
||||
@ -101,11 +117,11 @@ extern uint8_t gUpdateStatus;
|
||||
extern uint8_t g_20000370;
|
||||
extern uint8_t gFoundCTCSS;
|
||||
extern uint8_t gFoundCDCSS;
|
||||
extern uint8_t g_20000377;
|
||||
extern bool gEndOfRxDetectedMaybe;
|
||||
extern uint8_t gVFO_RSSI_Level[2];
|
||||
extern uint8_t gReducedService;
|
||||
extern uint8_t gBatteryVoltageIndex;
|
||||
extern volatile uint8_t g_20000381;
|
||||
extern CssScanMode_t gCssScanMode;
|
||||
extern uint8_t g_20000382;
|
||||
extern AlarmState_t gAlarmState;
|
||||
extern uint16_t g_2000038E;
|
||||
@ -113,7 +129,7 @@ extern volatile int8_t gFM_Step;
|
||||
extern uint8_t g_20000393;
|
||||
extern bool gPttWasReleased;
|
||||
extern bool gPttWasPressed;
|
||||
extern uint8_t g_20000398;
|
||||
extern bool g_20000398;
|
||||
extern uint8_t gVfoConfigureMode;
|
||||
extern bool gFlagRetuneVfos;
|
||||
extern bool gRequestSaveVFO;
|
||||
@ -142,12 +158,12 @@ extern uint16_t gVoxPauseCountdown;
|
||||
extern volatile uint16_t gFlashLightBlinkCounter;
|
||||
extern bool gFlagEndTransmission;
|
||||
extern uint8_t gLowBatteryCountdown;
|
||||
extern uint8_t g_20000410;
|
||||
extern uint8_t g_20000411;
|
||||
extern uint8_t gNextMrChannel;
|
||||
extern ReceptionMode_t gRxReceptionMode;
|
||||
extern bool g_20000413;
|
||||
extern uint8_t gRestoreMrChannel;
|
||||
extern uint8_t gCurrentScanList;
|
||||
extern uint8_t g_20000416;
|
||||
extern uint8_t gPreviousMrChannel;
|
||||
extern uint32_t gRestoreFrequency;
|
||||
extern uint8_t g_2000041F;
|
||||
extern uint8_t gAlarmToneCounter;
|
||||
|
111
radio.c
111
radio.c
@ -31,9 +31,9 @@
|
||||
#include "radio.h"
|
||||
#include "settings.h"
|
||||
|
||||
VFO_Info_t *gTxInfo;
|
||||
VFO_Info_t *gRxInfo;
|
||||
VFO_Info_t *gCrossTxRadioInfo;
|
||||
VFO_Info_t *gTxVfo;
|
||||
VFO_Info_t *gRxVfo;
|
||||
VFO_Info_t *gCurrentVfo;
|
||||
|
||||
DCS_CodeType_t gCodeType;
|
||||
DCS_CodeType_t gCopyOfCodeType;
|
||||
@ -436,8 +436,16 @@ void RADIO_ApplyOffset(VFO_Info_t *pInfo)
|
||||
pInfo->ConfigTX.Frequency = Frequency;
|
||||
}
|
||||
|
||||
static void RADIO_SelectCurrentVfo(void)
|
||||
{
|
||||
if (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF) {
|
||||
gCurrentVfo = gRxVfo;
|
||||
} else {
|
||||
gCurrentVfo = &gEeprom.VfoInfo[gEeprom.TX_CHANNEL];
|
||||
}
|
||||
}
|
||||
|
||||
void RADIO_ConfigureTX(void)
|
||||
void RADIO_SelectVfos(void)
|
||||
{
|
||||
if (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_CHAN_B) {
|
||||
gEeprom.TX_CHANNEL = 1;
|
||||
@ -449,9 +457,10 @@ void RADIO_ConfigureTX(void)
|
||||
gEeprom.TX_CHANNEL = 0;
|
||||
}
|
||||
|
||||
gTxInfo = &gEeprom.VfoInfo[gEeprom.TX_CHANNEL];
|
||||
gEeprom.RX_CHANNEL = gEeprom.TX_CHANNEL;
|
||||
if (gEeprom.CROSS_BAND_RX_TX != CROSS_BAND_OFF) {
|
||||
gTxVfo = &gEeprom.VfoInfo[gEeprom.TX_CHANNEL];
|
||||
if (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF) {
|
||||
gEeprom.RX_CHANNEL = gEeprom.TX_CHANNEL;
|
||||
} else {
|
||||
if (gEeprom.TX_CHANNEL == 0) {
|
||||
gEeprom.RX_CHANNEL = 1;
|
||||
} else {
|
||||
@ -459,16 +468,8 @@ void RADIO_ConfigureTX(void)
|
||||
}
|
||||
}
|
||||
|
||||
gRxInfo = &gEeprom.VfoInfo[gEeprom.RX_CHANNEL];
|
||||
RADIO_ConfigureCrossTX();
|
||||
}
|
||||
|
||||
void RADIO_ConfigureCrossTX(void)
|
||||
{
|
||||
gCrossTxRadioInfo = gRxInfo;
|
||||
if (gEeprom.CROSS_BAND_RX_TX != CROSS_BAND_OFF) {
|
||||
gCrossTxRadioInfo = &gEeprom.VfoInfo[gEeprom.TX_CHANNEL];
|
||||
}
|
||||
gRxVfo = &gEeprom.VfoInfo[gEeprom.RX_CHANNEL];
|
||||
RADIO_SelectCurrentVfo();
|
||||
}
|
||||
|
||||
void RADIO_SetupRegisters(bool bSwitchToFunction0)
|
||||
@ -482,7 +483,7 @@ void RADIO_SetupRegisters(bool bSwitchToFunction0)
|
||||
gEnableSpeaker = false;
|
||||
BK4819_ToggleGpioOut(BK4819_GPIO0_PIN28_GREEN, false);
|
||||
|
||||
Bandwidth = gRxInfo->CHANNEL_BANDWIDTH;
|
||||
Bandwidth = gRxVfo->CHANNEL_BANDWIDTH;
|
||||
if (Bandwidth != BK4819_FILTER_BW_WIDE) {
|
||||
Bandwidth = BK4819_FILTER_BW_NARROW;
|
||||
}
|
||||
@ -502,16 +503,16 @@ void RADIO_SetupRegisters(bool bSwitchToFunction0)
|
||||
}
|
||||
BK4819_WriteRegister(BK4819_REG_3F, 0);
|
||||
BK4819_WriteRegister(BK4819_REG_7D, gEeprom.MIC_SENSITIVITY_TUNING | 0xE940);
|
||||
if (IS_NOT_NOAA_CHANNEL(gRxInfo->CHANNEL_SAVE) || !gIsNoaaMode) {
|
||||
Frequency = gRxInfo->pCurrent->Frequency;
|
||||
if (IS_NOT_NOAA_CHANNEL(gRxVfo->CHANNEL_SAVE) || !gIsNoaaMode) {
|
||||
Frequency = gRxVfo->pCurrent->Frequency;
|
||||
} else {
|
||||
Frequency = NoaaFrequencyTable[gNoaaChannel];
|
||||
}
|
||||
BK4819_SetFrequency(Frequency);
|
||||
BK4819_SetupSquelch(
|
||||
gRxInfo->SquelchOpenRSSIThresh, gRxInfo->SquelchCloseRSSIThresh,
|
||||
gRxInfo->SquelchOpenNoiseThresh, gRxInfo->SquelchCloseNoiseThresh,
|
||||
gRxInfo->SquelchCloseGlitchThresh, gRxInfo->SquelchOpenGlitchThresh);
|
||||
gRxVfo->SquelchOpenRSSIThresh, gRxVfo->SquelchCloseRSSIThresh,
|
||||
gRxVfo->SquelchOpenNoiseThresh, gRxVfo->SquelchCloseNoiseThresh,
|
||||
gRxVfo->SquelchCloseGlitchThresh, gRxVfo->SquelchOpenGlitchThresh);
|
||||
BK4819_PickRXFilterPathBasedOnFrequency(Frequency);
|
||||
BK4819_ToggleGpioOut(BK4819_GPIO6_PIN2, true);
|
||||
BK4819_WriteRegister(BK4819_REG_48, 0xB3A8);
|
||||
@ -521,16 +522,16 @@ void RADIO_SetupRegisters(bool bSwitchToFunction0)
|
||||
| BK4819_REG_3F_SQUELCH_LOST
|
||||
;
|
||||
|
||||
if (IS_NOT_NOAA_CHANNEL(gRxInfo->CHANNEL_SAVE)) {
|
||||
if (!gRxInfo->IsAM) {
|
||||
if (IS_NOT_NOAA_CHANNEL(gRxVfo->CHANNEL_SAVE)) {
|
||||
if (!gRxVfo->IsAM) {
|
||||
uint8_t CodeType;
|
||||
uint8_t Code;
|
||||
|
||||
CodeType = gCodeType;
|
||||
Code = gCode;
|
||||
if (g_20000381 == 0) {
|
||||
CodeType = gRxInfo->pCurrent->CodeType;
|
||||
Code = gRxInfo->pCurrent->Code;
|
||||
if (gCssScanMode == CSS_SCAN_MODE_OFF) {
|
||||
CodeType = gRxVfo->pCurrent->CodeType;
|
||||
Code = gRxVfo->pCurrent->Code;
|
||||
}
|
||||
switch (CodeType) {
|
||||
case CODE_TYPE_DIGITAL:
|
||||
@ -565,10 +566,10 @@ void RADIO_SetupRegisters(bool bSwitchToFunction0)
|
||||
;
|
||||
break;
|
||||
}
|
||||
if (gRxInfo->SCRAMBLING_TYPE == 0 || !gSetting_ScrambleEnable) {
|
||||
if (gRxVfo->SCRAMBLING_TYPE == 0 || !gSetting_ScrambleEnable) {
|
||||
BK4819_DisableScramble();
|
||||
} else {
|
||||
BK4819_EnableScramble(gRxInfo->SCRAMBLING_TYPE - 1);
|
||||
BK4819_EnableScramble(gRxVfo->SCRAMBLING_TYPE - 1);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@ -581,7 +582,7 @@ void RADIO_SetupRegisters(bool bSwitchToFunction0)
|
||||
;
|
||||
}
|
||||
|
||||
if (gEeprom.VOX_SWITCH && !gFmRadioMode && IS_NOT_NOAA_CHANNEL(gCrossTxRadioInfo->CHANNEL_SAVE) && !gCrossTxRadioInfo->IsAM) {
|
||||
if (gEeprom.VOX_SWITCH && !gFmRadioMode && IS_NOT_NOAA_CHANNEL(gCurrentVfo->CHANNEL_SAVE) && !gCurrentVfo->IsAM) {
|
||||
BK4819_EnableVox(gEeprom.VOX1_THRESHOLD, gEeprom.VOX0_THRESHOLD);
|
||||
InterruptMask |= 0
|
||||
| BK4819_REG_3F_VOX_FOUND
|
||||
@ -590,7 +591,7 @@ void RADIO_SetupRegisters(bool bSwitchToFunction0)
|
||||
} else {
|
||||
BK4819_DisableVox();
|
||||
}
|
||||
if (gRxInfo->IsAM || (!gRxInfo->DTMF_DECODING_ENABLE && !gSetting_KILLED)) {
|
||||
if (gRxVfo->IsAM || (!gRxVfo->DTMF_DECODING_ENABLE && !gSetting_KILLED)) {
|
||||
BK4819_DisableDTMF();
|
||||
} else {
|
||||
BK4819_EnableDTMF();
|
||||
@ -600,7 +601,7 @@ void RADIO_SetupRegisters(bool bSwitchToFunction0)
|
||||
|
||||
FUNCTION_Init();
|
||||
|
||||
if (bSwitchToFunction0 == 1) {
|
||||
if (bSwitchToFunction0) {
|
||||
FUNCTION_Select(FUNCTION_0);
|
||||
}
|
||||
}
|
||||
@ -627,9 +628,9 @@ void RADIO_ConfigureNOAA(void)
|
||||
gIsNoaaMode = true;
|
||||
return;
|
||||
}
|
||||
if (gRxInfo->CHANNEL_SAVE >= NOAA_CHANNEL_FIRST) {
|
||||
if (gRxVfo->CHANNEL_SAVE >= NOAA_CHANNEL_FIRST) {
|
||||
gIsNoaaMode = true;
|
||||
gNoaaChannel = gRxInfo->CHANNEL_SAVE - NOAA_CHANNEL_FIRST;
|
||||
gNoaaChannel = gRxVfo->CHANNEL_SAVE - NOAA_CHANNEL_FIRST;
|
||||
gNOAA_Countdown = 50;
|
||||
gScheduleNOAA = false;
|
||||
} else {
|
||||
@ -640,7 +641,7 @@ void RADIO_ConfigureNOAA(void)
|
||||
}
|
||||
}
|
||||
|
||||
void RADIO_PrepareTransmit(void)
|
||||
void RADIO_SetTxParameters(void)
|
||||
{
|
||||
BK4819_FilterBandwidth_t Bandwidth;
|
||||
|
||||
@ -649,32 +650,32 @@ void RADIO_PrepareTransmit(void)
|
||||
gEnableSpeaker = false;
|
||||
|
||||
BK4819_ToggleGpioOut(BK4819_GPIO6_PIN2, false);
|
||||
Bandwidth = gCrossTxRadioInfo->CHANNEL_BANDWIDTH;
|
||||
Bandwidth = gCurrentVfo->CHANNEL_BANDWIDTH;
|
||||
if (Bandwidth != BK4819_FILTER_BW_WIDE) {
|
||||
Bandwidth = BK4819_FILTER_BW_NARROW;
|
||||
}
|
||||
BK4819_SetFilterBandwidth(Bandwidth);
|
||||
BK4819_SetFrequency(gCrossTxRadioInfo->pReverse->Frequency);
|
||||
BK4819_SetFrequency(gCurrentVfo->pReverse->Frequency);
|
||||
BK4819_PrepareTransmit();
|
||||
SYSTEM_DelayMs(10);
|
||||
|
||||
BK4819_PickRXFilterPathBasedOnFrequency(gCrossTxRadioInfo->pReverse->Frequency);
|
||||
BK4819_PickRXFilterPathBasedOnFrequency(gCurrentVfo->pReverse->Frequency);
|
||||
BK4819_ToggleGpioOut(BK4819_GPIO5_PIN1, true);
|
||||
SYSTEM_DelayMs(5);
|
||||
|
||||
BK4819_SetupPowerAmplifier(gCrossTxRadioInfo->TXP_CalculatedSetting, gCrossTxRadioInfo->pReverse->Frequency);
|
||||
BK4819_SetupPowerAmplifier(gCurrentVfo->TXP_CalculatedSetting, gCurrentVfo->pReverse->Frequency);
|
||||
SYSTEM_DelayMs(10);
|
||||
|
||||
switch (gCrossTxRadioInfo->pReverse->CodeType) {
|
||||
switch (gCurrentVfo->pReverse->CodeType) {
|
||||
case CODE_TYPE_CONTINUOUS_TONE:
|
||||
BK4819_SetCTCSSFrequency(CTCSS_Options[gCrossTxRadioInfo->pReverse->Code]);
|
||||
BK4819_SetCTCSSFrequency(CTCSS_Options[gCurrentVfo->pReverse->Code]);
|
||||
break;
|
||||
case CODE_TYPE_DIGITAL:
|
||||
case CODE_TYPE_REVERSE_DIGITAL:
|
||||
BK4819_SetCDCSSCodeWord(
|
||||
DCS_GetGolayCodeWord(
|
||||
gCrossTxRadioInfo->pReverse->CodeType,
|
||||
gCrossTxRadioInfo->pReverse->Code
|
||||
gCurrentVfo->pReverse->CodeType,
|
||||
gCurrentVfo->pReverse->Code
|
||||
)
|
||||
);
|
||||
break;
|
||||
@ -709,23 +710,23 @@ void RADIO_SetVfoState(VfoState_t State)
|
||||
gUpdateDisplay = true;
|
||||
}
|
||||
|
||||
void RADIO_SomethingWithTransmit(void)
|
||||
void RADIO_PrepareTX(void)
|
||||
{
|
||||
if (gEeprom.DUAL_WATCH != DUAL_WATCH_OFF) {
|
||||
gDualWatchCountdown = 360;
|
||||
gScheduleDualWatch = false;
|
||||
if (g_2000041F == 0) {
|
||||
gEeprom.RX_CHANNEL = gEeprom.TX_CHANNEL;
|
||||
gRxInfo = &gEeprom.VfoInfo[gEeprom.TX_CHANNEL];
|
||||
gRxVfo = &gEeprom.VfoInfo[gEeprom.TX_CHANNEL];
|
||||
}
|
||||
g_2000041F = 1;
|
||||
}
|
||||
RADIO_ConfigureCrossTX();
|
||||
RADIO_SelectCurrentVfo();
|
||||
if (gAlarmState == ALARM_STATE_OFF || gAlarmState == ALARM_STATE_TX1750 || (gAlarmState == ALARM_STATE_ALARM && gEeprom.ALARM_MODE == ALARM_MODE_TONE)) {
|
||||
VfoState_t State;
|
||||
|
||||
if (!FREQUENCY_Check(gCrossTxRadioInfo)) {
|
||||
if (gCrossTxRadioInfo->BUSY_CHANNEL_LOCK && gCurrentFunction == FUNCTION_RECEIVE) {
|
||||
if (!FREQUENCY_Check(gCurrentVfo)) {
|
||||
if (gCurrentVfo->BUSY_CHANNEL_LOCK && gCurrentFunction == FUNCTION_RECEIVE) {
|
||||
State = VFO_STATE_BUSY;
|
||||
} else if (gBatteryDisplayLevel == 0) {
|
||||
State = VFO_STATE_BAT_LOW;
|
||||
@ -769,7 +770,7 @@ Skip:
|
||||
|
||||
void RADIO_EnableCxCSS(void)
|
||||
{
|
||||
switch (gCrossTxRadioInfo->pReverse->CodeType) {
|
||||
switch (gCurrentVfo->pReverse->CodeType) {
|
||||
case CODE_TYPE_DIGITAL:
|
||||
case CODE_TYPE_REVERSE_DIGITAL:
|
||||
BK4819_EnableCDCSS();
|
||||
@ -782,17 +783,17 @@ void RADIO_EnableCxCSS(void)
|
||||
SYSTEM_DelayMs(200);
|
||||
}
|
||||
|
||||
void RADIO_Something(void)
|
||||
void RADIO_PrepareCssTX(void)
|
||||
{
|
||||
RADIO_SomethingWithTransmit();
|
||||
RADIO_PrepareTX();
|
||||
SYSTEM_DelayMs(200);
|
||||
RADIO_EnableCxCSS();
|
||||
RADIO_SetupRegisters(true);
|
||||
}
|
||||
|
||||
void RADIO_Whatever(void)
|
||||
void RADIO_StopCssScan(void)
|
||||
{
|
||||
g_20000381 = 0;
|
||||
gCssScanMode = CSS_SCAN_MODE_OFF;
|
||||
RADIO_SetupRegisters(true);
|
||||
}
|
||||
|
||||
@ -803,7 +804,7 @@ void RADIO_SendEndOfTransmission(void)
|
||||
} else if (gEeprom.ROGER == ROGER_MODE_MDC) {
|
||||
BK4819_PlayRogerMDC();
|
||||
}
|
||||
if (gDTMF_CallState == DTMF_CALL_STATE_NONE && (gCrossTxRadioInfo->DTMF_PTT_ID_TX_MODE == PTT_ID_EOT || gCrossTxRadioInfo->DTMF_PTT_ID_TX_MODE == PTT_ID_BOTH)) {
|
||||
if (gDTMF_CallState == DTMF_CALL_STATE_NONE && (gCurrentVfo->DTMF_PTT_ID_TX_MODE == PTT_ID_EOT || gCurrentVfo->DTMF_PTT_ID_TX_MODE == PTT_ID_BOTH)) {
|
||||
if (gEeprom.DTMF_SIDE_TONE) {
|
||||
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
|
||||
gEnableSpeaker = true;
|
||||
|
17
radio.h
17
radio.h
@ -109,9 +109,9 @@ typedef struct VFO_Info_t {
|
||||
char Name[16];
|
||||
} VFO_Info_t;
|
||||
|
||||
extern VFO_Info_t *gTxInfo;
|
||||
extern VFO_Info_t *gRxInfo;
|
||||
extern VFO_Info_t *gCrossTxRadioInfo;
|
||||
extern VFO_Info_t *gTxVfo;
|
||||
extern VFO_Info_t *gRxVfo;
|
||||
extern VFO_Info_t *gCurrentVfo;
|
||||
|
||||
extern DCS_CodeType_t gCodeType;
|
||||
extern DCS_CodeType_t gCopyOfCodeType;
|
||||
@ -127,17 +127,16 @@ void RADIO_InitInfo(VFO_Info_t *pInfo, uint8_t ChannelSave, uint8_t ChIndex, uin
|
||||
void RADIO_ConfigureChannel(uint8_t RadioNum, uint32_t Arg);
|
||||
void RADIO_ConfigureSquelchAndOutputPower(VFO_Info_t *pInfo);
|
||||
void RADIO_ApplyOffset(VFO_Info_t *pInfo);
|
||||
void RADIO_ConfigureTX(void);
|
||||
void RADIO_ConfigureCrossTX(void);
|
||||
void RADIO_SelectVfos(void);
|
||||
void RADIO_SetupRegisters(bool bSwitchToFunction0);
|
||||
void RADIO_ConfigureNOAA(void);
|
||||
void RADIO_PrepareTransmit(void);
|
||||
void RADIO_SetTxParameters(void);
|
||||
|
||||
void RADIO_SetVfoState(VfoState_t State);
|
||||
void RADIO_SomethingWithTransmit(void);
|
||||
void RADIO_PrepareTX(void);
|
||||
void RADIO_EnableCxCSS(void);
|
||||
void RADIO_Something(void);
|
||||
void RADIO_Whatever(void);
|
||||
void RADIO_PrepareCssTX(void);
|
||||
void RADIO_StopCssScan(void);
|
||||
void RADIO_SendEndOfTransmission(void);
|
||||
|
||||
#endif
|
||||
|
@ -62,7 +62,7 @@ void SystickHandler(void)
|
||||
gBatterySaveCountdownExpired = true;
|
||||
}
|
||||
}
|
||||
if (gStepDirection == 0 && g_20000381 == 0 && gEeprom.DUAL_WATCH != DUAL_WATCH_OFF) {
|
||||
if (gStepDirection == 0 && gCssScanMode == CSS_SCAN_MODE_OFF && gEeprom.DUAL_WATCH != DUAL_WATCH_OFF) {
|
||||
if (gCurrentFunction != FUNCTION_MONITOR && gCurrentFunction != FUNCTION_TRANSMIT) {
|
||||
if (gCurrentFunction != FUNCTION_RECEIVE) {
|
||||
if (gDualWatchCountdown) {
|
||||
@ -75,7 +75,7 @@ void SystickHandler(void)
|
||||
}
|
||||
}
|
||||
|
||||
if (gStepDirection == 0 && g_20000381 == 0 && gEeprom.DUAL_WATCH == DUAL_WATCH_OFF) {
|
||||
if (gStepDirection == 0 && gCssScanMode == CSS_SCAN_MODE_OFF && gEeprom.DUAL_WATCH == DUAL_WATCH_OFF) {
|
||||
if (gIsNoaaMode && gCurrentFunction != FUNCTION_MONITOR && gCurrentFunction != FUNCTION_TRANSMIT) {
|
||||
if (gCurrentFunction != FUNCTION_RECEIVE) {
|
||||
if (gNOAA_Countdown) {
|
||||
@ -88,7 +88,7 @@ void SystickHandler(void)
|
||||
}
|
||||
}
|
||||
|
||||
if (gStepDirection || g_20000381 == 1) {
|
||||
if (gStepDirection || gCssScanMode == CSS_SCAN_MODE_SCANNING) {
|
||||
if (gCurrentFunction != FUNCTION_MONITOR && gCurrentFunction != FUNCTION_TRANSMIT) {
|
||||
if (ScanPauseDelayIn10msec) {
|
||||
ScanPauseDelayIn10msec--;
|
||||
|
@ -40,7 +40,7 @@ void UI_DisplayAircopy(void)
|
||||
UI_PrintString(String, 2, 127, 0, 8, true);
|
||||
|
||||
if (gInputBoxIndex == 0) {
|
||||
NUMBER_ToDigits(gRxInfo->ConfigRX.Frequency, String);
|
||||
NUMBER_ToDigits(gRxVfo->ConfigRX.Frequency, String);
|
||||
UI_DisplayFrequency(String, 16, 2, 0, 0);
|
||||
UI_DisplaySmallDigits(2, String + 6, 97, 3);
|
||||
} else {
|
||||
|
@ -296,9 +296,9 @@ void UI_DisplayMain(void)
|
||||
uint8_t Level = 0;
|
||||
|
||||
if (SomeValue == 1) {
|
||||
if (gRxInfo->OUTPUT_POWER == OUTPUT_POWER_LOW) {
|
||||
if (gRxVfo->OUTPUT_POWER == OUTPUT_POWER_LOW) {
|
||||
Level = 2;
|
||||
} else if (gRxInfo->OUTPUT_POWER == OUTPUT_POWER_MID) {
|
||||
} else if (gRxVfo->OUTPUT_POWER == OUTPUT_POWER_MID) {
|
||||
Level = 4;
|
||||
} else {
|
||||
Level = 6;
|
||||
|
@ -426,7 +426,7 @@ void UI_DisplayMenu(void)
|
||||
UI_PrintString(String, 50, 127, 4, 8, true);
|
||||
}
|
||||
|
||||
if ((gMenuCursor == MENU_R_CTCS || gMenuCursor == MENU_R_DCS) && g_20000381) {
|
||||
if ((gMenuCursor == MENU_R_CTCS || gMenuCursor == MENU_R_DCS) && gCssScanMode != CSS_SCAN_MODE_OFF) {
|
||||
UI_PrintString("SCAN", 50, 127, 4, 8, true);
|
||||
}
|
||||
|
||||
|
@ -73,13 +73,13 @@ void UI_UpdateRSSI(uint16_t RSSI)
|
||||
{
|
||||
uint8_t Level;
|
||||
|
||||
if (RSSI >= gEEPROM_RSSI_CALIB[gRxInfo->Band][3]) {
|
||||
if (RSSI >= gEEPROM_RSSI_CALIB[gRxVfo->Band][3]) {
|
||||
Level = 6;
|
||||
} else if (RSSI >= gEEPROM_RSSI_CALIB[gRxInfo->Band][2]) {
|
||||
} else if (RSSI >= gEEPROM_RSSI_CALIB[gRxVfo->Band][2]) {
|
||||
Level = 4;
|
||||
} else if (RSSI >= gEEPROM_RSSI_CALIB[gRxInfo->Band][1]) {
|
||||
} else if (RSSI >= gEEPROM_RSSI_CALIB[gRxVfo->Band][1]) {
|
||||
Level = 2;
|
||||
} else if (RSSI >= gEEPROM_RSSI_CALIB[gRxInfo->Band][0]) {
|
||||
} else if (RSSI >= gEEPROM_RSSI_CALIB[gRxVfo->Band][0]) {
|
||||
Level = 1;
|
||||
} else {
|
||||
Level = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user