Tmep fix for #37, corrupts slow data, needs improvment

feature/IPV6_#35_Reboot
Geoffrey Merck 3 years ago
parent 08f96bc8af
commit 181d314ed5

@ -132,7 +132,9 @@ bool CVoiceTransmit::run()
header->setRptCall2(m_callsign); header->setRptCall2(m_callsign);
header->setDestination(address, G2_DV_PORT); header->setDestination(address, G2_DV_PORT);
if(!m_text.empty()) { bool overrideSlowData = !m_text.empty();
if(overrideSlowData) {
slowData = new CSlowDataEncoder(); slowData = new CSlowDataEncoder();
slowData->setHeaderData(*header); slowData->setHeaderData(*header);
if(!m_text.empty()) slowData->setTextData(m_text); if(!m_text.empty()) slowData->setTextData(m_text);
@ -152,6 +154,8 @@ bool CVoiceTransmit::run()
while (loop) { while (loop) {
unsigned int needed = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::high_resolution_clock::now() - start).count(); unsigned int needed = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::high_resolution_clock::now() - start).count();
needed /= DSTAR_FRAME_TIME_MS; needed /= DSTAR_FRAME_TIME_MS;
unsigned char buffer[DV_FRAME_LENGTH_BYTES];
unsigned char slowDataBuffer[DATA_FRAME_LENGTH_BYTES];
while (out < needed) { while (out < needed) {
CAMBEData* ambe = m_store->getAMBE(); CAMBEData* ambe = m_store->getAMBE();
@ -172,19 +176,23 @@ bool CVoiceTransmit::run()
break; break;
} }
if(slowData != nullptr) { // Override slowdata if specified so ambe->getData(buffer, DV_FRAME_LENGTH_BYTES);
unsigned char buffer[DV_FRAME_LENGTH_BYTES]; if(overrideSlowData) { // Override slowdata if specified so
ambe->getData(buffer, DV_FRAME_LENGTH_BYTES);
// Insert sync bytes when the sequence number is zero, slow data otherwise // Insert sync bytes when the sequence number is zero, slow data otherwise
if (seqNo == 0U) { if (seqNo == 0U) {
::memcpy(buffer + VOICE_FRAME_LENGTH_BYTES, DATA_SYNC_BYTES, DATA_FRAME_LENGTH_BYTES); ::memcpy(buffer + VOICE_FRAME_LENGTH_BYTES, DATA_SYNC_BYTES, DATA_FRAME_LENGTH_BYTES);
} else { } else {
slowData->getInterleavedData(buffer + VOICE_FRAME_LENGTH_BYTES); slowData->getInterleavedData(buffer + VOICE_FRAME_LENGTH_BYTES);
} }
ambe->setData(buffer, DV_FRAME_LENGTH_BYTES); ambe->setData(buffer, DV_FRAME_LENGTH_BYTES);
} }
else {
if(seqNo == 0U) {
::memcpy(slowDataBuffer, buffer + VOICE_FRAME_LENGTH_BYTES, DATA_FRAME_LENGTH_BYTES);
::memcpy(buffer + VOICE_FRAME_LENGTH_BYTES, DATA_SYNC_BYTES, DATA_FRAME_LENGTH_BYTES);
ambe->setData(buffer, DV_FRAME_LENGTH_BYTES);
}
}
ambe->setSeq(seqNo); ambe->setSeq(seqNo);
ambe->setDestination(address, G2_DV_PORT); ambe->setDestination(address, G2_DV_PORT);

Loading…
Cancel
Save

Powered by TurnKey Linux.