Added support for 1750Hz squelch tone, implemented squelch tone in UV-3x0 radio driver.
When pressing the Hash key and the PTT key in FM mode a 1750 Hz tone is transmitted
This commit is contained in:
parent
73bfc2a15d
commit
77e0ad27a0
|
|
@ -50,6 +50,7 @@ typedef struct
|
||||||
bool bank_enabled;
|
bool bank_enabled;
|
||||||
uint16_t bank;
|
uint16_t bank;
|
||||||
uint8_t rtxStatus;
|
uint8_t rtxStatus;
|
||||||
|
bool tone_enabled;
|
||||||
|
|
||||||
bool emergency;
|
bool emergency;
|
||||||
settings_t settings;
|
settings_t settings;
|
||||||
|
|
|
||||||
|
|
@ -52,6 +52,8 @@ typedef struct
|
||||||
uint16_t txToneEn : 1, /**< TX CTC/DCS tone enable */
|
uint16_t txToneEn : 1, /**< TX CTC/DCS tone enable */
|
||||||
txTone : 15; /**< TX CTC/DCS tone */
|
txTone : 15; /**< TX CTC/DCS tone */
|
||||||
|
|
||||||
|
bool toneEn;
|
||||||
|
|
||||||
uint8_t can : 4, /**< M17 Channel Access Number */
|
uint8_t can : 4, /**< M17 Channel Access Number */
|
||||||
canRxEn : 1, /**< M17 Check CAN on RX */
|
canRxEn : 1, /**< M17 Check CAN on RX */
|
||||||
_unused : 3;
|
_unused : 3;
|
||||||
|
|
|
||||||
|
|
@ -98,6 +98,7 @@ void *ui_threadFunc(void *arg)
|
||||||
rtx_cfg.rxTone = ctcss_tone[state.channel.fm.rxTone];
|
rtx_cfg.rxTone = ctcss_tone[state.channel.fm.rxTone];
|
||||||
rtx_cfg.txToneEn = state.channel.fm.txToneEn;
|
rtx_cfg.txToneEn = state.channel.fm.txToneEn;
|
||||||
rtx_cfg.txTone = ctcss_tone[state.channel.fm.txTone];
|
rtx_cfg.txTone = ctcss_tone[state.channel.fm.txTone];
|
||||||
|
rtx_cfg.toneEn = state.tone_enabled;
|
||||||
|
|
||||||
// Enable Tx if channel allows it and we are in UI main screen
|
// Enable Tx if channel allows it and we are in UI main screen
|
||||||
rtx_cfg.txDisable = state.channel.rx_only || state.txDisable;
|
rtx_cfg.txDisable = state.channel.rx_only || state.txDisable;
|
||||||
|
|
|
||||||
|
|
@ -1319,6 +1319,12 @@ void ui_updateFSM(bool *sync_rtx)
|
||||||
}
|
}
|
||||||
#endif // PLA%FORM_TTWRPLUS
|
#endif // PLA%FORM_TTWRPLUS
|
||||||
|
|
||||||
|
if(state.tone_enabled && !(msg.keys & KEY_HASH))
|
||||||
|
{
|
||||||
|
state.tone_enabled = false;
|
||||||
|
*sync_rtx = true;
|
||||||
|
}
|
||||||
|
|
||||||
int priorUIScreen = state.ui_screen;
|
int priorUIScreen = state.ui_screen;
|
||||||
switch(state.ui_screen)
|
switch(state.ui_screen)
|
||||||
{
|
{
|
||||||
|
|
@ -1403,6 +1409,14 @@ void ui_updateFSM(bool *sync_rtx)
|
||||||
vp_announceM17Info(NULL, ui_state.edit_mode,
|
vp_announceM17Info(NULL, ui_state.edit_mode,
|
||||||
queueFlags);
|
queueFlags);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(!state.tone_enabled)
|
||||||
|
{
|
||||||
|
state.tone_enabled = true;
|
||||||
|
*sync_rtx = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if(msg.keys & KEY_UP || msg.keys & KNOB_RIGHT)
|
else if(msg.keys & KEY_UP || msg.keys & KNOB_RIGHT)
|
||||||
{
|
{
|
||||||
|
|
@ -1585,6 +1599,14 @@ void ui_updateFSM(bool *sync_rtx)
|
||||||
// Reset text input variables
|
// Reset text input variables
|
||||||
_ui_textInputReset(ui_state.new_callsign);
|
_ui_textInputReset(ui_state.new_callsign);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(!state.tone_enabled)
|
||||||
|
{
|
||||||
|
state.tone_enabled = true;
|
||||||
|
*sync_rtx = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if(msg.keys & KEY_F1)
|
else if(msg.keys & KEY_F1)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -142,6 +142,25 @@ public:
|
||||||
maskSetRegister(0x30, 0x0060, value);
|
maskSetRegister(0x30, 0x0060, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Setup and enable tone output
|
||||||
|
* @param freq frequency in 1/10 Hz
|
||||||
|
*/
|
||||||
|
void enableTone(const tone_t freq)
|
||||||
|
{
|
||||||
|
i2c_writeReg16(0x35, freq); // Set tone 1 freq
|
||||||
|
maskSetRegister(0x3A, 0x7000, 0x1000); // Use tone 1
|
||||||
|
maskSetRegister(0x79, 0xF000, 0xC000); // Enable tone output
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Change output back to microphone
|
||||||
|
*/
|
||||||
|
void disableTone()
|
||||||
|
{
|
||||||
|
maskSetRegister(0x3A, 0x7000, 0x4000); // Use microphone
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enable the CTCSS tone for transmission.
|
* Enable the CTCSS tone for transmission.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -262,6 +262,11 @@ void radio_enableTx()
|
||||||
at1846s.enableTxCtcss(config->txTone);
|
at1846s.enableTxCtcss(config->txTone);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (config->toneEn)
|
||||||
|
{
|
||||||
|
at1846s.enableTone(17500);
|
||||||
|
}
|
||||||
|
|
||||||
radioStatus = TX;
|
radioStatus = TX;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -279,6 +284,7 @@ void radio_disableRtx()
|
||||||
C6000.stopAnalogTx();
|
C6000.stopAnalogTx();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
at1846s.disableTone();
|
||||||
at1846s.disableCtcss();
|
at1846s.disableCtcss();
|
||||||
at1846s.setFuncMode(AT1846S_FuncMode::OFF);
|
at1846s.setFuncMode(AT1846S_FuncMode::OFF);
|
||||||
radioStatus = OFF;
|
radioStatus = OFF;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue