Removed all traces of the parameters on the POGSAG config message

Left in the message for the moment, because there are likely to be parameters needed at some point.
This commit is contained in:
heurist1 2021-10-22 18:11:50 +01:00
parent 6ef24ce71c
commit 318720f364
8 changed files with 20 additions and 85 deletions

View File

@ -123,7 +123,7 @@ POCSAGAppView::POCSAGAppView(NavigationView& nav) {
audio::output::start(); audio::output::start();
audio::output::unmute(); audio::output::unmute();
baseband::set_pocsag(pocsag::BitRate::FSK1200, true); baseband::set_pocsag();
} }
POCSAGAppView::~POCSAGAppView() { POCSAGAppView::~POCSAGAppView() {

View File

@ -236,11 +236,8 @@ void set_fsk_data(const uint32_t stream_length, const uint32_t samples_per_bit,
send_message(&message); send_message(&message);
} }
void set_pocsag(const pocsag::BitRate bitrate, bool phase) { void set_pocsag() {
const POCSAGConfigureMessage message { const POCSAGConfigureMessage message {};
bitrate,
phase
};
send_message(&message); send_message(&message);
} }

View File

@ -79,7 +79,7 @@ void set_ook_data(const uint32_t stream_length, const uint32_t samples_per_bit,
const uint32_t pause_symbols); const uint32_t pause_symbols);
void set_fsk_data(const uint32_t stream_length, const uint32_t samples_per_bit, const uint32_t shift, void set_fsk_data(const uint32_t stream_length, const uint32_t samples_per_bit, const uint32_t shift,
const uint32_t progress_notice); const uint32_t progress_notice);
void set_pocsag(const pocsag::BitRate bitrate, bool phase); void set_pocsag();
void set_adsb(); void set_adsb();
void set_jammer(const bool run, const jammer::JammerType type, const uint32_t speed); void set_jammer(const bool run, const jammer::JammerType type, const uint32_t speed);
void set_rds_data(const uint16_t message_length); void set_rds_data(const uint16_t message_length);

View File

