mirror of
https://github.com/portapack-mayhem/mayhem-firmware.git
synced 2025-10-17 13:26:18 +00:00
Fixed LCR transmit and AFSK baseband module
This commit is contained in:
@@ -85,6 +85,21 @@ void set_xylos_data(const char ccir_message[]) {
|
||||
send_message(&message);
|
||||
}
|
||||
|
||||
void set_afsk_data(const char message_data[], const uint32_t afsk_samples_per_bit, const uint32_t afsk_phase_inc_mark,
|
||||
const uint32_t afsk_phase_inc_space, const uint8_t afsk_repeat, const uint32_t afsk_bw,
|
||||
const bool afsk_alt_format) {
|
||||
const AFSKConfigureMessage message {
|
||||
message_data,
|
||||
afsk_samples_per_bit,
|
||||
afsk_phase_inc_mark,
|
||||
afsk_phase_inc_space,
|
||||
afsk_repeat,
|
||||
afsk_bw,
|
||||
afsk_alt_format
|
||||
};
|
||||
send_message(&message);
|
||||
}
|
||||
|
||||
static bool baseband_image_running = false;
|
||||
|
||||
void run_image(const portapack::spi_flash::image_tag_t image_tag) {
|
||||
|
@@ -53,6 +53,9 @@ struct WFMConfig {
|
||||
};
|
||||
|
||||
void set_xylos_data(const char ccir_message[]);
|
||||
void set_afsk_data(const char message_data[], const uint32_t afsk_samples_per_bit, const uint32_t afsk_phase_inc_mark,
|
||||
const uint32_t afsk_phase_inc_space, const uint8_t afsk_repeat, const uint32_t afsk_bw,
|
||||
const bool afsk_alt_format);
|
||||
|
||||
void run_image(const portapack::spi_flash::image_tag_t image_tag);
|
||||
void shutdown();
|
||||
|
@@ -32,7 +32,6 @@
|
||||
#include "hackrf_gpio.hpp"
|
||||
#include "portapack.hpp"
|
||||
#include "event_m0.hpp"
|
||||
#include "radio.hpp"
|
||||
|
||||
#include "string_format.hpp"
|
||||
|
||||
@@ -52,16 +51,19 @@ void LCRView::focus() {
|
||||
}
|
||||
|
||||
LCRView::~LCRView() {
|
||||
radio::disable();
|
||||
transmitter_model.disable();
|
||||
baseband::shutdown();
|
||||
}
|
||||
|
||||
void LCRView::make_frame() {
|
||||
void LCRView::generate_message() {
|
||||
// Modem sync and SOM
|
||||
const char lcr_init[8] = { 127, 127, 127, 127, 127, 127, 127, 15 };
|
||||
// Eclairage (Auto, Jour, Nuit)
|
||||
const char ec_lut[3][2] = { { 'A', 0x00 },
|
||||
{ 'J', 0x00 },
|
||||
{ 'N', 0x00 }
|
||||
};
|
||||
char eom[3] = { 3, 0, 0 }; // EOM and space for checksum
|
||||
uint8_t i, pm;
|
||||
{ 'N', 0x00 } };
|
||||
char eom[3] = { 3, 0, 0 }; // EOM and space for checksum
|
||||
uint8_t i, pm, bit;
|
||||
uint16_t dp;
|
||||
uint8_t cp, pp, cur_byte, new_byte;
|
||||
|
||||
@@ -74,63 +76,56 @@ void LCRView::make_frame() {
|
||||
}
|
||||
}
|
||||
|
||||
// Make LCR frame
|
||||
memset(lcrframe, 0, 256);
|
||||
lcrframe[0] = 127; // Modem sync
|
||||
lcrframe[1] = 127;
|
||||
lcrframe[2] = 127;
|
||||
lcrframe[3] = 127;
|
||||
lcrframe[4] = 127;
|
||||
lcrframe[5] = 127;
|
||||
lcrframe[6] = 127;
|
||||
lcrframe[7] = 15; // SOM
|
||||
// Compose LCR message
|
||||
memset(lcr_message, 0, 256);
|
||||
memcpy(lcr_message, lcr_init, 8);
|
||||
|
||||
strcat(lcrframe, rgsb);
|
||||
strcat(lcrframe, "PA ");
|
||||
strcat(lcr_message, rgsb); // Address
|
||||
strcat(lcr_message, "PA ");
|
||||
|
||||
if (checkbox_am_a.value() == true) {
|
||||
strcat(lcrframe, "AM=1 AF=\"");
|
||||
strcat(lcrframe, litteral[0]);
|
||||
strcat(lcrframe, "\" CL=0 ");
|
||||
strcat(lcr_message, "AM=1 AF=\"");
|
||||
strcat(lcr_message, litteral[0]);
|
||||
strcat(lcr_message, "\" CL=0 ");
|
||||
}
|
||||
if (checkbox_am_b.value() == true) {
|
||||
strcat(lcrframe, "AM=2 AF=\"");
|
||||
strcat(lcrframe, litteral[1]);
|
||||
strcat(lcrframe, "\" CL=0 ");
|
||||
strcat(lcr_message, "AM=2 AF=\"");
|
||||
strcat(lcr_message, litteral[1]);
|
||||
strcat(lcr_message, "\" CL=0 ");
|
||||
}
|
||||
if (checkbox_am_c.value() == true) {
|
||||
strcat(lcrframe, "AM=3 AF=\"");
|
||||
strcat(lcrframe, litteral[2]);
|
||||
strcat(lcrframe, "\" CL=0 ");
|
||||
strcat(lcr_message, "AM=3 AF=\"");
|
||||
strcat(lcr_message, litteral[2]);
|
||||
strcat(lcr_message, "\" CL=0 ");
|
||||
}
|
||||
if (checkbox_am_d.value() == true) {
|
||||
strcat(lcrframe, "AM=4 AF=\"");
|
||||
strcat(lcrframe, litteral[3]);
|
||||
strcat(lcrframe, "\" CL=0 ");
|
||||
strcat(lcr_message, "AM=4 AF=\"");
|
||||
strcat(lcr_message, litteral[3]);
|
||||
strcat(lcr_message, "\" CL=0 ");
|
||||
}
|
||||
if (checkbox_am_e.value() == true) {
|
||||
strcat(lcrframe, "AM=5 AF=\"");
|
||||
strcat(lcrframe, litteral[4]);
|
||||
strcat(lcrframe, "\" CL=0 ");
|
||||
strcat(lcr_message, "AM=5 AF=\"");
|
||||
strcat(lcr_message, litteral[4]);
|
||||
strcat(lcr_message, "\" CL=0 ");
|
||||
}
|
||||
strcat(lcrframe, "EC=");
|
||||
strcat(lcrframe, ec_lut[options_ec.selected_index()]);
|
||||
strcat(lcrframe, " SAB=0");
|
||||
strcat(lcr_message, "EC=");
|
||||
strcat(lcr_message, ec_lut[options_ec.selected_index()]);
|
||||
strcat(lcr_message, " SAB=0");
|
||||
|
||||
memcpy(lcrstring, lcrframe, 256);
|
||||
memcpy(lcr_string, lcr_message, 256);
|
||||
|
||||
// Checksum
|
||||
checksum = 0;
|
||||
i = 7; // Skip modem sync
|
||||
while (lcrframe[i]) {
|
||||
checksum ^= lcrframe[i];
|
||||
while (lcr_message[i]) {
|
||||
checksum ^= lcr_message[i];
|
||||
i++;
|
||||
}
|
||||
checksum ^= eom[0]; // EOM char
|
||||
checksum &= 0x7F;
|
||||
checksum &= 0x7F; // Trim
|
||||
eom[1] = checksum;
|
||||
|
||||
strcat(lcrframe, eom);
|
||||
strcat(lcr_message, eom);
|
||||
|
||||
//if (persistent_memory::afsk_config() & 2)
|
||||
pm = 0; // Even parity
|
||||
@@ -138,30 +133,31 @@ void LCRView::make_frame() {
|
||||
// pm = 1; // Odd parity
|
||||
|
||||
if (!(persistent_memory::afsk_config() & 8)) {
|
||||
// Clear format
|
||||
for (dp = 0; dp < strlen(lcrframe); dp++) {
|
||||
// Normal format
|
||||
for (dp = 0; dp < strlen(lcr_message); dp++) {
|
||||
pp = pm;
|
||||
new_byte = 0;
|
||||
cur_byte = lcrframe[dp];
|
||||
cur_byte = lcr_message[dp];
|
||||
for (cp = 0; cp < 7; cp++) {
|
||||
if ((cur_byte >> cp) & 1) pp++;
|
||||
new_byte |= (((cur_byte >> cp) & 1) << (7 - cp));
|
||||
bit = (cur_byte >> cp) & 1;
|
||||
pp += bit;
|
||||
new_byte |= (bit << (7 - cp));
|
||||
}
|
||||
lcrframe_f[dp] = new_byte | (pp & 1);
|
||||
lcr_message_data[dp] = new_byte | (pp & 1);
|
||||
}
|
||||
lcrframe_f[dp] = 0;
|
||||
lcr_message_data[dp] = 0;
|
||||
} else {
|
||||
// Alt format
|
||||
for (dp = 0; dp < strlen(lcrframe); dp++) {
|
||||
for (dp = 0; dp < strlen(lcr_message); dp++) {
|
||||
pp = pm;
|
||||
cur_byte = alt_lookup[lcrframe[dp]];
|
||||
cur_byte = alt_lookup[(uint8_t)lcr_message[dp] & 0x7F];
|
||||
for (cp = 0; cp < 8; cp++) {
|
||||
if ((cur_byte >> cp) & 1) pp++;
|
||||
}
|
||||
lcrframe_f[dp * 2] = cur_byte;
|
||||
lcrframe_f[(dp * 2) + 1] = pp & 1;
|
||||
lcr_message_data[dp * 2] = cur_byte;
|
||||
lcr_message_data[(dp * 2) + 1] = pp & 1;
|
||||
}
|
||||
lcrframe_f[dp * 2] = 0;
|
||||
lcr_message_data[dp * 2] = 0;
|
||||
}
|
||||
|
||||
//if (persistent_memory::afsk_config() & 1) {
|
||||
@@ -169,13 +165,13 @@ void LCRView::make_frame() {
|
||||
// See above
|
||||
/*} else {
|
||||
// MSB first
|
||||
for (dp=0;dp<strlen(lcrframe);dp++) {
|
||||
for (dp=0;dp<strlen(lcr_message);dp++) {
|
||||
pp = pm;
|
||||
cur_byte = lcrframe[dp];
|
||||
cur_byte = lcr_message[dp];
|
||||
for (cp=0;cp<7;cp++) {
|
||||
if ((cur_byte>>cp)&1) pp++;
|
||||
}
|
||||
lcrframe_f[dp] = (cur_byte<<1)|(pp&1);
|
||||
lcr_message_data[dp] = (cur_byte<<1)|(pp&1);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
@@ -206,14 +202,17 @@ void LCRView::paint(Painter& painter) {
|
||||
|
||||
button_setrgsb.set_text(rgsb);
|
||||
|
||||
// Recap: tx freq @ bps / ALT
|
||||
// Recap: freq @ bps / ALT
|
||||
auto fstr = to_string_dec_int(portapack::persistent_memory::tuned_frequency() / 1000, 6);
|
||||
auto bstr = to_string_dec_int(portapack::persistent_memory::afsk_bitrate(), 4);
|
||||
strcpy(finalstr, fstr.c_str());
|
||||
strcat(finalstr, "@");
|
||||
strcat(finalstr, bstr.c_str());
|
||||
strcat(finalstr, "bps");
|
||||
if (portapack::persistent_memory::afsk_config() & 8) strcat(finalstr, " ALT");
|
||||
if (portapack::persistent_memory::afsk_config() & 8)
|
||||
strcat(finalstr, " ALT");
|
||||
else
|
||||
strcat(finalstr, " NRM");
|
||||
text_recap.set(finalstr);
|
||||
}
|
||||
|
||||
@@ -226,9 +225,8 @@ void LCRView::on_txdone(int n) {
|
||||
strcat(str, rgsb);
|
||||
text_status.set(str);
|
||||
progress.set_value(0);
|
||||
radio::disable();
|
||||
txing = false;
|
||||
scanning = false;
|
||||
transmitter_model.disable();
|
||||
tx_mode = IDLE;
|
||||
abort_scan = false;
|
||||
button_scan.set_style(&style_val);
|
||||
button_scan.set_text("SCAN");
|
||||
@@ -236,8 +234,8 @@ void LCRView::on_txdone(int n) {
|
||||
}
|
||||
|
||||
if (n > 0) {
|
||||
if (scanning) {
|
||||
scan_progress += 0.555f;
|
||||
if (tx_mode == SCAN) {
|
||||
scan_progress += 0.555f; // 100/(37*5)
|
||||
progress.set_value(scan_progress);
|
||||
} else {
|
||||
text_status.set(" ");
|
||||
@@ -247,71 +245,52 @@ void LCRView::on_txdone(int n) {
|
||||
progress.set_value((6 - n) * 20);
|
||||
}
|
||||
} else {
|
||||
if (scanning && (scan_index < 36)) {
|
||||
radio::disable();
|
||||
if ((tx_mode == SCAN) && (scan_index < LCR_SCAN_COUNT)) {
|
||||
transmitter_model.disable();
|
||||
|
||||
// Next address
|
||||
strcpy(rgsb, RGSB_list[scan_index]);
|
||||
make_frame();
|
||||
|
||||
memset(shared_memory.radio_data, 0, 256);
|
||||
memcpy(shared_memory.radio_data, lcrframe_f, 256);
|
||||
shared_memory.afsk_transmit_done = false;
|
||||
shared_memory.afsk_repeat = 5;
|
||||
generate_message();
|
||||
|
||||
text_status.set(" ");
|
||||
strcpy(str, to_string_dec_int(scan_index).c_str());
|
||||
strcat(str, "/36");
|
||||
strcat(str, "/");
|
||||
strcat(str, to_string_dec_uint(LCR_SCAN_COUNT).c_str());
|
||||
text_status.set(str);
|
||||
scan_progress += 0.694f;
|
||||
progress.set_value(scan_progress);
|
||||
|
||||
scan_index++;
|
||||
radio::disable();
|
||||
// start_tx ?
|
||||
} else {
|
||||
text_status.set("Ready ");
|
||||
progress.set_value(0);
|
||||
radio::disable();
|
||||
txing = false;
|
||||
scanning = false;
|
||||
transmitter_model.disable();
|
||||
tx_mode = IDLE;
|
||||
button_scan.set_style(&style_val);
|
||||
button_scan.set_text("SCAN");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void LCRView::start_tx() {
|
||||
void LCRView::start_tx(const bool scan) {
|
||||
char str[16];
|
||||
bool afsk_alt_format;
|
||||
|
||||
if (scanning) {
|
||||
if (scan) {
|
||||
tx_mode = SCAN;
|
||||
scan_index = 0;
|
||||
strcpy(rgsb, RGSB_list[0]);
|
||||
} else {
|
||||
tx_mode = SINGLE;
|
||||
}
|
||||
|
||||
make_frame();
|
||||
|
||||
lcr_radio_config.tuning_frequency = portapack::persistent_memory::tuned_frequency();
|
||||
|
||||
shared_memory.afsk_samples_per_bit = 228000 / portapack::persistent_memory::afsk_bitrate();
|
||||
shared_memory.afsk_phase_inc_mark = portapack::persistent_memory::afsk_mark_freq() * (0x40000 * 256) / 2280;
|
||||
shared_memory.afsk_phase_inc_space = portapack::persistent_memory::afsk_space_freq() * (0x40000 * 256) / 2280;
|
||||
generate_message();
|
||||
|
||||
if (portapack::persistent_memory::afsk_config() & 8)
|
||||
shared_memory.afsk_alt_format = true;
|
||||
else
|
||||
shared_memory.afsk_alt_format = false;
|
||||
|
||||
shared_memory.afsk_fmmod = portapack::persistent_memory::afsk_bw() * 8;
|
||||
|
||||
memset(shared_memory.radio_data, 0, 256);
|
||||
memcpy(shared_memory.radio_data, lcrframe_f, 256);
|
||||
|
||||
shared_memory.afsk_transmit_done = false;
|
||||
shared_memory.afsk_repeat = 5; //(portapack::persistent_memory::afsk_config() >> 8) & 0xFF;
|
||||
|
||||
if (scanning) {
|
||||
if (tx_mode == SCAN) {
|
||||
text_status.set(" ");
|
||||
strcat(str, "1/36");
|
||||
strcpy(str, "1/");
|
||||
strcat(str, to_string_dec_uint(LCR_SCAN_COUNT).c_str());
|
||||
text_status.set(str);
|
||||
progress.set_value(1);
|
||||
scan_index++;
|
||||
@@ -321,19 +300,42 @@ void LCRView::start_tx() {
|
||||
text_status.set(str);
|
||||
progress.set_value(20);
|
||||
}
|
||||
|
||||
if (portapack::persistent_memory::afsk_config() & 8)
|
||||
afsk_alt_format = true;
|
||||
else
|
||||
afsk_alt_format = false;
|
||||
|
||||
txing = true;
|
||||
radio::enable(lcr_radio_config);
|
||||
transmitter_model.set_tuning_frequency(portapack::persistent_memory::tuned_frequency());
|
||||
transmitter_model.set_baseband_configuration({
|
||||
.mode = 0,
|
||||
.sampling_rate = 2280000U,
|
||||
.decimation_factor = 1,
|
||||
});
|
||||
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();
|
||||
|
||||
baseband::set_afsk_data(
|
||||
lcr_message_data,
|
||||
228000 / portapack::persistent_memory::afsk_bitrate(),
|
||||
portapack::persistent_memory::afsk_mark_freq() * (0x40000 * 256) / 2280,
|
||||
portapack::persistent_memory::afsk_space_freq() * (0x40000 * 256) / 2280,
|
||||
5,
|
||||
portapack::persistent_memory::afsk_bw() * 115, // See proc_fsk_lcr.cpp
|
||||
afsk_alt_format
|
||||
);
|
||||
}
|
||||
|
||||
LCRView::LCRView(NavigationView& nav) {
|
||||
baseband::run_image(portapack::spi_flash::image_tag_lcr);
|
||||
baseband::run_image(portapack::spi_flash::image_tag_afsk);
|
||||
|
||||
memset(litteral, 0, 5 * 8);
|
||||
memset(rgsb, 0, 5);
|
||||
|
||||
strcpy(rgsb, RGSB_list[0]);
|
||||
button_setrgsb.set_text(rgsb);
|
||||
|
||||
add_children({ {
|
||||
&text_recap,
|
||||
@@ -358,7 +360,9 @@ LCRView::LCRView(NavigationView& nav) {
|
||||
&button_clear
|
||||
} });
|
||||
|
||||
options_ec.set_selected_index(0);
|
||||
button_setrgsb.set_text(rgsb);
|
||||
|
||||
options_ec.set_selected_index(0); // Auto
|
||||
|
||||
checkbox_am_a.set_value(true);
|
||||
checkbox_am_b.set_value(false);
|
||||
@@ -394,29 +398,27 @@ LCRView::LCRView(NavigationView& nav) {
|
||||
};
|
||||
|
||||
button_lcrdebug.on_select = [this,&nav](Button&) {
|
||||
make_frame();
|
||||
nav.push<DebugLCRView>(lcrstring, checksum);
|
||||
generate_message();
|
||||
nav.push<DebugLCRView>(lcr_string, checksum);
|
||||
};
|
||||
|
||||
button_transmit.on_select = [this](Button&) {
|
||||
if (txing == false) start_tx();
|
||||
if (tx_mode == IDLE) start_tx(false);
|
||||
};
|
||||
|
||||
button_scan.on_select = [this](Button&) {
|
||||
if (txing == false) {
|
||||
scanning = true;
|
||||
if (tx_mode == IDLE) {
|
||||
scan_progress = 0;
|
||||
button_scan.set_style(&style_cancel);
|
||||
button_scan.set_text("ABORT");
|
||||
start_tx();
|
||||
start_tx(true);
|
||||
} else {
|
||||
abort_scan = true;
|
||||
}
|
||||
};
|
||||
|
||||
button_clear.on_select = [this, &nav](Button&) {
|
||||
if (txing == false) {
|
||||
scanning = false;
|
||||
if (tx_mode == IDLE) {
|
||||
memset(litteral, 0, 5 * 8);
|
||||
options_ec.set_selected_index(0);
|
||||
checkbox_am_a.set_value(true);
|
||||
@@ -425,7 +427,7 @@ LCRView::LCRView(NavigationView& nav) {
|
||||
checkbox_am_d.set_value(true);
|
||||
checkbox_am_e.set_value(true);
|
||||
set_dirty();
|
||||
start_tx();
|
||||
start_tx(false);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@@ -36,43 +36,51 @@
|
||||
|
||||
namespace ui {
|
||||
|
||||
#define LCR_SCAN_COUNT 36
|
||||
|
||||
class LCRView : public View {
|
||||
public:
|
||||
LCRView(NavigationView& nav);
|
||||
~LCRView();
|
||||
std::string title() const override { return "LCR transmit"; };
|
||||
|
||||
void focus() override;
|
||||
void paint(Painter& painter) override;
|
||||
|
||||
std::string title() const override { return "LCR transmit"; };
|
||||
|
||||
private:
|
||||
bool txing = false;
|
||||
bool scanning = false;
|
||||
enum tx_modes {
|
||||
IDLE = 0,
|
||||
SINGLE,
|
||||
SCAN
|
||||
};
|
||||
|
||||
tx_modes tx_mode = IDLE;
|
||||
bool abort_scan = false;
|
||||
double scan_progress;
|
||||
const char RGSB_list[37][5] = {
|
||||
const char RGSB_list[LCR_SCAN_COUNT][5] = {
|
||||
"AI10", "AI20", "AI30", "AI40",
|
||||
"AI50", "AI60", "AI70", "AJ10",
|
||||
"AJ20", "AJ30", "AJ40", "AJ50",
|
||||
"AJ60", "AJ70", "AK10",
|
||||
"EAA0", "EAB0", "EAC0", "EAD0",
|
||||
"EbA0", "EbB0", "EbC0", "EbD0",
|
||||
"EbE0", "EbF0", "EbG0", "EbH0",
|
||||
"EbI0", "EbJ0", "EbK0", "EbL0",
|
||||
"EbM0", "EbN0", "EbO0", "EbP0",
|
||||
"EbS0", "EAD0", "AI10", "AI20",
|
||||
"AI30", "AI40", "AI50", "AI60",
|
||||
"AI70", "AJ10", "AJ20", "AJ30",
|
||||
"AJ40", "AJ50", "AJ60", "AJ70",
|
||||
"AK10"
|
||||
"EbS0"
|
||||
};
|
||||
char litteral[5][8];
|
||||
char rgsb[5];
|
||||
char lcrstring[256];
|
||||
char lcr_message[256];
|
||||
char lcr_string[256]; // For debugging, can remove
|
||||
char lcr_message_data[256];
|
||||
char checksum = 0;
|
||||
char lcrframe[256];
|
||||
char lcrframe_f[256];
|
||||
rf::Frequency f;
|
||||
int scan_index;
|
||||
|
||||
void make_frame();
|
||||
void start_tx();
|
||||
void generate_message();
|
||||
void start_tx(const bool scan);
|
||||
void on_txdone(int n);
|
||||
|
||||
radio::Configuration lcr_radio_config = {
|
||||
@@ -89,7 +97,7 @@ private:
|
||||
// 2: 94 ?
|
||||
// 9: 85 ?
|
||||
|
||||
const char alt_lookup[256] = {
|
||||
const char alt_lookup[128] = {
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x0F, // 0
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 10
|
||||
0xF8, 0, 0x99, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 20 !"#$%&'()*+,-./
|
||||
@@ -97,15 +105,7 @@ private:
|
||||
0, 0x3C, 0x9C, 0x5D, 0, 0, 0, 0, 0, 0x44, 0x85, 0, 0xD5, 0x14, 0, 0, // 40 @ABCDEFGHIJKLMNO
|
||||
0xF0, 0, 0, 0x50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 50 PQRSTUVWXYZ[\]^_
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 60 `abcdefghijklmno
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x7F, // 70 pqrstuvwxyz{|}~
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 80
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 90
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // A0
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // B0
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // C0
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // D0
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // E0
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 // F0
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x7F // 70 pqrstuvwxyz{|}~
|
||||
};
|
||||
|
||||
const Style style_val {
|
||||
@@ -125,7 +125,7 @@ private:
|
||||
};
|
||||
|
||||
OptionsField options_ec {
|
||||
{ 19 * 8, 6 },
|
||||
{ 20 * 8, 6 },
|
||||
7,
|
||||
{
|
||||
{ "EC:Auto", 0 },
|
||||
|
@@ -157,8 +157,9 @@ void RDSView::gen_PSN(const char * psname) {
|
||||
group[c][3] = makeblock(group[c][3], RDS_OFFSET_D);
|
||||
}
|
||||
|
||||
for (c = 0; c < 16; c++)
|
||||
shared_memory.radio_data[c] = group[c >> 2][c & 3];
|
||||
// Todo
|
||||
//for (c = 0; c < 16; c++)
|
||||
// shared_memory.radio_data[c] = group[c >> 2][c & 3];
|
||||
|
||||
shared_memory.bit_length = 4 * 4 * 26;
|
||||
}
|
||||
@@ -197,8 +198,9 @@ void RDSView::gen_RadioText(const char * radiotext) {
|
||||
group[i + 3] = makeblock(group[i + 3], RDS_OFFSET_D);
|
||||
}
|
||||
|
||||
for (c = 0; c < (groups * 4); c++)
|
||||
shared_memory.radio_data[c] = group[c];
|
||||
// Todo
|
||||
//for (c = 0; c < (groups * 4); c++)
|
||||
// shared_memory.radio_data[c] = group[c];
|
||||
|
||||
shared_memory.bit_length = groups * 4 * 26;
|
||||
}
|
||||
|
@@ -31,7 +31,6 @@
|
||||
#include "ff.h"
|
||||
#include "hackrf_gpio.hpp"
|
||||
#include "portapack.hpp"
|
||||
#include "radio.hpp"
|
||||
#include "baseband_api.hpp"
|
||||
|
||||
#include "hackrf_hal.hpp"
|
||||
@@ -118,7 +117,7 @@ void XylosView::focus() {
|
||||
}
|
||||
|
||||
XylosView::~XylosView() {
|
||||
receiver_model.disable();
|
||||
transmitter_model.disable();
|
||||
baseband::shutdown();
|
||||
}
|
||||
|
||||
@@ -257,7 +256,7 @@ void XylosView::on_txdone(const int n) {
|
||||
start_tx();
|
||||
}
|
||||
} else {
|
||||
progress.set_value((n + 1) * 5);
|
||||
progress.set_value(n * 5);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -313,80 +312,80 @@ XylosView::XylosView(NavigationView& nav) {
|
||||
|
||||
header_code_a.on_change = [this](int32_t v) {
|
||||
(void)v;
|
||||
XylosView::generate_message();
|
||||
generate_message();
|
||||
};
|
||||
header_code_b.on_change = [this](int32_t v) {
|
||||
(void)v;
|
||||
XylosView::generate_message();
|
||||
generate_message();
|
||||
};
|
||||
city_code.on_change = [this](int32_t v) {
|
||||
(void)v;
|
||||
XylosView::generate_message();
|
||||
generate_message();
|
||||
};
|
||||
family_code.on_change = [this](int32_t v) {
|
||||
(void)v;
|
||||
XylosView::generate_message();
|
||||
generate_message();
|
||||
};
|
||||
subfamily_code.on_change = [this](int32_t v) {
|
||||
(void)v;
|
||||
XylosView::generate_message();
|
||||
generate_message();
|
||||
};
|
||||
receiver_code.on_change = [this](int32_t v) {
|
||||
(void)v;
|
||||
XylosView::generate_message();
|
||||
generate_message();
|
||||
};
|
||||
|
||||
subfamily_code.hidden(true);
|
||||
text_subfamily.set_style(&style_grey);
|
||||
checkbox_wcsubfamily.on_select = [this](Checkbox&) {
|
||||
if (checkbox_wcsubfamily.value() == true) {
|
||||
subfamily_code.hidden(true);
|
||||
receiver_code.set_focusable(false);
|
||||
text_subfamily.set_style(&style_grey);
|
||||
} else {
|
||||
subfamily_code.hidden(false);
|
||||
receiver_code.set_focusable(true);
|
||||
text_subfamily.set_style(&style());
|
||||
}
|
||||
XylosView::generate_message();
|
||||
generate_message();
|
||||
};
|
||||
|
||||
receiver_code.hidden(true);
|
||||
text_receiver.set_style(&style_grey);
|
||||
checkbox_wcid.on_select = [this](Checkbox&) {
|
||||
if (checkbox_wcid.value() == true) {
|
||||
receiver_code.hidden(true);
|
||||
receiver_code.set_focusable(false);
|
||||
text_receiver.set_style(&style_grey);
|
||||
} else {
|
||||
receiver_code.hidden(false);
|
||||
receiver_code.set_focusable(true);
|
||||
text_receiver.set_style(&style());
|
||||
}
|
||||
receiver_code.set_dirty();
|
||||
XylosView::generate_message();
|
||||
generate_message();
|
||||
};
|
||||
|
||||
options_ra.on_change = [this](size_t n, OptionsField::value_t v) {
|
||||
(void)n;
|
||||
(void)v;
|
||||
XylosView::generate_message();
|
||||
generate_message();
|
||||
};
|
||||
options_rb.on_change = [this](size_t n, OptionsField::value_t v) {
|
||||
(void)n;
|
||||
(void)v;
|
||||
XylosView::generate_message();
|
||||
generate_message();
|
||||
};
|
||||
options_rc.on_change = [this](size_t n, OptionsField::value_t v) {
|
||||
(void)n;
|
||||
(void)v;
|
||||
XylosView::generate_message();
|
||||
generate_message();
|
||||
};
|
||||
options_rd.on_change = [this](size_t n, OptionsField::value_t v) {
|
||||
(void)n;
|
||||
(void)v;
|
||||
XylosView::generate_message();
|
||||
generate_message();
|
||||
};
|
||||
|
||||
button_transmit.set_style(&style_val);
|
||||
|
||||
XylosView::generate_message();
|
||||
generate_message();
|
||||
|
||||
// Transmission and tones testing
|
||||
button_txtest.on_select = [this](Button&) {
|
||||
|
@@ -145,9 +145,10 @@ class XylosView : public View {
|
||||
public:
|
||||
XylosView(NavigationView& nav);
|
||||
~XylosView();
|
||||
std::string title() const override { return "Xylos transmit"; };
|
||||
|
||||
void focus() override;
|
||||
|
||||
std::string title() const override { return "Xylos transmit"; };
|
||||
|
||||
private:
|
||||
enum tx_modes {
|
||||
@@ -158,7 +159,9 @@ private:
|
||||
};
|
||||
|
||||
tx_modes tx_mode = IDLE;
|
||||
|
||||
const rf::Frequency xylos_freqs[7] = { 31325000, 31387500, 31437500, 31475000, 31687500, 31975000, 88000000 };
|
||||
|
||||
char ccir_message[21];
|
||||
|
||||
const char ccir_base[21] = "0000000000B0000B0000";
|
||||
@@ -175,7 +178,7 @@ private:
|
||||
"0E03181AEAB10E0B0E0E"
|
||||
};
|
||||
|
||||
int sequence_idx;
|
||||
unsigned int sequence_idx;
|
||||
|
||||
void ascii_to_ccir(char *ascii);
|
||||
void start_tx();
|
||||
@@ -267,7 +270,7 @@ private:
|
||||
2,
|
||||
{ 0, 99 },
|
||||
1,
|
||||
' '
|
||||
'0'
|
||||
};
|
||||
Checkbox checkbox_wcid {
|
||||
{ 20 * 8, 6 * 16 },
|
||||
|
Reference in New Issue
Block a user