mirror of
https://github.com/eried/portapack-mayhem.git
synced 2024-10-01 01:26:06 -04:00
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:
parent
6ef24ce71c
commit
318720f364
@ -123,7 +123,7 @@ POCSAGAppView::POCSAGAppView(NavigationView& nav) {
|
||||
audio::output::start();
|
||||
audio::output::unmute();
|
||||
|
||||
baseband::set_pocsag(pocsag::BitRate::FSK1200, true);
|
||||
baseband::set_pocsag();
|
||||
}
|
||||
|
||||
POCSAGAppView::~POCSAGAppView() {
|
||||
|
@ -236,11 +236,8 @@ void set_fsk_data(const uint32_t stream_length, const uint32_t samples_per_bit,
|
||||
send_message(&message);
|
||||
}
|
||||
|
||||
void set_pocsag(const pocsag::BitRate bitrate, bool phase) {
|
||||
const POCSAGConfigureMessage message {
|
||||
bitrate,
|
||||
phase
|
||||
};
|
||||
void set_pocsag() {
|
||||
const POCSAGConfigureMessage message {};
|
||||
send_message(&message);
|
||||
}
|
||||
|
||||
|
@ -79,7 +79,7 @@ void set_ook_data(const uint32_t stream_length, const uint32_t samples_per_bit,
|
||||
const uint32_t pause_symbols);
|
||||
void set_fsk_data(const uint32_t stream_length, const uint32_t samples_per_bit, const uint32_t shift,
|
||||
const uint32_t progress_notice);
|
||||
void set_pocsag(const pocsag::BitRate bitrate, bool phase);
|
||||
void set_pocsag();
|
||||
void set_adsb();
|
||||
void set_jammer(const bool run, const jammer::JammerType type, const uint32_t speed);
|
||||
void set_rds_data(const uint16_t message_length);
|
||||
|
@ -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_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);
|
||||
|
@ -23,6 +23,8 @@
|
||||
#include <bitset>
|
||||
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)
|
||||
class extract_frame_pager
|
||||
{
|
||||
@ -41,7 +43,7 @@ public:
|
||||
|
||||
|
||||
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 extractFrames();
|
||||
|
@ -63,28 +63,7 @@ int POCSAGProcessor::OnDataFrame(int len, int baud)
|
||||
{
|
||||
if (len > 0)
|
||||
{
|
||||
if (baud > 492 && baud < 542)
|
||||
{
|
||||
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_bitrate(baud);
|
||||
packet.set_flag(pocsag::PacketFlag::NORMAL);
|
||||
packet.set_timestamp(Timestamp::now());
|
||||
const POCSAGPacketMessage message(packet);
|
||||
@ -93,14 +72,6 @@ int POCSAGProcessor::OnDataFrame(int len, int baud)
|
||||
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) {
|
||||
if (message->id == Message::ID::POCSAGConfigure)
|
||||
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);
|
||||
channel_filter.configure(taps_11k0_channel.taps, 2);
|
||||
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);
|
||||
|
||||
bitrate = message.bitrate;
|
||||
phase = message.phase;
|
||||
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);
|
||||
// Set up the frame extraction, limits of baud
|
||||
setFrameExtractParams(demod_input_fs, 4000, 300, 32);
|
||||
|
||||
// Mark the class as ready to accept data
|
||||
configured = true;
|
||||
}
|
||||
|
||||
|
@ -118,6 +118,9 @@ public:
|
||||
|
||||
|
||||
|
||||
// --------------------------------------------------
|
||||
// Class to process base band data to pocsag frames
|
||||
// --------------------------------------------------
|
||||
class POCSAGProcessor : public BasebandProcessor, extract_frame_pager {
|
||||
public:
|
||||
void execute(const buffer_c8_t& buffer) override;
|
||||
@ -128,17 +131,6 @@ public:
|
||||
virtual int OnDataWord(uint32_t word, int pos);
|
||||
|
||||
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;
|
||||
|
||||
BasebandThread baseband_thread { baseband_fs, this, NORMALPRIO + 20, baseband::Direction::Receive };
|
||||
@ -163,24 +155,9 @@ private:
|
||||
|
||||
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;
|
||||
rx_states rx_state { WAITING };
|
||||
pocsag::BitRate bitrate { pocsag::BitRate::FSK1200 };
|
||||
bool phase;
|
||||
uint32_t codeword_count { 0 };
|
||||
pocsag::POCSAGPacket packet { };
|
||||
|
||||
void push_packet(pocsag::PacketFlag flag);
|
||||
void configure(const POCSAGConfigureMessage& message);
|
||||
|
||||
};
|
||||
|
@ -1016,17 +1016,10 @@ public:
|
||||
|
||||
class POCSAGConfigureMessage : public Message {
|
||||
public:
|
||||
constexpr POCSAGConfigureMessage(
|
||||
const pocsag::BitRate bitrate,
|
||||
const bool phase
|
||||
) : Message { ID::POCSAGConfigure },
|
||||
bitrate(bitrate),
|
||||
phase(phase)
|
||||
constexpr POCSAGConfigureMessage()
|
||||
: Message { ID::POCSAGConfigure }
|
||||
{
|
||||
}
|
||||
|
||||
const pocsag::BitRate bitrate;
|
||||
const bool phase;
|
||||
};
|
||||
|
||||
class APRSPacketMessage : public Message {
|
||||
|
Loading…
Reference in New Issue
Block a user