POCSAG address filter now ignores alpha messages

Experimenting with FIFOs for replay...
This commit is contained in:
furrtek
2017-04-19 22:05:16 +01:00
parent a053c0e234
commit 40b49e2072
20 changed files with 120 additions and 69 deletions

View File

@@ -281,13 +281,13 @@ void capture_stop() {
send_message(&message);
}
void replay_start(CaptureConfig* const config) {
CaptureConfigMessage message { config };
void replay_start(ReplayConfig* const config) {
ReplayConfigMessage message { config };
send_message(&message);
}
void replay_stop() {
CaptureConfigMessage message { nullptr };
ReplayConfigMessage message { nullptr };
send_message(&message);
}

View File

@@ -86,7 +86,7 @@ void spectrum_streaming_stop();
void capture_start(CaptureConfig* const config);
void capture_stop();
void replay_start(CaptureConfig* const config);
void replay_start(ReplayConfig* const config);
void replay_stop();
} /* namespace baseband */

View File

@@ -23,6 +23,7 @@
// Color bitmaps generated with:
// Gimp image > indexed colors (16), then "xxd -i *.bmp"
//BUG: Replay freezes when SD card not present
//TODO: CTCSS detector
//BUG: RDS doesn't stop baseband when stopping tx ?
//BUG: Check AFSK transmit end, skips last bits ?

View File

