Skip to content

Commit b35a2f5

Browse files
committed
BUGFIX: fix issue with CTS COR blocking VOX audio even when not enabled;
1 parent 274a8f2 commit b35a2f5

1 file changed

Lines changed: 21 additions & 18 deletions

File tree

src/bridge/HostBridge.cpp

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -973,14 +973,6 @@ bool HostBridge::readParams()
973973
m_ctsCorPort = systemConf["ctsCorPort"].as<std::string>("/dev/ttyUSB0");
974974
m_ctsCorInvert = systemConf["ctsCorInvert"].as<bool>(false);
975975
m_ctsCorHoldoffMs = (uint32_t)systemConf["ctsCorHoldoffMs"].as<uint32_t>(m_ctsCorHoldoffMs);
976-
977-
if (m_ctsCorEnable) {
978-
LogInfo("CTS COR Configuration");
979-
LogInfo(" Enabled: yes");
980-
LogInfo(" Port: %s", m_ctsCorPort.c_str());
981-
LogInfo(" Invert: %s (%s triggers)", m_ctsCorInvert ? "yes" : "no", m_ctsCorInvert ? "LOW" : "HIGH");
982-
LogInfo(" Holdoff: %u ms", m_ctsCorHoldoffMs);
983-
}
984976

985977
std::string txModeStr = "DMR";
986978
if (m_txMode == TX_MODE_P25)
@@ -1012,6 +1004,12 @@ bool HostBridge::readParams()
10121004
LogInfo(" RTS PTT Port: %s", m_rtsPttPort.c_str());
10131005
LogInfo(" RTS PTT Hold-off: %ums", m_rtsPttHoldoffMs);
10141006
}
1007+
LogInfo(" CTS COR Enable: %s", m_ctsCorEnable ? "yes" : "no");
1008+
if (m_ctsCorEnable) {
1009+
LogInfo(" CTS COR Port: %s", m_ctsCorPort.c_str());
1010+
LogInfo(" CTS COR Invert: %s (%s triggers)", m_ctsCorInvert ? "yes" : "no", m_ctsCorInvert ? "LOW" : "HIGH");
1011+
LogInfo(" CTS COR Holdoff: %u ms", m_ctsCorHoldoffMs);
1012+
}
10151013

10161014
if (m_debug) {
10171015
LogInfo(" Debug: yes");
@@ -3097,17 +3095,22 @@ void* HostBridge::threadAudioProcess(void* arg)
30973095
// When COR is active, we need to send frames continuously when audio data is available
30983096
// The audio callback should be continuously feeding data, so we should always have data available
30993097
bool hasAudioData = bridge->m_inputAudio.dataSize() >= AUDIO_SAMPLES_LENGTH;
3100-
3101-
// Process if we have audio data
3102-
// When COR is active: process whenever we have data (which should be continuous)
3103-
// When COR is not active: only process when VOX detects audio (normal mode)
31043098
bool shouldProcess = false;
3105-
if (bridge->m_ctsCorActive && bridge->m_audioDetect) {
3106-
// COR is active: process whenever we have audio data (continuous transmission)
3107-
shouldProcess = hasAudioData;
3108-
} else if (!bridge->m_ctsCorActive && bridge->m_audioDetect) {
3109-
// Normal VOX mode: process when we have audio data
3110-
shouldProcess = hasAudioData;
3099+
3100+
if (!bridge->m_ctsCorEnable)
3101+
shouldProcess = true;
3102+
else {
3103+
// When COR is active: process whenever we have data (which should be continuous)
3104+
// When COR is not active: only process when VOX detects audio (normal mode)
3105+
if (bridge->m_ctsCorActive && bridge->m_audioDetect) {
3106+
// COR is active: process whenever we have audio data (continuous transmission)
3107+
shouldProcess = hasAudioData;
3108+
3109+
}
3110+
else if (!bridge->m_ctsCorActive && bridge->m_audioDetect) {
3111+
// Normal VOX mode: process when we have audio data
3112+
shouldProcess = hasAudioData;
3113+
}
31113114
}
31123115

31133116
if (shouldProcess && hasAudioData) {

0 commit comments

Comments
 (0)