diff --git a/doc/img/SimplePTT_plugin.png b/doc/img/SimplePTT_plugin.png index 748881e10..8cfdd0fe4 100644 Binary files a/doc/img/SimplePTT_plugin.png and b/doc/img/SimplePTT_plugin.png differ diff --git a/doc/img/SimplePTT_plugin.xcf b/doc/img/SimplePTT_plugin.xcf index af6b8a8a3..900612a03 100644 Binary files a/doc/img/SimplePTT_plugin.xcf and b/doc/img/SimplePTT_plugin.xcf differ diff --git a/doc/img/SimplePTT_vox.png b/doc/img/SimplePTT_vox.png new file mode 100644 index 000000000..19f701658 Binary files /dev/null and b/doc/img/SimplePTT_vox.png differ diff --git a/doc/img/SimplePTT_vox.xcf b/doc/img/SimplePTT_vox.xcf new file mode 100644 index 000000000..eeee8c352 Binary files /dev/null and b/doc/img/SimplePTT_vox.xcf differ diff --git a/plugins/feature/simpleptt/readme.md b/plugins/feature/simpleptt/readme.md index 6a5bf4c19..9d07da304 100644 --- a/plugins/feature/simpleptt/readme.md +++ b/plugins/feature/simpleptt/readme.md @@ -6,7 +6,7 @@ This plugin controls switchover between a Rx (Device source) and Tx (Device sink

Interface

-![File source channel plugin GUI](../../../doc/img/SimplePTT_plugin.png) +![PTT feature plugin GUI](../../../doc/img/SimplePTT_plugin.png)

1: Start/Stop plugin

@@ -24,22 +24,52 @@ This LED type display shows the current PTT status: - **Red**: Tx runs - **Grey**: None active (transient) -

4: Refresh list of devices

+

4: Vox control

+ +![PTT feature vox control](../../../doc/img/SimplePTT_vox.png) + +

4.1: Activate vox system

+ +Toggle this switch to activate or de-activate vox control. When activated the audio input level is monitored and appears in (4.5) and if the level exceeds the level set by (4.3) and displayed in (4.4) then the vox button turns green until vox goes off after the hold period (4.6). The vox system controls the PTT only if the vox PTT enable checkbox is checked (4.2). Thus you can set the appropriate level (4.3) before engaging PTT control. + +Right click on this button to open the audio input device selection dialog. + +

4.2: Enable PTT control

+ +Check this box to enable PTT control by the vox system. + +

4.3: Vox threshold level

+ +Use this button to adjust the vox threshold level in power dB (0 dB = full range) + +

4.4: Vox threshold display

+ +This is the value set by (4.3) in dB. + +

4.5: Audio input level

+ +This is the audio input level in dB displayed when the vox system is active (4.1) + +

4.6: Vox hold period

+ +The vox is held active for this amount of time in milliseconds after the audio input power goes below the threshold level (4.3) + +

5: Refresh list of devices

Use this button to refresh the list of devices (5) and (6) -

5: Select Rx device set

+

6: Select Rx device set

Use this combo to select which Rx device is controlled -

6: Select Tx device set

+

7: Select Tx device set

Use this combo to select which Tx device is controlled -

7: Transistion delay from Rx to Tx

+

8: Transistion delay from Rx to Tx

Value in milliseconds between Rx stop and Tx start -

8: Transistion delay from Tx to Rx

+

9: Transistion delay from Tx to Rx

Value in milliseconds between Tx stop and Rx start diff --git a/plugins/feature/simpleptt/simplepttgui.cpp b/plugins/feature/simpleptt/simplepttgui.cpp index 037e03b26..05785470b 100644 --- a/plugins/feature/simpleptt/simplepttgui.cpp +++ b/plugins/feature/simpleptt/simplepttgui.cpp @@ -99,9 +99,9 @@ bool SimplePTTGUI::handleMessage(const Message& message) const SimplePTTReport::MsgVox& cfg = (const SimplePTTReport::MsgVox&) message; if (cfg.getVox()) { - ui->voxLevelText->setStyleSheet("QLabel { background-color : green; }"); + ui->voxLevel->setStyleSheet("QDial { background-color : green; }"); } else { - ui->voxLevelText->setStyleSheet("QLabel { background:rgb(79,79,79); }"); + ui->voxLevel->setStyleSheet("QDial { background:rgb(79,79,79); }"); } return true; @@ -331,6 +331,13 @@ void SimplePTTGUI::on_startStop_toggled(bool checked) { if (m_doApplySettings) { + if (checked) + { + updateDeviceSetLists(); + displaySettings(); + applySettings(); + } + SimplePTT::MsgStartStop *message = SimplePTT::MsgStartStop::create(checked); m_simplePTT->getInputMessageQueue()->push(message); } @@ -393,7 +400,7 @@ void SimplePTTGUI::on_voxEnable_clicked(bool checked) void SimplePTTGUI::on_voxLevel_valueChanged(int value) { m_settings.m_voxLevel = value; - ui->voxLevelText->setText(tr("%1dB").arg(m_settings.m_voxLevel)); + ui->voxLevelText->setText(tr("%1").arg(m_settings.m_voxLevel)); applySettings(); } @@ -453,6 +460,7 @@ void SimplePTTGUI::applyPTT(bool tx) { if (m_doApplySettings) { + qDebug("SimplePTTGUI::applyPTT: %s", tx ? "tx" : "rx"); SimplePTT::MsgPTT* message = SimplePTT::MsgPTT::create(tx); m_simplePTT->getInputMessageQueue()->push(message); } diff --git a/plugins/feature/simpleptt/simplepttgui.ui b/plugins/feature/simpleptt/simplepttgui.ui index 92999e4be..619aaf38a 100644 --- a/plugins/feature/simpleptt/simplepttgui.ui +++ b/plugins/feature/simpleptt/simplepttgui.ui @@ -243,10 +243,10 @@ Vox delay (ms) - 200 + 500 - 2000 + 5000 100 diff --git a/plugins/feature/simpleptt/simplepttworker.cpp b/plugins/feature/simpleptt/simplepttworker.cpp index 9bb19b484..29e97f6ae 100644 --- a/plugins/feature/simpleptt/simplepttworker.cpp +++ b/plugins/feature/simpleptt/simplepttworker.cpp @@ -106,7 +106,7 @@ bool SimplePTTWorker::handleMessage(const Message& cmd) else if (MsgPTT::match(cmd)) { MsgPTT& cfg = (MsgPTT&) cmd; - qDebug() << "SimplePTTWorker::handleMessage: MsgPTT"; + qDebug() << "SimplePTTWorker::handleMessage: MsgPTT tx:" << cfg.getTx(); sendPTT(cfg.getTx()); @@ -142,6 +142,8 @@ void SimplePTTWorker::applySettings(const SimplePTTSettings& settings, bool forc audioDeviceManager->removeAudioSource(&m_audioFifo); audioDeviceManager->addAudioSource(&m_audioFifo, getInputMessageQueue(), audioDeviceIndex); m_audioSampleRate = audioDeviceManager->getInputSampleRate(audioDeviceIndex); + m_voxHoldCount = 0; + m_voxState = false; } if ((settings.m_vox != m_settings.m_vox) || force) @@ -174,6 +176,7 @@ void SimplePTTWorker::applySettings(const SimplePTTSettings& settings, bool forc void SimplePTTWorker::sendPTT(bool tx) { + qDebug("SimplePTTWorker::sendPTT: %s", tx ? "tx" : "rx"); if (!m_updateTimer.isActive()) { bool switchedOff = false; @@ -218,6 +221,7 @@ void SimplePTTWorker::sendPTT(bool tx) void SimplePTTWorker::updateHardware() { + qDebug("SimplePTTWorker::updateHardware: m_tx: %s", m_tx ? "on" : "off"); SWGSDRangel::SWGSuccessResponse response; SWGSDRangel::SWGErrorResponse error; m_updateTimer.stop(); @@ -240,6 +244,7 @@ void SimplePTTWorker::updateHardware() bool SimplePTTWorker::turnDevice(bool on) { + qDebug("SimplePTTWorker::turnDevice %s: %s", m_tx ? "tx" : "rx", on ? "on" : "off"); SWGSDRangel::SWGDeviceState response; SWGSDRangel::SWGErrorResponse error; int httpCode; @@ -254,6 +259,7 @@ bool SimplePTTWorker::turnDevice(bool on) if (httpCode/100 == 2) { + qDebug("SimplePTTWorker::turnDevice: %s success", on ? "on" : "off"); return true; } else @@ -278,9 +284,9 @@ void SimplePTTWorker::handleAudio() { bool voxState = m_voxState; - for (const auto &it : m_audioReadBuffer) + for (unsigned int i = 0; i < m_audioReadBufferFill; i++) { - std::complex za{it.l / 32768.0f, it.r / 32768.0f}; + std::complex za{m_audioReadBuffer[i].l / 46334.0f, m_audioReadBuffer[i].r / 46334.0f}; float magSq = std::norm(za); if (magSq > m_audioMagsqPeak) {