fec::{self, p_1, p_2, p_3},
interleave::interleave,
protocol::{
- LsfFrame, PacketFrame, PacketFrameCounter, StreamFrame, BERT_SYNC, LSF_SYNC, PACKET_SYNC,
- STREAM_SYNC,
+ LsfFrame, PacketFrame, PacketFrameCounter, StreamFrame, BERT_SYNC, END_OF_TRANSMISSION,
+ LSF_SYNC, PACKET_SYNC, PREAMBLE, STREAM_SYNC,
},
random::random_xor,
};
Bert,
Stream,
Packet,
+ Preamble,
+ EndOfTransmission,
}
impl SyncBurst {
Self::Bert => BERT_SYNC,
Self::Stream => STREAM_SYNC,
Self::Packet => PACKET_SYNC,
+ Self::Preamble => PREAMBLE,
+ Self::EndOfTransmission => END_OF_TRANSMISSION,
}
}
}
let mut pos_max: f32 = f32::MIN;
let mut neg_max: f32 = f32::MAX;
for i in 0..8 {
- pos_max = pos_max.max(samples[i * 10]);
- neg_max = neg_max.min(samples[i * 10]);
+ pos_max = pos_max.max(samples[i]);
+ neg_max = neg_max.min(samples[i]);
}
let gain = (pos_max - neg_max) / 2.0;
let shift = pos_max + neg_max;
let mut diff = 0.0;
for i in 0..8 {
- let sym_diff = (((samples[i * 10] - shift) / gain) - target[i] as f32).abs();
+ let sym_diff = (((samples[i] - shift) / gain) - target[i] as f32).abs();
if sym_diff > SYNC_BIT_THRESHOLD {
return (f32::MAX, gain, shift);
}