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
pull/193/head
marco 2023-07-01 19:24:43 +02:00 zatwierdzone przez Silvano Seva
rodzic 73bfc2a15d
commit 77e0ad27a0
6 zmienionych plików z 51 dodań i 0 usunięć

Wyświetl plik

@ -50,6 +50,7 @@ typedef struct
bool bank_enabled;
uint16_t bank;
uint8_t rtxStatus;
bool tone_enabled;
bool emergency;
settings_t settings;

Wyświetl plik

@ -52,6 +52,8 @@ typedef struct
uint16_t txToneEn : 1, /**< TX CTC/DCS tone enable */
txTone : 15; /**< TX CTC/DCS tone */
bool toneEn;
uint8_t can : 4, /**< M17 Channel Access Number */
canRxEn : 1, /**< M17 Check CAN on RX */
_unused : 3;

Wyświetl plik

@ -98,6 +98,7 @@ void *ui_threadFunc(void *arg)
rtx_cfg.rxTone = ctcss_tone[state.channel.fm.rxTone];
rtx_cfg.txToneEn = state.channel.fm.txToneEn;
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
rtx_cfg.txDisable = state.channel.rx_only || state.txDisable;

Wyświetl plik

@ -1319,6 +1319,12 @@ void ui_updateFSM(bool *sync_rtx)
}
#endif // PLA%FORM_TTWRPLUS
if(state.tone_enabled && !(msg.keys & KEY_HASH))
{
state.tone_enabled = false;
*sync_rtx = true;
}
int priorUIScreen = state.ui_screen;
switch(state.ui_screen)
{
@ -1403,6 +1409,14 @@ void ui_updateFSM(bool *sync_rtx)
vp_announceM17Info(NULL, ui_state.edit_mode,
queueFlags);
}
else
{
if(!state.tone_enabled)
{
state.tone_enabled = true;
*sync_rtx = true;
}
}
}
else if(msg.keys & KEY_UP || msg.keys & KNOB_RIGHT)
{
@ -1585,6 +1599,14 @@ void ui_updateFSM(bool *sync_rtx)
// Reset text input variables
_ui_textInputReset(ui_state.new_callsign);
}
else
{
if(!state.tone_enabled)
{
state.tone_enabled = true;
*sync_rtx = true;
}
}
}
else if(msg.keys & KEY_F1)
{

Wyświetl plik

@ -142,6 +142,25 @@ public:
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.
*

Wyświetl plik

@ -262,6 +262,11 @@ void radio_enableTx()
at1846s.enableTxCtcss(config->txTone);
}
if (config->toneEn)
{
at1846s.enableTone(17500);
}
radioStatus = TX;
}
@ -279,6 +284,7 @@ void radio_disableRtx()
C6000.stopAnalogTx();
}
at1846s.disableTone();
at1846s.disableCtcss();
at1846s.setFuncMode(AT1846S_FuncMode::OFF);
radioStatus = OFF;