@@ -147,10 +147,10 @@ void POCSAGAppView::on_packet(const POCSAGPacketMessage * message) {
else {
pocsag_decode_batch(message->packet, &pocsag_state);
if ((ignore) && (pocsag_state.out_type == ADDRESS) && (pocsag_state.address == sym_ignore.value_dec_u32())) {
if ((ignore) && (pocsag_state.address == sym_ignore.value_dec_u32())) {
// Ignore (inform, but no log)
console.write("\n\x1B\x03" + to_string_time(message->packet.timestamp()) +
" Ignored address " + to_string_dec_uint(pocsag_state.address));
//console.write("\n\x1B\x03" + to_string_time(message->packet.timestamp()) +
// " Ignored address " + to_string_dec_uint(pocsag_state.address));
return;
}
@@ -179,9 +179,7 @@ void POCSAGAppView::on_packet(const POCSAGPacketMessage * message) {
} else if (pocsag_state.out_type == MESSAGE) {
if (pocsag_state.address != last_address) {
// New message
console.writeln(console_info);
console.write(pocsag_state.output);
last_address = pocsag_state.address;

View File

@@ -29,7 +29,6 @@
using namespace portapack;
#include "portapack_persistent_memory.hpp"
using namespace portapack;
namespace ui {
@@ -46,14 +45,14 @@ ReplayAppView::ReplayAppView(
return;
}
//baseband::run_image(portapack::spi_flash::image_tag_replay);
baseband::run_image(portapack::spi_flash::image_tag_replay);
add_children({
&field_frequency,
&field_frequency_step,
&field_rf_amp,
&replay_view,
&waterfall,
//&waterfall,
});
replay_view.set_file_list(file_list);
@@ -91,16 +90,17 @@ ReplayAppView::~ReplayAppView() {
void ReplayAppView::on_hide() {
// TODO: Terrible kludge because widget system doesn't notify Waterfall that
// it's being shown or hidden.
waterfall.on_hide();
//waterfall.on_hide();
View::on_hide();
}
void ReplayAppView::set_parent_rect(const Rect new_parent_rect) {
/*void ReplayAppView::set_parent_rect(const Rect new_parent_rect) {
View::set_parent_rect(new_parent_rect);
const ui::Rect waterfall_rect { 0, header_height, new_parent_rect.width(), static_cast<ui::Dim>(new_parent_rect.height() - header_height) };
waterfall.set_parent_rect(waterfall_rect);
}
}*/
void ReplayAppView::focus() {
field_frequency.focus();

View File

@@ -41,11 +41,11 @@ public:
void on_hide() override;
void set_parent_rect(const Rect new_parent_rect) override;
//void set_parent_rect(const Rect new_parent_rect) override;
void focus() override;
std::string title() const override { return "Replay (beta)"; };
std::string title() const override { return "Replay (broken)"; };
private:
NavigationView& nav_;
@@ -79,7 +79,7 @@ private:
16384, 3
};
spectrum::WaterfallWidget waterfall { };
//spectrum::WaterfallWidget waterfall { };
};
} /* namespace ui */

View File

@@ -25,8 +25,12 @@
#include "baseband_api.hpp"
#include "buffer_exchange.hpp"
// DEBUG:
#include "hackrf_gpio.hpp"
using namespace hackrf::one;
struct BasebandReplay {
BasebandReplay(CaptureConfig* const config) {
BasebandReplay(ReplayConfig* const config) {
baseband::replay_start(config);
}
@@ -63,13 +67,13 @@ ReplayThread::~ReplayThread() {
msg_t ReplayThread::static_fn(void* arg) {
auto obj = static_cast<ReplayThread*>(arg);
const auto error = obj->run();
if( error.is_valid() && obj->error_callback ) {
/*if( error.is_valid() && obj->error_callback ) {
obj->error_callback(error.value());
} else {
if( obj->success_callback ) {
obj->success_callback();
}
}
}*/
return 0;
}
@@ -78,12 +82,15 @@ Optional<File::Error> ReplayThread::run() {
BufferExchange buffers { &config };
while( !chThdShouldTerminate() ) {
auto buffer = buffers.get();
auto read_result = reader->read(buffer->data(), buffer->size());
//auto buffer = buffers.get();
buffers.get();
/*auto read_result = reader->read(buffer->data(), buffer->size());
if( read_result.is_error() ) {
return read_result.error();
}
buffers.put(buffer);
buffers.put(buffer);*/
chThdSleep(50);
//led_tx.toggle();
}
return { };

View File

@@ -50,12 +50,12 @@ public:
ReplayThread& operator=(const ReplayThread&) = delete;
ReplayThread& operator=(ReplayThread&&) = delete;
const CaptureConfig& state() const {
const ReplayConfig& state() const {
return config;
}
private:
CaptureConfig config;
ReplayConfig config;
std::unique_ptr<stream::Reader> reader;
std::function<void()> success_callback;
std::function<void(File::Error)> error_callback;

View File

@@ -360,7 +360,7 @@ SystemMenuView::SystemMenuView(NavigationView& nav) {
{ "Play dead", ui::Color::red(), &bitmap_icon_playdead, [&nav](){ nav.push<PlayDeadView>(); } },
{ "Receivers", ui::Color::cyan(), &bitmap_icon_receivers, [&nav](){ nav.push<ReceiverMenuView>(); } },
{ "Capture", ui::Color::blue(), &bitmap_icon_capture, [&nav](){ nav.push<CaptureAppView>(); } },
{ "Replay", ui::Color::grey(), &bitmap_icon_replay, [&nav](){ nav.push<NotImplementedView>(); } }, // ReplayAppView
{ "Replay", ui::Color::blue(), &bitmap_icon_replay, [&nav](){ nav.push<ReplayAppView>(); } }, // ReplayAppView
{ "Audio transmitters", ui::Color::green(), &bitmap_icon_audiotx, [&nav](){ nav.push<TransmitterAudioMenuView>(); } },
{ "Code transmitters", ui::Color::green(), &bitmap_icon_codetx, [&nav](){ nav.push<TransmitterCodedMenuView>(); } },
{ "SSTV transmitter", ui::Color::dark_green(), &bitmap_icon_sstv, [&nav](){ nav.push<SSTVTXView>(); } },

View File

@@ -72,13 +72,13 @@ ReplayView::ReplayView(
this->toggle();
};
signal_token_tick_second = rtc_time::signal_tick_second += [this]() {
/*signal_token_tick_second = rtc_time::signal_tick_second += [this]() {
this->on_tick_second();
};
};*/
}
ReplayView::~ReplayView() {
rtc_time::signal_tick_second -= signal_token_tick_second;
//rtc_time::signal_tick_second -= signal_token_tick_second;
}
void ReplayView::focus() {
@@ -97,7 +97,6 @@ void ReplayView::set_file_list(const std::vector<std::filesystem::path>& file_li
options_files.set_options(file_options);
options_files.set_selected_index(0); // First file
on_file_changed(file_options[0].second);
}
bool ReplayView::is_active() const {
@@ -136,8 +135,8 @@ void ReplayView::start() {
update_status_display();
radio::enable({
460000000, //target_frequency(),
4000000, //sampling_rate,
434000000, //target_frequency(),
sampling_rate,
2500000, //baseband_bandwidth,
rf::Direction::Transmit,
receiver_model.rf_amp(),

View File

@@ -59,7 +59,7 @@ private:
using option_t = std::pair<std::string, int32_t>;
using options_t = std::vector<option_t>;
static constexpr uint32_t sampling_rate = 4000000;
static constexpr uint32_t sampling_rate = 500000;
void toggle();
@@ -72,7 +72,7 @@ private:
const size_t read_size;
const size_t buffer_count;
SignalToken signal_token_tick_second { };
//SignalToken signal_token_tick_second { };
options_t file_options { };
Rectangle rect_background {