This commit is contained in:
@@ -36,7 +36,7 @@
|
||||
#include "screenshot.h"
|
||||
#endif
|
||||
|
||||
static const uint16_t Obfuscation[8] = { 0x6C16, 0xE614, 0x912E, 0x400D, 0x3521, 0x40D5, 0x0313, 0x80E9 };
|
||||
static const uint16_t Obfuscation[8] = {0x6C16, 0xE614, 0x912E, 0x400D, 0x3521, 0x40D5, 0x0313, 0x80E9};
|
||||
|
||||
AIRCOPY_State_t gAircopyState;
|
||||
uint16_t gAirCopyBlockNumber;
|
||||
@@ -45,16 +45,13 @@ uint8_t gAirCopyIsSendMode;
|
||||
|
||||
uint16_t g_FSK_Buffer[36];
|
||||
|
||||
static void AIRCOPY_clear()
|
||||
{
|
||||
for (uint8_t i = 0; i < 15; i++)
|
||||
{
|
||||
static void AIRCOPY_clear() {
|
||||
for (uint8_t i = 0; i < 15; i++) {
|
||||
crc[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
bool AIRCOPY_SendMessage(void)
|
||||
{
|
||||
bool AIRCOPY_SendMessage(void) {
|
||||
static uint8_t gAircopySendCountdown = 1;
|
||||
|
||||
if (gAircopyState != AIRCOPY_TRANSFER) {
|
||||
@@ -77,9 +74,9 @@ bool AIRCOPY_SendMessage(void)
|
||||
|
||||
if (++gAirCopyBlockNumber >= 0x78) {
|
||||
gAircopyState = AIRCOPY_COMPLETE;
|
||||
#ifdef ENABLE_FEAT_F4HWN_SCREENSHOT
|
||||
getScreenShot();
|
||||
#endif
|
||||
#ifdef ENABLE_FEAT_F4HWN_SCREENSHOT
|
||||
getScreenShot();
|
||||
#endif
|
||||
//NVIC_SystemReset();
|
||||
}
|
||||
|
||||
@@ -94,8 +91,7 @@ bool AIRCOPY_SendMessage(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
void AIRCOPY_StorePacket(void)
|
||||
{
|
||||
void AIRCOPY_StorePacket(void) {
|
||||
if (gFSKWriteIndex < 36) {
|
||||
return;
|
||||
}
|
||||
@@ -138,16 +134,15 @@ void AIRCOPY_StorePacket(void)
|
||||
|
||||
if (Offset == 0x1E00) {
|
||||
gAircopyState = AIRCOPY_COMPLETE;
|
||||
#ifdef ENABLE_FEAT_F4HWN_SCREENSHOT
|
||||
getScreenShot();
|
||||
#endif
|
||||
#ifdef ENABLE_FEAT_F4HWN_SCREENSHOT
|
||||
getScreenShot();
|
||||
#endif
|
||||
}
|
||||
|
||||
gAirCopyBlockNumber++;
|
||||
}
|
||||
|
||||
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) {
|
||||
return;
|
||||
}
|
||||
@@ -194,8 +189,7 @@ static void AIRCOPY_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
gRequestDisplayScreen = DISPLAY_AIRCOPY;
|
||||
}
|
||||
|
||||
static void AIRCOPY_Key_EXIT(bool bKeyPressed, bool bKeyHeld)
|
||||
{
|
||||
static void AIRCOPY_Key_EXIT(bool bKeyPressed, bool bKeyHeld) {
|
||||
if (bKeyHeld || !bKeyPressed) {
|
||||
return;
|
||||
}
|
||||
@@ -220,8 +214,7 @@ static void AIRCOPY_Key_EXIT(bool bKeyPressed, bool bKeyHeld)
|
||||
gRequestDisplayScreen = DISPLAY_AIRCOPY;
|
||||
}
|
||||
|
||||
static void AIRCOPY_Key_MENU(bool bKeyPressed, bool bKeyHeld)
|
||||
{
|
||||
static void AIRCOPY_Key_MENU(bool bKeyPressed, bool bKeyHeld) {
|
||||
if (bKeyHeld || !bKeyPressed) {
|
||||
return;
|
||||
}
|
||||
@@ -242,29 +235,28 @@ static void AIRCOPY_Key_MENU(bool bKeyPressed, bool bKeyHeld)
|
||||
gAircopyState = AIRCOPY_TRANSFER;
|
||||
}
|
||||
|
||||
void AIRCOPY_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
{
|
||||
void AIRCOPY_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) {
|
||||
switch (Key) {
|
||||
case KEY_0:
|
||||
case KEY_1:
|
||||
case KEY_2:
|
||||
case KEY_3:
|
||||
case KEY_4:
|
||||
case KEY_5:
|
||||
case KEY_6:
|
||||
case KEY_7:
|
||||
case KEY_8:
|
||||
case KEY_9:
|
||||
AIRCOPY_Key_DIGITS(Key, bKeyPressed, bKeyHeld);
|
||||
break;
|
||||
case KEY_MENU:
|
||||
AIRCOPY_Key_MENU(bKeyPressed, bKeyHeld);
|
||||
break;
|
||||
case KEY_EXIT:
|
||||
AIRCOPY_Key_EXIT(bKeyPressed, bKeyHeld);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
case KEY_0:
|
||||
case KEY_1:
|
||||
case KEY_2:
|
||||
case KEY_3:
|
||||
case KEY_4:
|
||||
case KEY_5:
|
||||
case KEY_6:
|
||||
case KEY_7:
|
||||
case KEY_8:
|
||||
case KEY_9:
|
||||
AIRCOPY_Key_DIGITS(Key, bKeyPressed, bKeyHeld);
|
||||
break;
|
||||
case KEY_MENU:
|
||||
AIRCOPY_Key_MENU(bKeyPressed, bKeyHeld);
|
||||
break;
|
||||
case KEY_EXIT:
|
||||
AIRCOPY_Key_EXIT(bKeyPressed, bKeyHeld);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
18
app/app.h
18
app/app.h
@@ -23,13 +23,21 @@
|
||||
#include "frequencies.h"
|
||||
#include "radio.h"
|
||||
|
||||
void APP_EndTransmission(void);
|
||||
void APP_StartListening(FUNCTION_Type_t function);
|
||||
void APP_EndTransmission(void);
|
||||
|
||||
void APP_StartListening(FUNCTION_Type_t function);
|
||||
|
||||
uint32_t APP_SetFreqByStepAndLimits(VFO_Info_t *pInfo, int8_t direction, uint32_t lower, uint32_t upper);
|
||||
|
||||
uint32_t APP_SetFrequencyByStep(VFO_Info_t *pInfo, int8_t direction);
|
||||
void APP_Update(void);
|
||||
void APP_TimeSlice10ms(void);
|
||||
void APP_TimeSlice500ms(void);
|
||||
|
||||
void APP_Update(void);
|
||||
|
||||
void APP_TimeSlice10ms(void);
|
||||
|
||||
void APP_TimeSlice500ms(void);
|
||||
|
||||
void APP_EndTransmission(void);
|
||||
|
||||
#endif
|
||||
|
||||
|
94
app/dtmf.c
94
app/dtmf.c
@@ -248,7 +248,7 @@ void DTMF_HandleRequest(void)
|
||||
return;
|
||||
}
|
||||
|
||||
if (!gRxVfo->DTMF_DECODING_ENABLE && !gSetting_KILLED)
|
||||
if (!gRxVfo->DTMF_DECODING_ENABLE)
|
||||
{ // D-DCD is disabled or we're alive
|
||||
DTMF_clear_RX();
|
||||
return;
|
||||
@@ -266,28 +266,28 @@ void DTMF_HandleRequest(void)
|
||||
if (CompareMessage(gDTMF_RX + Offset, String, strlen(String), true))
|
||||
{ // bugger
|
||||
|
||||
if (gEeprom.PERMIT_REMOTE_KILL)
|
||||
{
|
||||
gSetting_KILLED = true; // oooerr !
|
||||
|
||||
DTMF_clear_RX();
|
||||
|
||||
SETTINGS_SaveSettings();
|
||||
|
||||
gDTMF_ReplyState = DTMF_REPLY_AB;
|
||||
|
||||
#ifdef ENABLE_FMRADIO
|
||||
if (gFmRadioMode)
|
||||
{
|
||||
FM_TurnOff();
|
||||
GUI_SelectNextDisplay(DISPLAY_MAIN);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
// if (gEeprom.PERMIT_REMOTE_KILL)
|
||||
// {
|
||||
// gSetting_KILLED = true; // oooerr !
|
||||
//
|
||||
// DTMF_clear_RX();
|
||||
//
|
||||
// SETTINGS_SaveSettings();
|
||||
//
|
||||
// gDTMF_ReplyState = DTMF_REPLY_AB;
|
||||
//
|
||||
// #ifdef ENABLE_FMRADIO
|
||||
// if (gFmRadioMode)
|
||||
// {
|
||||
// FM_TurnOff();
|
||||
// GUI_SelectNextDisplay(DISPLAY_MAIN);
|
||||
// }
|
||||
// #endif
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
gDTMF_ReplyState = DTMF_REPLY_NONE;
|
||||
}
|
||||
// }
|
||||
|
||||
gDTMF_CallState = DTMF_CALL_STATE_NONE;
|
||||
|
||||
@@ -297,30 +297,30 @@ 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);
|
||||
|
||||
Offset = gDTMF_RX_index - strlen(String);
|
||||
|
||||
if (CompareMessage(gDTMF_RX + Offset, String, strlen(String), true))
|
||||
{ // shit, we're back !
|
||||
|
||||
gSetting_KILLED = false;
|
||||
|
||||
DTMF_clear_RX();
|
||||
|
||||
SETTINGS_SaveSettings();
|
||||
|
||||
gDTMF_ReplyState = DTMF_REPLY_AB;
|
||||
gDTMF_CallState = DTMF_CALL_STATE_NONE;
|
||||
|
||||
gUpdateDisplay = true;
|
||||
gUpdateStatus = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
// 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);
|
||||
//
|
||||
// Offset = gDTMF_RX_index - strlen(String);
|
||||
//
|
||||
// if (CompareMessage(gDTMF_RX + Offset, String, strlen(String), true))
|
||||
// { // shit, we're back !
|
||||
//
|
||||
// gSetting_KILLED = false;
|
||||
//
|
||||
// DTMF_clear_RX();
|
||||
//
|
||||
// SETTINGS_SaveSettings();
|
||||
//
|
||||
// gDTMF_ReplyState = DTMF_REPLY_AB;
|
||||
// gDTMF_CallState = DTMF_CALL_STATE_NONE;
|
||||
//
|
||||
// gUpdateDisplay = true;
|
||||
// gUpdateStatus = true;
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
|
||||
if (gDTMF_RX_index >= 2)
|
||||
{ // look for ACK reply
|
||||
@@ -360,7 +360,7 @@ void DTMF_HandleRequest(void)
|
||||
}
|
||||
}
|
||||
|
||||
if (gSetting_KILLED || gDTMF_CallState != DTMF_CALL_STATE_NONE)
|
||||
if (gDTMF_CallState != DTMF_CALL_STATE_NONE)
|
||||
{ // we've been killed or expecting a reply
|
||||
return;
|
||||
}
|
||||
|
531
app/main.c
531
app/main.c
@@ -20,15 +20,21 @@
|
||||
#include "app/app.h"
|
||||
#include "app/chFrScanner.h"
|
||||
#include "app/common.h"
|
||||
|
||||
#ifdef ENABLE_FMRADIO
|
||||
#include "app/fm.h"
|
||||
|
||||
#include "app/fm.h"
|
||||
|
||||
#endif
|
||||
|
||||
#include "app/generic.h"
|
||||
#include "app/main.h"
|
||||
#include "app/scanner.h"
|
||||
|
||||
#ifdef ENABLE_SPECTRUM
|
||||
|
||||
#include "app/spectrum.h"
|
||||
|
||||
#endif
|
||||
|
||||
#include "audio.h"
|
||||
@@ -43,32 +49,46 @@
|
||||
#include "ui/ui.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
static void toggle_chan_scanlist(void)
|
||||
{ // toggle the selected channels scanlist setting
|
||||
#define T9Count 9
|
||||
|
||||
const char T9Table[10][T9Count] = {
|
||||
{'#', '(', ')', ';', ':', '<', '>', '/', '0'},
|
||||
{',', '.', '?', '&', '!', ' ', '-', '_', '1'},
|
||||
{'a', 'b', 'c', 'A', 'B', 'C', '[', ']', '2'},
|
||||
{'d', 'e', 'f', 'D', 'E', 'F', '@', '%', '3'},
|
||||
{'g', 'h', 'i', 'G', 'H', 'I', '~', '$', '4'},
|
||||
{'j', 'k', 'l', 'J', 'K', 'L', '|', '*', '5'},
|
||||
{'m', 'n', 'o', 'M', 'N', 'O', '{', '}', '6'},
|
||||
{'p', 'q', 'r', 's', 'P', 'Q', 'R', 'S', '7'},
|
||||
{'t', 'u', 'v', 'T', 'U', 'V', '"', '\'', '8'},
|
||||
{'w', 'x', 'y', 'z', 'W', 'X', 'Y', 'Z', '9'}
|
||||
};
|
||||
|
||||
static void toggle_chan_scanlist(void) { // toggle the selected channels scanlist setting
|
||||
|
||||
if (SCANNER_IsScanning())
|
||||
return;
|
||||
|
||||
if(!IS_MR_CHANNEL(gTxVfo->CHANNEL_SAVE)) {
|
||||
if (!IS_MR_CHANNEL(gTxVfo->CHANNEL_SAVE)) {
|
||||
#ifdef ENABLE_SCAN_RANGES
|
||||
gScanRangeStart = gScanRangeStart ? 0 : gTxVfo->pRX->Frequency;
|
||||
gScanRangeStop = gEeprom.VfoInfo[!gEeprom.TX_VFO].freq_config_RX.Frequency;
|
||||
if(gScanRangeStart > gScanRangeStop)
|
||||
if (gScanRangeStart > gScanRangeStop)
|
||||
SWAP(gScanRangeStart, gScanRangeStop);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Remove exclude
|
||||
if(gMR_ChannelExclude[gTxVfo->CHANNEL_SAVE] == true)
|
||||
{
|
||||
if (gMR_ChannelExclude[gTxVfo->CHANNEL_SAVE] == true) {
|
||||
gMR_ChannelExclude[gTxVfo->CHANNEL_SAVE] = false;
|
||||
return;
|
||||
}
|
||||
|
||||
uint8_t scanTmp = gTxVfo->SCANLIST1_PARTICIPATION | (gTxVfo->SCANLIST2_PARTICIPATION << 1) | (gTxVfo->SCANLIST3_PARTICIPATION << 2);
|
||||
uint8_t scanTmp = gTxVfo->SCANLIST1_PARTICIPATION | (gTxVfo->SCANLIST2_PARTICIPATION << 1) |
|
||||
(gTxVfo->SCANLIST3_PARTICIPATION << 2);
|
||||
|
||||
scanTmp = (scanTmp++ < 7) ? scanTmp: 0;
|
||||
scanTmp = (scanTmp++ < 7) ? scanTmp : 0;
|
||||
|
||||
gTxVfo->SCANLIST1_PARTICIPATION = (scanTmp >> 0) & 0x01;
|
||||
gTxVfo->SCANLIST2_PARTICIPATION = (scanTmp >> 1) & 0x01;
|
||||
@@ -77,11 +97,10 @@ static void toggle_chan_scanlist(void)
|
||||
SETTINGS_UpdateChannel(gTxVfo->CHANNEL_SAVE, gTxVfo, true, true, true);
|
||||
|
||||
gVfoConfigureMode = VFO_CONFIGURE;
|
||||
gFlagResetVfos = true;
|
||||
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 Vfo = gEeprom.TX_VFO;
|
||||
|
||||
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
|
||||
@@ -101,21 +120,21 @@ static void processFKeyFunction(const KEY_Code_t Key, const bool beep)
|
||||
gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
||||
|
||||
switch (Key) {
|
||||
case KEY_0:
|
||||
#ifdef ENABLE_FMRADIO
|
||||
ACTION_FM();
|
||||
#endif
|
||||
#ifdef ENABLE_FMRADIO
|
||||
ACTION_FM();
|
||||
#endif
|
||||
break;
|
||||
|
||||
case KEY_1:
|
||||
if (!IS_FREQ_CHANNEL(gTxVfo->CHANNEL_SAVE)) {
|
||||
gWasFKeyPressed = false;
|
||||
gUpdateStatus = true;
|
||||
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
||||
gUpdateStatus = true;
|
||||
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
||||
|
||||
#ifdef ENABLE_COPY_CHAN_TO_VFO
|
||||
if (!gEeprom.VFO_OPEN || gCssBackgroundScan) {
|
||||
@@ -125,17 +144,15 @@ static void processFKeyFunction(const KEY_Code_t Key, const bool beep)
|
||||
|
||||
if (gScanStateDir != SCAN_OFF) {
|
||||
if (gCurrentFunction != FUNCTION_INCOMING ||
|
||||
gRxReceptionMode == RX_MODE_NONE ||
|
||||
gScanPauseDelayIn_10ms == 0)
|
||||
{ // scan is running (not paused)
|
||||
gRxReceptionMode == RX_MODE_NONE ||
|
||||
gScanPauseDelayIn_10ms == 0) { // scan is running (not paused)
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
const uint8_t vfo = gEeprom.TX_VFO;
|
||||
|
||||
if (IS_MR_CHANNEL(gEeprom.ScreenChannel[vfo]))
|
||||
{ // copy channel to VFO, then swap to the VFO
|
||||
if (IS_MR_CHANNEL(gEeprom.ScreenChannel[vfo])) { // copy channel to VFO, then swap to the VFO
|
||||
|
||||
gEeprom.ScreenChannel[vfo] = FREQ_CHANNEL_FIRST + gEeprom.VfoInfo[vfo].Band;
|
||||
gEeprom.VfoInfo[vfo].CHANNEL_SAVE = gEeprom.ScreenChannel[vfo];
|
||||
@@ -156,9 +173,9 @@ static void processFKeyFunction(const KEY_Code_t Key, const bool beep)
|
||||
}
|
||||
|
||||
#ifdef ENABLE_WIDE_RX
|
||||
if(gTxVfo->Band == BAND7_470MHz && gTxVfo->pRX->Frequency < _1GHz_in_KHz) {
|
||||
gTxVfo->pRX->Frequency = _1GHz_in_KHz;
|
||||
return;
|
||||
if (gTxVfo->Band == BAND7_470MHz && gTxVfo->pRX->Frequency < _1GHz_in_KHz) {
|
||||
gTxVfo->pRX->Frequency = _1GHz_in_KHz;
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
gTxVfo->Band += 1;
|
||||
@@ -166,18 +183,18 @@ static void processFKeyFunction(const KEY_Code_t Key, const bool beep)
|
||||
if (gTxVfo->Band == BAND5_350MHz && !gSetting_350EN) {
|
||||
// skip if not enabled
|
||||
gTxVfo->Band += 1;
|
||||
} else if (gTxVfo->Band >= BAND_N_ELEM){
|
||||
} else if (gTxVfo->Band >= BAND_N_ELEM) {
|
||||
// go arround if overflowed
|
||||
gTxVfo->Band = BAND1_50MHz;
|
||||
}
|
||||
|
||||
gEeprom.ScreenChannel[Vfo] = FREQ_CHANNEL_FIRST + gTxVfo->Band;
|
||||
gEeprom.FreqChannel[Vfo] = FREQ_CHANNEL_FIRST + gTxVfo->Band;
|
||||
gEeprom.FreqChannel[Vfo] = FREQ_CHANNEL_FIRST + gTxVfo->Band;
|
||||
|
||||
gRequestSaveVFO = true;
|
||||
gVfoConfigureMode = VFO_CONFIGURE_RELOAD;
|
||||
gRequestSaveVFO = true;
|
||||
gVfoConfigureMode = VFO_CONFIGURE_RELOAD;
|
||||
|
||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||
|
||||
if (beep)
|
||||
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
||||
@@ -185,18 +202,18 @@ static void processFKeyFunction(const KEY_Code_t Key, const bool beep)
|
||||
break;
|
||||
|
||||
case KEY_2:
|
||||
#ifdef ENABLE_FEAT_F4HWN
|
||||
gVfoConfigureMode = VFO_CONFIGURE;
|
||||
#endif
|
||||
#ifdef ENABLE_FEAT_F4HWN
|
||||
gVfoConfigureMode = VFO_CONFIGURE;
|
||||
#endif
|
||||
COMMON_SwitchVFOs();
|
||||
if (beep)
|
||||
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
||||
break;
|
||||
|
||||
case KEY_3:
|
||||
#ifdef ENABLE_FEAT_F4HWN
|
||||
gVfoConfigureMode = VFO_CONFIGURE;
|
||||
#endif
|
||||
#ifdef ENABLE_FEAT_F4HWN
|
||||
gVfoConfigureMode = VFO_CONFIGURE;
|
||||
#endif
|
||||
COMMON_SwitchVFOMode();
|
||||
if (beep)
|
||||
gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
||||
@@ -204,11 +221,11 @@ static void processFKeyFunction(const KEY_Code_t Key, const bool beep)
|
||||
break;
|
||||
|
||||
case KEY_4:
|
||||
gWasFKeyPressed = false;
|
||||
gWasFKeyPressed = false;
|
||||
|
||||
gBackup_CROSS_BAND_RX_TX = gEeprom.CROSS_BAND_RX_TX;
|
||||
gBackup_CROSS_BAND_RX_TX = gEeprom.CROSS_BAND_RX_TX;
|
||||
gEeprom.CROSS_BAND_RX_TX = CROSS_BAND_OFF;
|
||||
gUpdateStatus = true;
|
||||
gUpdateStatus = true;
|
||||
if (beep)
|
||||
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
||||
|
||||
@@ -217,7 +234,7 @@ static void processFKeyFunction(const KEY_Code_t Key, const bool beep)
|
||||
break;
|
||||
|
||||
case KEY_5:
|
||||
if(beep) {
|
||||
if (beep) {
|
||||
#ifdef ENABLE_NOAA
|
||||
if (!IS_NOAA_CHANNEL(gTxVfo->CHANNEL_SAVE)) {
|
||||
gEeprom.ScreenChannel[Vfo] = gEeprom.NoaaChannel[gEeprom.TX_VFO];
|
||||
@@ -234,8 +251,7 @@ static void processFKeyFunction(const KEY_Code_t Key, const bool beep)
|
||||
APP_RunSpectrum();
|
||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
toggle_chan_scanlist();
|
||||
}
|
||||
|
||||
@@ -260,15 +276,15 @@ static void processFKeyFunction(const KEY_Code_t Key, const bool beep)
|
||||
|
||||
case KEY_9:
|
||||
if (RADIO_CheckValidChannel(gEeprom.CHAN_1_CALL, false, 0)) {
|
||||
gEeprom.MrChannel[Vfo] = gEeprom.CHAN_1_CALL;
|
||||
gEeprom.MrChannel[Vfo] = gEeprom.CHAN_1_CALL;
|
||||
gEeprom.ScreenChannel[Vfo] = gEeprom.CHAN_1_CALL;
|
||||
#ifdef ENABLE_VOICE
|
||||
AUDIO_SetVoiceID(0, VOICE_ID_CHANNEL_MODE);
|
||||
AUDIO_SetDigitVoice(1, gEeprom.CHAN_1_CALL + 1);
|
||||
gAnotherVoiceID = (VOICE_ID_t)0xFE;
|
||||
#endif
|
||||
gRequestSaveVFO = true;
|
||||
gVfoConfigureMode = VFO_CONFIGURE_RELOAD;
|
||||
gRequestSaveVFO = true;
|
||||
gVfoConfigureMode = VFO_CONFIGURE_RELOAD;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -278,46 +294,42 @@ static void processFKeyFunction(const KEY_Code_t Key, const bool beep)
|
||||
|
||||
#ifdef ENABLE_FEAT_F4HWN // Set Squelch F + UP or Down and Step F + SIDE1 or F + SIDE2
|
||||
case KEY_UP:
|
||||
gEeprom.SQUELCH_LEVEL = (gEeprom.SQUELCH_LEVEL < 9) ? gEeprom.SQUELCH_LEVEL + 1: 9;
|
||||
gVfoConfigureMode = VFO_CONFIGURE;
|
||||
gEeprom.SQUELCH_LEVEL = (gEeprom.SQUELCH_LEVEL < 9) ? gEeprom.SQUELCH_LEVEL + 1 : 9;
|
||||
gVfoConfigureMode = VFO_CONFIGURE;
|
||||
gWasFKeyPressed = false;
|
||||
break;
|
||||
case KEY_DOWN:
|
||||
gEeprom.SQUELCH_LEVEL = (gEeprom.SQUELCH_LEVEL > 0) ? gEeprom.SQUELCH_LEVEL - 1: 0;
|
||||
gVfoConfigureMode = VFO_CONFIGURE;
|
||||
gEeprom.SQUELCH_LEVEL = (gEeprom.SQUELCH_LEVEL > 0) ? gEeprom.SQUELCH_LEVEL - 1 : 0;
|
||||
gVfoConfigureMode = VFO_CONFIGURE;
|
||||
gWasFKeyPressed = false;
|
||||
break;
|
||||
|
||||
case KEY_SIDE1:
|
||||
uint8_t a = FREQUENCY_GetSortedIdxFromStepIdx(gTxVfo->STEP_SETTING);
|
||||
if (a < STEP_N_ELEM - 1)
|
||||
{
|
||||
if (a < STEP_N_ELEM - 1) {
|
||||
gTxVfo->STEP_SETTING = FREQUENCY_GetStepIdxFromSortedIdx(a + 1);
|
||||
}
|
||||
if (IS_FREQ_CHANNEL(gTxVfo->CHANNEL_SAVE))
|
||||
{
|
||||
if (IS_FREQ_CHANNEL(gTxVfo->CHANNEL_SAVE)) {
|
||||
gRequestSaveChannel = 1;
|
||||
}
|
||||
gVfoConfigureMode = VFO_CONFIGURE;
|
||||
gVfoConfigureMode = VFO_CONFIGURE;
|
||||
gWasFKeyPressed = false;
|
||||
break;
|
||||
case KEY_SIDE2:
|
||||
uint8_t b = FREQUENCY_GetSortedIdxFromStepIdx(gTxVfo->STEP_SETTING);
|
||||
if (b > 0)
|
||||
{
|
||||
if (b > 0) {
|
||||
gTxVfo->STEP_SETTING = FREQUENCY_GetStepIdxFromSortedIdx(b - 1);
|
||||
}
|
||||
if (IS_FREQ_CHANNEL(gTxVfo->CHANNEL_SAVE))
|
||||
{
|
||||
if (IS_FREQ_CHANNEL(gTxVfo->CHANNEL_SAVE)) {
|
||||
gRequestSaveChannel = 1;
|
||||
}
|
||||
gVfoConfigureMode = VFO_CONFIGURE;
|
||||
gVfoConfigureMode = VFO_CONFIGURE;
|
||||
gWasFKeyPressed = false;
|
||||
break;
|
||||
#endif
|
||||
|
||||
default:
|
||||
gUpdateStatus = true;
|
||||
gUpdateStatus = true;
|
||||
gWasFKeyPressed = false;
|
||||
|
||||
if (beep)
|
||||
@@ -326,8 +338,7 @@ static void processFKeyFunction(const KEY_Code_t Key, const bool beep)
|
||||
}
|
||||
}
|
||||
|
||||
void channelMove(uint16_t Channel)
|
||||
{
|
||||
void channelMove(uint16_t Channel) {
|
||||
const uint8_t Vfo = gEeprom.TX_VFO;
|
||||
|
||||
if (!RADIO_CheckValidChannel(Channel, false, 0)) {
|
||||
@@ -340,14 +351,14 @@ void channelMove(uint16_t Channel)
|
||||
|
||||
gBeepToPlay = BEEP_NONE;
|
||||
|
||||
#ifdef ENABLE_VOICE
|
||||
gAnotherVoiceID = (VOICE_ID_t)Key;
|
||||
#endif
|
||||
#ifdef ENABLE_VOICE
|
||||
gAnotherVoiceID = (VOICE_ID_t)Key;
|
||||
#endif
|
||||
|
||||
gEeprom.MrChannel[Vfo] = (uint8_t)Channel;
|
||||
gEeprom.ScreenChannel[Vfo] = (uint8_t)Channel;
|
||||
gEeprom.MrChannel[Vfo] = (uint8_t) Channel;
|
||||
gEeprom.ScreenChannel[Vfo] = (uint8_t) Channel;
|
||||
//gRequestSaveVFO = true;
|
||||
gVfoConfigureMode = VFO_CONFIGURE_RELOAD;
|
||||
gVfoConfigureMode = VFO_CONFIGURE_RELOAD;
|
||||
|
||||
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
|
||||
gRemoveOffset = false;
|
||||
@@ -355,7 +366,7 @@ void channelMove(uint16_t Channel)
|
||||
#endif
|
||||
|
||||
RADIO_ConfigureChannel(gEeprom.TX_VFO, gVfoConfigureMode);
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -392,7 +403,7 @@ void channelMoveSwitch(void) {
|
||||
|
||||
channelMove(Channel - 1);
|
||||
SETTINGS_SaveVfoIndices();
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -400,18 +411,17 @@ void channelMoveSwitch(void) {
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
if (bKeyPressed) {
|
||||
if (gScreenToDisplay == DISPLAY_MAIN) {
|
||||
if (gInputBoxIndex > 0) { // delete any inputted chars
|
||||
gInputBoxIndex = 0;
|
||||
gInputBoxIndex = 0;
|
||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||
}
|
||||
|
||||
gWasFKeyPressed = false;
|
||||
gUpdateStatus = true;
|
||||
gUpdateStatus = true;
|
||||
|
||||
processFKeyFunction(Key, false);
|
||||
}
|
||||
@@ -419,21 +429,20 @@ static void MAIN_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
return;
|
||||
}
|
||||
|
||||
if (bKeyPressed)
|
||||
{ // key is pressed
|
||||
if (bKeyPressed) { // key is pressed
|
||||
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL; // beep when key is pressed
|
||||
return; // don't use the key till it's released
|
||||
}
|
||||
|
||||
if (!gWasFKeyPressed) { // F-key wasn't pressed
|
||||
|
||||
if (gScanStateDir != SCAN_OFF){
|
||||
switch(Key) {
|
||||
if (gScanStateDir != SCAN_OFF) {
|
||||
switch (Key) {
|
||||
case KEY_0...KEY_5:
|
||||
gEeprom.SCAN_LIST_DEFAULT = Key;
|
||||
#ifdef ENABLE_FEAT_F4HWN_RESUME_STATE
|
||||
SETTINGS_WriteCurrentState();
|
||||
#endif
|
||||
#ifdef ENABLE_FEAT_F4HWN_RESUME_STATE
|
||||
SETTINGS_WriteCurrentState();
|
||||
#endif
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -453,18 +462,17 @@ static void MAIN_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
|
||||
gKeyInputCountdown = (key_input_timeout_500ms / 4); // short time...
|
||||
|
||||
#ifdef ENABLE_VOICE
|
||||
gAnotherVoiceID = (VOICE_ID_t)Key;
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_VOICE
|
||||
gAnotherVoiceID = (VOICE_ID_t)Key;
|
||||
#endif
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// #ifdef ENABLE_NOAA
|
||||
// if (!IS_NOAA_CHANNEL(gTxVfo->CHANNEL_SAVE))
|
||||
// #endif
|
||||
if (IS_FREQ_CHANNEL(gTxVfo->CHANNEL_SAVE))
|
||||
{ // user is entering a frequency
|
||||
if (IS_FREQ_CHANNEL(gTxVfo->CHANNEL_SAVE)) { // user is entering a frequency
|
||||
|
||||
#ifdef ENABLE_VOICE
|
||||
gAnotherVoiceID = (VOICE_ID_t)Key;
|
||||
@@ -478,8 +486,9 @@ static void MAIN_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
// do nothing
|
||||
return;
|
||||
}
|
||||
|
||||
gKeyInputCountdown = (gInputBoxIndex == totalDigits) ? (key_input_timeout_500ms / 16) : (key_input_timeout_500ms / 3);
|
||||
|
||||
gKeyInputCountdown = (gInputBoxIndex == totalDigits) ? (key_input_timeout_500ms / 16) : (
|
||||
key_input_timeout_500ms / 3);
|
||||
|
||||
const char *inputStr = INPUTBOX_GetAscii();
|
||||
uint8_t inputLength = gInputBoxIndex;
|
||||
@@ -500,21 +509,19 @@ static void MAIN_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
// clamp the frequency entered to some valid value
|
||||
if (Frequency < frequencyBandTable[0].lower) {
|
||||
Frequency = frequencyBandTable[0].lower;
|
||||
}
|
||||
else if (Frequency >= BX4819_band1.upper && Frequency < BX4819_band2.lower) {
|
||||
} else if (Frequency >= BX4819_band1.upper && Frequency < BX4819_band2.lower) {
|
||||
const uint32_t center = (BX4819_band1.upper + BX4819_band2.lower) / 2;
|
||||
Frequency = (Frequency < center) ? BX4819_band1.upper : BX4819_band2.lower;
|
||||
}
|
||||
else if (Frequency > frequencyBandTable[BAND_N_ELEM - 1].upper) {
|
||||
} else if (Frequency > frequencyBandTable[BAND_N_ELEM - 1].upper) {
|
||||
Frequency = frequencyBandTable[BAND_N_ELEM - 1].upper;
|
||||
}
|
||||
|
||||
const FREQUENCY_Band_t band = FREQUENCY_GetBand(Frequency);
|
||||
|
||||
if (gTxVfo->Band != band) {
|
||||
gTxVfo->Band = band;
|
||||
gTxVfo->Band = band;
|
||||
gEeprom.ScreenChannel[Vfo] = band + FREQ_CHANNEL_FIRST;
|
||||
gEeprom.FreqChannel[Vfo] = band + FREQ_CHANNEL_FIRST;
|
||||
gEeprom.FreqChannel[Vfo] = band + FREQ_CHANNEL_FIRST;
|
||||
|
||||
SETTINGS_SaveVfoIndices();
|
||||
|
||||
@@ -523,8 +530,8 @@ static void MAIN_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
|
||||
Frequency = FREQUENCY_RoundToStep(Frequency, gTxVfo->StepFrequency);
|
||||
|
||||
if (Frequency >= BX4819_band1.upper && Frequency < BX4819_band2.lower)
|
||||
{ // clamp the frequency to the limit
|
||||
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;
|
||||
}
|
||||
@@ -535,50 +542,47 @@ static void MAIN_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
return;
|
||||
|
||||
}
|
||||
#ifdef ENABLE_NOAA
|
||||
else
|
||||
if (IS_NOAA_CHANNEL(gTxVfo->CHANNEL_SAVE))
|
||||
{ // user is entering NOAA channel
|
||||
if (gInputBoxIndex != 2) {
|
||||
#ifdef ENABLE_VOICE
|
||||
gAnotherVoiceID = (VOICE_ID_t)Key;
|
||||
#endif
|
||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||
return;
|
||||
}
|
||||
|
||||
gInputBoxIndex = 0;
|
||||
|
||||
uint8_t Channel = (gInputBox[0] * 10) + gInputBox[1];
|
||||
if (Channel >= 1 && Channel <= ARRAY_SIZE(NoaaFrequencyTable)) {
|
||||
Channel += NOAA_CHANNEL_FIRST;
|
||||
#ifdef ENABLE_VOICE
|
||||
gAnotherVoiceID = (VOICE_ID_t)Key;
|
||||
#endif
|
||||
gEeprom.NoaaChannel[Vfo] = Channel;
|
||||
gEeprom.ScreenChannel[Vfo] = Channel;
|
||||
gRequestSaveVFO = true;
|
||||
gVfoConfigureMode = VFO_CONFIGURE_RELOAD;
|
||||
return;
|
||||
}
|
||||
#ifdef ENABLE_NOAA
|
||||
else
|
||||
if (IS_NOAA_CHANNEL(gTxVfo->CHANNEL_SAVE))
|
||||
{ // user is entering NOAA channel
|
||||
if (gInputBoxIndex != 2) {
|
||||
#ifdef ENABLE_VOICE
|
||||
gAnotherVoiceID = (VOICE_ID_t)Key;
|
||||
#endif
|
||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
gInputBoxIndex = 0;
|
||||
|
||||
uint8_t Channel = (gInputBox[0] * 10) + gInputBox[1];
|
||||
if (Channel >= 1 && Channel <= ARRAY_SIZE(NoaaFrequencyTable)) {
|
||||
Channel += NOAA_CHANNEL_FIRST;
|
||||
#ifdef ENABLE_VOICE
|
||||
gAnotherVoiceID = (VOICE_ID_t)Key;
|
||||
#endif
|
||||
gEeprom.NoaaChannel[Vfo] = Channel;
|
||||
gEeprom.ScreenChannel[Vfo] = Channel;
|
||||
gRequestSaveVFO = true;
|
||||
gVfoConfigureMode = VFO_CONFIGURE_RELOAD;
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||
gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
||||
gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
||||
return;
|
||||
}
|
||||
|
||||
gWasFKeyPressed = false;
|
||||
gUpdateStatus = true;
|
||||
gUpdateStatus = true;
|
||||
|
||||
if(Key == 8)
|
||||
{
|
||||
if (Key == 8) {
|
||||
ACTION_BackLightOnDemand();
|
||||
return;
|
||||
}
|
||||
else if(Key == 9)
|
||||
{
|
||||
} else if (Key == 9) {
|
||||
ACTION_BackLight();
|
||||
return;
|
||||
}
|
||||
@@ -586,8 +590,7 @@ static void MAIN_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
processFKeyFunction(Key, true);
|
||||
}
|
||||
|
||||
static void MAIN_Key_EXIT(bool bKeyPressed, bool bKeyHeld)
|
||||
{
|
||||
static void MAIN_Key_EXIT(bool bKeyPressed, bool bKeyHeld) {
|
||||
if (!bKeyHeld && bKeyPressed) { // exit key pressed
|
||||
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
||||
|
||||
@@ -615,8 +618,7 @@ static void MAIN_Key_EXIT(bool bKeyPressed, bool bKeyHeld)
|
||||
if (gInputBoxIndex == 0)
|
||||
gAnotherVoiceID = VOICE_ID_CANCEL;
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
gScanKeepResult = false;
|
||||
CHFRSCANNER_Stop();
|
||||
|
||||
@@ -636,36 +638,33 @@ static void MAIN_Key_EXIT(bool bKeyPressed, bool bKeyHeld)
|
||||
}
|
||||
|
||||
if (bKeyHeld && bKeyPressed) { // exit key held down
|
||||
if (gInputBoxIndex > 0 || gDTMF_InputBox_Index > 0 || gDTMF_InputMode)
|
||||
{ // cancel key input mode (channel/frequency entry)
|
||||
gDTMF_InputMode = false;
|
||||
gDTMF_InputBox_Index = 0;
|
||||
if (gInputBoxIndex > 0 || gDTMF_InputBox_Index > 0 ||
|
||||
gDTMF_InputMode) { // cancel key input mode (channel/frequency entry)
|
||||
gDTMF_InputMode = false;
|
||||
gDTMF_InputBox_Index = 0;
|
||||
memset(gDTMF_String, 0, sizeof(gDTMF_String));
|
||||
gInputBoxIndex = 0;
|
||||
gInputBoxIndex = 0;
|
||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
||||
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void MAIN_Key_MENU(bool bKeyPressed, bool bKeyHeld)
|
||||
{
|
||||
static void MAIN_Key_MENU(bool bKeyPressed, bool bKeyHeld) {
|
||||
if (bKeyPressed && !bKeyHeld) // menu key pressed
|
||||
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
||||
|
||||
if (bKeyHeld) { // menu key held down (long press)
|
||||
if (bKeyPressed) { // long press MENU key
|
||||
|
||||
#ifdef ENABLE_FEAT_F4HWN
|
||||
#ifdef ENABLE_FEAT_F4HWN
|
||||
// Exclude work with list 1, 2, 3 or all list
|
||||
if(gScanStateDir != SCAN_OFF)
|
||||
{
|
||||
if(FUNCTION_IsRx())
|
||||
{
|
||||
if (gScanStateDir != SCAN_OFF) {
|
||||
if (FUNCTION_IsRx()) {
|
||||
gMR_ChannelExclude[gTxVfo->CHANNEL_SAVE] = true;
|
||||
|
||||
gVfoConfigureMode = VFO_CONFIGURE;
|
||||
gFlagResetVfos = true;
|
||||
gFlagResetVfos = true;
|
||||
|
||||
lastFoundFrqOrChan = lastFoundFrqOrChanOld;
|
||||
|
||||
@@ -674,18 +673,18 @@ static void MAIN_Key_MENU(bool bKeyPressed, bool bKeyHeld)
|
||||
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
gWasFKeyPressed = false;
|
||||
|
||||
if (gScreenToDisplay == DISPLAY_MAIN) {
|
||||
if (gInputBoxIndex > 0) { // delete any inputted chars
|
||||
gInputBoxIndex = 0;
|
||||
gInputBoxIndex = 0;
|
||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||
}
|
||||
|
||||
gWasFKeyPressed = false;
|
||||
gUpdateStatus = true;
|
||||
gUpdateStatus = true;
|
||||
|
||||
ACTION_Handle(KEY_MENU, bKeyPressed, bKeyHeld);
|
||||
}
|
||||
@@ -696,7 +695,7 @@ static void MAIN_Key_MENU(bool bKeyPressed, bool bKeyHeld)
|
||||
|
||||
if (!bKeyPressed && !gDTMF_InputMode) { // menu key released
|
||||
const bool bFlag = !gInputBoxIndex;
|
||||
gInputBoxIndex = 0;
|
||||
gInputBoxIndex = 0;
|
||||
|
||||
if (bFlag) {
|
||||
if (gScanStateDir != SCAN_OFF) {
|
||||
@@ -704,28 +703,26 @@ static void MAIN_Key_MENU(bool bKeyPressed, bool bKeyHeld)
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
|
||||
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
|
||||
if(gEeprom.MENU_LOCK == false) {
|
||||
#endif
|
||||
#endif
|
||||
|
||||
gFlagRefreshSetting = true;
|
||||
gRequestDisplayScreen = DISPLAY_MENU;
|
||||
#ifdef ENABLE_VOICE
|
||||
gAnotherVoiceID = VOICE_ID_MENU;
|
||||
#endif
|
||||
#ifdef ENABLE_VOICE
|
||||
gAnotherVoiceID = VOICE_ID_MENU;
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
|
||||
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
#endif
|
||||
} else {
|
||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void MAIN_Key_STAR(bool bKeyPressed, bool bKeyHeld)
|
||||
{
|
||||
static void MAIN_Key_STAR(bool bKeyPressed, bool bKeyHeld) {
|
||||
|
||||
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
|
||||
if(gEeprom.MENU_LOCK == true) {
|
||||
@@ -735,16 +732,16 @@ static void MAIN_Key_STAR(bool bKeyPressed, bool bKeyHeld)
|
||||
|
||||
if (gCurrentFunction == FUNCTION_TRANSMIT)
|
||||
return;
|
||||
|
||||
|
||||
if (gInputBoxIndex) {
|
||||
if (!bKeyHeld && bKeyPressed)
|
||||
gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
||||
return;
|
||||
}
|
||||
|
||||
if (bKeyHeld && !gWasFKeyPressed){ // long press
|
||||
if (bKeyHeld && !gWasFKeyPressed) { // long press
|
||||
if (!bKeyPressed) // released
|
||||
return;
|
||||
return;
|
||||
|
||||
/*
|
||||
#ifdef ENABLE_FEAT_F4HWN_RESUME_STATE
|
||||
@@ -768,61 +765,55 @@ static void MAIN_Key_STAR(bool bKeyPressed, bool bKeyHeld)
|
||||
if (bKeyPressed) { // just pressed
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// just released
|
||||
|
||||
|
||||
if (!gWasFKeyPressed) // pressed without the F-key
|
||||
{
|
||||
if (gScanStateDir == SCAN_OFF
|
||||
#ifdef ENABLE_NOAA
|
||||
{
|
||||
if (gScanStateDir == SCAN_OFF
|
||||
#ifdef ENABLE_NOAA
|
||||
&& !IS_NOAA_CHANNEL(gTxVfo->CHANNEL_SAVE)
|
||||
#endif
|
||||
#ifdef ENABLE_SCAN_RANGES
|
||||
#endif
|
||||
#ifdef ENABLE_SCAN_RANGES
|
||||
&& gScanRangeStart == 0
|
||||
#endif
|
||||
)
|
||||
{ // start entering a DTMF string
|
||||
#endif
|
||||
) { // start entering a DTMF string
|
||||
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
||||
memcpy(gDTMF_InputBox, gDTMF_String, MIN(sizeof(gDTMF_InputBox), sizeof(gDTMF_String) - 1));
|
||||
gDTMF_InputBox_Index = 0;
|
||||
gDTMF_InputMode = true;
|
||||
gDTMF_InputBox_Index = 0;
|
||||
gDTMF_InputMode = true;
|
||||
|
||||
gKeyInputCountdown = key_input_timeout_500ms;
|
||||
gKeyInputCountdown = key_input_timeout_500ms;
|
||||
|
||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||
}
|
||||
else
|
||||
} else
|
||||
gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
||||
}
|
||||
else
|
||||
{ // with the F-key
|
||||
} else { // with the F-key
|
||||
gWasFKeyPressed = false;
|
||||
|
||||
#ifdef ENABLE_NOAA
|
||||
if (IS_NOAA_CHANNEL(gTxVfo->CHANNEL_SAVE)) {
|
||||
gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
// scan the CTCSS/DCS code
|
||||
gBackup_CROSS_BAND_RX_TX = gEeprom.CROSS_BAND_RX_TX;
|
||||
gBackup_CROSS_BAND_RX_TX = gEeprom.CROSS_BAND_RX_TX;
|
||||
gEeprom.CROSS_BAND_RX_TX = CROSS_BAND_OFF;
|
||||
|
||||
SCANNER_Start(true);
|
||||
gRequestDisplayScreen = DISPLAY_SCANNER;
|
||||
}
|
||||
|
||||
|
||||
//gPttWasReleased = true; Fixed issue #138
|
||||
gUpdateStatus = true;
|
||||
gUpdateStatus = true;
|
||||
}
|
||||
|
||||
static void MAIN_Key_UP_DOWN(bool bKeyPressed, bool bKeyHeld, int8_t Direction)
|
||||
{
|
||||
static void MAIN_Key_UP_DOWN(bool bKeyPressed, bool bKeyHeld, int8_t Direction) {
|
||||
|
||||
#ifdef ENABLE_FEAT_F4HWN // Set Squelch F + UP or Down
|
||||
if(gWasFKeyPressed) {
|
||||
switch(Direction)
|
||||
{
|
||||
if (gWasFKeyPressed) {
|
||||
switch (Direction) {
|
||||
case 1:
|
||||
processFKeyFunction(KEY_UP, false);
|
||||
break;
|
||||
@@ -855,8 +846,7 @@ static void MAIN_Key_UP_DOWN(bool bKeyPressed, bool bKeyHeld, int8_t Direction)
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
}
|
||||
else { // short pressed
|
||||
} else { // short pressed
|
||||
if (gInputBoxIndex > 0) {
|
||||
gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
||||
return;
|
||||
@@ -907,7 +897,7 @@ static void MAIN_Key_UP_DOWN(bool bKeyPressed, bool bKeyHeld, int8_t Direction)
|
||||
}
|
||||
#endif
|
||||
|
||||
gRequestSaveVFO = true;
|
||||
gRequestSaveVFO = true;
|
||||
gVfoConfigureMode = VFO_CONFIGURE_RELOAD;
|
||||
return;
|
||||
}
|
||||
@@ -920,8 +910,13 @@ 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 updatePrevChar(KEY_Code_t Key) {
|
||||
if (Key != prevKey) {
|
||||
prevKey = Key;
|
||||
}
|
||||
}
|
||||
|
||||
void MAIN_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) {
|
||||
#ifdef ENABLE_FMRADIO
|
||||
if (gFmRadioMode && Key != KEY_PTT && Key != KEY_EXIT) {
|
||||
if (!bKeyHeld && bKeyPressed)
|
||||
@@ -932,13 +927,12 @@ void MAIN_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
|
||||
if (gDTMF_InputMode && bKeyPressed && !bKeyHeld) {
|
||||
const char Character = DTMF_GetCharacter(Key);
|
||||
if (Character != 0xFF)
|
||||
{ // add key to DTMF string
|
||||
if (Character != 0xFF) { // add key to DTMF string
|
||||
DTMF_Append(Character);
|
||||
gKeyInputCountdown = key_input_timeout_500ms;
|
||||
gKeyInputCountdown = key_input_timeout_500ms;
|
||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||
gPttWasReleased = true;
|
||||
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
||||
gPttWasReleased = true;
|
||||
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -949,31 +943,138 @@ void MAIN_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
// Key = KEY_SIDE2; // what's this doing ???
|
||||
// }
|
||||
|
||||
if (Key == KEY_9 && bKeyHeld) {
|
||||
if (bKeyPressed) {
|
||||
if (gEnteringSMS == SMS_NOT_ENTERING) {
|
||||
gEnteringSMS = SMS_ENTERING_DEST;
|
||||
updatePrevChar(Key);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (Key == KEY_MENU) {
|
||||
if (gEnteringSMS == SMS_ENTERING_DEST) {
|
||||
if (bKeyPressed) {
|
||||
memset(dataPacket.data, 0, DataPacketDataSize);
|
||||
prepareDataPacket();
|
||||
dataPacket.flags = 126;
|
||||
gEnteringSMS = SMS_ENTERING_MESSAGE;
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (gEnteringSMS == SMS_ENTERING_MESSAGE) {
|
||||
if (bKeyPressed) {
|
||||
if (strlen((char *) dataPacket.data)) {
|
||||
BK4819_ToggleGpioOut(BK4819_GPIO5_PIN1_RED, true);
|
||||
AUDIO_AudioPathOff();
|
||||
gEnableSpeaker = false;
|
||||
RADIO_PrepareTX();
|
||||
if (gCurrentVfo->SCRAMBLING_TYPE > 0)
|
||||
BK4819_EnableScramble(gCurrentVfo->SCRAMBLING_TYPE - 1);
|
||||
else
|
||||
BK4819_DisableScramble();
|
||||
MSG_FSKSendData();
|
||||
AUDIO_AudioPathOn();
|
||||
gEnableSpeaker = true;
|
||||
BK4819_ExitTxMute();
|
||||
MSG_EnableRX(true);
|
||||
gVfoConfigureMode = VFO_CONFIGURE;
|
||||
BK4819_ToggleGpioOut(BK4819_GPIO5_PIN1_RED, false);
|
||||
dataPTR = dataPacket.data;
|
||||
memset(dataPacket.data, 0, DataPacketDataSize);
|
||||
gEnteringSMS = SMS_NOT_ENTERING;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (Key == KEY_EXIT && gEnteringSMS != SMS_NOT_ENTERING) {
|
||||
if (bKeyHeld) {
|
||||
if (bKeyPressed) {
|
||||
gEnteringSMS = SMS_NOT_ENTERING;
|
||||
dataPTR = dataPacket.data;
|
||||
memset(dataPacket.data, 0, DataPacketDataSize);
|
||||
}
|
||||
} else {
|
||||
if (bKeyPressed) {
|
||||
if (gEnteringSMS == SMS_ENTERING_MESSAGE) {
|
||||
if (dataPacket.data <= dataPTR) {
|
||||
*dataPTR = '\0';
|
||||
if (dataPacket.data < dataPTR) {
|
||||
dataPTR--;
|
||||
}
|
||||
*dataPTR = '\0';
|
||||
}
|
||||
} else if (gEnteringSMS == SMS_ENTERING_DEST) {
|
||||
dataPacket.dest /= 10;
|
||||
}
|
||||
}
|
||||
}
|
||||
updatePrevChar(Key);
|
||||
return;
|
||||
}
|
||||
|
||||
if (gEnteringSMS != SMS_NOT_ENTERING && !bKeyHeld) {
|
||||
if (!dataPTR) {
|
||||
dataPTR = dataPacket.data;
|
||||
}
|
||||
if (gEnteringSMS == SMS_ENTERING_MESSAGE) {
|
||||
if (bKeyPressed) {
|
||||
if (prevKey != Key) {
|
||||
dataPTR++;
|
||||
if (dataPTR - dataPacket.data >= DataPacketDataSize) {
|
||||
dataPTR = dataPacket.data;
|
||||
}
|
||||
prevLetter = 0;
|
||||
}
|
||||
*(dataPTR - 1) = T9Table[Key][(prevLetter++) % T9Count];
|
||||
updatePrevChar(Key);
|
||||
}
|
||||
return;
|
||||
} else if (gEnteringSMS == SMS_ENTERING_DEST) {
|
||||
if (bKeyPressed) {
|
||||
dataPacket.dest *= 10;
|
||||
dataPacket.dest += Key;
|
||||
prevLetter = 0;
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
switch (Key) {
|
||||
#ifdef ENABLE_FEAT_F4HWN
|
||||
case KEY_SIDE1:
|
||||
case KEY_SIDE2:
|
||||
#endif
|
||||
case KEY_0...KEY_9:
|
||||
MAIN_Key_DIGITS(Key, bKeyPressed, bKeyHeld);
|
||||
case
|
||||
KEY_0...KEY_9
|
||||
:
|
||||
MAIN_Key_DIGITS(Key, bKeyPressed, bKeyHeld
|
||||
);
|
||||
break;
|
||||
case KEY_MENU:
|
||||
MAIN_Key_MENU(bKeyPressed, bKeyHeld);
|
||||
MAIN_Key_MENU(bKeyPressed, bKeyHeld
|
||||
);
|
||||
break;
|
||||
case KEY_UP:
|
||||
MAIN_Key_UP_DOWN(bKeyPressed, bKeyHeld, 1);
|
||||
MAIN_Key_UP_DOWN(bKeyPressed, bKeyHeld,
|
||||
1);
|
||||
break;
|
||||
case KEY_DOWN:
|
||||
MAIN_Key_UP_DOWN(bKeyPressed, bKeyHeld, -1);
|
||||
MAIN_Key_UP_DOWN(bKeyPressed, bKeyHeld,
|
||||
-1);
|
||||
break;
|
||||
case KEY_EXIT:
|
||||
MAIN_Key_EXIT(bKeyPressed, bKeyHeld);
|
||||
MAIN_Key_EXIT(bKeyPressed, bKeyHeld
|
||||
);
|
||||
break;
|
||||
case KEY_STAR:
|
||||
MAIN_Key_STAR(bKeyPressed, bKeyHeld);
|
||||
MAIN_Key_STAR(bKeyPressed, bKeyHeld
|
||||
);
|
||||
break;
|
||||
case KEY_F:
|
||||
GENERIC_Key_F(bKeyPressed, bKeyHeld);
|
||||
GENERIC_Key_F(bKeyPressed, bKeyHeld
|
||||
);
|
||||
break;
|
||||
case KEY_PTT:
|
||||
GENERIC_Key_PTT(bKeyPressed);
|
||||
|
998
app/menu.c
998
app/menu.c
File diff suppressed because it is too large
Load Diff
1132
app/spectrum.c
1132
app/spectrum.c
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user