mirror of
https://github.com/OneOfEleven/uv-k5-firmware-custom.git
synced 2025-06-19 06:39:49 +03:00
lots of renames
This commit is contained in:
52
app/action.c
52
app/action.c
@ -55,14 +55,14 @@ static void ACTION_FlashLight(void)
|
||||
|
||||
void ACTION_Power(void)
|
||||
{
|
||||
if (++gTxVfo->OUTPUT_POWER > OUTPUT_POWER_HIGH)
|
||||
gTxVfo->OUTPUT_POWER = OUTPUT_POWER_LOW;
|
||||
if (++gTxVfo->output_power > OUTPUT_POWER_HIGH)
|
||||
gTxVfo->output_power = OUTPUT_POWER_LOW;
|
||||
|
||||
gRequestSaveChannel = 1;
|
||||
//gRequestSaveChannel = 2; // auto save the channel
|
||||
|
||||
#ifdef ENABLE_VOICE
|
||||
gAnotherVoiceID = VOICE_ID_POWER;
|
||||
g_another_voice_id = VOICE_ID_POWER;
|
||||
#endif
|
||||
|
||||
gRequestDisplayScreen = gScreenToDisplay;
|
||||
@ -74,8 +74,8 @@ void ACTION_Monitor(void)
|
||||
{ // enable the monitor
|
||||
RADIO_SelectVfos();
|
||||
#ifdef ENABLE_NOAA
|
||||
if (gRxVfo->CHANNEL_SAVE >= NOAA_CHANNEL_FIRST && gIsNoaaMode)
|
||||
gNoaaChannel = gRxVfo->CHANNEL_SAVE - NOAA_CHANNEL_FIRST;
|
||||
if (gRxVfo->channel_save >= NOAA_CHANNEL_FIRST && gIsNoaaMode)
|
||||
gNoaaChannel = gRxVfo->channel_save - NOAA_CHANNEL_FIRST;
|
||||
#endif
|
||||
RADIO_SetupRegisters(true);
|
||||
APP_StartListening(FUNCTION_MONITOR, false);
|
||||
@ -92,7 +92,7 @@ void ACTION_Monitor(void)
|
||||
}
|
||||
|
||||
#ifdef ENABLE_NOAA
|
||||
if (gEeprom.DUAL_WATCH == DUAL_WATCH_OFF && gIsNoaaMode)
|
||||
if (g_eeprom.dual_watch == DUAL_WATCH_OFF && gIsNoaaMode)
|
||||
{
|
||||
gNOAA_Countdown_10ms = NOAA_countdown_10ms;
|
||||
gScheduleNOAA = false;
|
||||
@ -130,7 +130,7 @@ void ACTION_Scan(bool bRestart)
|
||||
FM_PlayAndUpdate();
|
||||
|
||||
#ifdef ENABLE_VOICE
|
||||
gAnotherVoiceID = VOICE_ID_SCANNING_STOP;
|
||||
g_another_voice_id = VOICE_ID_SCANNING_STOP;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
@ -142,20 +142,20 @@ void ACTION_Scan(bool bRestart)
|
||||
gFM_AutoScan = true;
|
||||
gFM_ChannelPosition = 0;
|
||||
FM_EraseChannels();
|
||||
Frequency = gEeprom.FM_LowerLimit;
|
||||
Frequency = g_eeprom.fm_lower_limit;
|
||||
}
|
||||
else
|
||||
{
|
||||
gFM_AutoScan = false;
|
||||
gFM_ChannelPosition = 0;
|
||||
Frequency = gEeprom.FM_FrequencyPlaying;
|
||||
Frequency = g_eeprom.fm_frequency_playing;
|
||||
}
|
||||
|
||||
BK1080_GetFrequencyDeviation(Frequency);
|
||||
FM_Tune(Frequency, 1, bRestart);
|
||||
|
||||
#ifdef ENABLE_VOICE
|
||||
gAnotherVoiceID = VOICE_ID_SCANNING_BEGIN;
|
||||
g_another_voice_id = VOICE_ID_SCANNING_BEGIN;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@ -177,7 +177,7 @@ void ACTION_Scan(bool bRestart)
|
||||
RADIO_SelectVfos();
|
||||
|
||||
#ifdef ENABLE_NOAA
|
||||
if (IS_NOT_NOAA_CHANNEL(gRxVfo->CHANNEL_SAVE))
|
||||
if (IS_NOT_NOAA_CHANNEL(gRxVfo->channel_save))
|
||||
#endif
|
||||
{
|
||||
GUI_SelectNextDisplay(DISPLAY_MAIN);
|
||||
@ -185,11 +185,11 @@ void ACTION_Scan(bool bRestart)
|
||||
if (gScanStateDir != SCAN_OFF)
|
||||
{ // already scanning
|
||||
|
||||
if (gNextMrChannel <= MR_CHANNEL_LAST)
|
||||
if (gNextChannel <= USER_CHANNEL_LAST)
|
||||
{ // channel mode
|
||||
|
||||
// keep scanning but toggle between scan lists
|
||||
gEeprom.SCAN_LIST_DEFAULT = (gEeprom.SCAN_LIST_DEFAULT + 1) % 3;
|
||||
g_eeprom.scan_list_default = (g_eeprom.scan_list_default + 1) % 3;
|
||||
|
||||
// jump to the next channel
|
||||
CHANNEL_Next(true, gScanStateDir);
|
||||
@ -204,7 +204,7 @@ void ACTION_Scan(bool bRestart)
|
||||
SCANNER_Stop();
|
||||
|
||||
#ifdef ENABLE_VOICE
|
||||
gAnotherVoiceID = VOICE_ID_SCANNING_STOP;
|
||||
g_another_voice_id = VOICE_ID_SCANNING_STOP;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@ -219,7 +219,7 @@ void ACTION_Scan(bool bRestart)
|
||||
#endif
|
||||
|
||||
// clear the other vfo's rssi level (to hide the antenna symbol)
|
||||
gVFO_RSSI_bar_level[(gEeprom.RX_VFO + 1) & 1u] = 0;
|
||||
gVFO_RSSI_bar_level[(g_eeprom.rx_vfo + 1) & 1u] = 0;
|
||||
|
||||
// let the user see DW is not active
|
||||
gDualWatchActive = false;
|
||||
@ -229,9 +229,9 @@ void ACTION_Scan(bool bRestart)
|
||||
}
|
||||
else
|
||||
// if (!bRestart)
|
||||
if (!bRestart && gNextMrChannel <= MR_CHANNEL_LAST)
|
||||
if (!bRestart && gNextChannel <= USER_CHANNEL_LAST)
|
||||
{ // channel mode, keep scanning but toggle between scan lists
|
||||
gEeprom.SCAN_LIST_DEFAULT = (gEeprom.SCAN_LIST_DEFAULT + 1) % 3;
|
||||
g_eeprom.scan_list_default = (g_eeprom.scan_list_default + 1) % 3;
|
||||
|
||||
// jump to the next channel
|
||||
CHANNEL_Next(true, gScanStateDir);
|
||||
@ -247,7 +247,7 @@ void ACTION_Scan(bool bRestart)
|
||||
SCANNER_Stop();
|
||||
|
||||
#ifdef ENABLE_VOICE
|
||||
gAnotherVoiceID = VOICE_ID_SCANNING_STOP;
|
||||
g_another_voice_id = VOICE_ID_SCANNING_STOP;
|
||||
#endif
|
||||
|
||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||
@ -257,11 +257,11 @@ void ACTION_Scan(bool bRestart)
|
||||
#ifdef ENABLE_VOX
|
||||
void ACTION_Vox(void)
|
||||
{
|
||||
gEeprom.VOX_SWITCH = !gEeprom.VOX_SWITCH;
|
||||
g_eeprom.vox_switch = !g_eeprom.vox_switch;
|
||||
gRequestSaveSettings = true;
|
||||
gFlagReconfigureVfos = true;
|
||||
#ifdef ENABLE_VOICE
|
||||
gAnotherVoiceID = VOICE_ID_VOX;
|
||||
g_another_voice_id = VOICE_ID_VOX;
|
||||
#endif
|
||||
gUpdateStatus = true;
|
||||
}
|
||||
@ -323,7 +323,7 @@ void ACTION_Scan(bool bRestart)
|
||||
}
|
||||
#endif
|
||||
|
||||
void ACTION_Handle(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
void ACTION_Handle(key_code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
{
|
||||
uint8_t Short = ACTION_OPT_NONE;
|
||||
uint8_t Long = ACTION_OPT_NONE;
|
||||
@ -346,7 +346,7 @@ void ACTION_Handle(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
}
|
||||
|
||||
#ifdef ENABLE_VOICE
|
||||
gAnotherVoiceID = VOICE_ID_CANCEL;
|
||||
g_another_voice_id = VOICE_ID_CANCEL;
|
||||
#endif
|
||||
|
||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||
@ -359,14 +359,14 @@ void ACTION_Handle(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
|
||||
if (Key == KEY_SIDE1)
|
||||
{
|
||||
Short = gEeprom.KEY_1_SHORT_PRESS_ACTION;
|
||||
Long = gEeprom.KEY_1_LONG_PRESS_ACTION;
|
||||
Short = g_eeprom.key1_short_press_action;
|
||||
Long = g_eeprom.key1_long_press_action;
|
||||
}
|
||||
else
|
||||
if (Key == KEY_SIDE2)
|
||||
{
|
||||
Short = gEeprom.KEY_2_SHORT_PRESS_ACTION;
|
||||
Long = gEeprom.KEY_2_LONG_PRESS_ACTION;
|
||||
Short = g_eeprom.key2_short_press_action;
|
||||
Long = g_eeprom.key2_long_press_action;
|
||||
}
|
||||
|
||||
if (!bKeyHeld && bKeyPressed)
|
||||
|
@ -33,7 +33,7 @@ void ACTION_Scan(bool bFlag);
|
||||
void ACTION_FM(void);
|
||||
#endif
|
||||
|
||||
void ACTION_Handle(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld);
|
||||
void ACTION_Handle(key_code_t Key, bool bKeyPressed, bool bKeyHeld);
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -113,7 +113,7 @@ void AIRCOPY_StorePacket(void)
|
||||
gErrorsDuringAirCopy++;
|
||||
}
|
||||
|
||||
static void AIRCOPY_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
static void AIRCOPY_Key_DIGITS(key_code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
{
|
||||
if (!bKeyHeld && bKeyPressed)
|
||||
{
|
||||
@ -125,7 +125,7 @@ static void AIRCOPY_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
if (gInputBoxIndex < 6)
|
||||
{
|
||||
#ifdef ENABLE_VOICE
|
||||
gAnotherVoiceID = (VOICE_ID_t)Key;
|
||||
g_another_voice_id = (voice_id_t)Key;
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
@ -139,13 +139,13 @@ static void AIRCOPY_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
if (Frequency >= frequencyBandTable[i].lower && Frequency < frequencyBandTable[i].upper)
|
||||
{
|
||||
#ifdef ENABLE_VOICE
|
||||
gAnotherVoiceID = (VOICE_ID_t)Key;
|
||||
g_another_voice_id = (voice_id_t)Key;
|
||||
#endif
|
||||
gRxVfo->Band = i;
|
||||
gRxVfo->band = i;
|
||||
Frequency += 75;
|
||||
Frequency = FREQUENCY_FloorToStep(Frequency, gRxVfo->StepFrequency, 0);
|
||||
gRxVfo->freq_config_RX.Frequency = Frequency;
|
||||
gRxVfo->freq_config_TX.Frequency = Frequency;
|
||||
Frequency = FREQUENCY_FloorToStep(Frequency, gRxVfo->step_freq, 0);
|
||||
gRxVfo->freq_config_rx.frequency = Frequency;
|
||||
gRxVfo->freq_config_tx.frequency = Frequency;
|
||||
RADIO_ConfigureSquelchAndOutputPower(gRxVfo);
|
||||
gCurrentVfo = gRxVfo;
|
||||
RADIO_SetupRegisters(true);
|
||||
@ -202,7 +202,7 @@ static void AIRCOPY_Key_MENU(bool bKeyPressed, bool bKeyHeld)
|
||||
}
|
||||
}
|
||||
|
||||
void AIRCOPY_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
void AIRCOPY_ProcessKeys(key_code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
{
|
||||
switch (Key)
|
||||
{
|
||||
|
@ -21,25 +21,24 @@
|
||||
|
||||
#include "driver/keyboard.h"
|
||||
|
||||
enum AIRCOPY_State_t
|
||||
enum aircopy_state_e
|
||||
{
|
||||
AIRCOPY_READY = 0,
|
||||
AIRCOPY_TRANSFER,
|
||||
AIRCOPY_COMPLETE
|
||||
};
|
||||
typedef enum aircopy_state_e aircopy_state_t;
|
||||
|
||||
typedef enum AIRCOPY_State_t AIRCOPY_State_t;
|
||||
extern aircopy_state_t g_aircopy_state;
|
||||
extern uint16_t g_air_copy_block_number;
|
||||
extern uint16_t g_errors_during_air_copyy;
|
||||
extern uint8_t g_air_copy_is_send_mode;
|
||||
|
||||
extern AIRCOPY_State_t gAircopyState;
|
||||
extern uint16_t gAirCopyBlockNumber;
|
||||
extern uint16_t gErrorsDuringAirCopy;
|
||||
extern uint8_t gAirCopyIsSendMode;
|
||||
|
||||
extern uint16_t g_FSK_Buffer[36];
|
||||
extern uint16_t g_fsk_buffer[36];
|
||||
|
||||
void AIRCOPY_SendMessage(void);
|
||||
void AIRCOPY_StorePacket(void);
|
||||
void AIRCOPY_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld);
|
||||
void AIRCOPY_ProcessKeys(key_code_t Key, bool bKeyPressed, bool bKeyHeld);
|
||||
|
||||
#endif
|
||||
|
||||
|
44
app/dtmf.c
44
app/dtmf.c
@ -162,7 +162,7 @@ bool DTMF_CompareMessage(const char *pMsg, const char *pTemplate, const unsigned
|
||||
{
|
||||
if (pMsg[i] != pTemplate[i])
|
||||
{
|
||||
if (!bCheckGroup || pMsg[i] != gEeprom.DTMF_GROUP_CALL_CODE)
|
||||
if (!bCheckGroup || pMsg[i] != g_eeprom.DTMF_group_call_code)
|
||||
return false;
|
||||
gDTMF_IsGroupCall = true;
|
||||
}
|
||||
@ -175,7 +175,7 @@ DTMF_CallMode_t DTMF_CheckGroupCall(const char *pMsg, const unsigned int size)
|
||||
{
|
||||
unsigned int i;
|
||||
for (i = 0; i < size; i++)
|
||||
if (pMsg[i] == gEeprom.DTMF_GROUP_CALL_CODE)
|
||||
if (pMsg[i] == g_eeprom.DTMF_group_call_code)
|
||||
break;
|
||||
|
||||
return (i < size) ? DTMF_CALL_MODE_GROUP : DTMF_CALL_MODE_NOT_GROUP;
|
||||
@ -215,7 +215,7 @@ void DTMF_HandleRequest(void)
|
||||
return;
|
||||
}
|
||||
|
||||
if (!gRxVfo->DTMF_DECODING_ENABLE && !gSetting_KILLED)
|
||||
if (!gRxVfo->DTMF_decoding_enable && !gSetting_KILLED)
|
||||
{ // D-DCD is disabled or we're alive
|
||||
DTMF_clear_RX();
|
||||
return;
|
||||
@ -226,14 +226,14 @@ void DTMF_HandleRequest(void)
|
||||
if (gDTMF_RX_index >= 9)
|
||||
{ // look for the KILL code
|
||||
|
||||
sprintf(String, "%s%c%s", gEeprom.ANI_DTMF_ID, gEeprom.DTMF_SEPARATE_CODE, gEeprom.KILL_CODE);
|
||||
sprintf(String, "%s%c%s", g_eeprom.ani_DTMF_id, g_eeprom.DTMF_separate_code, g_eeprom.kill_code);
|
||||
|
||||
Offset = gDTMF_RX_index - strlen(String);
|
||||
|
||||
if (DTMF_CompareMessage(gDTMF_RX + Offset, String, strlen(String), true))
|
||||
{ // bugger
|
||||
|
||||
if (gEeprom.PERMIT_REMOTE_KILL)
|
||||
if (g_eeprom.permit_remote_kill)
|
||||
{
|
||||
gSetting_KILLED = true; // oooerr !
|
||||
|
||||
@ -267,7 +267,7 @@ void DTMF_HandleRequest(void)
|
||||
if (gDTMF_RX_index >= 9)
|
||||
{ // look for the REVIVE code
|
||||
|
||||
sprintf(String, "%s%c%s", gEeprom.ANI_DTMF_ID, gEeprom.DTMF_SEPARATE_CODE, gEeprom.REVIVE_CODE);
|
||||
sprintf(String, "%s%c%s", g_eeprom.ani_DTMF_id, g_eeprom.DTMF_separate_code, g_eeprom.revive_code);
|
||||
|
||||
Offset = gDTMF_RX_index - strlen(String);
|
||||
|
||||
@ -316,7 +316,7 @@ void DTMF_HandleRequest(void)
|
||||
gDTMF_RX_index >= 9)
|
||||
{ // waiting for a reply
|
||||
|
||||
sprintf(String, "%s%c%s", gDTMF_String, gEeprom.DTMF_SEPARATE_CODE, "AAAAA");
|
||||
sprintf(String, "%s%c%s", gDTMF_String, g_eeprom.DTMF_separate_code, "AAAAA");
|
||||
|
||||
Offset = gDTMF_RX_index - strlen(String);
|
||||
|
||||
@ -338,7 +338,7 @@ void DTMF_HandleRequest(void)
|
||||
|
||||
gDTMF_IsGroupCall = false;
|
||||
|
||||
sprintf(String, "%s%c", gEeprom.ANI_DTMF_ID, gEeprom.DTMF_SEPARATE_CODE);
|
||||
sprintf(String, "%s%c", g_eeprom.ani_DTMF_id, g_eeprom.DTMF_separate_code);
|
||||
|
||||
Offset = gDTMF_RX_index - strlen(String) - 3;
|
||||
|
||||
@ -359,7 +359,7 @@ void DTMF_HandleRequest(void)
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough="
|
||||
|
||||
switch (gEeprom.DTMF_DECODE_RESPONSE)
|
||||
switch (g_eeprom.DTMF_decode_response)
|
||||
{
|
||||
case DTMF_DEC_RESPONSE_BOTH:
|
||||
gDTMF_DecodeRingCountdown_500ms = DTMF_decode_ring_countdown_500ms;
|
||||
@ -399,7 +399,7 @@ void DTMF_Reply(void)
|
||||
}
|
||||
else
|
||||
{ // append our ID code onto the end of the DTMF code to send
|
||||
sprintf(String, "%s%c%s", gDTMF_String, gEeprom.DTMF_SEPARATE_CODE, gEeprom.ANI_DTMF_ID);
|
||||
sprintf(String, "%s%c%s", gDTMF_String, g_eeprom.DTMF_separate_code, g_eeprom.ani_DTMF_id);
|
||||
pString = String;
|
||||
}
|
||||
break;
|
||||
@ -409,23 +409,23 @@ void DTMF_Reply(void)
|
||||
break;
|
||||
|
||||
case DTMF_REPLY_AAAAA:
|
||||
sprintf(String, "%s%c%s", gEeprom.ANI_DTMF_ID, gEeprom.DTMF_SEPARATE_CODE, "AAAAA");
|
||||
sprintf(String, "%s%c%s", g_eeprom.ani_DTMF_id, g_eeprom.DTMF_separate_code, "AAAAA");
|
||||
pString = String;
|
||||
break;
|
||||
|
||||
default:
|
||||
case DTMF_REPLY_NONE:
|
||||
if (gDTMF_CallState != DTMF_CALL_STATE_NONE ||
|
||||
gCurrentVfo->DTMF_PTT_ID_TX_MODE == PTT_ID_APOLLO ||
|
||||
gCurrentVfo->DTMF_PTT_ID_TX_MODE == PTT_ID_OFF ||
|
||||
gCurrentVfo->DTMF_PTT_ID_TX_MODE == PTT_ID_TX_DOWN)
|
||||
gCurrentVfo->DTMF_ptt_id_tx_mode == PTT_ID_APOLLO ||
|
||||
gCurrentVfo->DTMF_ptt_id_tx_mode == PTT_ID_OFF ||
|
||||
gCurrentVfo->DTMF_ptt_id_tx_mode == PTT_ID_TX_DOWN)
|
||||
{
|
||||
gDTMF_ReplyState = DTMF_REPLY_NONE;
|
||||
return;
|
||||
}
|
||||
|
||||
// send TX-UP DTMF
|
||||
pString = gEeprom.DTMF_UP_CODE;
|
||||
pString = g_eeprom.DTMF_up_code;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -434,9 +434,9 @@ void DTMF_Reply(void)
|
||||
if (pString == NULL)
|
||||
return;
|
||||
|
||||
Delay = (gEeprom.DTMF_PRELOAD_TIME < 200) ? 200 : gEeprom.DTMF_PRELOAD_TIME;
|
||||
Delay = (g_eeprom.DTMF_preload_time < 200) ? 200 : g_eeprom.DTMF_preload_time;
|
||||
|
||||
if (gEeprom.DTMF_SIDE_TONE)
|
||||
if (g_eeprom.DTMF_side_tone)
|
||||
{ // the user will also hear the transmitted tones
|
||||
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
|
||||
gEnableSpeaker = true;
|
||||
@ -444,15 +444,15 @@ void DTMF_Reply(void)
|
||||
|
||||
SYSTEM_DelayMs(Delay);
|
||||
|
||||
BK4819_EnterDTMF_TX(gEeprom.DTMF_SIDE_TONE);
|
||||
BK4819_EnterDTMF_TX(g_eeprom.DTMF_side_tone);
|
||||
|
||||
BK4819_PlayDTMFString(
|
||||
pString,
|
||||
1,
|
||||
gEeprom.DTMF_FIRST_CODE_PERSIST_TIME,
|
||||
gEeprom.DTMF_HASH_CODE_PERSIST_TIME,
|
||||
gEeprom.DTMF_CODE_PERSIST_TIME,
|
||||
gEeprom.DTMF_CODE_INTERVAL_TIME);
|
||||
g_eeprom.DTMF_first_code_persist_time,
|
||||
g_eeprom.DTMF_hash_code_persist_time,
|
||||
g_eeprom.DTMF_code_persist_time,
|
||||
g_eeprom.DTMF_code_interval_time);
|
||||
|
||||
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
|
||||
|
||||
|
128
app/fm.c
128
app/fm.c
@ -74,18 +74,18 @@ uint8_t FM_FindNextChannel(uint8_t Channel, uint8_t Direction)
|
||||
|
||||
int FM_ConfigureChannelState(void)
|
||||
{
|
||||
gEeprom.FM_FrequencyPlaying = gEeprom.FM_SelectedFrequency;
|
||||
g_eeprom.fm_frequency_playing = g_eeprom.fm_selected_frequency;
|
||||
|
||||
if (gEeprom.FM_IsMrMode)
|
||||
if (g_eeprom.fm_is_channel_mode)
|
||||
{
|
||||
const uint8_t Channel = FM_FindNextChannel(gEeprom.FM_SelectedChannel, FM_CHANNEL_UP);
|
||||
const uint8_t Channel = FM_FindNextChannel(g_eeprom.fm_selected_channel, FM_CHANNEL_UP);
|
||||
if (Channel == 0xFF)
|
||||
{
|
||||
gEeprom.FM_IsMrMode = false;
|
||||
g_eeprom.fm_is_channel_mode = false;
|
||||
return -1;
|
||||
}
|
||||
gEeprom.FM_SelectedChannel = Channel;
|
||||
gEeprom.FM_FrequencyPlaying = gFM_Channels[Channel];
|
||||
g_eeprom.fm_selected_channel = Channel;
|
||||
g_eeprom.fm_frequency_playing = gFM_Channels[Channel];
|
||||
}
|
||||
|
||||
return 0;
|
||||
@ -130,23 +130,23 @@ void FM_Tune(uint16_t Frequency, int8_t Step, bool bFlag)
|
||||
gFM_FoundFrequency = false;
|
||||
gAskToSave = false;
|
||||
gAskToDelete = false;
|
||||
gEeprom.FM_FrequencyPlaying = Frequency;
|
||||
g_eeprom.fm_frequency_playing = Frequency;
|
||||
|
||||
if (!bFlag)
|
||||
{
|
||||
Frequency += Step;
|
||||
if (Frequency < gEeprom.FM_LowerLimit)
|
||||
Frequency = gEeprom.FM_UpperLimit;
|
||||
if (Frequency < g_eeprom.fm_lower_limit)
|
||||
Frequency = g_eeprom.fm_upper_limit;
|
||||
else
|
||||
if (Frequency > gEeprom.FM_UpperLimit)
|
||||
Frequency = gEeprom.FM_LowerLimit;
|
||||
if (Frequency > g_eeprom.fm_upper_limit)
|
||||
Frequency = g_eeprom.fm_lower_limit;
|
||||
|
||||
gEeprom.FM_FrequencyPlaying = Frequency;
|
||||
g_eeprom.fm_frequency_playing = Frequency;
|
||||
}
|
||||
|
||||
gFM_ScanState = Step;
|
||||
|
||||
BK1080_SetFrequency(gEeprom.FM_FrequencyPlaying);
|
||||
BK1080_SetFrequency(g_eeprom.fm_frequency_playing);
|
||||
}
|
||||
|
||||
void FM_PlayAndUpdate(void)
|
||||
@ -155,12 +155,12 @@ void FM_PlayAndUpdate(void)
|
||||
|
||||
if (gFM_AutoScan)
|
||||
{
|
||||
gEeprom.FM_IsMrMode = true;
|
||||
gEeprom.FM_SelectedChannel = 0;
|
||||
g_eeprom.fm_is_channel_mode = true;
|
||||
g_eeprom.fm_selected_channel = 0;
|
||||
}
|
||||
|
||||
FM_ConfigureChannelState();
|
||||
BK1080_SetFrequency(gEeprom.FM_FrequencyPlaying);
|
||||
BK1080_SetFrequency(g_eeprom.fm_frequency_playing);
|
||||
SETTINGS_SaveFM();
|
||||
|
||||
gFmPlayCountdown_10ms = 0;
|
||||
@ -224,15 +224,15 @@ Bail:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void FM_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
static void FM_Key_DIGITS(key_code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
{
|
||||
#define STATE_FREQ_MODE 0
|
||||
#define STATE_MR_MODE 1
|
||||
#define STATE_USER_MODE 1
|
||||
#define STATE_SAVE 2
|
||||
|
||||
if (!bKeyHeld && bKeyPressed)
|
||||
{
|
||||
if (!gWasFKeyPressed)
|
||||
if (!g_was_f_key_pressed)
|
||||
{
|
||||
uint8_t State;
|
||||
|
||||
@ -254,7 +254,7 @@ static void FM_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
return;
|
||||
}
|
||||
|
||||
State = gEeprom.FM_IsMrMode ? STATE_MR_MODE : STATE_FREQ_MODE;
|
||||
State = g_eeprom.fm_is_channel_mode ? STATE_USER_MODE : STATE_FREQ_MODE;
|
||||
}
|
||||
|
||||
INPUTBOX_Append(Key);
|
||||
@ -281,21 +281,21 @@ static void FM_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
NUMBER_Get(gInputBox, &Frequency);
|
||||
Frequency /= 10000;
|
||||
|
||||
if (Frequency < gEeprom.FM_LowerLimit || gEeprom.FM_UpperLimit < Frequency)
|
||||
if (Frequency < g_eeprom.fm_lower_limit || g_eeprom.fm_upper_limit < Frequency)
|
||||
{
|
||||
gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
||||
gRequestDisplayScreen = DISPLAY_FM;
|
||||
return;
|
||||
}
|
||||
|
||||
gEeprom.FM_SelectedFrequency = (uint16_t)Frequency;
|
||||
g_eeprom.fm_selected_frequency = (uint16_t)Frequency;
|
||||
|
||||
#ifdef ENABLE_VOICE
|
||||
gAnotherVoiceID = (VOICE_ID_t)Key;
|
||||
g_another_voice_id = (voice_id_t)Key;
|
||||
#endif
|
||||
|
||||
gEeprom.FM_FrequencyPlaying = gEeprom.FM_SelectedFrequency;
|
||||
BK1080_SetFrequency(gEeprom.FM_FrequencyPlaying);
|
||||
g_eeprom.fm_frequency_playing = g_eeprom.fm_selected_frequency;
|
||||
BK1080_SetFrequency(g_eeprom.fm_frequency_playing);
|
||||
gRequestSaveFM = true;
|
||||
return;
|
||||
}
|
||||
@ -308,16 +308,16 @@ static void FM_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
gInputBoxIndex = 0;
|
||||
Channel = ((gInputBox[0] * 10) + gInputBox[1]) - 1;
|
||||
|
||||
if (State == STATE_MR_MODE)
|
||||
if (State == STATE_USER_MODE)
|
||||
{
|
||||
if (FM_CheckValidChannel(Channel))
|
||||
{
|
||||
#ifdef ENABLE_VOICE
|
||||
gAnotherVoiceID = (VOICE_ID_t)Key;
|
||||
g_another_voice_id = (voice_id_t)Key;
|
||||
#endif
|
||||
gEeprom.FM_SelectedChannel = Channel;
|
||||
gEeprom.FM_FrequencyPlaying = gFM_Channels[Channel];
|
||||
BK1080_SetFrequency(gEeprom.FM_FrequencyPlaying);
|
||||
g_eeprom.fm_selected_channel = Channel;
|
||||
g_eeprom.fm_frequency_playing = gFM_Channels[Channel];
|
||||
BK1080_SetFrequency(g_eeprom.fm_frequency_playing);
|
||||
gRequestSaveFM = true;
|
||||
return;
|
||||
}
|
||||
@ -326,7 +326,7 @@ static void FM_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
if (Channel < 20)
|
||||
{
|
||||
#ifdef ENABLE_VOICE
|
||||
gAnotherVoiceID = (VOICE_ID_t)Key;
|
||||
g_another_voice_id = (voice_id_t)Key;
|
||||
#endif
|
||||
gRequestDisplayScreen = DISPLAY_FM;
|
||||
gInputBoxIndex = 0;
|
||||
@ -339,14 +339,14 @@ static void FM_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
}
|
||||
|
||||
#ifdef ENABLE_VOICE
|
||||
gAnotherVoiceID = (VOICE_ID_t)Key;
|
||||
g_another_voice_id = (voice_id_t)Key;
|
||||
#endif
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
||||
gWasFKeyPressed = false;
|
||||
g_was_f_key_pressed = false;
|
||||
gUpdateStatus = true;
|
||||
gRequestDisplayScreen = DISPLAY_FM;
|
||||
|
||||
@ -357,11 +357,11 @@ static void FM_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
break;
|
||||
|
||||
case KEY_1:
|
||||
gEeprom.FM_IsMrMode = !gEeprom.FM_IsMrMode;
|
||||
g_eeprom.fm_is_channel_mode = !g_eeprom.fm_is_channel_mode;
|
||||
|
||||
if (!FM_ConfigureChannelState())
|
||||
{
|
||||
BK1080_SetFrequency(gEeprom.FM_FrequencyPlaying);
|
||||
BK1080_SetFrequency(g_eeprom.fm_frequency_playing);
|
||||
gRequestSaveFM = true;
|
||||
}
|
||||
else
|
||||
@ -429,14 +429,14 @@ static void FM_Key_EXIT(bool bKeyPressed, bool bKeyHeld)
|
||||
}
|
||||
|
||||
#ifdef ENABLE_VOICE
|
||||
gAnotherVoiceID = VOICE_ID_CANCEL;
|
||||
g_another_voice_id = VOICE_ID_CANCEL;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
FM_PlayAndUpdate();
|
||||
#ifdef ENABLE_VOICE
|
||||
gAnotherVoiceID = VOICE_ID_SCANNING_STOP;
|
||||
g_another_voice_id = VOICE_ID_SCANNING_STOP;
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -456,11 +456,11 @@ static void FM_Key_MENU(bool bKeyPressed, bool bKeyHeld)
|
||||
|
||||
if (gFM_ScanState == FM_SCAN_OFF)
|
||||
{
|
||||
if (!gEeprom.FM_IsMrMode)
|
||||
if (!g_eeprom.fm_is_channel_mode)
|
||||
{
|
||||
if (gAskToSave)
|
||||
{
|
||||
gFM_Channels[gFM_ChannelPosition] = gEeprom.FM_FrequencyPlaying;
|
||||
gFM_Channels[gFM_ChannelPosition] = g_eeprom.fm_frequency_playing;
|
||||
gAskToSave = false;
|
||||
gRequestSaveFM = true;
|
||||
}
|
||||
@ -471,10 +471,10 @@ static void FM_Key_MENU(bool bKeyPressed, bool bKeyHeld)
|
||||
{
|
||||
if (gAskToDelete)
|
||||
{
|
||||
gFM_Channels[gEeprom.FM_SelectedChannel] = 0xFFFF;
|
||||
gFM_Channels[g_eeprom.fm_selected_channel] = 0xFFFF;
|
||||
|
||||
FM_ConfigureChannelState();
|
||||
BK1080_SetFrequency(gEeprom.FM_FrequencyPlaying);
|
||||
BK1080_SetFrequency(g_eeprom.fm_frequency_playing);
|
||||
|
||||
gRequestSaveFM = true;
|
||||
gAskToDelete = false;
|
||||
@ -494,7 +494,7 @@ static void FM_Key_MENU(bool bKeyPressed, bool bKeyHeld)
|
||||
|
||||
if (gAskToSave)
|
||||
{
|
||||
gFM_Channels[gFM_ChannelPosition] = gEeprom.FM_FrequencyPlaying;
|
||||
gFM_Channels[gFM_ChannelPosition] = g_eeprom.fm_frequency_playing;
|
||||
gAskToSave = false;
|
||||
gRequestSaveFM = true;
|
||||
}
|
||||
@ -539,42 +539,42 @@ static void FM_Key_UP_DOWN(bool bKeyPressed, bool bKeyHeld, int8_t Step)
|
||||
return;
|
||||
}
|
||||
|
||||
FM_Tune(gEeprom.FM_FrequencyPlaying, Step, false);
|
||||
FM_Tune(g_eeprom.fm_frequency_playing, Step, false);
|
||||
gRequestDisplayScreen = DISPLAY_FM;
|
||||
return;
|
||||
}
|
||||
|
||||
if (gEeprom.FM_IsMrMode)
|
||||
if (g_eeprom.fm_is_channel_mode)
|
||||
{
|
||||
const uint8_t Channel = FM_FindNextChannel(gEeprom.FM_SelectedChannel + Step, Step);
|
||||
if (Channel == 0xFF || gEeprom.FM_SelectedChannel == Channel)
|
||||
const uint8_t Channel = FM_FindNextChannel(g_eeprom.fm_selected_channel + Step, Step);
|
||||
if (Channel == 0xFF || g_eeprom.fm_selected_channel == Channel)
|
||||
goto Bail;
|
||||
|
||||
gEeprom.FM_SelectedChannel = Channel;
|
||||
gEeprom.FM_FrequencyPlaying = gFM_Channels[Channel];
|
||||
g_eeprom.fm_selected_channel = Channel;
|
||||
g_eeprom.fm_frequency_playing = gFM_Channels[Channel];
|
||||
}
|
||||
else
|
||||
{
|
||||
uint16_t Frequency = gEeprom.FM_SelectedFrequency + Step;
|
||||
if (Frequency < gEeprom.FM_LowerLimit)
|
||||
Frequency = gEeprom.FM_UpperLimit;
|
||||
uint16_t Frequency = g_eeprom.fm_selected_frequency + Step;
|
||||
if (Frequency < g_eeprom.fm_lower_limit)
|
||||
Frequency = g_eeprom.fm_upper_limit;
|
||||
else
|
||||
if (Frequency > gEeprom.FM_UpperLimit)
|
||||
Frequency = gEeprom.FM_LowerLimit;
|
||||
if (Frequency > g_eeprom.fm_upper_limit)
|
||||
Frequency = g_eeprom.fm_lower_limit;
|
||||
|
||||
gEeprom.FM_FrequencyPlaying = Frequency;
|
||||
gEeprom.FM_SelectedFrequency = gEeprom.FM_FrequencyPlaying;
|
||||
g_eeprom.fm_frequency_playing = Frequency;
|
||||
g_eeprom.fm_selected_frequency = g_eeprom.fm_frequency_playing;
|
||||
}
|
||||
|
||||
gRequestSaveFM = true;
|
||||
|
||||
Bail:
|
||||
BK1080_SetFrequency(gEeprom.FM_FrequencyPlaying);
|
||||
BK1080_SetFrequency(g_eeprom.fm_frequency_playing);
|
||||
|
||||
gRequestDisplayScreen = DISPLAY_FM;
|
||||
}
|
||||
|
||||
void FM_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
void FM_ProcessKeys(key_code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
{
|
||||
switch (Key)
|
||||
{
|
||||
@ -617,15 +617,15 @@ void FM_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
|
||||
void FM_Play(void)
|
||||
{
|
||||
if (!FM_CheckFrequencyLock(gEeprom.FM_FrequencyPlaying, gEeprom.FM_LowerLimit))
|
||||
if (!FM_CheckFrequencyLock(g_eeprom.fm_frequency_playing, g_eeprom.fm_lower_limit))
|
||||
{
|
||||
if (!gFM_AutoScan)
|
||||
{
|
||||
gFmPlayCountdown_10ms = 0;
|
||||
gFM_FoundFrequency = true;
|
||||
|
||||
if (!gEeprom.FM_IsMrMode)
|
||||
gEeprom.FM_SelectedFrequency = gEeprom.FM_FrequencyPlaying;
|
||||
if (!g_eeprom.fm_is_channel_mode)
|
||||
g_eeprom.fm_selected_frequency = g_eeprom.fm_frequency_playing;
|
||||
|
||||
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
|
||||
gEnableSpeaker = true;
|
||||
@ -635,7 +635,7 @@ void FM_Play(void)
|
||||
}
|
||||
|
||||
if (gFM_ChannelPosition < 20)
|
||||
gFM_Channels[gFM_ChannelPosition++] = gEeprom.FM_FrequencyPlaying;
|
||||
gFM_Channels[gFM_ChannelPosition++] = g_eeprom.fm_frequency_playing;
|
||||
|
||||
if (gFM_ChannelPosition >= 20)
|
||||
{
|
||||
@ -645,10 +645,10 @@ void FM_Play(void)
|
||||
}
|
||||
}
|
||||
|
||||
if (gFM_AutoScan && gEeprom.FM_FrequencyPlaying >= gEeprom.FM_UpperLimit)
|
||||
if (gFM_AutoScan && g_eeprom.fm_frequency_playing >= g_eeprom.fm_upper_limit)
|
||||
FM_PlayAndUpdate();
|
||||
else
|
||||
FM_Tune(gEeprom.FM_FrequencyPlaying, gFM_ScanState, false);
|
||||
FM_Tune(g_eeprom.fm_frequency_playing, gFM_ScanState, false);
|
||||
|
||||
GUI_SelectNextDisplay(DISPLAY_FM);
|
||||
}
|
||||
@ -659,7 +659,7 @@ void FM_Start(void)
|
||||
gFM_ScanState = FM_SCAN_OFF;
|
||||
gFM_RestoreCountdown_10ms = 0;
|
||||
|
||||
BK1080_Init(gEeprom.FM_FrequencyPlaying, true);
|
||||
BK1080_Init(g_eeprom.fm_frequency_playing, true);
|
||||
|
||||
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
|
||||
|
||||
|
2
app/fm.h
2
app/fm.h
@ -52,7 +52,7 @@ void FM_Tune(uint16_t Frequency, int8_t Step, bool bFlag);
|
||||
void FM_PlayAndUpdate(void);
|
||||
int FM_CheckFrequencyLock(uint16_t Frequency, uint16_t LowerLimit);
|
||||
|
||||
void FM_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld);
|
||||
void FM_ProcessKeys(key_code_t Key, bool bKeyPressed, bool bKeyHeld);
|
||||
|
||||
void FM_Play(void);
|
||||
void FM_Start(void);
|
||||
|
@ -61,10 +61,10 @@ void GENERIC_Key_F(bool bKeyPressed, bool bKeyHeld)
|
||||
{ // toggle the keyboad lock
|
||||
|
||||
#ifdef ENABLE_VOICE
|
||||
gAnotherVoiceID = gEeprom.KEY_LOCK ? VOICE_ID_UNLOCK : VOICE_ID_LOCK;
|
||||
g_another_voice_id = g_eeprom.key_lock ? VOICE_ID_UNLOCK : VOICE_ID_LOCK;
|
||||
#endif
|
||||
|
||||
gEeprom.KEY_LOCK = !gEeprom.KEY_LOCK;
|
||||
g_eeprom.key_lock = !g_eeprom.key_lock;
|
||||
|
||||
gRequestSaveSettings = true;
|
||||
}
|
||||
@ -79,14 +79,14 @@ void GENERIC_Key_F(bool bKeyPressed, bool bKeyHeld)
|
||||
return;
|
||||
#endif
|
||||
|
||||
gWasFKeyPressed = !gWasFKeyPressed;
|
||||
g_was_f_key_pressed = !g_was_f_key_pressed;
|
||||
|
||||
if (gWasFKeyPressed)
|
||||
if (g_was_f_key_pressed)
|
||||
gKeyInputCountdown = key_input_timeout_500ms;
|
||||
|
||||
#ifdef ENABLE_VOICE
|
||||
if (!gWasFKeyPressed)
|
||||
gAnotherVoiceID = VOICE_ID_CANCEL;
|
||||
if (!g_was_f_key_pressed)
|
||||
g_another_voice_id = VOICE_ID_CANCEL;
|
||||
#endif
|
||||
|
||||
gUpdateStatus = true;
|
||||
@ -132,10 +132,10 @@ void GENERIC_Key_PTT(bool bKeyPressed)
|
||||
{
|
||||
APP_EndTransmission();
|
||||
|
||||
if (gEeprom.REPEATER_TAIL_TONE_ELIMINATION == 0)
|
||||
if (g_eeprom.repeater_tail_tone_elimination == 0)
|
||||
FUNCTION_Select(FUNCTION_FOREGROUND);
|
||||
else
|
||||
gRTTECountdown = gEeprom.REPEATER_TAIL_TONE_ELIMINATION * 10;
|
||||
gRTTECountdown = g_eeprom.repeater_tail_tone_elimination * 10;
|
||||
}
|
||||
|
||||
gFlagEndTransmission = false;
|
||||
@ -162,7 +162,7 @@ void GENERIC_Key_PTT(bool bKeyPressed)
|
||||
|
||||
if (gScreenToDisplay == DISPLAY_SCANNER)
|
||||
{ // CTCSS/CDCSS scanning .. stop
|
||||
gEeprom.CROSS_BAND_RX_TX = gBackup_CROSS_BAND_RX_TX;
|
||||
g_eeprom.cross_vfo_rx_tx = gBackup_cross_vfo_rx_tx;
|
||||
gFlagStopScan = true;
|
||||
gVfoConfigureMode = VFO_CONFIGURE_RELOAD;
|
||||
gFlagResetVfos = true;
|
||||
@ -178,7 +178,7 @@ void GENERIC_Key_PTT(bool bKeyPressed)
|
||||
MENU_StopCssScan();
|
||||
|
||||
#ifdef ENABLE_VOICE
|
||||
gAnotherVoiceID = VOICE_ID_SCANNING_STOP;
|
||||
g_another_voice_id = VOICE_ID_SCANNING_STOP;
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -190,7 +190,7 @@ void GENERIC_Key_PTT(bool bKeyPressed)
|
||||
{ // FM radio is scanning .. stop
|
||||
FM_PlayAndUpdate();
|
||||
#ifdef ENABLE_VOICE
|
||||
gAnotherVoiceID = VOICE_ID_SCANNING_STOP;
|
||||
g_another_voice_id = VOICE_ID_SCANNING_STOP;
|
||||
#endif
|
||||
gRequestDisplayScreen = DISPLAY_FM;
|
||||
goto cancel_tx;
|
||||
@ -235,7 +235,7 @@ void GENERIC_Key_PTT(bool bKeyPressed)
|
||||
#else
|
||||
// append our DTMF ID to the inputted DTMF code -
|
||||
// IF the user inputted code is exactly 3 digits long and D-DCD is enabled
|
||||
if (gDTMF_InputBox_Index == 3 && gTxVfo->DTMF_DECODING_ENABLE > 0)
|
||||
if (gDTMF_InputBox_Index == 3 && gTxVfo->DTMF_decoding_enable > 0)
|
||||
gDTMF_CallMode = DTMF_CheckGroupCall(gDTMF_InputBox, 3);
|
||||
else
|
||||
gDTMF_CallMode = DTMF_CALL_MODE_DTMF;
|
||||
|
210
app/main.c
210
app/main.c
@ -41,34 +41,34 @@
|
||||
void toggle_chan_scanlist(void)
|
||||
{ // toggle the selected channels scanlist setting
|
||||
|
||||
if (gScreenToDisplay == DISPLAY_SCANNER || !IS_MR_CHANNEL(gTxVfo->CHANNEL_SAVE))
|
||||
if (gScreenToDisplay == DISPLAY_SCANNER || !IS_USER_CHANNEL(gTxVfo->channel_save))
|
||||
return;
|
||||
|
||||
if (gTxVfo->SCANLIST1_PARTICIPATION)
|
||||
if (gTxVfo->scanlist_1_participation)
|
||||
{
|
||||
if (gTxVfo->SCANLIST2_PARTICIPATION)
|
||||
gTxVfo->SCANLIST1_PARTICIPATION = 0;
|
||||
if (gTxVfo->scanlist_2_participation)
|
||||
gTxVfo->scanlist_1_participation = 0;
|
||||
else
|
||||
gTxVfo->SCANLIST2_PARTICIPATION = 1;
|
||||
gTxVfo->scanlist_2_participation = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (gTxVfo->SCANLIST2_PARTICIPATION)
|
||||
gTxVfo->SCANLIST2_PARTICIPATION = 0;
|
||||
if (gTxVfo->scanlist_2_participation)
|
||||
gTxVfo->scanlist_2_participation = 0;
|
||||
else
|
||||
gTxVfo->SCANLIST1_PARTICIPATION = 1;
|
||||
gTxVfo->scanlist_1_participation = 1;
|
||||
}
|
||||
|
||||
SETTINGS_UpdateChannel(gTxVfo->CHANNEL_SAVE, gTxVfo, true);
|
||||
SETTINGS_UpdateChannel(gTxVfo->channel_save, gTxVfo, true);
|
||||
|
||||
gVfoConfigureMode = VFO_CONFIGURE;
|
||||
gFlagResetVfos = true;
|
||||
}
|
||||
|
||||
static void processFKeyFunction(const KEY_Code_t Key, const bool beep)
|
||||
static void processFKeyFunction(const key_code_t Key, const bool beep)
|
||||
{
|
||||
uint8_t Band;
|
||||
uint8_t Vfo = gEeprom.TX_VFO;
|
||||
uint8_t Vfo = g_eeprom.tx_vfo;
|
||||
|
||||
if (gScreenToDisplay == DISPLAY_MENU)
|
||||
{
|
||||
@ -95,15 +95,15 @@ static void processFKeyFunction(const KEY_Code_t Key, const bool beep)
|
||||
break;
|
||||
|
||||
case KEY_1:
|
||||
if (!IS_FREQ_CHANNEL(gTxVfo->CHANNEL_SAVE))
|
||||
if (!IS_FREQ_CHANNEL(gTxVfo->channel_save))
|
||||
{
|
||||
gWasFKeyPressed = false;
|
||||
g_was_f_key_pressed = false;
|
||||
gUpdateStatus = true;
|
||||
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
||||
return;
|
||||
}
|
||||
|
||||
Band = gTxVfo->Band + 1;
|
||||
Band = gTxVfo->band + 1;
|
||||
if (gSetting_350EN || Band != BAND5_350MHz)
|
||||
{
|
||||
if (Band > BAND7_470MHz)
|
||||
@ -111,10 +111,10 @@ static void processFKeyFunction(const KEY_Code_t Key, const bool beep)
|
||||
}
|
||||
else
|
||||
Band = BAND6_400MHz;
|
||||
gTxVfo->Band = Band;
|
||||
gTxVfo->band = Band;
|
||||
|
||||
gEeprom.ScreenChannel[Vfo] = FREQ_CHANNEL_FIRST + Band;
|
||||
gEeprom.FreqChannel[Vfo] = FREQ_CHANNEL_FIRST + Band;
|
||||
g_eeprom.screen_channel[Vfo] = FREQ_CHANNEL_FIRST + Band;
|
||||
g_eeprom.freq_channel[Vfo] = FREQ_CHANNEL_FIRST + Band;
|
||||
|
||||
gRequestSaveVFO = true;
|
||||
gVfoConfigureMode = VFO_CONFIGURE_RELOAD;
|
||||
@ -127,19 +127,19 @@ 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;
|
||||
if (g_eeprom.cross_vfo_rx_tx == CROSS_BAND_CHAN_A)
|
||||
g_eeprom.cross_vfo_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;
|
||||
if (g_eeprom.cross_vfo_rx_tx == CROSS_BAND_CHAN_B)
|
||||
g_eeprom.cross_vfo_rx_tx = CROSS_BAND_CHAN_A;
|
||||
else
|
||||
if (gEeprom.DUAL_WATCH == DUAL_WATCH_CHAN_A)
|
||||
gEeprom.DUAL_WATCH = DUAL_WATCH_CHAN_B;
|
||||
if (g_eeprom.dual_watch == DUAL_WATCH_CHAN_A)
|
||||
g_eeprom.dual_watch = DUAL_WATCH_CHAN_B;
|
||||
else
|
||||
if (gEeprom.DUAL_WATCH == DUAL_WATCH_CHAN_B)
|
||||
gEeprom.DUAL_WATCH = DUAL_WATCH_CHAN_A;
|
||||
if (g_eeprom.dual_watch == DUAL_WATCH_CHAN_B)
|
||||
g_eeprom.dual_watch = DUAL_WATCH_CHAN_A;
|
||||
else
|
||||
gEeprom.TX_VFO = (Vfo + 1) & 1u;
|
||||
g_eeprom.tx_vfo = (Vfo + 1) & 1u;
|
||||
|
||||
gRequestSaveSettings = 1;
|
||||
gFlagReconfigureVfos = true;
|
||||
@ -153,32 +153,32 @@ static void processFKeyFunction(const KEY_Code_t Key, const bool beep)
|
||||
|
||||
case KEY_3:
|
||||
#ifdef ENABLE_NOAA
|
||||
if (gEeprom.VFO_OPEN && IS_NOT_NOAA_CHANNEL(gTxVfo->CHANNEL_SAVE))
|
||||
if (g_eeprom.vfo_open && IS_NOT_NOAA_CHANNEL(gTxVfo->channel_save))
|
||||
#else
|
||||
if (gEeprom.VFO_OPEN)
|
||||
if (g_eeprom.vfo_open)
|
||||
#endif
|
||||
{
|
||||
uint8_t Channel;
|
||||
|
||||
if (IS_MR_CHANNEL(gTxVfo->CHANNEL_SAVE))
|
||||
if (IS_USER_CHANNEL(gTxVfo->channel_save))
|
||||
{ // swap to frequency mode
|
||||
gEeprom.ScreenChannel[Vfo] = gEeprom.FreqChannel[gEeprom.TX_VFO];
|
||||
g_eeprom.screen_channel[Vfo] = g_eeprom.freq_channel[g_eeprom.tx_vfo];
|
||||
#ifdef ENABLE_VOICE
|
||||
gAnotherVoiceID = VOICE_ID_FREQUENCY_MODE;
|
||||
g_another_voice_id = VOICE_ID_FREQUENCY_MODE;
|
||||
#endif
|
||||
gRequestSaveVFO = true;
|
||||
gVfoConfigureMode = VFO_CONFIGURE_RELOAD;
|
||||
break;
|
||||
}
|
||||
|
||||
Channel = RADIO_FindNextChannel(gEeprom.MrChannel[gEeprom.TX_VFO], 1, false, 0);
|
||||
Channel = RADIO_FindNextChannel(g_eeprom.user_channel[g_eeprom.tx_vfo], 1, false, 0);
|
||||
if (Channel != 0xFF)
|
||||
{ // swap to channel mode
|
||||
gEeprom.ScreenChannel[Vfo] = Channel;
|
||||
g_eeprom.screen_channel[Vfo] = Channel;
|
||||
#ifdef ENABLE_VOICE
|
||||
AUDIO_SetVoiceID(0, VOICE_ID_CHANNEL_MODE);
|
||||
AUDIO_SetDigitVoice(1, Channel + 1);
|
||||
gAnotherVoiceID = (VOICE_ID_t)0xFE;
|
||||
g_another_voice_id = (voice_id_t)0xFE;
|
||||
#endif
|
||||
gRequestSaveVFO = true;
|
||||
gVfoConfigureMode = VFO_CONFIGURE_RELOAD;
|
||||
@ -192,11 +192,11 @@ static void processFKeyFunction(const KEY_Code_t Key, const bool beep)
|
||||
break;
|
||||
|
||||
case KEY_4:
|
||||
gWasFKeyPressed = false;
|
||||
g_was_f_key_pressed = false;
|
||||
gFlagStartScan = true;
|
||||
gScanSingleFrequency = false;
|
||||
gBackup_CROSS_BAND_RX_TX = gEeprom.CROSS_BAND_RX_TX;
|
||||
gEeprom.CROSS_BAND_RX_TX = CROSS_BAND_OFF;
|
||||
gBackup_cross_vfo_rx_tx = g_eeprom.cross_vfo_rx_tx;
|
||||
g_eeprom.cross_vfo_rx_tx = CROSS_BAND_OFF;
|
||||
gUpdateStatus = true;
|
||||
|
||||
// if (beep)
|
||||
@ -207,15 +207,15 @@ static void processFKeyFunction(const KEY_Code_t Key, const bool beep)
|
||||
case KEY_5:
|
||||
#ifdef ENABLE_NOAA
|
||||
|
||||
if (IS_NOT_NOAA_CHANNEL(gTxVfo->CHANNEL_SAVE))
|
||||
if (IS_NOT_NOAA_CHANNEL(gTxVfo->channel_save))
|
||||
{
|
||||
gEeprom.ScreenChannel[Vfo] = gEeprom.NoaaChannel[gEeprom.TX_VFO];
|
||||
g_eeprom.screen_channel[Vfo] = g_eeprom.noaa_channel[g_eeprom.tx_vfo];
|
||||
}
|
||||
else
|
||||
{
|
||||
gEeprom.ScreenChannel[Vfo] = gEeprom.FreqChannel[gEeprom.TX_VFO];
|
||||
g_eeprom.screen_channel[Vfo] = g_eeprom.freq_channel[g_eeprom.tx_vfo];
|
||||
#ifdef ENABLE_VOICE
|
||||
gAnotherVoiceID = VOICE_ID_FREQUENCY_MODE;
|
||||
g_another_voice_id = VOICE_ID_FREQUENCY_MODE;
|
||||
#endif
|
||||
}
|
||||
gRequestSaveVFO = true;
|
||||
@ -242,19 +242,19 @@ static void processFKeyFunction(const KEY_Code_t Key, const bool beep)
|
||||
break;
|
||||
|
||||
case KEY_8:
|
||||
gTxVfo->FrequencyReverse = gTxVfo->FrequencyReverse == false;
|
||||
gTxVfo->frequency_reverse = gTxVfo->frequency_reverse == false;
|
||||
gRequestSaveChannel = 1;
|
||||
break;
|
||||
|
||||
case KEY_9:
|
||||
if (RADIO_CheckValidChannel(gEeprom.CHAN_1_CALL, false, 0))
|
||||
if (RADIO_CheckValidChannel(g_eeprom.chan_1_call, false, 0))
|
||||
{
|
||||
gEeprom.MrChannel[Vfo] = gEeprom.CHAN_1_CALL;
|
||||
gEeprom.ScreenChannel[Vfo] = gEeprom.CHAN_1_CALL;
|
||||
g_eeprom.user_channel[Vfo] = g_eeprom.chan_1_call;
|
||||
g_eeprom.screen_channel[Vfo] = g_eeprom.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;
|
||||
AUDIO_SetDigitVoice(1, g_eeprom.chan_1_call + 1);
|
||||
g_another_voice_id = (voice_id_t)0xFE;
|
||||
#endif
|
||||
gRequestSaveVFO = true;
|
||||
gVfoConfigureMode = VFO_CONFIGURE_RELOAD;
|
||||
@ -267,7 +267,7 @@ static void processFKeyFunction(const KEY_Code_t Key, const bool beep)
|
||||
|
||||
default:
|
||||
gUpdateStatus = true;
|
||||
gWasFKeyPressed = false;
|
||||
g_was_f_key_pressed = false;
|
||||
|
||||
if (beep)
|
||||
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
||||
@ -275,7 +275,7 @@ static void processFKeyFunction(const KEY_Code_t Key, const bool beep)
|
||||
}
|
||||
}
|
||||
|
||||
static void MAIN_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
static void MAIN_Key_DIGITS(key_code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
{
|
||||
if (bKeyHeld)
|
||||
{ // key held down
|
||||
@ -290,7 +290,7 @@ static void MAIN_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||
}
|
||||
|
||||
gWasFKeyPressed = false;
|
||||
g_was_f_key_pressed = false;
|
||||
gUpdateStatus = true;
|
||||
|
||||
processFKeyFunction(Key, false);
|
||||
@ -306,10 +306,10 @@ static void MAIN_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
return; // don't use the key till it's released
|
||||
}
|
||||
|
||||
if (!gWasFKeyPressed)
|
||||
if (!g_was_f_key_pressed)
|
||||
{ // F-key wasn't pressed
|
||||
|
||||
const uint8_t Vfo = gEeprom.TX_VFO;
|
||||
const uint8_t Vfo = g_eeprom.tx_vfo;
|
||||
|
||||
gKeyInputCountdown = key_input_timeout_500ms;
|
||||
|
||||
@ -317,7 +317,7 @@ static void MAIN_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
|
||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||
|
||||
if (IS_MR_CHANNEL(gTxVfo->CHANNEL_SAVE))
|
||||
if (IS_USER_CHANNEL(gTxVfo->channel_save))
|
||||
{ // user is entering channel number
|
||||
|
||||
uint16_t Channel;
|
||||
@ -325,7 +325,7 @@ static void MAIN_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
if (gInputBoxIndex != 3)
|
||||
{
|
||||
#ifdef ENABLE_VOICE
|
||||
gAnotherVoiceID = (VOICE_ID_t)Key;
|
||||
g_another_voice_id = (voice_id_t)Key;
|
||||
#endif
|
||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||
return;
|
||||
@ -342,11 +342,11 @@ static void MAIN_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
}
|
||||
|
||||
#ifdef ENABLE_VOICE
|
||||
gAnotherVoiceID = (VOICE_ID_t)Key;
|
||||
g_another_voice_id = (voice_id_t)Key;
|
||||
#endif
|
||||
|
||||
gEeprom.MrChannel[Vfo] = (uint8_t)Channel;
|
||||
gEeprom.ScreenChannel[Vfo] = (uint8_t)Channel;
|
||||
g_eeprom.user_channel[Vfo] = (uint8_t)Channel;
|
||||
g_eeprom.screen_channel[Vfo] = (uint8_t)Channel;
|
||||
gRequestSaveVFO = true;
|
||||
gVfoConfigureMode = VFO_CONFIGURE_RELOAD;
|
||||
|
||||
@ -354,9 +354,9 @@ static void MAIN_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
}
|
||||
|
||||
// #ifdef ENABLE_NOAA
|
||||
// if (IS_NOT_NOAA_CHANNEL(gTxVfo->CHANNEL_SAVE))
|
||||
// if (IS_NOT_NOAA_CHANNEL(gTxVfo->channel_save))
|
||||
// #endif
|
||||
if (IS_FREQ_CHANNEL(gTxVfo->CHANNEL_SAVE))
|
||||
if (IS_FREQ_CHANNEL(gTxVfo->channel_save))
|
||||
{ // user is entering a frequency
|
||||
|
||||
uint32_t Frequency;
|
||||
@ -364,7 +364,7 @@ static void MAIN_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
if (gInputBoxIndex < 6)
|
||||
{
|
||||
#ifdef ENABLE_VOICE
|
||||
gAnotherVoiceID = (VOICE_ID_t)Key;
|
||||
g_another_voice_id = (voice_id_t)Key;
|
||||
#endif
|
||||
|
||||
return;
|
||||
@ -395,14 +395,14 @@ static void MAIN_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
const FREQUENCY_Band_t band = FREQUENCY_GetBand(Frequency);
|
||||
|
||||
#ifdef ENABLE_VOICE
|
||||
gAnotherVoiceID = (VOICE_ID_t)Key;
|
||||
g_another_voice_id = (voice_id_t)Key;
|
||||
#endif
|
||||
|
||||
if (gTxVfo->Band != band)
|
||||
if (gTxVfo->band != band)
|
||||
{
|
||||
gTxVfo->Band = band;
|
||||
gEeprom.ScreenChannel[Vfo] = band + FREQ_CHANNEL_FIRST;
|
||||
gEeprom.FreqChannel[Vfo] = band + FREQ_CHANNEL_FIRST;
|
||||
gTxVfo->band = band;
|
||||
g_eeprom.screen_channel[Vfo] = band + FREQ_CHANNEL_FIRST;
|
||||
g_eeprom.freq_channel[Vfo] = band + FREQ_CHANNEL_FIRST;
|
||||
|
||||
SETTINGS_SaveVfoIndices();
|
||||
|
||||
@ -410,17 +410,17 @@ static void MAIN_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
}
|
||||
|
||||
// Frequency += 75; // is this meant to be rounding ?
|
||||
Frequency += gTxVfo->StepFrequency / 2; // no idea, but this is
|
||||
Frequency += gTxVfo->step_freq / 2; // no idea, but this is
|
||||
|
||||
Frequency = FREQUENCY_FloorToStep(Frequency, gTxVfo->StepFrequency, frequencyBandTable[gTxVfo->Band].lower);
|
||||
Frequency = FREQUENCY_FloorToStep(Frequency, gTxVfo->step_freq, frequencyBandTable[gTxVfo->band].lower);
|
||||
|
||||
if (Frequency >= BX4819_band1.upper && Frequency < BX4819_band2.lower)
|
||||
{ // clamp the frequency to the limit
|
||||
const uint32_t center = (BX4819_band1.upper + BX4819_band2.lower) / 2;
|
||||
Frequency = (Frequency < center) ? BX4819_band1.upper - gTxVfo->StepFrequency : BX4819_band2.lower;
|
||||
Frequency = (Frequency < center) ? BX4819_band1.upper - gTxVfo->step_freq : BX4819_band2.lower;
|
||||
}
|
||||
|
||||
gTxVfo->freq_config_RX.Frequency = Frequency;
|
||||
gTxVfo->freq_config_rx.frequency = Frequency;
|
||||
|
||||
gRequestSaveChannel = 1;
|
||||
return;
|
||||
@ -429,7 +429,7 @@ static void MAIN_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
}
|
||||
#ifdef ENABLE_NOAA
|
||||
else
|
||||
if (IS_NOAA_CHANNEL(gTxVfo->CHANNEL_SAVE))
|
||||
if (IS_NOAA_CHANNEL(gTxVfo->channel_save))
|
||||
{ // user is entering NOAA channel
|
||||
|
||||
uint8_t Channel;
|
||||
@ -437,7 +437,7 @@ static void MAIN_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
if (gInputBoxIndex != 2)
|
||||
{
|
||||
#ifdef ENABLE_VOICE
|
||||
gAnotherVoiceID = (VOICE_ID_t)Key;
|
||||
g_another_voice_id = (voice_id_t)Key;
|
||||
#endif
|
||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||
return;
|
||||
@ -450,10 +450,10 @@ static void MAIN_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
{
|
||||
Channel += NOAA_CHANNEL_FIRST;
|
||||
#ifdef ENABLE_VOICE
|
||||
gAnotherVoiceID = (VOICE_ID_t)Key;
|
||||
g_another_voice_id = (voice_id_t)Key;
|
||||
#endif
|
||||
gEeprom.NoaaChannel[Vfo] = Channel;
|
||||
gEeprom.ScreenChannel[Vfo] = Channel;
|
||||
g_eeprom.noaa_channel[Vfo] = Channel;
|
||||
g_eeprom.screen_channel[Vfo] = Channel;
|
||||
gRequestSaveVFO = true;
|
||||
gVfoConfigureMode = VFO_CONFIGURE_RELOAD;
|
||||
return;
|
||||
@ -466,7 +466,7 @@ static void MAIN_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
return;
|
||||
}
|
||||
|
||||
gWasFKeyPressed = false;
|
||||
g_was_f_key_pressed = false;
|
||||
gUpdateStatus = true;
|
||||
|
||||
processFKeyFunction(Key, true);
|
||||
@ -500,7 +500,7 @@ static void MAIN_Key_EXIT(bool bKeyPressed, bool bKeyHeld)
|
||||
|
||||
#ifdef ENABLE_VOICE
|
||||
if (gInputBoxIndex == 0)
|
||||
gAnotherVoiceID = VOICE_ID_CANCEL;
|
||||
g_another_voice_id = VOICE_ID_CANCEL;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
@ -508,7 +508,7 @@ static void MAIN_Key_EXIT(bool bKeyPressed, bool bKeyHeld)
|
||||
SCANNER_Stop();
|
||||
|
||||
#ifdef ENABLE_VOICE
|
||||
gAnotherVoiceID = VOICE_ID_SCANNING_STOP;
|
||||
g_another_voice_id = VOICE_ID_SCANNING_STOP;
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -550,7 +550,7 @@ static void MAIN_Key_MENU(const bool bKeyPressed, const bool bKeyHeld)
|
||||
if (bKeyPressed)
|
||||
{ // long press MENU key
|
||||
|
||||
gWasFKeyPressed = false;
|
||||
g_was_f_key_pressed = false;
|
||||
|
||||
if (gScreenToDisplay == DISPLAY_MAIN)
|
||||
{
|
||||
@ -560,12 +560,12 @@ static void MAIN_Key_MENU(const bool bKeyPressed, const bool bKeyHeld)
|
||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||
}
|
||||
|
||||
gWasFKeyPressed = false;
|
||||
g_was_f_key_pressed = false;
|
||||
gUpdateStatus = true;
|
||||
|
||||
#ifdef ENABLE_COPY_CHAN_TO_VFO
|
||||
|
||||
if (gEeprom.VFO_OPEN && gCssScanMode == CSS_SCAN_MODE_OFF)
|
||||
if (g_eeprom.vfo_open && gCssScanMode == CSS_SCAN_MODE_OFF)
|
||||
{
|
||||
|
||||
if (gScanStateDir != SCAN_OFF)
|
||||
@ -580,21 +580,21 @@ static void MAIN_Key_MENU(const bool bKeyPressed, const bool bKeyHeld)
|
||||
|
||||
const unsigned int vfo = get_rx_VFO();
|
||||
|
||||
if (IS_MR_CHANNEL(gEeprom.ScreenChannel[vfo]))
|
||||
if (IS_USER_CHANNEL(g_eeprom.screen_channel[vfo]))
|
||||
{ // copy channel to VFO, then swap to the VFO
|
||||
|
||||
const unsigned int channel = FREQ_CHANNEL_FIRST + gEeprom.VfoInfo[vfo].Band;
|
||||
const unsigned int channel = FREQ_CHANNEL_FIRST + g_eeprom.VfoInfo[vfo].band;
|
||||
|
||||
gEeprom.ScreenChannel[vfo] = channel;
|
||||
gEeprom.VfoInfo[vfo].CHANNEL_SAVE = channel;
|
||||
gEeprom.TX_VFO = vfo;
|
||||
g_eeprom.screen_channel[vfo] = channel;
|
||||
g_eeprom.VfoInfo[vfo].channel_save = channel;
|
||||
g_eeprom.tx_vfo = vfo;
|
||||
|
||||
RADIO_SelectVfos();
|
||||
RADIO_ApplyOffset(gRxVfo);
|
||||
RADIO_ConfigureSquelchAndOutputPower(gRxVfo);
|
||||
RADIO_SetupRegisters(true);
|
||||
|
||||
//SETTINGS_SaveChannel(channel, gEeprom.RX_VFO, gRxVfo, 1);
|
||||
//SETTINGS_SaveChannel(channel, g_eeprom.rx_vfo, gRxVfo, 1);
|
||||
|
||||
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
||||
|
||||
@ -624,7 +624,7 @@ static void MAIN_Key_MENU(const bool bKeyPressed, const bool bKeyHeld)
|
||||
gFlagRefreshSetting = true;
|
||||
gRequestDisplayScreen = DISPLAY_MENU;
|
||||
#ifdef ENABLE_VOICE
|
||||
gAnotherVoiceID = VOICE_ID_MENU;
|
||||
g_another_voice_id = VOICE_ID_MENU;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
@ -646,7 +646,7 @@ static void MAIN_Key_STAR(bool bKeyPressed, bool bKeyHeld)
|
||||
return;
|
||||
}
|
||||
|
||||
if (bKeyHeld && !gWasFKeyPressed)
|
||||
if (bKeyHeld && !g_was_f_key_pressed)
|
||||
{ // long press .. toggle scanning
|
||||
if (!bKeyPressed)
|
||||
return; // released
|
||||
@ -666,11 +666,11 @@ static void MAIN_Key_STAR(bool bKeyPressed, bool bKeyHeld)
|
||||
|
||||
// just released
|
||||
|
||||
if (!gWasFKeyPressed)
|
||||
if (!g_was_f_key_pressed)
|
||||
{ // pressed without the F-key
|
||||
|
||||
#ifdef ENABLE_NOAA
|
||||
if (gScanStateDir == SCAN_OFF && IS_NOT_NOAA_CHANNEL(gTxVfo->CHANNEL_SAVE))
|
||||
if (gScanStateDir == SCAN_OFF && IS_NOT_NOAA_CHANNEL(gTxVfo->channel_save))
|
||||
#else
|
||||
if (gScanStateDir == SCAN_OFF)
|
||||
#endif
|
||||
@ -687,10 +687,10 @@ static void MAIN_Key_STAR(bool bKeyPressed, bool bKeyHeld)
|
||||
}
|
||||
else
|
||||
{ // with the F-key
|
||||
gWasFKeyPressed = false;
|
||||
g_was_f_key_pressed = false;
|
||||
|
||||
#ifdef ENABLE_NOAA
|
||||
if (IS_NOAA_CHANNEL(gTxVfo->CHANNEL_SAVE))
|
||||
if (IS_NOAA_CHANNEL(gTxVfo->channel_save))
|
||||
{
|
||||
gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
||||
return;
|
||||
@ -700,8 +700,8 @@ static void MAIN_Key_STAR(bool bKeyPressed, bool bKeyHeld)
|
||||
// scan the CTCSS/DCS code
|
||||
gFlagStartScan = true;
|
||||
gScanSingleFrequency = true;
|
||||
gBackup_CROSS_BAND_RX_TX = gEeprom.CROSS_BAND_RX_TX;
|
||||
gEeprom.CROSS_BAND_RX_TX = CROSS_BAND_OFF;
|
||||
gBackup_cross_vfo_rx_tx = g_eeprom.cross_vfo_rx_tx;
|
||||
g_eeprom.cross_vfo_rx_tx = CROSS_BAND_OFF;
|
||||
}
|
||||
|
||||
gPttWasReleased = true;
|
||||
@ -711,7 +711,7 @@ static void MAIN_Key_STAR(bool bKeyPressed, bool bKeyHeld)
|
||||
|
||||
static void MAIN_Key_UP_DOWN(bool bKeyPressed, bool bKeyHeld, int8_t Direction)
|
||||
{
|
||||
uint8_t Channel = gEeprom.ScreenChannel[gEeprom.TX_VFO];
|
||||
uint8_t Channel = g_eeprom.screen_channel[g_eeprom.tx_vfo];
|
||||
|
||||
if (bKeyHeld || !bKeyPressed)
|
||||
{ // long press
|
||||
@ -728,8 +728,8 @@ static void MAIN_Key_UP_DOWN(bool bKeyPressed, bool bKeyHeld, int8_t Direction)
|
||||
return;
|
||||
|
||||
#ifdef ENABLE_VOICE
|
||||
AUDIO_SetDigitVoice(0, gTxVfo->CHANNEL_SAVE + 1);
|
||||
gAnotherVoiceID = (VOICE_ID_t)0xFE;
|
||||
AUDIO_SetDigitVoice(0, gTxVfo->channel_save + 1);
|
||||
g_another_voice_id = (voice_id_t)0xFE;
|
||||
#endif
|
||||
|
||||
return;
|
||||
@ -764,7 +764,7 @@ static void MAIN_Key_UP_DOWN(bool bKeyPressed, bool bKeyHeld, int8_t Direction)
|
||||
return;
|
||||
}
|
||||
|
||||
gTxVfo->freq_config_RX.Frequency = frequency;
|
||||
gTxVfo->freq_config_rx.frequency = frequency;
|
||||
|
||||
gRequestSaveChannel = 1;
|
||||
return;
|
||||
@ -777,23 +777,23 @@ static void MAIN_Key_UP_DOWN(bool bKeyPressed, bool bKeyHeld, int8_t Direction)
|
||||
if (Channel == Next)
|
||||
return;
|
||||
|
||||
gEeprom.MrChannel[gEeprom.TX_VFO] = Next;
|
||||
gEeprom.ScreenChannel[gEeprom.TX_VFO] = Next;
|
||||
g_eeprom.user_channel[g_eeprom.tx_vfo] = Next;
|
||||
g_eeprom.screen_channel[g_eeprom.tx_vfo] = Next;
|
||||
|
||||
if (!bKeyHeld)
|
||||
{
|
||||
#ifdef ENABLE_VOICE
|
||||
AUDIO_SetDigitVoice(0, Next + 1);
|
||||
gAnotherVoiceID = (VOICE_ID_t)0xFE;
|
||||
g_another_voice_id = (voice_id_t)0xFE;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#ifdef ENABLE_NOAA
|
||||
else
|
||||
{
|
||||
Channel = NOAA_CHANNEL_FIRST + NUMBER_AddWithWraparound(gEeprom.ScreenChannel[gEeprom.TX_VFO] - NOAA_CHANNEL_FIRST, Direction, 0, 9);
|
||||
gEeprom.NoaaChannel[gEeprom.TX_VFO] = Channel;
|
||||
gEeprom.ScreenChannel[gEeprom.TX_VFO] = Channel;
|
||||
Channel = NOAA_CHANNEL_FIRST + NUMBER_AddWithWraparound(g_eeprom.screen_channel[g_eeprom.tx_vfo] - NOAA_CHANNEL_FIRST, Direction, 0, 9);
|
||||
g_eeprom.noaa_channel[g_eeprom.tx_vfo] = Channel;
|
||||
g_eeprom.screen_channel[g_eeprom.tx_vfo] = Channel;
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -810,7 +810,7 @@ static void MAIN_Key_UP_DOWN(bool bKeyPressed, bool bKeyHeld, int8_t Direction)
|
||||
gPttWasReleased = true;
|
||||
}
|
||||
|
||||
void MAIN_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
void MAIN_ProcessKeys(key_code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
{
|
||||
#ifdef ENABLE_FMRADIO
|
||||
if (gFmRadioMode && Key != KEY_PTT && Key != KEY_EXIT)
|
||||
|
@ -19,7 +19,7 @@
|
||||
|
||||
#include "driver/keyboard.h"
|
||||
|
||||
void MAIN_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld);
|
||||
void MAIN_ProcessKeys(key_code_t Key, bool bKeyPressed, bool bKeyHeld);
|
||||
|
||||
#endif
|
||||
|
||||
|
322
app/menu.c
322
app/menu.c
@ -59,11 +59,11 @@
|
||||
int16_t BK4819_XtalFreqLow;
|
||||
uint16_t EEPROM_1F8A;
|
||||
uint16_t EEPROM_1F8C;
|
||||
uint8_t VOLUME_GAIN;
|
||||
uint8_t DAC_GAIN;
|
||||
uint8_t volume_gain;
|
||||
uint8_t dac_gain;
|
||||
} __attribute__((packed)) misc;
|
||||
|
||||
gEeprom.BK4819_XTAL_FREQ_LOW = value;
|
||||
g_eeprom.BK4819_xtal_freq_low = value;
|
||||
|
||||
// radio 1 .. 04 00 46 00 50 00 2C 0E
|
||||
// radio 2 .. 05 00 46 00 50 00 2C 0E
|
||||
@ -114,7 +114,7 @@ int MENU_GetLimits(uint8_t Cursor, int32_t *pMin, int32_t *pMax)
|
||||
|
||||
case MENU_ABR:
|
||||
*pMin = 0;
|
||||
*pMax = ARRAY_SIZE(gSubMenu_BACKLIGHT) - 1;
|
||||
*pMax = ARRAY_SIZE(gSubMenu_backlight) - 1;
|
||||
break;
|
||||
|
||||
case MENU_F_LOCK:
|
||||
@ -273,13 +273,13 @@ int MENU_GetLimits(uint8_t Cursor, int32_t *pMin, int32_t *pMax)
|
||||
case MENU_DEL_CH:
|
||||
case MENU_MEM_NAME:
|
||||
*pMin = 0;
|
||||
*pMax = MR_CHANNEL_LAST;
|
||||
*pMax = USER_CHANNEL_LAST;
|
||||
break;
|
||||
|
||||
case MENU_SLIST1:
|
||||
case MENU_SLIST2:
|
||||
*pMin = -1;
|
||||
*pMax = MR_CHANNEL_LAST;
|
||||
*pMax = USER_CHANNEL_LAST;
|
||||
break;
|
||||
|
||||
case MENU_SAVE:
|
||||
@ -352,7 +352,7 @@ void MENU_AcceptSetting(void)
|
||||
int32_t Min;
|
||||
int32_t Max;
|
||||
uint8_t Code;
|
||||
FREQ_Config_t *pConfig = &gTxVfo->freq_config_RX;
|
||||
FREQ_Config_t *pConfig = &gTxVfo->freq_config_rx;
|
||||
|
||||
if (!MENU_GetLimits(gMenuCursor, &Min, &Max))
|
||||
{
|
||||
@ -367,13 +367,13 @@ void MENU_AcceptSetting(void)
|
||||
return;
|
||||
|
||||
case MENU_SQL:
|
||||
gEeprom.SQUELCH_LEVEL = gSubMenuSelection;
|
||||
g_eeprom.squelch_level = gSubMenuSelection;
|
||||
gVfoConfigureMode = VFO_CONFIGURE;
|
||||
break;
|
||||
|
||||
case MENU_STEP:
|
||||
gTxVfo->STEP_SETTING = gSubMenuSelection;
|
||||
if (IS_FREQ_CHANNEL(gTxVfo->CHANNEL_SAVE))
|
||||
gTxVfo->step_setting = gSubMenuSelection;
|
||||
if (IS_FREQ_CHANNEL(gTxVfo->channel_save))
|
||||
{
|
||||
gRequestSaveChannel = 1;
|
||||
return;
|
||||
@ -381,39 +381,39 @@ void MENU_AcceptSetting(void)
|
||||
return;
|
||||
|
||||
case MENU_TXP:
|
||||
gTxVfo->OUTPUT_POWER = gSubMenuSelection;
|
||||
gTxVfo->output_power = gSubMenuSelection;
|
||||
gRequestSaveChannel = 1;
|
||||
return;
|
||||
|
||||
case MENU_T_DCS:
|
||||
pConfig = &gTxVfo->freq_config_TX;
|
||||
pConfig = &gTxVfo->freq_config_tx;
|
||||
|
||||
// Fallthrough
|
||||
|
||||
case MENU_R_DCS:
|
||||
if (gSubMenuSelection == 0)
|
||||
{
|
||||
if (pConfig->CodeType != CODE_TYPE_DIGITAL && pConfig->CodeType != CODE_TYPE_REVERSE_DIGITAL)
|
||||
if (pConfig->code_type != CODE_TYPE_DIGITAL && pConfig->code_type != CODE_TYPE_REVERSE_DIGITAL)
|
||||
{
|
||||
gRequestSaveChannel = 1;
|
||||
return;
|
||||
}
|
||||
Code = 0;
|
||||
pConfig->CodeType = CODE_TYPE_OFF;
|
||||
Code = 0;
|
||||
pConfig->code_type = CODE_TYPE_OFF;
|
||||
}
|
||||
else
|
||||
if (gSubMenuSelection < 105)
|
||||
{
|
||||
pConfig->CodeType = CODE_TYPE_DIGITAL;
|
||||
Code = gSubMenuSelection - 1;
|
||||
pConfig->code_type = CODE_TYPE_DIGITAL;
|
||||
Code = gSubMenuSelection - 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
pConfig->CodeType = CODE_TYPE_REVERSE_DIGITAL;
|
||||
Code = gSubMenuSelection - 105;
|
||||
pConfig->code_type = CODE_TYPE_REVERSE_DIGITAL;
|
||||
Code = gSubMenuSelection - 105;
|
||||
}
|
||||
|
||||
pConfig->Code = Code;
|
||||
pConfig->code = Code;
|
||||
gRequestSaveChannel = 1;
|
||||
return;
|
||||
|
||||
@ -421,26 +421,26 @@ void MENU_AcceptSetting(void)
|
||||
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough="
|
||||
|
||||
case MENU_T_CTCS:
|
||||
pConfig = &gTxVfo->freq_config_TX;
|
||||
pConfig = &gTxVfo->freq_config_tx;
|
||||
case MENU_R_CTCS:
|
||||
if (gSubMenuSelection == 0)
|
||||
{
|
||||
if (pConfig->CodeType != CODE_TYPE_CONTINUOUS_TONE)
|
||||
if (pConfig->code_type != CODE_TYPE_CONTINUOUS_TONE)
|
||||
{
|
||||
gRequestSaveChannel = 1;
|
||||
return;
|
||||
}
|
||||
Code = 0;
|
||||
pConfig->Code = Code;
|
||||
pConfig->CodeType = CODE_TYPE_OFF;
|
||||
pConfig->code = Code;
|
||||
pConfig->code_type = CODE_TYPE_OFF;
|
||||
|
||||
BK4819_ExitSubAu();
|
||||
}
|
||||
else
|
||||
{
|
||||
pConfig->CodeType = CODE_TYPE_CONTINUOUS_TONE;
|
||||
pConfig->code_type = CODE_TYPE_CONTINUOUS_TONE;
|
||||
Code = gSubMenuSelection - 1;
|
||||
pConfig->Code = Code;
|
||||
pConfig->code = Code;
|
||||
|
||||
BK4819_SetCTCSSFrequency(CTCSS_Options[Code]);
|
||||
}
|
||||
@ -451,22 +451,22 @@ void MENU_AcceptSetting(void)
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
case MENU_SFT_D:
|
||||
gTxVfo->TX_OFFSET_FREQUENCY_DIRECTION = gSubMenuSelection;
|
||||
gTxVfo->tx_offset_freq_dir = gSubMenuSelection;
|
||||
gRequestSaveChannel = 1;
|
||||
return;
|
||||
|
||||
case MENU_OFFSET:
|
||||
gTxVfo->TX_OFFSET_FREQUENCY = gSubMenuSelection;
|
||||
gTxVfo->tx_offset_freq = gSubMenuSelection;
|
||||
gRequestSaveChannel = 1;
|
||||
return;
|
||||
|
||||
case MENU_W_N:
|
||||
gTxVfo->CHANNEL_BANDWIDTH = gSubMenuSelection;
|
||||
gTxVfo->channel_bandwidth = gSubMenuSelection;
|
||||
gRequestSaveChannel = 1;
|
||||
return;
|
||||
|
||||
case MENU_SCR:
|
||||
gTxVfo->SCRAMBLING_TYPE = gSubMenuSelection;
|
||||
gTxVfo->scrambling_type = gSubMenuSelection;
|
||||
#if 0
|
||||
if (gSubMenuSelection > 0 && gSetting_ScrambleEnable)
|
||||
BK4819_EnableScramble(gSubMenuSelection - 1);
|
||||
@ -477,16 +477,16 @@ void MENU_AcceptSetting(void)
|
||||
return;
|
||||
|
||||
case MENU_BCL:
|
||||
gTxVfo->BUSY_CHANNEL_LOCK = gSubMenuSelection;
|
||||
gTxVfo->busy_channel_lock = gSubMenuSelection;
|
||||
gRequestSaveChannel = 1;
|
||||
return;
|
||||
|
||||
case MENU_MEM_CH:
|
||||
gTxVfo->CHANNEL_SAVE = gSubMenuSelection;
|
||||
gTxVfo->channel_save = gSubMenuSelection;
|
||||
#if 0
|
||||
gEeprom.MrChannel[0] = gSubMenuSelection;
|
||||
g_eeprom.user_channel[0] = gSubMenuSelection;
|
||||
#else
|
||||
gEeprom.MrChannel[gEeprom.TX_VFO] = gSubMenuSelection;
|
||||
g_eeprom.user_channel[g_eeprom.tx_vfo] = gSubMenuSelection;
|
||||
#endif
|
||||
gRequestSaveChannel = 2;
|
||||
gVfoConfigureMode = VFO_CONFIGURE_RELOAD;
|
||||
@ -504,21 +504,21 @@ void MENU_AcceptSetting(void)
|
||||
}
|
||||
|
||||
// save the channel name
|
||||
memset(gTxVfo->Name, 0, sizeof(gTxVfo->Name));
|
||||
memmove(gTxVfo->Name, edit, 10);
|
||||
SETTINGS_SaveChannel(gSubMenuSelection, gEeprom.TX_VFO, gTxVfo, 3);
|
||||
memset(gTxVfo->name, 0, sizeof(gTxVfo->name));
|
||||
memmove(gTxVfo->name, edit, 10);
|
||||
SETTINGS_SaveChannel(gSubMenuSelection, g_eeprom.tx_vfo, gTxVfo, 3);
|
||||
gFlagReconfigureVfos = true;
|
||||
return;
|
||||
|
||||
case MENU_SAVE:
|
||||
gEeprom.BATTERY_SAVE = gSubMenuSelection;
|
||||
g_eeprom.battery_save = gSubMenuSelection;
|
||||
break;
|
||||
|
||||
#ifdef ENABLE_VOX
|
||||
case MENU_VOX:
|
||||
gEeprom.VOX_SWITCH = gSubMenuSelection != 0;
|
||||
if (gEeprom.VOX_SWITCH)
|
||||
gEeprom.VOX_LEVEL = gSubMenuSelection - 1;
|
||||
g_eeprom.vox_switch = gSubMenuSelection != 0;
|
||||
if (g_eeprom.vox_switch)
|
||||
g_eeprom.vox_level = gSubMenuSelection - 1;
|
||||
BOARD_EEPROM_LoadMoreSettings();
|
||||
gFlagReconfigureVfos = true;
|
||||
gUpdateStatus = true;
|
||||
@ -526,7 +526,7 @@ void MENU_AcceptSetting(void)
|
||||
#endif
|
||||
|
||||
case MENU_ABR:
|
||||
gEeprom.BACKLIGHT = gSubMenuSelection;
|
||||
g_eeprom.backlight = gSubMenuSelection;
|
||||
break;
|
||||
|
||||
case MENU_ABR_ON_TX_RX:
|
||||
@ -534,8 +534,8 @@ void MENU_AcceptSetting(void)
|
||||
break;
|
||||
|
||||
case MENU_TDR:
|
||||
// gEeprom.DUAL_WATCH = gSubMenuSelection;
|
||||
gEeprom.DUAL_WATCH = (gSubMenuSelection > 0) ? 1 + gEeprom.TX_VFO : DUAL_WATCH_OFF;
|
||||
// g_eeprom.dual_watch = gSubMenuSelection;
|
||||
g_eeprom.dual_watch = (gSubMenuSelection > 0) ? 1 + g_eeprom.tx_vfo : DUAL_WATCH_OFF;
|
||||
|
||||
gFlagReconfigureVfos = true;
|
||||
gUpdateStatus = true;
|
||||
@ -543,69 +543,69 @@ void MENU_AcceptSetting(void)
|
||||
|
||||
case MENU_XB:
|
||||
#ifdef ENABLE_NOAA
|
||||
if (IS_NOAA_CHANNEL(gEeprom.ScreenChannel[0]))
|
||||
if (IS_NOAA_CHANNEL(g_eeprom.screen_channel[0]))
|
||||
return;
|
||||
if (IS_NOAA_CHANNEL(gEeprom.ScreenChannel[1]))
|
||||
if (IS_NOAA_CHANNEL(g_eeprom.screen_channel[1]))
|
||||
return;
|
||||
#endif
|
||||
|
||||
gEeprom.CROSS_BAND_RX_TX = gSubMenuSelection;
|
||||
g_eeprom.cross_vfo_rx_tx = gSubMenuSelection;
|
||||
gFlagReconfigureVfos = true;
|
||||
gUpdateStatus = true;
|
||||
break;
|
||||
|
||||
case MENU_BEEP:
|
||||
gEeprom.BEEP_CONTROL = gSubMenuSelection;
|
||||
g_eeprom.beep_control = gSubMenuSelection;
|
||||
break;
|
||||
|
||||
case MENU_TOT:
|
||||
gEeprom.TX_TIMEOUT_TIMER = gSubMenuSelection;
|
||||
g_eeprom.tx_timeout_timer = gSubMenuSelection;
|
||||
break;
|
||||
|
||||
#ifdef ENABLE_VOICE
|
||||
case MENU_VOICE:
|
||||
gEeprom.VOICE_PROMPT = gSubMenuSelection;
|
||||
g_eeprom.voice_prompt = gSubMenuSelection;
|
||||
gUpdateStatus = true;
|
||||
break;
|
||||
#endif
|
||||
|
||||
case MENU_SC_REV:
|
||||
gEeprom.SCAN_RESUME_MODE = gSubMenuSelection;
|
||||
g_eeprom.scan_resume_mode = gSubMenuSelection;
|
||||
break;
|
||||
|
||||
case MENU_MDF:
|
||||
gEeprom.CHANNEL_DISPLAY_MODE = gSubMenuSelection;
|
||||
g_eeprom.channel_display_mode = gSubMenuSelection;
|
||||
break;
|
||||
|
||||
case MENU_AUTOLK:
|
||||
gEeprom.AUTO_KEYPAD_LOCK = gSubMenuSelection;
|
||||
g_eeprom.auto_keypad_lock = gSubMenuSelection;
|
||||
gKeyLockCountdown = 30;
|
||||
break;
|
||||
|
||||
case MENU_S_ADD1:
|
||||
gTxVfo->SCANLIST1_PARTICIPATION = gSubMenuSelection;
|
||||
SETTINGS_UpdateChannel(gTxVfo->CHANNEL_SAVE, gTxVfo, true);
|
||||
gTxVfo->scanlist_1_participation = gSubMenuSelection;
|
||||
SETTINGS_UpdateChannel(gTxVfo->channel_save, gTxVfo, true);
|
||||
gVfoConfigureMode = VFO_CONFIGURE;
|
||||
gFlagResetVfos = true;
|
||||
return;
|
||||
|
||||
case MENU_S_ADD2:
|
||||
gTxVfo->SCANLIST2_PARTICIPATION = gSubMenuSelection;
|
||||
SETTINGS_UpdateChannel(gTxVfo->CHANNEL_SAVE, gTxVfo, true);
|
||||
gTxVfo->scanlist_2_participation = gSubMenuSelection;
|
||||
SETTINGS_UpdateChannel(gTxVfo->channel_save, gTxVfo, true);
|
||||
gVfoConfigureMode = VFO_CONFIGURE;
|
||||
gFlagResetVfos = true;
|
||||
return;
|
||||
|
||||
case MENU_STE:
|
||||
gEeprom.TAIL_NOTE_ELIMINATION = gSubMenuSelection;
|
||||
g_eeprom.tail_note_elimination = gSubMenuSelection;
|
||||
break;
|
||||
|
||||
case MENU_RP_STE:
|
||||
gEeprom.REPEATER_TAIL_TONE_ELIMINATION = gSubMenuSelection;
|
||||
g_eeprom.repeater_tail_tone_elimination = gSubMenuSelection;
|
||||
break;
|
||||
|
||||
case MENU_MIC:
|
||||
gEeprom.MIC_SENSITIVITY = gSubMenuSelection;
|
||||
g_eeprom.mic_sensitivity = gSubMenuSelection;
|
||||
BOARD_EEPROM_LoadMoreSettings();
|
||||
gFlagReconfigureVfos = true;
|
||||
break;
|
||||
@ -617,45 +617,45 @@ void MENU_AcceptSetting(void)
|
||||
#endif
|
||||
|
||||
case MENU_COMPAND:
|
||||
gTxVfo->Compander = gSubMenuSelection;
|
||||
SETTINGS_UpdateChannel(gTxVfo->CHANNEL_SAVE, gTxVfo, true);
|
||||
gTxVfo->compander = gSubMenuSelection;
|
||||
SETTINGS_UpdateChannel(gTxVfo->channel_save, gTxVfo, true);
|
||||
gVfoConfigureMode = VFO_CONFIGURE;
|
||||
gFlagResetVfos = true;
|
||||
// gRequestSaveChannel = 1;
|
||||
return;
|
||||
|
||||
case MENU_1_CALL:
|
||||
gEeprom.CHAN_1_CALL = gSubMenuSelection;
|
||||
g_eeprom.chan_1_call = gSubMenuSelection;
|
||||
break;
|
||||
|
||||
case MENU_S_LIST:
|
||||
gEeprom.SCAN_LIST_DEFAULT = gSubMenuSelection;
|
||||
g_eeprom.scan_list_default = gSubMenuSelection;
|
||||
break;
|
||||
|
||||
#ifdef ENABLE_ALARM
|
||||
case MENU_AL_MOD:
|
||||
gEeprom.ALARM_MODE = gSubMenuSelection;
|
||||
g_eeprom.alarm_mode = gSubMenuSelection;
|
||||
break;
|
||||
#endif
|
||||
|
||||
case MENU_D_ST:
|
||||
gEeprom.DTMF_SIDE_TONE = gSubMenuSelection;
|
||||
g_eeprom.DTMF_side_tone = gSubMenuSelection;
|
||||
break;
|
||||
|
||||
case MENU_D_RSP:
|
||||
gEeprom.DTMF_DECODE_RESPONSE = gSubMenuSelection;
|
||||
g_eeprom.DTMF_decode_response = gSubMenuSelection;
|
||||
break;
|
||||
|
||||
case MENU_D_HOLD:
|
||||
gEeprom.DTMF_auto_reset_time = gSubMenuSelection;
|
||||
g_eeprom.DTMF_auto_reset_time = gSubMenuSelection;
|
||||
break;
|
||||
|
||||
case MENU_D_PRE:
|
||||
gEeprom.DTMF_PRELOAD_TIME = gSubMenuSelection * 10;
|
||||
g_eeprom.DTMF_preload_time = gSubMenuSelection * 10;
|
||||
break;
|
||||
|
||||
case MENU_PTT_ID:
|
||||
gTxVfo->DTMF_PTT_ID_TX_MODE = gSubMenuSelection;
|
||||
gTxVfo->DTMF_ptt_id_tx_mode = gSubMenuSelection;
|
||||
gRequestSaveChannel = 1;
|
||||
return;
|
||||
|
||||
@ -664,7 +664,7 @@ void MENU_AcceptSetting(void)
|
||||
break;
|
||||
|
||||
case MENU_D_DCD:
|
||||
gTxVfo->DTMF_DECODING_ENABLE = gSubMenuSelection;
|
||||
gTxVfo->DTMF_decoding_enable = gSubMenuSelection;
|
||||
DTMF_clear_RX();
|
||||
gRequestSaveChannel = 1;
|
||||
return;
|
||||
@ -692,15 +692,15 @@ void MENU_AcceptSetting(void)
|
||||
return;
|
||||
|
||||
case MENU_PONMSG:
|
||||
gEeprom.POWER_ON_DISPLAY_MODE = gSubMenuSelection;
|
||||
g_eeprom.pwr_on_display_mode = gSubMenuSelection;
|
||||
break;
|
||||
|
||||
case MENU_ROGER:
|
||||
gEeprom.ROGER = gSubMenuSelection;
|
||||
g_eeprom.roger_mode = gSubMenuSelection;
|
||||
break;
|
||||
|
||||
case MENU_AM:
|
||||
gTxVfo->AM_mode = gSubMenuSelection;
|
||||
gTxVfo->am_mode = gSubMenuSelection;
|
||||
gRequestSaveChannel = 1;
|
||||
return;
|
||||
|
||||
@ -722,7 +722,7 @@ void MENU_AcceptSetting(void)
|
||||
|
||||
#ifdef ENABLE_NOAA
|
||||
case MENU_NOAA_S:
|
||||
gEeprom.NOAA_AUTO_SCAN = gSubMenuSelection;
|
||||
g_eeprom.NOAA_auto_scan = gSubMenuSelection;
|
||||
gFlagReconfigureVfos = true;
|
||||
break;
|
||||
#endif
|
||||
@ -734,19 +734,19 @@ void MENU_AcceptSetting(void)
|
||||
return;
|
||||
|
||||
case MENU_SIDE1_SHORT:
|
||||
gEeprom.KEY_1_SHORT_PRESS_ACTION = gSubMenuSelection;
|
||||
g_eeprom.key1_short_press_action = gSubMenuSelection;
|
||||
break;
|
||||
|
||||
case MENU_SIDE1_LONG:
|
||||
gEeprom.KEY_1_LONG_PRESS_ACTION = gSubMenuSelection;
|
||||
g_eeprom.key1_long_press_action = gSubMenuSelection;
|
||||
break;
|
||||
|
||||
case MENU_SIDE2_SHORT:
|
||||
gEeprom.KEY_2_SHORT_PRESS_ACTION = gSubMenuSelection;
|
||||
g_eeprom.key2_short_press_action = gSubMenuSelection;
|
||||
break;
|
||||
|
||||
case MENU_SIDE2_LONG:
|
||||
gEeprom.KEY_2_LONG_PRESS_ACTION = gSubMenuSelection;
|
||||
g_eeprom.key2_long_press_action = gSubMenuSelection;
|
||||
break;
|
||||
|
||||
case MENU_RESET:
|
||||
@ -833,25 +833,25 @@ void MENU_SelectNextCode(void)
|
||||
{
|
||||
if (gSubMenuSelection > 104)
|
||||
{
|
||||
gSelectedCodeType = CODE_TYPE_REVERSE_DIGITAL;
|
||||
gSelectedcode_type = CODE_TYPE_REVERSE_DIGITAL;
|
||||
gSelectedCode = gSubMenuSelection - 105;
|
||||
}
|
||||
else
|
||||
{
|
||||
gSelectedCodeType = CODE_TYPE_DIGITAL;
|
||||
gSelectedcode_type = CODE_TYPE_DIGITAL;
|
||||
gSelectedCode = gSubMenuSelection - 1;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
gSelectedCodeType = CODE_TYPE_CONTINUOUS_TONE;
|
||||
gSelectedcode_type = CODE_TYPE_CONTINUOUS_TONE;
|
||||
gSelectedCode = gSubMenuSelection - 1;
|
||||
}
|
||||
|
||||
RADIO_SetupRegisters(true);
|
||||
|
||||
gScanPauseDelayIn_10ms = (gSelectedCodeType == CODE_TYPE_CONTINUOUS_TONE) ? scan_pause_delay_in_3_10ms : scan_pause_delay_in_4_10ms;
|
||||
gScanPauseDelayIn_10ms = (gSelectedcode_type == CODE_TYPE_CONTINUOUS_TONE) ? scan_pause_delay_in_3_10ms : scan_pause_delay_in_4_10ms;
|
||||
|
||||
gUpdateDisplay = true;
|
||||
}
|
||||
@ -876,25 +876,25 @@ void MENU_ShowCurrentSetting(void)
|
||||
switch (gMenuCursor)
|
||||
{
|
||||
case MENU_SQL:
|
||||
gSubMenuSelection = gEeprom.SQUELCH_LEVEL;
|
||||
gSubMenuSelection = g_eeprom.squelch_level;
|
||||
break;
|
||||
|
||||
case MENU_STEP:
|
||||
gSubMenuSelection = gTxVfo->STEP_SETTING;
|
||||
gSubMenuSelection = gTxVfo->step_setting;
|
||||
break;
|
||||
|
||||
case MENU_TXP:
|
||||
gSubMenuSelection = gTxVfo->OUTPUT_POWER;
|
||||
gSubMenuSelection = gTxVfo->output_power;
|
||||
break;
|
||||
|
||||
case MENU_R_DCS:
|
||||
switch (gTxVfo->freq_config_RX.CodeType)
|
||||
switch (gTxVfo->freq_config_rx.code_type)
|
||||
{
|
||||
case CODE_TYPE_DIGITAL:
|
||||
gSubMenuSelection = gTxVfo->freq_config_RX.Code + 1;
|
||||
gSubMenuSelection = gTxVfo->freq_config_rx.code + 1;
|
||||
break;
|
||||
case CODE_TYPE_REVERSE_DIGITAL:
|
||||
gSubMenuSelection = gTxVfo->freq_config_RX.Code + 105;
|
||||
gSubMenuSelection = gTxVfo->freq_config_rx.code + 105;
|
||||
break;
|
||||
default:
|
||||
gSubMenuSelection = 0;
|
||||
@ -907,17 +907,17 @@ void MENU_ShowCurrentSetting(void)
|
||||
break;
|
||||
|
||||
case MENU_R_CTCS:
|
||||
gSubMenuSelection = (gTxVfo->freq_config_RX.CodeType == CODE_TYPE_CONTINUOUS_TONE) ? gTxVfo->freq_config_RX.Code + 1 : 0;
|
||||
gSubMenuSelection = (gTxVfo->freq_config_rx.code_type == CODE_TYPE_CONTINUOUS_TONE) ? gTxVfo->freq_config_rx.code + 1 : 0;
|
||||
break;
|
||||
|
||||
case MENU_T_DCS:
|
||||
switch (gTxVfo->freq_config_TX.CodeType)
|
||||
switch (gTxVfo->freq_config_tx.code_type)
|
||||
{
|
||||
case CODE_TYPE_DIGITAL:
|
||||
gSubMenuSelection = gTxVfo->freq_config_TX.Code + 1;
|
||||
gSubMenuSelection = gTxVfo->freq_config_tx.code + 1;
|
||||
break;
|
||||
case CODE_TYPE_REVERSE_DIGITAL:
|
||||
gSubMenuSelection = gTxVfo->freq_config_TX.Code + 105;
|
||||
gSubMenuSelection = gTxVfo->freq_config_tx.code + 105;
|
||||
break;
|
||||
default:
|
||||
gSubMenuSelection = 0;
|
||||
@ -926,53 +926,53 @@ void MENU_ShowCurrentSetting(void)
|
||||
break;
|
||||
|
||||
case MENU_T_CTCS:
|
||||
gSubMenuSelection = (gTxVfo->freq_config_TX.CodeType == CODE_TYPE_CONTINUOUS_TONE) ? gTxVfo->freq_config_TX.Code + 1 : 0;
|
||||
gSubMenuSelection = (gTxVfo->freq_config_tx.code_type == CODE_TYPE_CONTINUOUS_TONE) ? gTxVfo->freq_config_tx.code + 1 : 0;
|
||||
break;
|
||||
|
||||
case MENU_SFT_D:
|
||||
gSubMenuSelection = gTxVfo->TX_OFFSET_FREQUENCY_DIRECTION;
|
||||
gSubMenuSelection = gTxVfo->tx_offset_freq_dir;
|
||||
break;
|
||||
|
||||
case MENU_OFFSET:
|
||||
gSubMenuSelection = gTxVfo->TX_OFFSET_FREQUENCY;
|
||||
gSubMenuSelection = gTxVfo->tx_offset_freq;
|
||||
break;
|
||||
|
||||
case MENU_W_N:
|
||||
gSubMenuSelection = gTxVfo->CHANNEL_BANDWIDTH;
|
||||
gSubMenuSelection = gTxVfo->channel_bandwidth;
|
||||
break;
|
||||
|
||||
case MENU_SCR:
|
||||
gSubMenuSelection = gTxVfo->SCRAMBLING_TYPE;
|
||||
gSubMenuSelection = gTxVfo->scrambling_type;
|
||||
break;
|
||||
|
||||
case MENU_BCL:
|
||||
gSubMenuSelection = gTxVfo->BUSY_CHANNEL_LOCK;
|
||||
gSubMenuSelection = gTxVfo->busy_channel_lock;
|
||||
break;
|
||||
|
||||
case MENU_MEM_CH:
|
||||
#if 0
|
||||
gSubMenuSelection = gEeprom.MrChannel[0];
|
||||
gSubMenuSelection = g_eeprom.user_channel[0];
|
||||
#else
|
||||
gSubMenuSelection = gEeprom.MrChannel[gEeprom.TX_VFO];
|
||||
gSubMenuSelection = g_eeprom.user_channel[g_eeprom.tx_vfo];
|
||||
#endif
|
||||
break;
|
||||
|
||||
case MENU_MEM_NAME:
|
||||
gSubMenuSelection = gEeprom.MrChannel[gEeprom.TX_VFO];
|
||||
gSubMenuSelection = g_eeprom.user_channel[g_eeprom.tx_vfo];
|
||||
break;
|
||||
|
||||
case MENU_SAVE:
|
||||
gSubMenuSelection = gEeprom.BATTERY_SAVE;
|
||||
gSubMenuSelection = g_eeprom.battery_save;
|
||||
break;
|
||||
|
||||
#ifdef ENABLE_VOX
|
||||
case MENU_VOX:
|
||||
gSubMenuSelection = gEeprom.VOX_SWITCH ? gEeprom.VOX_LEVEL + 1 : 0;
|
||||
gSubMenuSelection = g_eeprom.vox_switch ? g_eeprom.vox_level + 1 : 0;
|
||||
break;
|
||||
#endif
|
||||
|
||||
case MENU_ABR:
|
||||
gSubMenuSelection = gEeprom.BACKLIGHT;
|
||||
gSubMenuSelection = g_eeprom.backlight;
|
||||
|
||||
gBacklightCountdown = 0;
|
||||
GPIO_SetBit(&GPIOB->DATA, GPIOB_PIN_BACKLIGHT); // turn the backlight ON while in backlight menu
|
||||
@ -983,58 +983,58 @@ void MENU_ShowCurrentSetting(void)
|
||||
break;
|
||||
|
||||
case MENU_TDR:
|
||||
// gSubMenuSelection = gEeprom.DUAL_WATCH;
|
||||
gSubMenuSelection = (gEeprom.DUAL_WATCH == DUAL_WATCH_OFF) ? 0 : 1;
|
||||
// gSubMenuSelection = g_eeprom.dual_watch;
|
||||
gSubMenuSelection = (g_eeprom.dual_watch == DUAL_WATCH_OFF) ? 0 : 1;
|
||||
break;
|
||||
|
||||
case MENU_XB:
|
||||
gSubMenuSelection = gEeprom.CROSS_BAND_RX_TX;
|
||||
gSubMenuSelection = g_eeprom.cross_vfo_rx_tx;
|
||||
break;
|
||||
|
||||
case MENU_BEEP:
|
||||
gSubMenuSelection = gEeprom.BEEP_CONTROL;
|
||||
gSubMenuSelection = g_eeprom.beep_control;
|
||||
break;
|
||||
|
||||
case MENU_TOT:
|
||||
gSubMenuSelection = gEeprom.TX_TIMEOUT_TIMER;
|
||||
gSubMenuSelection = g_eeprom.tx_timeout_timer;
|
||||
break;
|
||||
|
||||
#ifdef ENABLE_VOICE
|
||||
case MENU_VOICE:
|
||||
gSubMenuSelection = gEeprom.VOICE_PROMPT;
|
||||
gSubMenuSelection = g_eeprom.voice_prompt;
|
||||
break;
|
||||
#endif
|
||||
|
||||
case MENU_SC_REV:
|
||||
gSubMenuSelection = gEeprom.SCAN_RESUME_MODE;
|
||||
gSubMenuSelection = g_eeprom.scan_resume_mode;
|
||||
break;
|
||||
|
||||
case MENU_MDF:
|
||||
gSubMenuSelection = gEeprom.CHANNEL_DISPLAY_MODE;
|
||||
gSubMenuSelection = g_eeprom.channel_display_mode;
|
||||
break;
|
||||
|
||||
case MENU_AUTOLK:
|
||||
gSubMenuSelection = gEeprom.AUTO_KEYPAD_LOCK;
|
||||
gSubMenuSelection = g_eeprom.auto_keypad_lock;
|
||||
break;
|
||||
|
||||
case MENU_S_ADD1:
|
||||
gSubMenuSelection = gTxVfo->SCANLIST1_PARTICIPATION;
|
||||
gSubMenuSelection = gTxVfo->scanlist_1_participation;
|
||||
break;
|
||||
|
||||
case MENU_S_ADD2:
|
||||
gSubMenuSelection = gTxVfo->SCANLIST2_PARTICIPATION;
|
||||
gSubMenuSelection = gTxVfo->scanlist_2_participation;
|
||||
break;
|
||||
|
||||
case MENU_STE:
|
||||
gSubMenuSelection = gEeprom.TAIL_NOTE_ELIMINATION;
|
||||
gSubMenuSelection = g_eeprom.tail_note_elimination;
|
||||
break;
|
||||
|
||||
case MENU_RP_STE:
|
||||
gSubMenuSelection = gEeprom.REPEATER_TAIL_TONE_ELIMINATION;
|
||||
gSubMenuSelection = g_eeprom.repeater_tail_tone_elimination;
|
||||
break;
|
||||
|
||||
case MENU_MIC:
|
||||
gSubMenuSelection = gEeprom.MIC_SENSITIVITY;
|
||||
gSubMenuSelection = g_eeprom.mic_sensitivity;
|
||||
break;
|
||||
|
||||
#ifdef ENABLE_AUDIO_BAR
|
||||
@ -1044,15 +1044,15 @@ void MENU_ShowCurrentSetting(void)
|
||||
#endif
|
||||
|
||||
case MENU_COMPAND:
|
||||
gSubMenuSelection = gTxVfo->Compander;
|
||||
gSubMenuSelection = gTxVfo->compander;
|
||||
return;
|
||||
|
||||
case MENU_1_CALL:
|
||||
gSubMenuSelection = gEeprom.CHAN_1_CALL;
|
||||
gSubMenuSelection = g_eeprom.chan_1_call;
|
||||
break;
|
||||
|
||||
case MENU_S_LIST:
|
||||
gSubMenuSelection = gEeprom.SCAN_LIST_DEFAULT;
|
||||
gSubMenuSelection = g_eeprom.scan_list_default;
|
||||
break;
|
||||
|
||||
case MENU_SLIST1:
|
||||
@ -1065,20 +1065,20 @@ void MENU_ShowCurrentSetting(void)
|
||||
|
||||
#ifdef ENABLE_ALARM
|
||||
case MENU_AL_MOD:
|
||||
gSubMenuSelection = gEeprom.ALARM_MODE;
|
||||
gSubMenuSelection = g_eeprom.alarm_mode;
|
||||
break;
|
||||
#endif
|
||||
|
||||
case MENU_D_ST:
|
||||
gSubMenuSelection = gEeprom.DTMF_SIDE_TONE;
|
||||
gSubMenuSelection = g_eeprom.DTMF_side_tone;
|
||||
break;
|
||||
|
||||
case MENU_D_RSP:
|
||||
gSubMenuSelection = gEeprom.DTMF_DECODE_RESPONSE;
|
||||
gSubMenuSelection = g_eeprom.DTMF_decode_response;
|
||||
break;
|
||||
|
||||
case MENU_D_HOLD:
|
||||
gSubMenuSelection = gEeprom.DTMF_auto_reset_time;
|
||||
gSubMenuSelection = g_eeprom.DTMF_auto_reset_time;
|
||||
|
||||
if (gSubMenuSelection <= DTMF_HOLD_MIN)
|
||||
gSubMenuSelection = DTMF_HOLD_MIN;
|
||||
@ -1106,11 +1106,11 @@ void MENU_ShowCurrentSetting(void)
|
||||
break;
|
||||
|
||||
case MENU_D_PRE:
|
||||
gSubMenuSelection = gEeprom.DTMF_PRELOAD_TIME / 10;
|
||||
gSubMenuSelection = g_eeprom.DTMF_preload_time / 10;
|
||||
break;
|
||||
|
||||
case MENU_PTT_ID:
|
||||
gSubMenuSelection = gTxVfo->DTMF_PTT_ID_TX_MODE;
|
||||
gSubMenuSelection = gTxVfo->DTMF_ptt_id_tx_mode;
|
||||
break;
|
||||
|
||||
case MENU_BAT_TXT:
|
||||
@ -1118,7 +1118,7 @@ void MENU_ShowCurrentSetting(void)
|
||||
return;
|
||||
|
||||
case MENU_D_DCD:
|
||||
gSubMenuSelection = gTxVfo->DTMF_DECODING_ENABLE;
|
||||
gSubMenuSelection = gTxVfo->DTMF_decoding_enable;
|
||||
break;
|
||||
|
||||
case MENU_D_LIST:
|
||||
@ -1130,15 +1130,15 @@ void MENU_ShowCurrentSetting(void)
|
||||
break;
|
||||
|
||||
case MENU_PONMSG:
|
||||
gSubMenuSelection = gEeprom.POWER_ON_DISPLAY_MODE;
|
||||
gSubMenuSelection = g_eeprom.pwr_on_display_mode;
|
||||
break;
|
||||
|
||||
case MENU_ROGER:
|
||||
gSubMenuSelection = gEeprom.ROGER;
|
||||
gSubMenuSelection = g_eeprom.roger_mode;
|
||||
break;
|
||||
|
||||
case MENU_AM:
|
||||
gSubMenuSelection = gTxVfo->AM_mode;
|
||||
gSubMenuSelection = gTxVfo->am_mode;
|
||||
break;
|
||||
|
||||
#ifdef ENABLE_AM_FIX
|
||||
@ -1155,32 +1155,32 @@ void MENU_ShowCurrentSetting(void)
|
||||
|
||||
#ifdef ENABLE_NOAA
|
||||
case MENU_NOAA_S:
|
||||
gSubMenuSelection = gEeprom.NOAA_AUTO_SCAN;
|
||||
gSubMenuSelection = g_eeprom.NOAA_auto_scan;
|
||||
break;
|
||||
#endif
|
||||
|
||||
case MENU_DEL_CH:
|
||||
#if 0
|
||||
gSubMenuSelection = RADIO_FindNextChannel(gEeprom.MrChannel[0], 1, false, 1);
|
||||
gSubMenuSelection = RADIO_FindNextChannel(g_eeprom.user_channel[0], 1, false, 1);
|
||||
#else
|
||||
gSubMenuSelection = RADIO_FindNextChannel(gEeprom.MrChannel[gEeprom.TX_VFO], 1, false, 1);
|
||||
gSubMenuSelection = RADIO_FindNextChannel(g_eeprom.user_channel[g_eeprom.tx_vfo], 1, false, 1);
|
||||
#endif
|
||||
break;
|
||||
|
||||
case MENU_SIDE1_SHORT:
|
||||
gSubMenuSelection = gEeprom.KEY_1_SHORT_PRESS_ACTION;
|
||||
gSubMenuSelection = g_eeprom.key1_short_press_action;
|
||||
break;
|
||||
|
||||
case MENU_SIDE1_LONG:
|
||||
gSubMenuSelection = gEeprom.KEY_1_LONG_PRESS_ACTION;
|
||||
gSubMenuSelection = g_eeprom.key1_long_press_action;
|
||||
break;
|
||||
|
||||
case MENU_SIDE2_SHORT:
|
||||
gSubMenuSelection = gEeprom.KEY_2_SHORT_PRESS_ACTION;
|
||||
gSubMenuSelection = g_eeprom.key2_short_press_action;
|
||||
break;
|
||||
|
||||
case MENU_SIDE2_LONG:
|
||||
gSubMenuSelection = gEeprom.KEY_2_LONG_PRESS_ACTION;
|
||||
gSubMenuSelection = g_eeprom.key2_long_press_action;
|
||||
break;
|
||||
|
||||
case MENU_350TX:
|
||||
@ -1213,7 +1213,7 @@ void MENU_ShowCurrentSetting(void)
|
||||
|
||||
#ifdef ENABLE_F_CAL_MENU
|
||||
case MENU_F_CALI:
|
||||
gSubMenuSelection = gEeprom.BK4819_XTAL_FREQ_LOW;
|
||||
gSubMenuSelection = g_eeprom.BK4819_xtal_freq_low;
|
||||
break;
|
||||
#endif
|
||||
|
||||
@ -1226,7 +1226,7 @@ void MENU_ShowCurrentSetting(void)
|
||||
}
|
||||
}
|
||||
|
||||
static void MENU_Key_0_to_9(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
static void MENU_Key_0_to_9(key_code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
{
|
||||
uint8_t Offset;
|
||||
int32_t Min;
|
||||
@ -1315,17 +1315,17 @@ static void MENU_Key_0_to_9(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
if (gInputBoxIndex < 6)
|
||||
{ // invalid frequency
|
||||
#ifdef ENABLE_VOICE
|
||||
gAnotherVoiceID = (VOICE_ID_t)Key;
|
||||
g_another_voice_id = (voice_id_t)Key;
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef ENABLE_VOICE
|
||||
gAnotherVoiceID = (VOICE_ID_t)Key;
|
||||
g_another_voice_id = (voice_id_t)Key;
|
||||
#endif
|
||||
|
||||
NUMBER_Get(gInputBox, &Frequency);
|
||||
gSubMenuSelection = FREQUENCY_FloorToStep(Frequency + 75, gTxVfo->StepFrequency, 0);
|
||||
gSubMenuSelection = FREQUENCY_FloorToStep(Frequency + 75, gTxVfo->step_freq, 0);
|
||||
|
||||
gInputBoxIndex = 0;
|
||||
return;
|
||||
@ -1337,7 +1337,7 @@ static void MENU_Key_0_to_9(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
if (gInputBoxIndex < 3)
|
||||
{
|
||||
#ifdef ENABLE_VOICE
|
||||
gAnotherVoiceID = (VOICE_ID_t)Key;
|
||||
g_another_voice_id = (voice_id_t)Key;
|
||||
#endif
|
||||
gRequestDisplayScreen = DISPLAY_MENU;
|
||||
return;
|
||||
@ -1347,10 +1347,10 @@ static void MENU_Key_0_to_9(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
|
||||
Value = ((gInputBox[0] * 100) + (gInputBox[1] * 10) + gInputBox[2]) - 1;
|
||||
|
||||
if (Value <= MR_CHANNEL_LAST)
|
||||
if (Value <= USER_CHANNEL_LAST)
|
||||
{
|
||||
#ifdef ENABLE_VOICE
|
||||
gAnotherVoiceID = (VOICE_ID_t)Key;
|
||||
g_another_voice_id = (voice_id_t)Key;
|
||||
#endif
|
||||
gSubMenuSelection = Value;
|
||||
return;
|
||||
@ -1413,7 +1413,7 @@ static void MENU_Key_EXIT(bool bKeyPressed, bool bKeyHeld)
|
||||
gFlagRefreshSetting = true;
|
||||
|
||||
#ifdef ENABLE_VOICE
|
||||
gAnotherVoiceID = VOICE_ID_CANCEL;
|
||||
g_another_voice_id = VOICE_ID_CANCEL;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
@ -1426,12 +1426,12 @@ static void MENU_Key_EXIT(bool bKeyPressed, bool bKeyHeld)
|
||||
}
|
||||
|
||||
#ifdef ENABLE_VOICE
|
||||
gAnotherVoiceID = VOICE_ID_CANCEL;
|
||||
g_another_voice_id = VOICE_ID_CANCEL;
|
||||
#endif
|
||||
|
||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||
|
||||
if (gEeprom.BACKLIGHT == 0)
|
||||
if (g_eeprom.backlight == 0)
|
||||
{
|
||||
gBacklightCountdown = 0;
|
||||
GPIO_ClearBit(&GPIOB->DATA, GPIOB_PIN_BACKLIGHT); // turn the backlight OFF
|
||||
@ -1442,7 +1442,7 @@ static void MENU_Key_EXIT(bool bKeyPressed, bool bKeyHeld)
|
||||
MENU_StopCssScan();
|
||||
|
||||
#ifdef ENABLE_VOICE
|
||||
gAnotherVoiceID = VOICE_ID_SCANNING_STOP;
|
||||
g_another_voice_id = VOICE_ID_SCANNING_STOP;
|
||||
#endif
|
||||
|
||||
gRequestDisplayScreen = DISPLAY_MENU;
|
||||
@ -1463,7 +1463,7 @@ static void MENU_Key_MENU(const bool bKeyPressed, const bool bKeyHeld)
|
||||
{
|
||||
#ifdef ENABLE_VOICE
|
||||
if (gMenuCursor != MENU_SCR)
|
||||
gAnotherVoiceID = MenuList[MenuList_sorted[gMenuCursor]].voice_id;
|
||||
g_another_voice_id = MenuList[MenuList_sorted[gMenuCursor]].voice_id;
|
||||
#endif
|
||||
|
||||
#if 1
|
||||
@ -1583,9 +1583,9 @@ static void MENU_Key_MENU(const bool bKeyPressed, const bool bKeyHeld)
|
||||
|
||||
#ifdef ENABLE_VOICE
|
||||
if (gMenuCursor == MENU_SCR)
|
||||
gAnotherVoiceID = (gSubMenuSelection == 0) ? VOICE_ID_SCRAMBLER_OFF : VOICE_ID_SCRAMBLER_ON;
|
||||
g_another_voice_id = (gSubMenuSelection == 0) ? VOICE_ID_SCRAMBLER_OFF : VOICE_ID_SCRAMBLER_ON;
|
||||
else
|
||||
gAnotherVoiceID = VOICE_ID_CONFIRM;
|
||||
g_another_voice_id = VOICE_ID_CONFIRM;
|
||||
#endif
|
||||
|
||||
gInputBoxIndex = 0;
|
||||
@ -1620,9 +1620,9 @@ static void MENU_Key_STAR(const bool bKeyPressed, const bool bKeyHeld)
|
||||
RADIO_SelectVfos();
|
||||
|
||||
#ifdef ENABLE_NOAA
|
||||
if (IS_NOT_NOAA_CHANNEL(gRxVfo->CHANNEL_SAVE) && gRxVfo->AM_mode == 0)
|
||||
if (IS_NOT_NOAA_CHANNEL(gRxVfo->channel_save) && gRxVfo->am_mode == 0)
|
||||
#else
|
||||
if (gRxVfo->AM_mode == 0)
|
||||
if (gRxVfo->am_mode == 0)
|
||||
#endif
|
||||
{
|
||||
if (gMenuCursor == MENU_R_CTCS || gMenuCursor == MENU_R_DCS)
|
||||
@ -1642,7 +1642,7 @@ static void MENU_Key_STAR(const bool bKeyPressed, const bool bKeyHeld)
|
||||
MENU_StopCssScan();
|
||||
gRequestDisplayScreen = DISPLAY_MENU;
|
||||
#ifdef ENABLE_VOICE
|
||||
gAnotherVoiceID = VOICE_ID_SCANNING_STOP;
|
||||
g_another_voice_id = VOICE_ID_SCANNING_STOP;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@ -1712,7 +1712,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 (gMenuCursor != MENU_ABR && g_eeprom.backlight == 0)
|
||||
{
|
||||
gBacklightCountdown = 0;
|
||||
GPIO_ClearBit(&GPIOB->DATA, GPIOB_PIN_BACKLIGHT); // turn the backlight OFF
|
||||
@ -1723,7 +1723,7 @@ static void MENU_Key_UP_DOWN(bool bKeyPressed, bool bKeyHeld, int8_t Direction)
|
||||
|
||||
if (gMenuCursor == MENU_OFFSET)
|
||||
{
|
||||
int32_t Offset = (Direction * gTxVfo->StepFrequency) + gSubMenuSelection;
|
||||
int32_t Offset = (Direction * gTxVfo->step_freq) + gSubMenuSelection;
|
||||
if (Offset < 99999990)
|
||||
{
|
||||
if (Offset < 0)
|
||||
@ -1732,7 +1732,7 @@ static void MENU_Key_UP_DOWN(bool bKeyPressed, bool bKeyHeld, int8_t Direction)
|
||||
else
|
||||
Offset = 0;
|
||||
|
||||
gSubMenuSelection = FREQUENCY_FloorToStep(Offset, gTxVfo->StepFrequency, 0);
|
||||
gSubMenuSelection = FREQUENCY_FloorToStep(Offset, gTxVfo->step_freq, 0);
|
||||
gRequestDisplayScreen = DISPLAY_MENU;
|
||||
return;
|
||||
}
|
||||
@ -1771,7 +1771,7 @@ static void MENU_Key_UP_DOWN(bool bKeyPressed, bool bKeyHeld, int8_t Direction)
|
||||
gRequestDisplayScreen = DISPLAY_MENU;
|
||||
}
|
||||
|
||||
void MENU_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
void MENU_ProcessKeys(key_code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
{
|
||||
switch (Key)
|
||||
{
|
||||
|
@ -30,7 +30,7 @@ void MENU_ShowCurrentSetting(void);
|
||||
void MENU_StartCssScan(int8_t Direction);
|
||||
void MENU_StopCssScan(void);
|
||||
|
||||
void MENU_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld);
|
||||
void MENU_ProcessKeys(key_code_t Key, bool bKeyPressed, bool bKeyHeld);
|
||||
|
||||
#endif
|
||||
|
||||
|
112
app/scanner.c
112
app/scanner.c
@ -26,7 +26,7 @@
|
||||
#include "ui/inputbox.h"
|
||||
#include "ui/ui.h"
|
||||
|
||||
DCS_CodeType_t gScanCssResultType;
|
||||
dcs_code_type_t gScanCssResultType;
|
||||
uint8_t gScanCssResultCode;
|
||||
bool gFlagStartScan;
|
||||
bool gFlagStopScan;
|
||||
@ -44,7 +44,7 @@ bool gScanUseCssResult;
|
||||
int8_t gScanStateDir;
|
||||
bool bScanKeepFrequency;
|
||||
|
||||
static void SCANNER_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
static void SCANNER_Key_DIGITS(key_code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
{
|
||||
if (!bKeyHeld && bKeyPressed)
|
||||
{
|
||||
@ -61,7 +61,7 @@ static void SCANNER_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
if (gInputBoxIndex < 3)
|
||||
{
|
||||
#ifdef ENABLE_VOICE
|
||||
gAnotherVoiceID = (VOICE_ID_t)Key;
|
||||
g_another_voice_id = (voice_id_t)Key;
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
@ -69,10 +69,10 @@ static void SCANNER_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
gInputBoxIndex = 0;
|
||||
|
||||
Channel = ((gInputBox[0] * 100) + (gInputBox[1] * 10) + gInputBox[2]) - 1;
|
||||
if (Channel <= MR_CHANNEL_LAST)
|
||||
if (Channel <= USER_CHANNEL_LAST)
|
||||
{
|
||||
#ifdef ENABLE_VOICE
|
||||
gAnotherVoiceID = (VOICE_ID_t)Key;
|
||||
g_another_voice_id = (voice_id_t)Key;
|
||||
#endif
|
||||
gShowChPrefix = RADIO_CheckValidChannel(Channel, false, 0);
|
||||
gScanChannel = (uint8_t)Channel;
|
||||
@ -95,13 +95,13 @@ static void SCANNER_Key_EXIT(bool bKeyPressed, bool bKeyHeld)
|
||||
case SCAN_EDIT_STATE_NONE:
|
||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||
|
||||
gEeprom.CROSS_BAND_RX_TX = gBackup_CROSS_BAND_RX_TX;
|
||||
g_eeprom.cross_vfo_rx_tx = gBackup_cross_vfo_rx_tx;
|
||||
gUpdateStatus = true;
|
||||
gFlagStopScan = true;
|
||||
gVfoConfigureMode = VFO_CONFIGURE_RELOAD;
|
||||
gFlagResetVfos = true;
|
||||
#ifdef ENABLE_VOICE
|
||||
gAnotherVoiceID = VOICE_ID_CANCEL;
|
||||
g_another_voice_id = VOICE_ID_CANCEL;
|
||||
#endif
|
||||
break;
|
||||
|
||||
@ -118,7 +118,7 @@ static void SCANNER_Key_EXIT(bool bKeyPressed, bool bKeyHeld)
|
||||
case SCAN_EDIT_STATE_DONE:
|
||||
gScannerEditState = SCAN_EDIT_STATE_NONE;
|
||||
#ifdef ENABLE_VOICE
|
||||
gAnotherVoiceID = VOICE_ID_CANCEL;
|
||||
g_another_voice_id = VOICE_ID_CANCEL;
|
||||
#endif
|
||||
gRequestDisplayScreen = DISPLAY_SCANNER;
|
||||
break;
|
||||
@ -199,11 +199,11 @@ static void SCANNER_Key_MENU(bool bKeyPressed, bool bKeyHeld)
|
||||
#else
|
||||
|
||||
#ifdef ENABLE_1250HZ_STEP
|
||||
const STEP_Setting_t small_step = STEP_1_25kHz;
|
||||
const STEP_Setting_t big_step = STEP_6_25kHz;
|
||||
const step_setting_t small_step = STEP_1_25kHz;
|
||||
const step_setting_t big_step = STEP_6_25kHz;
|
||||
#else
|
||||
const STEP_Setting_t small_step = STEP_2_5kHz;
|
||||
const STEP_Setting_t big_step = STEP_6_25kHz;
|
||||
const step_setting_t small_step = STEP_2_5kHz;
|
||||
const step_setting_t big_step = STEP_6_25kHz;
|
||||
#endif
|
||||
|
||||
const uint32_t small_step_freq = StepFrequencyTable[small_step];
|
||||
@ -242,11 +242,11 @@ static void SCANNER_Key_MENU(bool bKeyPressed, bool bKeyHeld)
|
||||
#endif
|
||||
}
|
||||
|
||||
if (gTxVfo->CHANNEL_SAVE <= MR_CHANNEL_LAST)
|
||||
if (gTxVfo->channel_save <= USER_CHANNEL_LAST)
|
||||
{
|
||||
gScannerEditState = SCAN_EDIT_STATE_BUSY;
|
||||
gScanChannel = gTxVfo->CHANNEL_SAVE;
|
||||
gShowChPrefix = RADIO_CheckValidChannel(gTxVfo->CHANNEL_SAVE, false, 0);
|
||||
gScanChannel = gTxVfo->channel_save;
|
||||
gShowChPrefix = RADIO_CheckValidChannel(gTxVfo->channel_save, false, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -256,7 +256,7 @@ static void SCANNER_Key_MENU(bool bKeyPressed, bool bKeyHeld)
|
||||
gScanCssState = SCAN_CSS_STATE_FOUND;
|
||||
|
||||
#ifdef ENABLE_VOICE
|
||||
gAnotherVoiceID = VOICE_ID_MEMORY_CHANNEL;
|
||||
g_another_voice_id = VOICE_ID_MEMORY_CHANNEL;
|
||||
#endif
|
||||
|
||||
gRequestDisplayScreen = DISPLAY_SCANNER;
|
||||
@ -275,45 +275,45 @@ static void SCANNER_Key_MENU(bool bKeyPressed, bool bKeyHeld)
|
||||
case SCAN_EDIT_STATE_DONE:
|
||||
if (!gScanSingleFrequency)
|
||||
{
|
||||
RADIO_InitInfo(gTxVfo, gTxVfo->CHANNEL_SAVE, gScanFrequency);
|
||||
RADIO_InitInfo(gTxVfo, gTxVfo->channel_save, gScanFrequency);
|
||||
|
||||
if (gScanUseCssResult)
|
||||
{
|
||||
gTxVfo->freq_config_RX.CodeType = gScanCssResultType;
|
||||
gTxVfo->freq_config_RX.Code = gScanCssResultCode;
|
||||
gTxVfo->freq_config_rx.code_type = gScanCssResultType;
|
||||
gTxVfo->freq_config_rx.code = gScanCssResultCode;
|
||||
}
|
||||
|
||||
gTxVfo->freq_config_TX = gTxVfo->freq_config_RX;
|
||||
gTxVfo->STEP_SETTING = gStepSetting;
|
||||
gTxVfo->freq_config_tx = gTxVfo->freq_config_rx;
|
||||
gTxVfo->step_setting = gStepSetting;
|
||||
}
|
||||
else
|
||||
{
|
||||
RADIO_ConfigureChannel(0, VFO_CONFIGURE_RELOAD);
|
||||
RADIO_ConfigureChannel(1, VFO_CONFIGURE_RELOAD);
|
||||
|
||||
gTxVfo->freq_config_RX.CodeType = gScanCssResultType;
|
||||
gTxVfo->freq_config_RX.Code = gScanCssResultCode;
|
||||
gTxVfo->freq_config_TX.CodeType = gScanCssResultType;
|
||||
gTxVfo->freq_config_TX.Code = gScanCssResultCode;
|
||||
gTxVfo->freq_config_rx.code_type = gScanCssResultType;
|
||||
gTxVfo->freq_config_rx.code = gScanCssResultCode;
|
||||
gTxVfo->freq_config_tx.code_type = gScanCssResultType;
|
||||
gTxVfo->freq_config_tx.code = gScanCssResultCode;
|
||||
}
|
||||
|
||||
if (gTxVfo->CHANNEL_SAVE <= MR_CHANNEL_LAST)
|
||||
if (gTxVfo->channel_save <= USER_CHANNEL_LAST)
|
||||
{
|
||||
Channel = gScanChannel;
|
||||
gEeprom.MrChannel[gEeprom.TX_VFO] = Channel;
|
||||
g_eeprom.user_channel[g_eeprom.tx_vfo] = Channel;
|
||||
}
|
||||
else
|
||||
{
|
||||
Channel = gTxVfo->Band + FREQ_CHANNEL_FIRST;
|
||||
gEeprom.FreqChannel[gEeprom.TX_VFO] = Channel;
|
||||
Channel = gTxVfo->band + FREQ_CHANNEL_FIRST;
|
||||
g_eeprom.freq_channel[g_eeprom.tx_vfo] = Channel;
|
||||
}
|
||||
|
||||
gTxVfo->CHANNEL_SAVE = Channel;
|
||||
gEeprom.ScreenChannel[gEeprom.TX_VFO] = Channel;
|
||||
gTxVfo->channel_save = Channel;
|
||||
g_eeprom.screen_channel[g_eeprom.tx_vfo] = Channel;
|
||||
gRequestSaveChannel = 2;
|
||||
|
||||
#ifdef ENABLE_VOICE
|
||||
gAnotherVoiceID = VOICE_ID_CONFIRM;
|
||||
g_another_voice_id = VOICE_ID_CONFIRM;
|
||||
#endif
|
||||
|
||||
gScannerEditState = SCAN_EDIT_STATE_NONE;
|
||||
@ -355,7 +355,7 @@ static void SCANNER_Key_UP_DOWN(bool bKeyPressed, bool pKeyHeld, int8_t Directio
|
||||
|
||||
if (gScannerEditState == SCAN_EDIT_STATE_BUSY)
|
||||
{
|
||||
gScanChannel = NUMBER_AddWithWraparound(gScanChannel, Direction, 0, MR_CHANNEL_LAST);
|
||||
gScanChannel = NUMBER_AddWithWraparound(gScanChannel, Direction, 0, USER_CHANNEL_LAST);
|
||||
gShowChPrefix = RADIO_CheckValidChannel(gScanChannel, false, 0);
|
||||
gRequestDisplayScreen = DISPLAY_SCANNER;
|
||||
}
|
||||
@ -363,7 +363,7 @@ static void SCANNER_Key_UP_DOWN(bool bKeyPressed, bool pKeyHeld, int8_t Directio
|
||||
gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
||||
}
|
||||
|
||||
void SCANNER_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
void SCANNER_ProcessKeys(key_code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
{
|
||||
switch (Key)
|
||||
{
|
||||
@ -414,17 +414,17 @@ void SCANNER_Start(void)
|
||||
RADIO_SelectVfos();
|
||||
|
||||
#ifdef ENABLE_NOAA
|
||||
if (IS_NOAA_CHANNEL(gRxVfo->CHANNEL_SAVE))
|
||||
gRxVfo->CHANNEL_SAVE = FREQ_CHANNEL_FIRST + BAND6_400MHz;
|
||||
if (IS_NOAA_CHANNEL(gRxVfo->channel_save))
|
||||
gRxVfo->channel_save = FREQ_CHANNEL_FIRST + BAND6_400MHz;
|
||||
#endif
|
||||
|
||||
BackupStep = gRxVfo->STEP_SETTING;
|
||||
BackupStepFreq = gRxVfo->StepFrequency;
|
||||
BackupStep = gRxVfo->step_setting;
|
||||
BackupStepFreq = gRxVfo->step_freq;
|
||||
|
||||
RADIO_InitInfo(gRxVfo, gRxVfo->CHANNEL_SAVE, gRxVfo->pRX->Frequency);
|
||||
RADIO_InitInfo(gRxVfo, gRxVfo->channel_save, gRxVfo->pRX->frequency);
|
||||
|
||||
gRxVfo->STEP_SETTING = BackupStep;
|
||||
gRxVfo->StepFrequency = BackupStepFreq;
|
||||
gRxVfo->step_setting = BackupStep;
|
||||
gRxVfo->step_freq = BackupStepFreq;
|
||||
|
||||
RADIO_SetupRegisters(true);
|
||||
|
||||
@ -435,8 +435,8 @@ void SCANNER_Start(void)
|
||||
if (gScanSingleFrequency)
|
||||
{
|
||||
gScanCssState = SCAN_CSS_STATE_SCANNING;
|
||||
gScanFrequency = gRxVfo->pRX->Frequency;
|
||||
gStepSetting = gRxVfo->STEP_SETTING;
|
||||
gScanFrequency = gRxVfo->pRX->frequency;
|
||||
gStepSetting = gRxVfo->step_setting;
|
||||
|
||||
BK4819_PickRXFilterPathBasedOnFrequency(gScanFrequency);
|
||||
BK4819_SetScanFrequency(gScanFrequency);
|
||||
@ -457,12 +457,12 @@ void SCANNER_Start(void)
|
||||
gScanCssResultType = 0xFF;
|
||||
gScanHitCount = 0;
|
||||
gScanUseCssResult = false;
|
||||
g_CxCSS_TAIL_Found = false;
|
||||
g_CDCSS_Lost = false;
|
||||
gCDCSSCodeType = 0;
|
||||
g_CTCSS_Lost = false;
|
||||
g_CxCSS_tailL_found = false;
|
||||
g_CDCSS_lost = false;
|
||||
g_CDCSS_code_type = 0;
|
||||
g_CTCSS_lost = false;
|
||||
#ifdef ENABLE_VOX
|
||||
g_VOX_Lost = false;
|
||||
g_vox_lost = false;
|
||||
#endif
|
||||
g_SquelchLost = false;
|
||||
gScannerEditState = SCAN_EDIT_STATE_NONE;
|
||||
@ -474,7 +474,7 @@ void SCANNER_Start(void)
|
||||
|
||||
void SCANNER_Stop(void)
|
||||
{
|
||||
const uint8_t Previous = gRestoreMrChannel;
|
||||
const uint8_t Previous = gRestoreUSER_CHANNEL;
|
||||
|
||||
if (gScanStateDir == SCAN_OFF)
|
||||
return; // but, but, we weren't !
|
||||
@ -483,16 +483,16 @@ void SCANNER_Stop(void)
|
||||
|
||||
if (!bScanKeepFrequency)
|
||||
{
|
||||
if (gNextMrChannel <= MR_CHANNEL_LAST)
|
||||
if (gNextChannel <= USER_CHANNEL_LAST)
|
||||
{
|
||||
gEeprom.MrChannel[gEeprom.RX_VFO] = gRestoreMrChannel;
|
||||
gEeprom.ScreenChannel[gEeprom.RX_VFO] = Previous;
|
||||
g_eeprom.user_channel[g_eeprom.rx_vfo] = gRestoreUSER_CHANNEL;
|
||||
g_eeprom.screen_channel[g_eeprom.rx_vfo] = Previous;
|
||||
|
||||
RADIO_ConfigureChannel(gEeprom.RX_VFO, VFO_CONFIGURE_RELOAD);
|
||||
RADIO_ConfigureChannel(g_eeprom.rx_vfo, VFO_CONFIGURE_RELOAD);
|
||||
}
|
||||
else
|
||||
{
|
||||
gRxVfo->freq_config_RX.Frequency = gRestoreFrequency;
|
||||
gRxVfo->freq_config_rx.frequency = gRestoreFrequency;
|
||||
RADIO_ApplyOffset(gRxVfo);
|
||||
RADIO_ConfigureSquelchAndOutputPower(gRxVfo);
|
||||
}
|
||||
@ -501,11 +501,11 @@ void SCANNER_Stop(void)
|
||||
return;
|
||||
}
|
||||
|
||||
if (gRxVfo->CHANNEL_SAVE > MR_CHANNEL_LAST)
|
||||
if (gRxVfo->channel_save > USER_CHANNEL_LAST)
|
||||
{
|
||||
RADIO_ApplyOffset(gRxVfo);
|
||||
RADIO_ConfigureSquelchAndOutputPower(gRxVfo);
|
||||
SETTINGS_SaveChannel(gRxVfo->CHANNEL_SAVE, gEeprom.RX_VFO, gRxVfo, 1);
|
||||
SETTINGS_SaveChannel(gRxVfo->channel_save, g_eeprom.rx_vfo, gRxVfo, 1);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -42,7 +42,7 @@ enum SCAN_edit_state_e {
|
||||
};
|
||||
typedef enum SCAN_edit_state_e SCAN_edit_state_t;
|
||||
|
||||
extern DCS_CodeType_t gScanCssResultType;
|
||||
extern dcs_code_type_t gScanCssResultType;
|
||||
extern uint8_t gScanCssResultCode;
|
||||
extern bool gFlagStartScan;
|
||||
extern bool gFlagStopScan;
|
||||
@ -60,7 +60,7 @@ extern bool gScanUseCssResult;
|
||||
extern int8_t gScanStateDir;
|
||||
extern bool bScanKeepFrequency;
|
||||
|
||||
void SCANNER_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld);
|
||||
void SCANNER_ProcessKeys(key_code_t Key, bool bKeyPressed, bool bKeyHeld);
|
||||
void SCANNER_Start(void);
|
||||
void SCANNER_Stop(void);
|
||||
|
||||
|
248
app/spectrum.c
248
app/spectrum.c
@ -22,169 +22,181 @@
|
||||
const uint16_t RSSI_MAX_VALUE = 65535;
|
||||
|
||||
static uint32_t initialFreq;
|
||||
static char String[32];
|
||||
static char String[32];
|
||||
|
||||
bool isInitialized = false;
|
||||
bool monitorMode = false;
|
||||
bool redrawStatus = true;
|
||||
bool redrawScreen = false;
|
||||
bool newScanStart = true;
|
||||
bool isInitialized = false;
|
||||
bool monitorMode = false;
|
||||
bool redrawStatus = true;
|
||||
bool redrawScreen = false;
|
||||
bool newScanStart = true;
|
||||
bool preventKeypress = true;
|
||||
|
||||
bool isListening = false;
|
||||
bool isTransmitting = false;
|
||||
bool isListening = false;
|
||||
bool isTransmitting = false;
|
||||
|
||||
State currentState = SPECTRUM, previousState = SPECTRUM;
|
||||
State currentState = SPECTRUM, previousState = SPECTRUM;
|
||||
|
||||
PeakInfo peak;
|
||||
ScanInfo scanInfo;
|
||||
KeyboardState kbd = {KEY_INVALID, KEY_INVALID, 0};
|
||||
PeakInfo peak;
|
||||
ScanInfo scanInfo;
|
||||
KeyboardState kbd = {KEY_INVALID, KEY_INVALID, 0};
|
||||
|
||||
const char *bwOptions[] = {" 25k", "12.5k", "6.25k"};
|
||||
const char *modulationTypeOptions[] = {" FM", " AM", "USB"};
|
||||
const char *bwOptions[] = {" 25k", "12.5k", "6.25k"};
|
||||
const char *modulationTypeOptions[] = {" FM", " AM", "USB"};
|
||||
const uint8_t modulationTypeTuneSteps[] = {100, 50, 10};
|
||||
const uint8_t modTypeReg47Values[] = {1, 7, 5};
|
||||
const uint8_t modTypeReg47Values[] = {1, 7, 5};
|
||||
|
||||
SpectrumSettings settings = {
|
||||
.stepsCount = STEPS_64,
|
||||
.scanStepIndex = S_STEP_25_0kHz,
|
||||
.frequencyChangeStep = 80000,
|
||||
.scanDelay = 3200,
|
||||
.rssiTriggerLevel = 150,
|
||||
.backlightState = true,
|
||||
.bw = BK4819_FILTER_BW_WIDE,
|
||||
.listenBw = BK4819_FILTER_BW_WIDE,
|
||||
.modulationType = false,
|
||||
.stepsCount = STEPS_64,
|
||||
.scanStepIndex = S_STEP_25_0kHz,
|
||||
.frequencyChangeStep = 80000,
|
||||
.scanDelay = 3200,
|
||||
.rssiTriggerLevel = 150,
|
||||
.backlightState = true,
|
||||
.bw = BK4819_FILTER_BW_WIDE,
|
||||
.listenBw = BK4819_FILTER_BW_WIDE,
|
||||
.modulationType = false,
|
||||
};
|
||||
|
||||
uint32_t fMeasure = 0;
|
||||
uint32_t fTx = 0;
|
||||
uint32_t currentFreq, tempFreq;
|
||||
uint32_t fMeasure = 0;
|
||||
uint32_t fTx = 0;
|
||||
uint32_t currentFreq;
|
||||
uint32_t tempFreq;
|
||||
uint16_t rssiHistory[128] = {0};
|
||||
bool blacklist[128] = {false};
|
||||
bool blacklist[128] = {false};
|
||||
|
||||
static const RegisterSpec afOutRegSpec = {"AF OUT", 0x47, 8, 0xF, 1};
|
||||
static const RegisterSpec afOutRegSpec = {"AF OUT", 0x47, 8, 0xF, 1};
|
||||
static const RegisterSpec afDacGainRegSpec = {"AF DAC G", 0x48, 0, 0xF, 1};
|
||||
static const RegisterSpec registerSpecs[] = {
|
||||
{},
|
||||
{"LNAs", 0x13, 8, 0b11, 1},
|
||||
{"LNA", 0x13, 5, 0b111, 1},
|
||||
{"PGA", 0x13, 0, 0b111, 1},
|
||||
{"MIX", 0x13, 3, 0b11, 1},
|
||||
|
||||
{"DEV", 0x40, 0, 4095, 1},
|
||||
{"CMP", 0x31, 3, 1, 1},
|
||||
{"MIC", 0x7D, 0, 0x1F, 1},
|
||||
static const RegisterSpec registerSpecs[] = {
|
||||
{},
|
||||
{"LNAs", 0x13, 8, 0b11, 1},
|
||||
{"LNA", 0x13, 5, 0b111, 1},
|
||||
{"PGA", 0x13, 0, 0b111, 1},
|
||||
{"MIX", 0x13, 3, 0b11, 1},
|
||||
{"DEV", 0x40, 0, 4095, 1},
|
||||
{"CMP", 0x31, 3, 1, 1},
|
||||
{"MIC", 0x7D, 0, 0x1F, 1},
|
||||
};
|
||||
|
||||
static uint16_t registersBackup[128];
|
||||
static const uint8_t registersToBackup[] = {
|
||||
0x13, 0x30, 0x31, 0x37, 0x3D, 0x40, 0x43, 0x47, 0x48, 0x7D, 0x7E,
|
||||
0x13, 0x30, 0x31, 0x37, 0x3D, 0x40, 0x43, 0x47, 0x48, 0x7D, 0x7E,
|
||||
};
|
||||
|
||||
static MovingAverage mov = {{128}, {}, 255, 128, 0, 0};
|
||||
static MovingAverage mov = {{128}, {}, 255, 128, 0, 0};
|
||||
static const uint8_t MOV_N = ARRAY_SIZE(mov.buf);
|
||||
|
||||
const uint8_t FREQ_INPUT_LENGTH = 10;
|
||||
uint8_t freqInputIndex = 0;
|
||||
uint8_t freqInputDotIndex = 0;
|
||||
KEY_Code_t freqInputArr[10];
|
||||
char freqInputString[] = "----------"; // XXXX.XXXXX
|
||||
uint8_t freqInputIndex = 0;
|
||||
uint8_t freqInputDotIndex = 0;
|
||||
key_code_t freqInputArr[10];
|
||||
char freqInputString[] = "----------"; // XXXX.XXXXX
|
||||
|
||||
uint8_t menuState = 0;
|
||||
uint8_t menuState = 0;
|
||||
|
||||
uint16_t listenT = 0;
|
||||
uint16_t listenT = 0;
|
||||
|
||||
uint16_t batteryUpdateTimer = 0;
|
||||
bool isMovingInitialized = false;
|
||||
uint8_t lastStepsCount = 0;
|
||||
uint16_t batteryUpdateTimer = 0;
|
||||
bool isMovingInitialized = false;
|
||||
uint8_t lastStepsCount = 0;
|
||||
|
||||
uint8_t CountBits(uint16_t n) {
|
||||
uint8_t count = 0;
|
||||
while (n) {
|
||||
count++;
|
||||
n >>= 1;
|
||||
}
|
||||
return count;
|
||||
uint8_t CountBits(uint16_t n)
|
||||
{
|
||||
uint8_t count = 0;
|
||||
while (n)
|
||||
{
|
||||
count++;
|
||||
n >>= 1;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
static uint16_t GetRegMask(RegisterSpec s) {
|
||||
return (1 << CountBits(s.maxValue)) - 1;
|
||||
static uint16_t GetRegMask(RegisterSpec s)
|
||||
{
|
||||
return (1 << CountBits(s.maxValue)) - 1;
|
||||
}
|
||||
|
||||
static uint16_t GetRegValue(RegisterSpec s) {
|
||||
return (BK4819_ReadRegister(s.num) >> s.offset) & s.maxValue;
|
||||
static uint16_t GetRegValue(RegisterSpec s)
|
||||
{
|
||||
return (BK4819_ReadRegister(s.num) >> s.offset) & s.maxValue;
|
||||
}
|
||||
|
||||
static void SetRegValue(RegisterSpec s, uint16_t v) {
|
||||
uint16_t reg = BK4819_ReadRegister(s.num);
|
||||
reg &= ~(GetRegMask(s) << s.offset);
|
||||
BK4819_WriteRegister(s.num, reg | (v << s.offset));
|
||||
static void SetRegValue(RegisterSpec s, uint16_t v)
|
||||
{
|
||||
uint16_t reg = BK4819_ReadRegister(s.num);
|
||||
reg &= ~(GetRegMask(s) << s.offset);
|
||||
BK4819_WriteRegister(s.num, reg | (v << s.offset));
|
||||
}
|
||||
|
||||
static void UpdateRegMenuValue(RegisterSpec s, bool add) {
|
||||
uint16_t v = GetRegValue(s);
|
||||
|
||||
if (add && v <= s.maxValue - s.inc) {
|
||||
v += s.inc;
|
||||
} else if (!add && v >= 0 + s.inc) {
|
||||
v -= s.inc;
|
||||
}
|
||||
|
||||
SetRegValue(s, v);
|
||||
redrawScreen = true;
|
||||
static void UpdateRegMenuValue(RegisterSpec s, bool add)
|
||||
{
|
||||
uint16_t v = GetRegValue(s);
|
||||
|
||||
if (add && v <= s.maxValue - s.inc)
|
||||
v += s.inc;
|
||||
else
|
||||
if (!add && v >= 0 + s.inc)
|
||||
v -= s.inc;
|
||||
|
||||
SetRegValue(s, v);
|
||||
redrawScreen = true;
|
||||
}
|
||||
|
||||
// Utility functions
|
||||
|
||||
KEY_Code_t GetKey() {
|
||||
KEY_Code_t btn = KEYBOARD_Poll();
|
||||
if (btn == KEY_INVALID && !GPIO_CheckBit(&GPIOC->DATA, GPIOC_PIN_PTT)) {
|
||||
btn = KEY_PTT;
|
||||
}
|
||||
return btn;
|
||||
key_code_t GetKey()
|
||||
{
|
||||
key_code_t btn = KEYBOARD_Poll();
|
||||
if (btn == KEY_INVALID && !GPIO_CheckBit(&GPIOC->DATA, GPIOC_PIN_PTT))
|
||||
btn = KEY_PTT;
|
||||
return btn;
|
||||
}
|
||||
|
||||
void SetState(State state) {
|
||||
previousState = currentState;
|
||||
currentState = state;
|
||||
redrawScreen = true;
|
||||
redrawStatus = true;
|
||||
void SetState(State state)
|
||||
{
|
||||
previousState = currentState;
|
||||
currentState = state;
|
||||
redrawScreen = true;
|
||||
redrawStatus = true;
|
||||
}
|
||||
|
||||
// Radio functions
|
||||
|
||||
static void BackupRegisters() {
|
||||
for (int i = 0; i < ARRAY_SIZE(registersToBackup); ++i) {
|
||||
uint8_t regNum = registersToBackup[i];
|
||||
registersBackup[regNum] = BK4819_ReadRegister(regNum);
|
||||
}
|
||||
static void BackupRegisters()
|
||||
{
|
||||
for (int i = 0; i < ARRAY_SIZE(registersToBackup); ++i)
|
||||
{
|
||||
uint8_t regNum = registersToBackup[i];
|
||||
registersBackup[regNum] = BK4819_ReadRegister(regNum);
|
||||
}
|
||||
}
|
||||
|
||||
static void RestoreRegisters() {
|
||||
for (int i = 0; i < ARRAY_SIZE(registersToBackup); ++i) {
|
||||
uint8_t regNum = registersToBackup[i];
|
||||
BK4819_WriteRegister(regNum, registersBackup[regNum]);
|
||||
}
|
||||
static void RestoreRegisters()
|
||||
{
|
||||
for (int i = 0; i < ARRAY_SIZE(registersToBackup); ++i)
|
||||
{
|
||||
uint8_t regNum = registersToBackup[i];
|
||||
BK4819_WriteRegister(regNum, registersBackup[regNum]);
|
||||
}
|
||||
}
|
||||
|
||||
static void SetModulation(ModulationType type) {
|
||||
// restore only registers, which we affect here fully
|
||||
BK4819_WriteRegister(0x37, registersBackup[0x37]);
|
||||
BK4819_WriteRegister(0x3D, registersBackup[0x3D]);
|
||||
BK4819_WriteRegister(0x48, registersBackup[0x48]);
|
||||
|
||||
SetRegValue(afOutRegSpec, modTypeReg47Values[type]);
|
||||
|
||||
if (type == MOD_USB) {
|
||||
BK4819_WriteRegister(0x37, 0b0001011000001111);
|
||||
BK4819_WriteRegister(0x3D, 0b0010101101000101);
|
||||
BK4819_WriteRegister(0x48, 0b0000001110101000);
|
||||
}
|
||||
|
||||
if (type == MOD_AM) {
|
||||
SetRegValue(afDacGainRegSpec, 0xE);
|
||||
}
|
||||
static void SetModulation(ModulationType type)
|
||||
{
|
||||
// restore only registers, which we affect here fully
|
||||
BK4819_WriteRegister(0x37, registersBackup[0x37]);
|
||||
BK4819_WriteRegister(0x3D, registersBackup[0x3D]);
|
||||
BK4819_WriteRegister(0x48, registersBackup[0x48]);
|
||||
|
||||
SetRegValue(afOutRegSpec, modTypeReg47Values[type]);
|
||||
|
||||
if (type == MOD_USB)
|
||||
{
|
||||
BK4819_WriteRegister(0x37, 0b0001011000001111);
|
||||
BK4819_WriteRegister(0x3D, 0b0010101101000101);
|
||||
BK4819_WriteRegister(0x48, 0b0000001110101000);
|
||||
}
|
||||
|
||||
if (type == MOD_AM)
|
||||
SetRegValue(afDacGainRegSpec, 0xE);
|
||||
}
|
||||
|
||||
static void SetF(uint32_t f) {
|
||||
@ -646,7 +658,7 @@ static void FreqInput() {
|
||||
SetState(FREQ_INPUT);
|
||||
}
|
||||
|
||||
static void UpdateFreqInput(KEY_Code_t key) {
|
||||
static void UpdateFreqInput(key_code_t key) {
|
||||
if (key != KEY_EXIT && freqInputIndex >= 10) {
|
||||
return;
|
||||
}
|
||||
@ -667,7 +679,7 @@ static void UpdateFreqInput(KEY_Code_t key) {
|
||||
uint8_t dotIndex =
|
||||
freqInputDotIndex == 0 ? freqInputIndex : freqInputDotIndex;
|
||||
|
||||
KEY_Code_t digitKey;
|
||||
key_code_t digitKey;
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
if (i < freqInputIndex) {
|
||||
digitKey = freqInputArr[i];
|
||||
@ -965,7 +977,7 @@ static void OnKeyDownFreqInput(uint8_t key) {
|
||||
}
|
||||
}
|
||||
|
||||
void OnKeyDownStill(KEY_Code_t key) {
|
||||
void OnKeyDownStill(key_code_t key) {
|
||||
switch (key) {
|
||||
case KEY_3:
|
||||
break;
|
||||
@ -1315,7 +1327,7 @@ static void AutomaticPresetChoose(uint32_t f) {
|
||||
void APP_RunSpectrum() {
|
||||
BackupRegisters();
|
||||
// TX here coz it always? set to active VFO
|
||||
VFO_Info_t vfo = gEeprom.VfoInfo[gEeprom.TX_CHANNEL];
|
||||
VFO_Info_t vfo = g_eeprom.VfoInfo[g_eeprom.TX_CHANNEL];
|
||||
initialFreq = vfo.pRX->Frequency;
|
||||
currentFreq = initialFreq;
|
||||
settings.scanStepIndex = gStepSettingToIndex[vfo.STEP_SETTING];
|
||||
|
236
app/spectrum.h
236
app/spectrum.h
@ -17,6 +17,10 @@
|
||||
#ifndef SPECTRUM_H
|
||||
#define SPECTRUM_H
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "../bitmaps.h"
|
||||
#include "../board.h"
|
||||
#include "../bsp/dp32g030/gpio.h"
|
||||
@ -36,184 +40,164 @@
|
||||
#include "../radio.h"
|
||||
#include "../settings.h"
|
||||
#include "../ui/helper.h"
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
|
||||
static const uint8_t DrawingEndY = 40;
|
||||
|
||||
static const uint16_t scanStepValues[] = {
|
||||
1, 10, 50, 100,
|
||||
|
||||
250, 500, 625, 833, 1000, 1250, 2500, 10000,
|
||||
1, 10, 50, 100, 250, 500, 625, 833, 1000, 1250, 2500, 10000,
|
||||
};
|
||||
|
||||
static const uint8_t gStepSettingToIndex[] = {
|
||||
[STEP_2_5kHz] = 4, [STEP_5_0kHz] = 5, [STEP_6_25kHz] = 6,
|
||||
[STEP_10_0kHz] = 8, [STEP_12_5kHz] = 9, [STEP_25_0kHz] = 10,
|
||||
[STEP_8_33kHz] = 7,
|
||||
[STEP_2_5kHz] = 4, [STEP_5_0kHz] = 5, [STEP_6_25kHz] = 6,
|
||||
[STEP_10_0kHz] = 8, [STEP_12_5kHz] = 9, [STEP_25_0kHz] = 10,
|
||||
[STEP_8_33kHz] = 7,
|
||||
};
|
||||
|
||||
static const uint16_t scanStepBWRegValues[12] = {
|
||||
// RX RXw TX BW
|
||||
// 0b0 000 000 001 01 1000
|
||||
// 1
|
||||
0b0000000001011000, // 6.25
|
||||
// 10
|
||||
0b0000000001011000, // 6.25
|
||||
// 50
|
||||
0b0000000001011000, // 6.25
|
||||
// 100
|
||||
0b0000000001011000, // 6.25
|
||||
// 250
|
||||
0b0000000001011000, // 6.25
|
||||
// 500
|
||||
0b0010010001011000, // 6.25
|
||||
// 625
|
||||
0b0100100001011000, // 6.25
|
||||
// 833
|
||||
0b0110110001001000, // 6.25
|
||||
// 1000
|
||||
0b0110110001001000, // 6.25
|
||||
// 1250
|
||||
0b0111111100001000, // 6.25
|
||||
// 2500
|
||||
0b0011011000101000, // 25
|
||||
// 10000
|
||||
0b0011011000101000, // 25
|
||||
// RX RXw TX BW
|
||||
// 0b0 000 000 001 01 1000
|
||||
// 1
|
||||
0b0000000001011000, // 6.25
|
||||
// 10
|
||||
0b0000000001011000, // 6.25
|
||||
// 50
|
||||
0b0000000001011000, // 6.25
|
||||
// 100
|
||||
0b0000000001011000, // 6.25
|
||||
// 250
|
||||
0b0000000001011000, // 6.25
|
||||
// 500
|
||||
0b0010010001011000, // 6.25
|
||||
// 625
|
||||
0b0100100001011000, // 6.25
|
||||
// 833
|
||||
0b0110110001001000, // 6.25
|
||||
// 1000
|
||||
0b0110110001001000, // 6.25
|
||||
// 1250
|
||||
0b0111111100001000, // 6.25
|
||||
// 2500
|
||||
0b0011011000101000, // 25
|
||||
// 10000
|
||||
0b0011011000101000, // 25
|
||||
};
|
||||
|
||||
static const uint16_t listenBWRegValues[] = {
|
||||
0b0011011000101000, // 25
|
||||
0b0111111100001000, // 12.5
|
||||
0b0100100001011000, // 6.25
|
||||
0b0011011000101000, // 25
|
||||
0b0111111100001000, // 12.5
|
||||
0b0100100001011000, // 6.25
|
||||
};
|
||||
|
||||
typedef enum State {
|
||||
SPECTRUM,
|
||||
FREQ_INPUT,
|
||||
STILL,
|
||||
SPECTRUM,
|
||||
FREQ_INPUT,
|
||||
STILL,
|
||||
} State;
|
||||
|
||||
typedef enum StepsCount {
|
||||
STEPS_128,
|
||||
STEPS_64,
|
||||
STEPS_32,
|
||||
STEPS_16,
|
||||
STEPS_128,
|
||||
STEPS_64,
|
||||
STEPS_32,
|
||||
STEPS_16,
|
||||
} StepsCount;
|
||||
|
||||
typedef enum ModulationType {
|
||||
MOD_FM,
|
||||
MOD_AM,
|
||||
MOD_USB,
|
||||
MOD_FM,
|
||||
MOD_AM,
|
||||
MOD_USB,
|
||||
} ModulationType;
|
||||
|
||||
typedef enum ScanStep {
|
||||
S_STEP_0_01kHz,
|
||||
S_STEP_0_1kHz,
|
||||
S_STEP_0_5kHz,
|
||||
S_STEP_1_0kHz,
|
||||
S_STEP_0_01kHz,
|
||||
S_STEP_0_1kHz,
|
||||
S_STEP_0_5kHz,
|
||||
S_STEP_1_0kHz,
|
||||
|
||||
S_STEP_2_5kHz,
|
||||
S_STEP_5_0kHz,
|
||||
S_STEP_6_25kHz,
|
||||
S_STEP_8_33kHz,
|
||||
S_STEP_10_0kHz,
|
||||
S_STEP_12_5kHz,
|
||||
S_STEP_25_0kHz,
|
||||
S_STEP_100_0kHz,
|
||||
S_STEP_2_5kHz,
|
||||
S_STEP_5_0kHz,
|
||||
S_STEP_6_25kHz,
|
||||
S_STEP_8_33kHz,
|
||||
S_STEP_10_0kHz,
|
||||
S_STEP_12_5kHz,
|
||||
S_STEP_25_0kHz,
|
||||
S_STEP_100_0kHz,
|
||||
} ScanStep;
|
||||
|
||||
typedef struct SpectrumSettings {
|
||||
StepsCount stepsCount;
|
||||
ScanStep scanStepIndex;
|
||||
uint32_t frequencyChangeStep;
|
||||
uint16_t scanDelay;
|
||||
uint16_t rssiTriggerLevel;
|
||||
StepsCount stepsCount;
|
||||
ScanStep scanStepIndex;
|
||||
uint32_t frequencyChangeStep;
|
||||
uint16_t scanDelay;
|
||||
uint16_t rssiTriggerLevel;
|
||||
|
||||
bool backlightState;
|
||||
BK4819_FilterBandwidth_t bw;
|
||||
BK4819_FilterBandwidth_t listenBw;
|
||||
ModulationType modulationType;
|
||||
bool backlightState;
|
||||
BK4819_FilterBandwidth_t bw;
|
||||
BK4819_FilterBandwidth_t listenBw;
|
||||
ModulationType modulationType;
|
||||
} SpectrumSettings;
|
||||
|
||||
typedef struct KeyboardState {
|
||||
KEY_Code_t current;
|
||||
KEY_Code_t prev;
|
||||
uint8_t counter;
|
||||
KEY_Code_t current;
|
||||
KEY_Code_t prev;
|
||||
uint8_t counter;
|
||||
} KeyboardState;
|
||||
|
||||
typedef struct ScanInfo {
|
||||
uint16_t rssi, rssiMin, rssiMax;
|
||||
uint8_t i, iPeak;
|
||||
uint32_t f, fPeak;
|
||||
uint16_t scanStep;
|
||||
uint8_t measurementsCount;
|
||||
uint16_t rssi, rssiMin, rssiMax;
|
||||
uint8_t i, iPeak;
|
||||
uint32_t f, fPeak;
|
||||
uint16_t scanStep;
|
||||
uint8_t measurementsCount;
|
||||
} ScanInfo;
|
||||
|
||||
typedef struct RegisterSpec {
|
||||
const char *name;
|
||||
uint8_t num;
|
||||
uint8_t offset;
|
||||
uint16_t maxValue;
|
||||
uint16_t inc;
|
||||
const char *name;
|
||||
uint8_t num;
|
||||
uint8_t offset;
|
||||
uint16_t maxValue;
|
||||
uint16_t inc;
|
||||
} RegisterSpec;
|
||||
|
||||
typedef struct PeakInfo {
|
||||
uint16_t t;
|
||||
uint16_t rssi;
|
||||
uint8_t i;
|
||||
uint32_t f;
|
||||
uint16_t t;
|
||||
uint16_t rssi;
|
||||
uint8_t i;
|
||||
uint32_t f;
|
||||
} PeakInfo;
|
||||
|
||||
typedef struct MovingAverage {
|
||||
uint16_t mean[128];
|
||||
uint16_t buf[4][128];
|
||||
uint16_t min, mid, max;
|
||||
uint16_t t;
|
||||
uint16_t mean[128];
|
||||
uint16_t buf[4][128];
|
||||
uint16_t min, mid, max;
|
||||
uint16_t t;
|
||||
} MovingAverage;
|
||||
|
||||
typedef struct FreqPreset {
|
||||
char name[16];
|
||||
uint32_t fStart;
|
||||
uint32_t fEnd;
|
||||
StepsCount stepsCountIndex;
|
||||
uint8_t stepSizeIndex;
|
||||
ModulationType modulationType;
|
||||
BK4819_FilterBandwidth_t listenBW;
|
||||
char name[16];
|
||||
uint32_t fStart;
|
||||
uint32_t fEnd;
|
||||
StepsCount stepsCountIndex;
|
||||
uint8_t stepSizeIndex;
|
||||
ModulationType modulationType;
|
||||
BK4819_FilterBandwidth_t listenBW;
|
||||
} FreqPreset;
|
||||
|
||||
static const FreqPreset freqPresets[] = {
|
||||
{"17m", 1806800, 1831800, STEPS_128, S_STEP_1_0kHz, MOD_USB,
|
||||
BK4819_FILTER_BW_NARROWER},
|
||||
{"15m", 2100000, 2145000, STEPS_128, S_STEP_1_0kHz, MOD_USB,
|
||||
BK4819_FILTER_BW_NARROWER},
|
||||
{"12m", 2489000, 2514000, STEPS_128, S_STEP_1_0kHz, MOD_USB,
|
||||
BK4819_FILTER_BW_NARROWER},
|
||||
{"CB", 2697500, 2785500, STEPS_128, S_STEP_5_0kHz, MOD_FM,
|
||||
BK4819_FILTER_BW_NARROW},
|
||||
{"10m", 2800000, 2970000, STEPS_128, S_STEP_1_0kHz, MOD_USB,
|
||||
BK4819_FILTER_BW_NARROWER},
|
||||
{"AIR", 11800000, 13500000, STEPS_128, S_STEP_100_0kHz, MOD_AM,
|
||||
BK4819_FILTER_BW_NARROW},
|
||||
{"2m", 14400000, 14600000, STEPS_128, S_STEP_25_0kHz, MOD_FM,
|
||||
BK4819_FILTER_BW_NARROW},
|
||||
{"JD1", 15175000, 15400000, STEPS_128, S_STEP_25_0kHz, MOD_FM,
|
||||
BK4819_FILTER_BW_NARROW},
|
||||
{"JD2", 15500000, 15600000, STEPS_64, S_STEP_25_0kHz, MOD_FM,
|
||||
BK4819_FILTER_BW_NARROW},
|
||||
{"LPD", 43307500, 43477500, STEPS_128, S_STEP_25_0kHz, MOD_FM,
|
||||
BK4819_FILTER_BW_WIDE},
|
||||
{"PMR", 44600625, 44620000, STEPS_16, S_STEP_12_5kHz, MOD_FM,
|
||||
BK4819_FILTER_BW_NARROW},
|
||||
{"FRS/GM 462", 46256250, 46272500, STEPS_16, S_STEP_12_5kHz, MOD_FM,
|
||||
BK4819_FILTER_BW_NARROW},
|
||||
{"FRS/GM 467", 46756250, 46771250, STEPS_16, S_STEP_12_5kHz, MOD_FM,
|
||||
BK4819_FILTER_BW_NARROW},
|
||||
{"17m", 1806800, 1831800, STEPS_128, S_STEP_1_0kHz, MOD_USB, BK4819_FILTER_BW_NARROWER},
|
||||
{"15m", 2100000, 2145000, STEPS_128, S_STEP_1_0kHz, MOD_USB, BK4819_FILTER_BW_NARROWER},
|
||||
{"12m", 2489000, 2514000, STEPS_128, S_STEP_1_0kHz, MOD_USB, BK4819_FILTER_BW_NARROWER},
|
||||
{"CB", 2697500, 2785500, STEPS_128, S_STEP_5_0kHz, MOD_FM, BK4819_FILTER_BW_NARROW },
|
||||
{"10m", 2800000, 2970000, STEPS_128, S_STEP_1_0kHz, MOD_USB, BK4819_FILTER_BW_NARROWER},
|
||||
{"AIR", 11800000, 13500000, STEPS_128, S_STEP_100_0kHz, MOD_AM, BK4819_FILTER_BW_NARROW },
|
||||
{"2m", 14400000, 14600000, STEPS_128, S_STEP_25_0kHz, MOD_FM, BK4819_FILTER_BW_NARROW },
|
||||
{"JD1", 15175000, 15400000, STEPS_128, S_STEP_25_0kHz, MOD_FM, BK4819_FILTER_BW_NARROW },
|
||||
{"JD2", 15500000, 15600000, STEPS_64, S_STEP_25_0kHz, MOD_FM, BK4819_FILTER_BW_NARROW },
|
||||
{"LPD", 43307500, 43477500, STEPS_128, S_STEP_25_0kHz, MOD_FM, BK4819_FILTER_BW_WIDE },
|
||||
{"PMR", 44600625, 44620000, STEPS_16, S_STEP_12_5kHz, MOD_FM, BK4819_FILTER_BW_NARROW },
|
||||
{"FRS/GM 462", 46256250, 46272500, STEPS_16, S_STEP_12_5kHz, MOD_FM, BK4819_FILTER_BW_NARROW },
|
||||
{"FRS/GM 467", 46756250, 46771250, STEPS_16, S_STEP_12_5kHz, MOD_FM, BK4819_FILTER_BW_NARROW },
|
||||
};
|
||||
|
||||
void APP_RunSpectrum(void);
|
||||
|
||||
#endif /* ifndef SPECTRUM_H */
|
||||
|
||||
// vim: ft=c
|
||||
#endif
|
||||
|
20
app/uart.c
20
app/uart.c
@ -390,16 +390,16 @@ static void CMD_052F(const uint8_t *pBuffer)
|
||||
{
|
||||
const CMD_052F_t *pCmd = (const CMD_052F_t *)pBuffer;
|
||||
|
||||
gEeprom.DUAL_WATCH = DUAL_WATCH_OFF;
|
||||
gEeprom.CROSS_BAND_RX_TX = CROSS_BAND_OFF;
|
||||
gEeprom.RX_VFO = 0;
|
||||
gEeprom.DTMF_SIDE_TONE = false;
|
||||
gEeprom.VfoInfo[0].FrequencyReverse = false;
|
||||
gEeprom.VfoInfo[0].pRX = &gEeprom.VfoInfo[0].freq_config_RX;
|
||||
gEeprom.VfoInfo[0].pTX = &gEeprom.VfoInfo[0].freq_config_TX;
|
||||
gEeprom.VfoInfo[0].TX_OFFSET_FREQUENCY_DIRECTION = TX_OFFSET_FREQUENCY_DIRECTION_OFF;
|
||||
gEeprom.VfoInfo[0].DTMF_PTT_ID_TX_MODE = PTT_ID_OFF;
|
||||
gEeprom.VfoInfo[0].DTMF_DECODING_ENABLE = false;
|
||||
g_eeprom.dual_watch = DUAL_WATCH_OFF;
|
||||
g_eeprom.cross_vfo_rx_tx = CROSS_BAND_OFF;
|
||||
g_eeprom.rx_vfo = 0;
|
||||
g_eeprom.DTMF_side_tone = false;
|
||||
g_eeprom.VfoInfo[0].frequency_reverse = false;
|
||||
g_eeprom.VfoInfo[0].pRX = &g_eeprom.VfoInfo[0].freq_config_rx;
|
||||
g_eeprom.VfoInfo[0].pTX = &g_eeprom.VfoInfo[0].freq_config_tx;
|
||||
g_eeprom.VfoInfo[0].tx_offset_freq_dir = TX_OFFSET_FREQ_DIR_OFF;
|
||||
g_eeprom.VfoInfo[0].DTMF_ptt_id_tx_mode = PTT_ID_OFF;
|
||||
g_eeprom.VfoInfo[0].DTMF_decoding_enable = false;
|
||||
|
||||
#ifdef ENABLE_NOAA
|
||||
gIsNoaaMode = false;
|
||||
|
Reference in New Issue
Block a user