mirror of
https://github.com/portapack-mayhem/mayhem-firmware.git
synced 2025-12-02 22:21:47 +00:00
POCSAG address filter now ignores alpha messages
Experimenting with FIFOs for replay...
This commit is contained in:
@@ -39,15 +39,21 @@ void ReplayProcessor::execute(const buffer_c8_t& buffer) {
|
||||
//const auto& decimator_out = decim_1_out;
|
||||
//const auto& channel = decimator_out;
|
||||
|
||||
if( stream ) {
|
||||
const size_t bytes_to_read = buffer.count; // ?
|
||||
const auto result = stream->read(iq_buffer.p, bytes_to_read);
|
||||
}
|
||||
|
||||
//feed_channel_stats(channel);
|
||||
size_t pos = 0;
|
||||
|
||||
for (size_t i = 0; i < buffer.count; i++) {
|
||||
buffer.p[i] = { iq_buffer.p[i].real() >> 8, iq_buffer.p[i].imag() >> 8};
|
||||
for (size_t c = 0; c < 4; c++) {
|
||||
if( stream ) {
|
||||
const size_t bytes_to_read = sizeof(*buffer.p) * buffer.count / 4; // ?
|
||||
const auto result = stream->read(iq_buffer.p, bytes_to_read);
|
||||
}
|
||||
|
||||
//feed_channel_stats(channel);
|
||||
|
||||
for (size_t i = 0; i < (buffer.count / 4); i++) {
|
||||
buffer.p[pos] = { iq_buffer.p[i].real() >> 8, iq_buffer.p[i].imag() >> 8 };
|
||||
pos++;
|
||||
//buffer.p[i] = { iq_buffer.p[i].real(), iq_buffer.p[i].imag() };
|
||||
}
|
||||
}
|
||||
|
||||
/*spectrum_samples += channel.count;
|
||||
|
||||
@@ -46,13 +46,13 @@ public:
|
||||
|
||||
private:
|
||||
// TODO: Repeated value needs to be transmitted from application side.
|
||||
static constexpr size_t baseband_fs = 4000000;
|
||||
static constexpr size_t baseband_fs = 500000;
|
||||
//static constexpr auto spectrum_rate_hz = 50.0f;
|
||||
|
||||
BasebandThread baseband_thread { baseband_fs, this, NORMALPRIO + 20, baseband::Direction::Transmit };
|
||||
//RSSIThread rssi_thread { NORMALPRIO + 10 };
|
||||
|
||||
std::array<complex16_t, 2048> iq { };
|
||||
std::array<complex16_t, 512> iq { }; // 2048
|
||||
const buffer_c16_t iq_buffer {
|
||||
iq.data(),
|
||||
iq.size()
|
||||
|
||||
@@ -57,7 +57,7 @@ size_t StreamInput::write(const void* const data, const size_t length) {
|
||||
|
||||
if( active_buffer->is_full() ) {
|
||||
if( !fifo_buffers_full.in(active_buffer) ) {
|
||||
// FIFO is fuil of buffers, there's no place for this one.
|
||||
// FIFO is full of buffers, there's no place for this one.
|
||||
// Bail out of the loop, and try submitting the buffer in the
|
||||
// next pass.
|
||||
// This should never happen if the number of buffers is less
|
||||
|
||||
@@ -40,29 +40,30 @@ StreamOutput::StreamOutput(ReplayConfig* const config) :
|
||||
}
|
||||
}
|
||||
|
||||
size_t StreamOutput::read(const void* const data, const size_t length) {
|
||||
const uint8_t* p = static_cast<const uint8_t*>(data);
|
||||
size_t written = 0;
|
||||
size_t StreamOutput::read(void* const data, const size_t length) {
|
||||
uint8_t* p = static_cast<uint8_t*>(data);
|
||||
size_t read = 0;
|
||||
|
||||
while( written < length ) {
|
||||
while( read < length ) {
|
||||
if( !active_buffer ) {
|
||||
// We need an empty buffer...
|
||||
if( !fifo_buffers_empty.out(active_buffer) ) {
|
||||
// We need a full buffer...
|
||||
if( !fifo_buffers_full.out(active_buffer) ) {
|
||||
// ...but none are available. Samples were dropped.
|
||||
//active_buffer = nullptr; // Testing ! Jumpstart
|
||||
creg::m4txevent::assert();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
const auto remaining = length - written;
|
||||
written += active_buffer->write(&p[written], remaining);
|
||||
const auto remaining = length - read;
|
||||
read += active_buffer->read(&p[read], remaining);
|
||||
//buffer->empty();
|
||||
|
||||
if( active_buffer->is_full() ) {
|
||||
if( !fifo_buffers_full.in(active_buffer) ) {
|
||||
// FIFO is fuil of buffers, there's no place for this one.
|
||||
// Bail out of the loop, and try submitting the buffer in the
|
||||
if( active_buffer->is_empty() ) {
|
||||
if( !fifo_buffers_empty.in(active_buffer) ) {
|
||||
// FIFO is completly empty.
|
||||
// Bail out of the loop, and try retrieving the buffer in the
|
||||
// next pass.
|
||||
// This should never happen if the number of buffers is less
|
||||
// than the capacity of the FIFO.
|
||||
break;
|
||||
}
|
||||
active_buffer = nullptr;
|
||||
@@ -70,7 +71,7 @@ size_t StreamOutput::read(const void* const data, const size_t length) {
|
||||
}
|
||||
}
|
||||
|
||||
config->baseband_bytes_sent += length;
|
||||
config->baseband_bytes_received += length;
|
||||
|
||||
return written;
|
||||
return read;
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ public:
|
||||
StreamOutput& operator=(const StreamOutput&) = delete;
|
||||
StreamOutput& operator=(StreamOutput&&) = delete;
|
||||
|
||||
size_t read(const void* const data, const size_t length);
|
||||
size_t read(void* const data, const size_t length);
|
||||
|
||||
private:
|
||||
static constexpr size_t buffer_count_max_log2 = 3;
|
||||
|
||||
Reference in New Issue
Block a user