kopia lustrzana https://github.com/OpenRTX/OpenRTX
Remove SPS
Now M17_SAPLES_PER_SYMBOL is computed dinamically from sample rate. TG-81pull/68/head
rodzic
a091bca35f
commit
ae26cca46f
|
@ -99,12 +99,12 @@ private:
|
|||
* our input buffer contains half M17 frame.
|
||||
*/
|
||||
// TODO: Select correct RRC filter according to sample rate
|
||||
static constexpr size_t M17_RX_SAMPLE_RATE = 24000;
|
||||
static constexpr size_t M17_SYMBOL_RATE = 4800;
|
||||
static constexpr size_t M17_FRAME_SAMPLES_24K = 960;
|
||||
static constexpr size_t M17_FRAME_SYMBOLS = 192;
|
||||
static constexpr size_t M17_SYNCWORD_SYMBOLS = 8;
|
||||
static constexpr size_t M17_CONV_THRESHOLD = 50000;
|
||||
static constexpr size_t M17_SAMPLES_PER_SYMBOL = M17_SPS;
|
||||
static constexpr size_t M17_SAMPLES_PER_SYMBOL = M17_RX_SAMPLE_RATE / M17_SYMBOL_RATE;
|
||||
static constexpr size_t M17_INPUT_BUF_SIZE = M17_FRAME_SAMPLES_24K / 2;
|
||||
static constexpr size_t M17_FRAME_BYTES = M17_FRAME_SYMBOLS / 4;
|
||||
static constexpr float conv_stats_alpha = 0.0001f;
|
||||
|
|
|
@ -140,6 +140,6 @@
|
|||
#define GPS_DATA GPIOD,9
|
||||
|
||||
/* M17 demodulation */
|
||||
#define M17_SPS 5
|
||||
#define M17_RX_SAMPLE_RATE 24000
|
||||
|
||||
#endif
|
||||
|
|
|
@ -84,6 +84,6 @@
|
|||
#define SOFTPOT_TX 0x2F
|
||||
|
||||
/* M17 demodulation */
|
||||
#define M17_SPS 5
|
||||
#define M17_RX_SAMPLE_RATE 24000
|
||||
|
||||
#endif
|
||||
|
|
|
@ -56,4 +56,4 @@
|
|||
#define PTT_SW "PTT_SW",11
|
||||
|
||||
/* M17 demodulation */
|
||||
#define M17_SPS 10
|
||||
#define M17_RX_SAMPLE_RATE 48000
|
||||
|
|
|
@ -92,7 +92,7 @@ int main()
|
|||
fprintf(output_csv_1, "Input,RRCSignal,LSFConvolution,FrameConvolution,Stddev\n");
|
||||
// Test convolution
|
||||
m17Demodulator.resetCorrelationStats();
|
||||
for(unsigned i = 0; i < baseband_samples - m17Demodulator.M17_SYNCWORD_SYMBOLS * M17_SPS; i++)
|
||||
for(unsigned i = 0; i < baseband_samples - m17Demodulator.M17_SYNCWORD_SYMBOLS * m17Demodulator.M17_SAMPLES_PER_SYMBOL; i++)
|
||||
{
|
||||
int32_t lsf_conv =
|
||||
m17Demodulator.convolution(i,
|
||||
|
@ -125,7 +125,7 @@ int main()
|
|||
int expected_syncword = 0;
|
||||
fscanf(syncword_ref, "%d\n", &expected_syncword);
|
||||
syncword = m17Demodulator.nextFrameSync(offset);
|
||||
offset = syncword.index + m17Demodulator.M17_SYNCWORD_SYMBOLS * M17_SPS;
|
||||
offset = syncword.index + m17Demodulator.M17_SYNCWORD_SYMBOLS * m17Demodulator.M17_SAMPLES_PER_SYMBOL;
|
||||
//printf("%d\n", syncword.index);
|
||||
if (syncword.index != expected_syncword)
|
||||
{
|
||||
|
@ -147,14 +147,14 @@ int main()
|
|||
syncword = { -1, false };
|
||||
m17Demodulator.resetCorrelationStats();
|
||||
syncword = m17Demodulator.nextFrameSync(offset);
|
||||
for(unsigned i = 0; i < baseband_samples - m17Demodulator.M17_SYNCWORD_SYMBOLS * M17_SPS; i++)
|
||||
for(unsigned i = 0; i < baseband_samples - m17Demodulator.M17_SYNCWORD_SYMBOLS * m17Demodulator.M17_SAMPLES_PER_SYMBOL; i++)
|
||||
{
|
||||
if ((int) i == syncword.index + 2) {
|
||||
if (syncword.lsf)
|
||||
detect = -40000;
|
||||
else
|
||||
detect = 40000;
|
||||
syncword = m17Demodulator.nextFrameSync(syncword.index + m17Demodulator.M17_SYNCWORD_SYMBOLS * M17_SPS);
|
||||
syncword = m17Demodulator.nextFrameSync(syncword.index + m17Demodulator.M17_SYNCWORD_SYMBOLS * m17Demodulator.M17_SAMPLES_PER_SYMBOL);
|
||||
} else if (((int) i % 10) == ((syncword.index + 2) % 10)) {
|
||||
m17Demodulator.updateQuantizationStats(i);
|
||||
symbol = m17Demodulator.quantize(i) * 10000;
|
||||
|
@ -228,7 +228,6 @@ int main()
|
|||
}
|
||||
printf("Failed decoding %d/%d bytes!\n", failed_bytes, total_bytes);
|
||||
|
||||
// TODO: keep aside end of last buffer and use at beginning of the next buffer
|
||||
// TODO: when stream is over pad with zeroes to avoid corrupting the last symbols
|
||||
|
||||
m17Demodulator.baseband = old_baseband;
|
||||
|
|
Ładowanie…
Reference in New Issue