@ -94,9 +94,8 @@ void extract_frame_pager::resetVals()
// ==================================================================== // ====================================================================
// //
// ==================================================================== // ====================================================================
void extract_frame_pager::setParams(long a_samplesPerSec, long a_maxBaud, long a_minBaud, long maxRunOfSameValue) void extract_frame_pager::setFrameExtractParams(long a_samplesPerSec, long a_maxBaud, long a_minBaud, long maxRunOfSameValue)
{ {
m_samplesPerSec = a_samplesPerSec; m_samplesPerSec = a_samplesPerSec;
m_minSymSamples_1024 = (uint32_t)(1024.0f * (float)a_samplesPerSec / (float)a_maxBaud); m_minSymSamples_1024 = (uint32_t)(1024.0f * (float)a_samplesPerSec / (float)a_maxBaud);
m_maxSymSamples_1024 = (uint32_t)(1024.0f*(float)a_samplesPerSec / (float)a_minBaud); m_maxSymSamples_1024 = (uint32_t)(1024.0f*(float)a_samplesPerSec / (float)a_minBaud);

View File

@ -23,6 +23,8 @@
#include <bitset> #include <bitset>
using namespace std; using namespace std;
// This class extracts a POCSAG message from a FM demodulated sample stream
// TODO extend to also process FLEX frames
#define MAX_CODEWORDS (16) #define MAX_CODEWORDS (16)
class extract_frame_pager class extract_frame_pager
{ {
@ -41,7 +43,7 @@ public:
void resetVals(); void resetVals();
void setParams(long a_samplesPerSec, long a_maxBaud = 8000, long a_minBaud = 200, long maxRunOfSameValue = 32); void setFrameExtractParams(long a_samplesPerSec, long a_maxBaud = 8000, long a_minBaud = 200, long maxRunOfSameValue = 32);
int processDemodulatedSamples(float * sampleBuff, int noOfSamples); int processDemodulatedSamples(float * sampleBuff, int noOfSamples);
int extractFrames(); int extractFrames();

View File

@ -63,28 +63,7 @@ int POCSAGProcessor::OnDataFrame(int len, int baud)
{ {
if (len > 0) if (len > 0)
{ {
if (baud > 492 && baud < 542) packet.set_bitrate(baud);
{
bitrate = pocsag::BitRate::FSK512;
}
else if (baud > 1000 && baud < 1400)
{
bitrate = pocsag::BitRate::FSK1200;
}
else if (baud > 2300 && baud < 2500)
{
bitrate = pocsag::BitRate::FSK2400;
}
else if (baud > 3100 && baud < 3300)
{
bitrate = pocsag::BitRate::FSK3200;
}
else
{
bitrate = pocsag::BitRate::UNKNOWN;
}
packet.set_bitrate(bitrate);
packet.set_flag(pocsag::PacketFlag::NORMAL); packet.set_flag(pocsag::PacketFlag::NORMAL);
packet.set_timestamp(Timestamp::now()); packet.set_timestamp(Timestamp::now());
const POCSAGPacketMessage message(packet); const POCSAGPacketMessage message(packet);
@ -93,14 +72,6 @@ int POCSAGProcessor::OnDataFrame(int len, int baud)
return 0; return 0;
} }
void POCSAGProcessor::push_packet(pocsag::PacketFlag flag) {
packet.set_bitrate(bitrate);
packet.set_flag(flag);
packet.set_timestamp(Timestamp::now());
const POCSAGPacketMessage message(packet);
shared_memory.application_queue.push(message);
}
void POCSAGProcessor::on_message(const Message* const message) { void POCSAGProcessor::on_message(const Message* const message) {
if (message->id == Message::ID::POCSAGConfigure) if (message->id == Message::ID::POCSAGConfigure)
configure(*reinterpret_cast<const POCSAGConfigureMessage*>(message)); configure(*reinterpret_cast<const POCSAGConfigureMessage*>(message));
@ -122,19 +93,15 @@ void POCSAGProcessor::configure(const POCSAGConfigureMessage& message) {
decim_1.configure(taps_11k0_decim_1.taps, 131072); decim_1.configure(taps_11k0_decim_1.taps, 131072);
channel_filter.configure(taps_11k0_channel.taps, 2); channel_filter.configure(taps_11k0_channel.taps, 2);
demod.configure(demod_input_fs, 4500); demod.configure(demod_input_fs, 4500);
smooth.SetSize(9); // Smoothing should be roughly sample rate over max baud
// 24k / 3.2k is 7.5
smooth.SetSize(8);
audio_output.configure(false); audio_output.configure(false);
bitrate = message.bitrate; // Set up the frame extraction, limits of baud
phase = message.phase; setFrameExtractParams(demod_input_fs, 4000, 300, 32);
sphase_delta = 0x10000u * bitrate / POCSAG_AUDIO_RATE;
sphase_delta_half = sphase_delta / 2; // Just for speed
sphase_delta_eighth = sphase_delta / 8;
rx_state = WAITING;
setParams(demod_input_fs, 6000, 300, 32);
// Mark the class as ready to accept data
configured = true; configured = true;
} }

View File

@ -118,6 +118,9 @@ public:
// --------------------------------------------------
// Class to process base band data to pocsag frames
// --------------------------------------------------
class POCSAGProcessor : public BasebandProcessor, extract_frame_pager { class POCSAGProcessor : public BasebandProcessor, extract_frame_pager {
public: public:
void execute(const buffer_c8_t& buffer) override; void execute(const buffer_c8_t& buffer) override;
@ -128,17 +131,6 @@ public:
virtual int OnDataWord(uint32_t word, int pos); virtual int OnDataWord(uint32_t word, int pos);
private: private:
enum rx_states {
WAITING = 0,
PREAMBLE = 32,
SYNC = 64,
//LOSING_SYNC = 65,
//LOST_SYNC = 66,
//ADDRESS = 67,
//MESSAGE = 68,
//END_OF_MESSAGE = 69
};
static constexpr size_t baseband_fs = 3072000; static constexpr size_t baseband_fs = 3072000;
BasebandThread baseband_thread { baseband_fs, this, NORMALPRIO + 20, baseband::Direction::Receive }; BasebandThread baseband_thread { baseband_fs, this, NORMALPRIO + 20, baseband::Direction::Receive };
@ -163,24 +155,9 @@ private:
AudioOutput audio_output { }; AudioOutput audio_output { };
uint32_t sync_timeout { 0 };
uint32_t msg_timeout { 0 };
uint32_t slicer_sr { 0 };
uint32_t sphase { 0 };
uint32_t sphase_delta { 0 };
uint32_t sphase_delta_half { 0 };
uint32_t sphase_delta_eighth { 0 };
uint32_t rx_data { 0 };
uint32_t rx_bit { 0 };
bool configured = false; bool configured = false;
rx_states rx_state { WAITING };
pocsag::BitRate bitrate { pocsag::BitRate::FSK1200 };
bool phase;
uint32_t codeword_count { 0 };
pocsag::POCSAGPacket packet { }; pocsag::POCSAGPacket packet { };
void push_packet(pocsag::PacketFlag flag);
void configure(const POCSAGConfigureMessage& message); void configure(const POCSAGConfigureMessage& message);
}; };

View File

@ -1016,17 +1016,10 @@ public:
class POCSAGConfigureMessage : public Message { class POCSAGConfigureMessage : public Message {
public: public:
constexpr POCSAGConfigureMessage( constexpr POCSAGConfigureMessage()
const pocsag::BitRate bitrate, : Message { ID::POCSAGConfigure }
const bool phase
) : Message { ID::POCSAGConfigure },
bitrate(bitrate),
phase(phase)
{ {
} }
const pocsag::BitRate bitrate;
const bool phase;
}; };
class APRSPacketMessage : public Message { class APRSPacketMessage : public Message {