Browse Source

meshtastic: add one-shot FIFO timing adjustment

Add a pending sample adjustment to the next FIFO consumption and clear it after use or frame reset. Nothing sets a nonzero adjustment yet, so decoding behavior is unchanged.
chirpmodem-v8.0.0
jvn314 2 months ago
parent
commit
10980324dc
  1. 6
      plugins/channelrx/demodmeshtastic/meshtasticdemodsink.cpp
  2. 1
      plugins/channelrx/demodmeshtastic/meshtasticdemodsink.h

6
plugins/channelrx/demodmeshtastic/meshtasticdemodsink.cpp

@ -65,6 +65,7 @@ MeshtasticDemodSink::MeshtasticDemodSink() : @@ -65,6 +65,7 @@ MeshtasticDemodSink::MeshtasticDemodSink() :
m_loRaFrameSymbolCount(0),
m_loRaCFOFrac(0.0f),
m_loRaSTOFrac(0.0f),
m_loRaPendingShift(0),
m_loRaSFOHat(0.0f),
m_loRaSFOCum(0.0f),
m_loRaCFOSTOEstimated(false),
@ -535,6 +536,7 @@ void MeshtasticDemodSink::resetLoRaFrameSync() @@ -535,6 +536,7 @@ void MeshtasticDemodSink::resetLoRaFrameSync()
m_loRaAdditionalUpchirps = 0;
m_loRaCFOFrac = 0.0f;
m_loRaSTOFrac = 0.0f;
m_loRaPendingShift = 0;
m_loRaSFOHat = 0.0f;
m_loRaSFOCum = 0.0f;
m_loRaCFOSTOEstimated = false;
@ -808,6 +810,10 @@ void MeshtasticDemodSink::processSampleLoRa(const Complex& ci) @@ -808,6 +810,10 @@ void MeshtasticDemodSink::processSampleLoRa(const Complex& ci)
int consumed = processLoRaFrameSyncStep();
// Apply a one-shot adjustment requested by the step just processed.
consumed += m_loRaPendingShift;
m_loRaPendingShift = 0;
if (consumed <= 0) {
consumed = 1;
}

1
plugins/channelrx/demodmeshtastic/meshtasticdemodsink.h

@ -147,6 +147,7 @@ private: @@ -147,6 +147,7 @@ private:
unsigned int m_loRaFrameSymbolCount;
float m_loRaCFOFrac;
float m_loRaSTOFrac;
int m_loRaPendingShift; //!< Extra FIFO samples to consume once after the current step
float m_loRaSFOHat;
float m_loRaSFOCum;
bool m_loRaCFOSTOEstimated;

Loading…
Cancel
Save