wip : info about Rx protocol

This commit is contained in:
Georgi Gerganov
2020-12-05 14:06:45 +02:00
parent cf35ed33c9
commit 1ee4274c48
2 changed files with 13 additions and 6 deletions

View File

@@ -77,6 +77,7 @@ public:
const TxProtocols & getTxProtocols() const { return kTxProtocols; }
const TxRxData & getRxData() const { return m_rxData; }
const TxProtocol & getRxProtocol() const { return m_rxProtocol; }
int takeRxData(TxRxData & dst);
private:
@@ -106,14 +107,11 @@ private:
const int m_encodedDataOffset;
// Rx
bool m_hasNewRxData;
bool m_receivingData;
bool m_analyzingData;
int m_markerFreqStart;
int m_recvDuration_frames;
int m_lastRxDataLength;
int m_framesLeftToAnalyze;
int m_framesLeftToRecord;
@@ -126,7 +124,10 @@ private:
AmplitudeData m_sampleAmplitude;
SpectrumData m_sampleSpectrum;
bool m_hasNewRxData;
int m_lastRxDataLength;
TxRxData m_rxData;
TxProtocol m_rxProtocol;
int m_historyId = 0;
AmplitudeData m_sampleAmplitudeAverage;

View File

@@ -423,6 +423,7 @@ void GGWave::receive(const CBDequeueAudio & CBDequeueAudio) {
const int stepsPerFrame = 16;
const int step = m_samplesPerFrame/stepsPerFrame;
int lastRSLength = -1;
std::unique_ptr<RS::ReedSolomon> rsData;
bool isValid = false;
@@ -468,7 +469,7 @@ void GGWave::receive(const CBDequeueAudio & CBDequeueAudio) {
uint8_t curByte = 0;
for (int i = 0; i < 2*rxProtocol.bytesPerTx; ++i) {
double freq = m_hzPerSample*rxProtocol.freqStart;
int bin = std::round(freq*m_ihzPerSample) + i*16;
int bin = std::round(freq*m_ihzPerSample) + 16*i;
int kmax = 0;
double amax = 0.0;
@@ -498,9 +499,13 @@ void GGWave::receive(const CBDequeueAudio & CBDequeueAudio) {
}
if (knownLength) {
rsData.reset(new RS::ReedSolomon(m_rxData[0], ::getECCBytesForLength(m_rxData[0])));
int decodedLength = m_rxData[0];
if (decodedLength != lastRSLength) {
rsData.reset(new RS::ReedSolomon(decodedLength, ::getECCBytesForLength(decodedLength)));
lastRSLength = decodedLength;
}
if (rsData->Decode(m_txDataEncoded.data() + m_encodedDataOffset, m_rxData.data()) == 0) {
if (m_rxData[0] != 0) {
std::string s((char *) m_rxData.data(), decodedLength);
@@ -511,6 +516,7 @@ void GGWave::receive(const CBDequeueAudio & CBDequeueAudio) {
isValid = true;
m_hasNewRxData = true;
m_lastRxDataLength = decodedLength;
m_rxProtocol = rxProtocol;
}
}
}