Pocsag improvements (#20)

* Update analog_audio_app.cpp (#353)

* Adding phase field (extracted from @jamesshao8 repo)
This commit is contained in:
Erwin Ried 2020-05-09 13:13:21 +02:00 committed by GitHub
parent 3e15baa251
commit 4aaac8545b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 51 additions and 11 deletions

View file

@ -69,6 +69,7 @@ POCSAGAppView::POCSAGAppView(NavigationView& nav) {
&field_vga,
&field_frequency,
&options_bitrate,
&options_phase,
&check_log,
&check_ignore,
&sym_ignore,
@ -99,10 +100,13 @@ POCSAGAppView::POCSAGAppView(NavigationView& nav) {
};
options_bitrate.on_change = [this](size_t, OptionsField::value_t v) {
on_bitrate_changed(v);
on_config_changed(v, options_phase.selected_index_value());
};
options_bitrate.set_selected_index(1); // 1200bps
options_phase.on_change = [this](size_t, OptionsField::value_t v) {
on_config_changed(options_bitrate.selected_index_value(),v);
};
check_ignore.set_value(ignore);
check_ignore.on_select = [this](Checkbox&, bool v) {
ignore = v;
@ -197,8 +201,8 @@ void POCSAGAppView::on_packet(const POCSAGPacketMessage * message) {
logger->log_raw_data(message->packet, target_frequency());
}
void POCSAGAppView::on_bitrate_changed(const uint32_t new_bitrate) {
baseband::set_pocsag(pocsag_bitrates[new_bitrate]);
void POCSAGAppView::on_config_changed(const uint32_t new_bitrate, bool new_phase) {
baseband::set_pocsag(pocsag_bitrates[new_bitrate], new_phase);
}
void POCSAGAppView::set_target_frequency(const uint32_t new_value) {

View file

@ -93,6 +93,14 @@ private:
{ "2400bps", 2 }
}
};
OptionsField options_phase {
{ 6 * 8, 21 },
1,
{
{ "P", 0 },
{ "N", 1 },
}
};
Checkbox check_log {
{ 22 * 8, 21 },
3,
@ -124,7 +132,7 @@ private:
void on_packet(const POCSAGPacketMessage * message);
void on_bitrate_changed(const uint32_t new_bitrate);
void on_config_changed(const uint32_t new_bitrate, const bool phase);
uint32_t target_frequency() const;
void set_target_frequency(const uint32_t new_value);

View file

@ -71,6 +71,7 @@ bool POCSAGTXView::start_tx() {
return false;
}
}
MessageType phase = (MessageType)options_phase.selected_index_value();
pocsag_encode(type, BCH_code, options_function.selected_index_value(), message, address, codewords);
@ -79,6 +80,9 @@ bool POCSAGTXView::start_tx() {
progressbar.set_max(total_frames);
transmitter_model.set_sampling_rate(2280000);
transmitter_model.set_rf_amp(true);
transmitter_model.set_lna(40);
transmitter_model.set_vga(40);
transmitter_model.set_baseband_bandwidth(1750000);
transmitter_model.enable();
@ -86,7 +90,11 @@ bool POCSAGTXView::start_tx() {
bi = 0;
for (i = 0; i < codewords.size(); i++) {
if (phase == 0)
codeword = ~(codewords[i]);
else
codeword = codewords[i];
data_ptr[bi++] = (codeword >> 24) & 0xFF;
data_ptr[bi++] = (codeword >> 16) & 0xFF;
data_ptr[bi++] = (codeword >> 8) & 0xFF;
@ -126,6 +134,7 @@ POCSAGTXView::POCSAGTXView(
&field_address,
&options_type,
&options_function,
&options_phase,
&text_message,
&button_message,
&progressbar,

View file

@ -71,6 +71,7 @@ private:
{ { 3 * 8, 6 * 8 }, "Address:", Color::light_grey() },
{ { 6 * 8, 8 * 8 }, "Type:", Color::light_grey() },
{ { 2 * 8, 10 * 8 }, "Function:", Color::light_grey() },
{ { 5 * 8, 12 * 8 }, "Phase:", Color::light_grey() },
{ { 0 * 8, 14 * 8 }, "Message:", Color::light_grey() }
};
@ -110,6 +111,15 @@ private:
{ "D", 3 }
}
};
OptionsField options_phase {
{ 11 * 8, 12 * 8 },
1,
{
{ "P", 0 },
{ "N", 1 },
}
};
Text text_message {
{ 0 * 8, 16 * 8, 16 * 8, 16 },