mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-08-07 22:22:21 -04:00
POCSAG TX (with fixed message for testing)
This commit is contained in:
parent
b430b1e427
commit
dc7fcbc6c3
22 changed files with 562 additions and 91 deletions
|
@ -171,6 +171,7 @@ set(CPPSRC
|
|||
ui_navigation.cpp
|
||||
ui_numbers.cpp
|
||||
ui_nuoptix.cpp
|
||||
ui_pocsag_tx.cpp
|
||||
ui_rds.cpp
|
||||
ui_receiver.cpp
|
||||
ui_record_view.cpp
|
||||
|
|
|
@ -4919,6 +4919,33 @@ ui_nuoptix.cpp.s:
|
|||
cd /home/furrtek/portapack-hackrf && $(MAKE) -f firmware/application/CMakeFiles/application.elf.dir/build.make firmware/application/CMakeFiles/application.elf.dir/ui_nuoptix.cpp.s
|
||||
.PHONY : ui_nuoptix.cpp.s
|
||||
|
||||
ui_pocsag_tx.obj: ui_pocsag_tx.cpp.obj
|
||||
|
||||
.PHONY : ui_pocsag_tx.obj
|
||||
|
||||
# target to build an object file
|
||||
ui_pocsag_tx.cpp.obj:
|
||||
cd /home/furrtek/portapack-hackrf && $(MAKE) -f firmware/application/CMakeFiles/application.elf.dir/build.make firmware/application/CMakeFiles/application.elf.dir/ui_pocsag_tx.cpp.obj
|
||||
.PHONY : ui_pocsag_tx.cpp.obj
|
||||
|
||||
ui_pocsag_tx.i: ui_pocsag_tx.cpp.i
|
||||
|
||||
.PHONY : ui_pocsag_tx.i
|
||||
|
||||
# target to preprocess a source file
|
||||
ui_pocsag_tx.cpp.i:
|
||||
cd /home/furrtek/portapack-hackrf && $(MAKE) -f firmware/application/CMakeFiles/application.elf.dir/build.make firmware/application/CMakeFiles/application.elf.dir/ui_pocsag_tx.cpp.i
|
||||
.PHONY : ui_pocsag_tx.cpp.i
|
||||
|
||||
ui_pocsag_tx.s: ui_pocsag_tx.cpp.s
|
||||
|
||||
.PHONY : ui_pocsag_tx.s
|
||||
|
||||
# target to generate assembly for a file
|
||||
ui_pocsag_tx.cpp.s:
|
||||
cd /home/furrtek/portapack-hackrf && $(MAKE) -f firmware/application/CMakeFiles/application.elf.dir/build.make firmware/application/CMakeFiles/application.elf.dir/ui_pocsag_tx.cpp.s
|
||||
.PHONY : ui_pocsag_tx.cpp.s
|
||||
|
||||
ui_rds.obj: ui_rds.cpp.obj
|
||||
|
||||
.PHONY : ui_rds.obj
|
||||
|
@ -5892,6 +5919,9 @@ help:
|
|||
@echo "... ui_nuoptix.obj"
|
||||
@echo "... ui_nuoptix.i"
|
||||
@echo "... ui_nuoptix.s"
|
||||
@echo "... ui_pocsag_tx.obj"
|
||||
@echo "... ui_pocsag_tx.i"
|
||||
@echo "... ui_pocsag_tx.s"
|
||||
@echo "... ui_rds.obj"
|
||||
@echo "... ui_rds.i"
|
||||
@echo "... ui_rds.s"
|
||||
|
|
|
@ -141,6 +141,17 @@ void set_ook_data(const uint32_t stream_length, const uint32_t samples_per_bit,
|
|||
send_message(&message);
|
||||
}
|
||||
|
||||
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 FSKConfigureMessage message {
|
||||
stream_length,
|
||||
samples_per_bit,
|
||||
shift,
|
||||
progress_notice
|
||||
};
|
||||
send_message(&message);
|
||||
}
|
||||
|
||||
void set_pocsag(const pocsag::BitRate bitrate) {
|
||||
const POCSAGConfigureMessage message {
|
||||
bitrate
|
||||
|
|
|
@ -63,6 +63,8 @@ void set_afsk_data(const uint32_t afsk_samples_per_bit, const uint32_t afsk_phas
|
|||
const uint8_t afsk_repeat, const uint32_t afsk_bw, const bool afsk_alt_format);
|
||||
void set_ook_data(const uint32_t stream_length, const uint32_t samples_per_bit, const uint8_t repeat,
|
||||
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);
|
||||
void set_adsb();
|
||||
void set_jammer(const bool run, const uint32_t type, const uint32_t speed);
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
// Color bitmaps generated with:
|
||||
// Gimp image > indexed colors (16), then "xxd -i *.bmp"
|
||||
|
||||
//BUG: POCSAG TX: Chops off the few last chars on long messages ?
|
||||
//BUG: (fixed ?) POCSAG: Bad console scroll init
|
||||
//BUG: (fixed ?) POCSAG misses alphanum messages, cuts them off sometimes
|
||||
//BUG: Check AFSK transmit end, skips last bits ?
|
||||
|
@ -31,6 +32,7 @@
|
|||
//TEST: Imperial in whipcalc
|
||||
//TEST: Numbers
|
||||
|
||||
//TODO: Use TransmitterView everywhere possible
|
||||
//TODO: FreqMan: Add and rename categories
|
||||
//TODO: FreqMan: Sort by category in edit screen
|
||||
//TODO: FreqMan: Cap entry count per category (only done for total entries right now)
|
||||
|
|
|
@ -33,7 +33,6 @@
|
|||
|
||||
#include "log_file.hpp"
|
||||
|
||||
#include "bch_code.hpp"
|
||||
#include "pocsag.hpp"
|
||||
#include "pocsag_packet.hpp"
|
||||
|
||||
|
@ -70,11 +69,6 @@ private:
|
|||
static constexpr uint32_t sampling_rate = 3072000;
|
||||
//static constexpr uint32_t baseband_bandwidth = 1750000;
|
||||
|
||||
BCHCode BCH_code {
|
||||
{ 1, 0, 1, 0, 0, 1 },
|
||||
5, 31, 21, 2
|
||||
};
|
||||
|
||||
bool logging { true };
|
||||
uint32_t last_address = 0xFFFFFFFF;
|
||||
pocsag::POCSAGState pocsag_state { };
|
||||
|
|
|
@ -63,7 +63,6 @@ void BHTView::start_tx() {
|
|||
|
||||
generate_message();
|
||||
|
||||
//transmitter_model.set_tuning_frequency(bht_freqs[options_freq.selected_index()]);
|
||||
transmitter_model.set_sampling_rate(1536000);
|
||||
transmitter_model.set_rf_amp(true);
|
||||
transmitter_model.set_lna(40);
|
||||
|
@ -136,13 +135,9 @@ BHTView::BHTView(NavigationView& nav) {
|
|||
&text_receiver,
|
||||
&receiver_code,
|
||||
&checkbox_wcid,
|
||||
//&text_freq,
|
||||
//&options_freq,
|
||||
//&field_bw,
|
||||
&text_relais,
|
||||
&progressbar,
|
||||
&text_message,
|
||||
//&button_transmit,
|
||||
&checkbox_cligno,
|
||||
&tempo_cligno,
|
||||
&text_cligno,
|
||||
|
@ -158,13 +153,10 @@ BHTView::BHTView(NavigationView& nav) {
|
|||
family_code_ep.set_selected_index(2);
|
||||
subfamily_code.set_value(1);
|
||||
receiver_code.set_value(1);
|
||||
//options_freq.set_selected_index(0);
|
||||
tempo_cligno.set_value(1);
|
||||
progressbar.set_max(20);
|
||||
relay_states[0].set_selected_index(1); // R1 OFF
|
||||
|
||||
//field_bw.set_value(20);
|
||||
|
||||
options_mode.on_change = [this](size_t mode, OptionsField::value_t) {
|
||||
_mode = mode;
|
||||
|
||||
|
@ -289,8 +281,6 @@ BHTView::BHTView(NavigationView& nav) {
|
|||
n++;
|
||||
}
|
||||
|
||||
//button_transmit.set_style(&style_val);
|
||||
|
||||
generate_message();
|
||||
|
||||
tx_view.on_edit_frequency = [this, &nav]() {
|
||||
|
@ -301,11 +291,9 @@ BHTView::BHTView(NavigationView& nav) {
|
|||
};
|
||||
|
||||
tx_view.on_start = [this]() {
|
||||
if ((tx_mode == IDLE) && (!_mode)) { // DEBUG
|
||||
if (speaker_enabled)
|
||||
chThdSleepMilliseconds(40 * 1000); // DEBUG 40s
|
||||
//if (speaker_enabled && _mode)
|
||||
// audio::headphone::set_volume(volume_t::decibel(90 - 99) + audio::headphone::volume_range().max);
|
||||
if ((tx_mode == IDLE) && (!_mode)) {
|
||||
if (speaker_enabled && _mode)
|
||||
audio::headphone::set_volume(volume_t::decibel(90 - 99) + audio::headphone::volume_range().max);
|
||||
tx_mode = SINGLE;
|
||||
tx_view.set_transmitting(true);
|
||||
start_tx();
|
||||
|
|
|
@ -197,32 +197,6 @@ private:
|
|||
"Tous"
|
||||
};
|
||||
|
||||
/*Text text_freq {
|
||||
{ 1 * 8, 8 * 16, 10 * 8, 16 },
|
||||
"Frequence:"
|
||||
};
|
||||
OptionsField options_freq {
|
||||
{ 12 * 8, 8 * 16},
|
||||
7,
|
||||
{
|
||||
{ "31.3250", 0 },
|
||||
{ "31.3875", 1 },
|
||||
{ "31.4375", 2 },
|
||||
{ "31.4750", 3 },
|
||||
{ "31.6875", 4 },
|
||||
{ "31.9750", 5 },
|
||||
{ "TEST 88", 6 }
|
||||
}
|
||||
};
|
||||
|
||||
NumberField field_bw {
|
||||
{ 20 * 8, 8 * 16 },
|
||||
2,
|
||||
{ 0, 99 },
|
||||
1,
|
||||
' '
|
||||
};*/
|
||||
|
||||
Text text_relais {
|
||||
{ 1 * 8, 8 * 16 + 8, 7 * 8, 16 },
|
||||
"Relais:"
|
||||
|
@ -244,11 +218,6 @@ private:
|
|||
""
|
||||
};
|
||||
|
||||
/*Button button_transmit {
|
||||
{ 2 * 8, 16 * 16, 12 * 8, 32 },
|
||||
"START"
|
||||
};*/
|
||||
|
||||
Checkbox checkbox_cligno {
|
||||
{ 18 * 8 + 4, 10 * 16},
|
||||
3,
|
||||
|
|
|
@ -43,6 +43,7 @@
|
|||
#include "ui_morse.hpp"
|
||||
#include "ui_numbers.hpp"
|
||||
#include "ui_nuoptix.hpp"
|
||||
#include "ui_pocsag_tx.hpp"
|
||||
#include "ui_rds.hpp"
|
||||
#include "ui_sd_wipe.hpp"
|
||||
#include "ui_setup.hpp"
|
||||
|
@ -301,12 +302,13 @@ ReceiverMenuView::ReceiverMenuView(NavigationView& nav) {
|
|||
/* TransmitterCodedMenuView ******************************************************/
|
||||
|
||||
TransmitterCodedMenuView::TransmitterCodedMenuView(NavigationView& nav) {
|
||||
add_items<7>({ {
|
||||
add_items<8>({ {
|
||||
{ "ADS-B Mode S", ui::Color::orange(),&bitmap_icon_adsb, [&nav](){ nav.push<ADSBTxView>(); } },
|
||||
{ "BHT Xy/EP", ui::Color::yellow(),&bitmap_icon_bht, [&nav](){ nav.push<BHTView>(); } },
|
||||
{ "Morse beacon", ui::Color::yellow(),&bitmap_icon_morse, [&nav](){ nav.push<MorseView>(); } },
|
||||
{ "Nuoptix DTMF timecode", ui::Color::green(), &bitmap_icon_nuoptix, [&nav](){ nav.push<NuoptixView>(); } },
|
||||
{ "OOK remote encoders", ui::Color::green(), &bitmap_icon_remote, [&nav](){ nav.push<EncodersView>(); } },
|
||||
{ "POCSAG", ui::Color::cyan(), &bitmap_icon_pocsag, [&nav](){ nav.push<POCSAGTXView>(); } },
|
||||
{ "RDS", ui::Color::green(), &bitmap_icon_rds, [&nav](){ nav.push<RDSView>(); } },
|
||||
{ "TEDI/LCR AFSK", ui::Color::green(), &bitmap_icon_lcr, [&nav](){ nav.push<LCRView>(); } },
|
||||
} });
|
||||
|
|
142
firmware/application/ui_pocsag_tx.cpp
Normal file
142
firmware/application/ui_pocsag_tx.cpp
Normal file
|
@ -0,0 +1,142 @@
|
|||
/*
|
||||
* Copyright (C) 2015 Jared Boone, ShareBrained Technology, Inc.
|
||||
* Copyright (C) 2016 Furrtek
|
||||
*
|
||||
* This file is part of PortaPack.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, Inc., 51 Franklin Street,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include "ui_pocsag_tx.hpp"
|
||||
|
||||
#include "pocsag.hpp"
|
||||
#include "baseband_api.hpp"
|
||||
#include "string_format.hpp"
|
||||
|
||||
#include "portapack_persistent_memory.hpp"
|
||||
|
||||
#include <cstring>
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
|
||||
using namespace portapack;
|
||||
using namespace pocsag;
|
||||
|
||||
namespace ui {
|
||||
|
||||
void POCSAGTXView::focus() {
|
||||
tx_view.focus();
|
||||
}
|
||||
|
||||
POCSAGTXView::~POCSAGTXView() {
|
||||
transmitter_model.disable();
|
||||
baseband::shutdown();
|
||||
}
|
||||
|
||||
void POCSAGTXView::on_tx_progress(const int progress, const bool done) {
|
||||
if (done) {
|
||||
transmitter_model.disable();
|
||||
progressbar.set_value(0);
|
||||
tx_view.set_transmitting(false);
|
||||
} else
|
||||
progressbar.set_value(progress);
|
||||
}
|
||||
|
||||
void POCSAGTXView::start_tx() {
|
||||
uint32_t total_frames, i, codeword, b, bi, address;
|
||||
std::string test_string = "PORTAPACK !";
|
||||
std::vector<uint32_t> codewords;
|
||||
uint8_t byte = 0;
|
||||
|
||||
address = address_field.value_dec_u32();
|
||||
if (address > 0x7FFFFFU)
|
||||
address = 0; // Todo: Error screen
|
||||
|
||||
pocsag_encode(BCH_code, test_string, address, codewords);
|
||||
|
||||
total_frames = codewords.size() / 2;
|
||||
|
||||
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();
|
||||
|
||||
uint8_t * data_ptr = shared_memory.bb_data.data;
|
||||
|
||||
bi = 0;
|
||||
for (i = 0; i < codewords.size(); i++) {
|
||||
/*for (b = 0; b < 32; b++) {
|
||||
byte |= ((((codewords[i] << b) & 0x80000000U) ? 1 : 0) << (7 - (b & 7)));
|
||||
if ((b & 7) == 7) {
|
||||
data_ptr[bi++] = byte;
|
||||
byte = 0;
|
||||
}
|
||||
}*/
|
||||
codeword = codewords[i];
|
||||
data_ptr[bi++] = (codeword >> 24) & 0xFF;
|
||||
data_ptr[bi++] = (codeword >> 16) & 0xFF;
|
||||
data_ptr[bi++] = (codeword >> 8) & 0xFF;
|
||||
data_ptr[bi++] = codeword & 0xFF;
|
||||
}
|
||||
|
||||
text_debug_a.set("Codewords: " + to_string_dec_uint(codewords.size()));
|
||||
|
||||
baseband::set_fsk_data(
|
||||
codewords.size() * 32,
|
||||
228000 / 1200,
|
||||
4500,
|
||||
64
|
||||
//228000 / ((numberfield_clk.value() * 1000) / encoder_def->clk_per_fragment),
|
||||
);
|
||||
}
|
||||
|
||||
POCSAGTXView::POCSAGTXView(NavigationView& nav) {
|
||||
//size_t i;
|
||||
|
||||
baseband::run_image(portapack::spi_flash::image_tag_fsktx);
|
||||
|
||||
add_children({
|
||||
&text_debug_a,
|
||||
&text_debug_b,
|
||||
&text_debug_c,
|
||||
&address_field,
|
||||
&progressbar,
|
||||
&tx_view
|
||||
});
|
||||
|
||||
tx_view.on_edit_frequency = [this, &nav]() {
|
||||
auto new_view = nav.push<FrequencyKeypadView>(receiver_model.tuning_frequency());
|
||||
new_view->on_changed = [this](rf::Frequency f) {
|
||||
receiver_model.set_tuning_frequency(f);
|
||||
};
|
||||
};
|
||||
|
||||
tx_view.on_start = [this]() {
|
||||
tx_view.set_transmitting(true);
|
||||
start_tx();
|
||||
};
|
||||
|
||||
tx_view.on_stop = [this]() {
|
||||
tx_view.set_transmitting(false);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
} /* namespace ui */
|
102
firmware/application/ui_pocsag_tx.hpp
Normal file
102
firmware/application/ui_pocsag_tx.hpp
Normal file
|
@ -0,0 +1,102 @@
|
|||
/*
|
||||
* Copyright (C) 2015 Jared Boone, ShareBrained Technology, Inc.
|
||||
* Copyright (C) 2016 Furrtek
|
||||
*
|
||||
* This file is part of PortaPack.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, Inc., 51 Franklin Street,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef __POCSAG_TX_H__
|
||||
#define __POCSAG_TX_H__
|
||||
|
||||
#include "ui.hpp"
|
||||
#include "ui_widget.hpp"
|
||||
#include "ui_navigation.hpp"
|
||||
#include "ui_font_fixed_8x16.hpp"
|
||||
#include "ui_receiver.hpp"
|
||||
#include "ui_transmitter.hpp"
|
||||
#include "bch_code.hpp"
|
||||
#include "message.hpp"
|
||||
#include "transmitter_model.hpp"
|
||||
|
||||
namespace ui {
|
||||
|
||||
class POCSAGTXView : public View {
|
||||
public:
|
||||
POCSAGTXView(NavigationView& nav);
|
||||
~POCSAGTXView();
|
||||
|
||||
/*POCSAGTXView(const EncodersView&) = delete;
|
||||
POCSAGTXView(EncodersView&&) = delete;
|
||||
POCSAGTXView& operator=(const EncodersView&) = delete;
|
||||
POCSAGTXView& operator=(EncodersView&&) = delete;*/
|
||||
|
||||
void focus() override;
|
||||
|
||||
std::string title() const override { return "POCSAG TX"; };
|
||||
|
||||
private:
|
||||
|
||||
BCHCode BCH_code {
|
||||
{ 1, 0, 1, 0, 0, 1 },
|
||||
5, 31, 21, 2
|
||||
};
|
||||
|
||||
void on_tx_progress(const int progress, const bool done);
|
||||
void start_tx();
|
||||
|
||||
Text text_debug_a {
|
||||
{ 1 * 8, 4 * 8, 20 * 8, 16 },
|
||||
"-"
|
||||
};
|
||||
Text text_debug_b {
|
||||
{ 1 * 8, 6 * 8, 20 * 8, 16 },
|
||||
"-"
|
||||
};
|
||||
Text text_debug_c {
|
||||
{ 1 * 8, 12 * 8, 20 * 8, 16 },
|
||||
"Address:"
|
||||
};
|
||||
|
||||
SymField address_field {
|
||||
{ 9 * 8, 12 * 8 },
|
||||
7,
|
||||
SymField::SYMFIELD_DEC
|
||||
};
|
||||
|
||||
ProgressBar progressbar {
|
||||
{ 16, 200, 208, 16 }
|
||||
};
|
||||
|
||||
TransmitterView tx_view {
|
||||
16 * 16,
|
||||
10000,
|
||||
9
|
||||
};
|
||||
|
||||
MessageHandlerRegistration message_handler_tx_done {
|
||||
Message::ID::TXDone,
|
||||
[this](const Message* const p) {
|
||||
const auto message = *reinterpret_cast<const TXDoneMessage*>(p);
|
||||
this->on_tx_progress(message.progress, message.done);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
} /* namespace ui */
|
||||
|
||||
#endif/*__POCSAG_TX_H__*/
|
|
@ -75,6 +75,10 @@ void TransmitterView::on_show() {
|
|||
field_frequency.set_value(receiver_model.tuning_frequency());
|
||||
}
|
||||
|
||||
void TransmitterView::focus() {
|
||||
button_start.focus();
|
||||
}
|
||||
|
||||
TransmitterView::TransmitterView(
|
||||
const Coord y, const uint32_t frequency_step, const uint32_t bandwidth
|
||||
) {
|
||||
|
|
|
@ -56,6 +56,7 @@ public:
|
|||
~TransmitterView();
|
||||
|
||||
void on_show() override;
|
||||
void focus() override;
|
||||
|
||||
void set_transmitting(const bool transmitting);
|
||||
|
||||
|
@ -78,11 +79,11 @@ private:
|
|||
};
|
||||
|
||||
TXGainField field_gain {
|
||||
{ 11 * 8, 0 * 16 }
|
||||
{ 10 * 8, 0 * 16 }
|
||||
};
|
||||
|
||||
NumberField field_bw {
|
||||
{ 14 * 8, 0 * 16 },
|
||||
{ 13 * 8, 0 * 16 },
|
||||
3,
|
||||
{ 1, 150 },
|
||||
1,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue