mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-08-06 05:34:50 -04:00
Reverted WFM mode to working state
TXView in ADSB TX Lockable TXView POCSAG TX bugfix with Alphanum and Numeric only Testing Labels widget
This commit is contained in:
parent
884d0c4f58
commit
0102a34286
17 changed files with 202 additions and 133 deletions
|
@ -78,7 +78,9 @@ void ADSBTxView::generate_frame() {
|
|||
button_callsign.set_text(callsign);
|
||||
}
|
||||
|
||||
void ADSBTxView::start_tx() {
|
||||
bool ADSBTxView::start_tx() {
|
||||
generate_frame();
|
||||
|
||||
transmitter_model.set_tuning_frequency(434000000); // FOR TESTING - DEBUG
|
||||
transmitter_model.set_sampling_rate(2000000U);
|
||||
transmitter_model.set_rf_amp(true);
|
||||
|
@ -89,6 +91,8 @@ void ADSBTxView::start_tx() {
|
|||
|
||||
memcpy(shared_memory.bb_data.data, adsb_bin, 112);
|
||||
baseband::set_adsb();
|
||||
|
||||
return false; // DEBUG
|
||||
}
|
||||
|
||||
void ADSBTxView::on_txdone(const int n) {
|
||||
|
@ -97,23 +101,16 @@ void ADSBTxView::on_txdone(const int n) {
|
|||
if (n == 200) {
|
||||
transmitter_model.disable();
|
||||
//progress.set_value(0);
|
||||
|
||||
tx_mode = IDLE;
|
||||
button_transmit.set_style(&style_val);
|
||||
button_transmit.set_text("START");
|
||||
} else {
|
||||
//progress.set_value(n);
|
||||
}
|
||||
}
|
||||
|
||||
ADSBTxView::ADSBTxView(NavigationView& nav) {
|
||||
(void)nav;
|
||||
uint32_t c;
|
||||
|
||||
baseband::run_image(portapack::spi_flash::image_tag_adsb_tx);
|
||||
|
||||
// http://openflights.org
|
||||
|
||||
add_children({
|
||||
&text_format,
|
||||
&options_format,
|
||||
|
@ -136,7 +133,7 @@ ADSBTxView::ADSBTxView(NavigationView& nav) {
|
|||
&field_squawk,
|
||||
&text_frame_a,
|
||||
&text_frame_b,
|
||||
&button_transmit
|
||||
&tx_view
|
||||
});
|
||||
|
||||
options_format.set_by_value(17); // Mode S
|
||||
|
@ -164,19 +161,21 @@ ADSBTxView::ADSBTxView(NavigationView& nav) {
|
|||
for (c = 0; c < 4; c++)
|
||||
field_squawk.set_value(c, 0);
|
||||
|
||||
button_transmit.set_style(&style_val);
|
||||
|
||||
generate_frame();
|
||||
|
||||
// Single transmit
|
||||
button_transmit.on_select = [this, &nav](Button&) {
|
||||
if (tx_mode == IDLE) {
|
||||
tx_mode = SINGLE;
|
||||
button_transmit.set_style(&style_cancel);
|
||||
button_transmit.set_text("Wait");
|
||||
generate_frame();
|
||||
start_tx();
|
||||
}
|
||||
|
||||
tx_view.on_edit_frequency = [this, &nav]() {
|
||||
// Shouldn't be able to edit frequency
|
||||
return;
|
||||
};
|
||||
|
||||
tx_view.on_start = [this]() {
|
||||
if (start_tx())
|
||||
tx_view.set_transmitting(true);
|
||||
};
|
||||
|
||||
tx_view.on_stop = [this]() {
|
||||
tx_view.set_transmitting(false);
|
||||
transmitter_model.disable();
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include "ui_widget.hpp"
|
||||
#include "ui_navigation.hpp"
|
||||
#include "ui_font_fixed_8x16.hpp"
|
||||
#include "ui_transmitter.hpp"
|
||||
|
||||
#include "message.hpp"
|
||||
#include "transmitter_model.hpp"
|
||||
|
@ -57,7 +58,7 @@ private:
|
|||
uint8_t adsb_frame[14]; // 112 bit data block as 14 bytes
|
||||
uint8_t adsb_bin[112]; // 112 bit data block
|
||||
|
||||
void start_tx();
|
||||
bool start_tx();
|
||||
void generate_frame();
|
||||
void generate_frame_pos();
|
||||
void on_txdone(const int n);
|
||||
|
@ -170,9 +171,11 @@ private:
|
|||
"-"
|
||||
};
|
||||
|
||||
Button button_transmit {
|
||||
{ 2 * 8, 16 * 16, 64, 32 },
|
||||
"START"
|
||||
TransmitterView tx_view {
|
||||
16 * 16,
|
||||
1090000000,
|
||||
2000000,
|
||||
true
|
||||
};
|
||||
|
||||
MessageHandlerRegistration message_handler_tx_done {
|
||||
|
|
|
@ -33,7 +33,7 @@ namespace ui {
|
|||
|
||||
class HandWriteView : public View {
|
||||
public:
|
||||
std::function<void(char *)> on_changed;
|
||||
std::function<void(char *)> on_changed { };
|
||||
|
||||
HandWriteView(NavigationView& nav, char txt[], size_t max_length);
|
||||
|
||||
|
@ -51,19 +51,19 @@ public:
|
|||
std::string title() const override { return "Text entry"; };
|
||||
|
||||
private:
|
||||
const HandWriting * handwriting;
|
||||
Painter * _painter;
|
||||
const HandWriting * handwriting { };
|
||||
Painter * _painter { };
|
||||
size_t _max_length;
|
||||
uint8_t dir_cnt = 0;
|
||||
uint8_t dir_prev;
|
||||
uint8_t flash_timer = 0;
|
||||
uint8_t txtidx = 0;
|
||||
bool cursor = false;
|
||||
bool tracing = false;
|
||||
uint8_t stroke_index;
|
||||
uint8_t sample_skip, move_wait;
|
||||
uint8_t dir_cnt { 0 };
|
||||
uint8_t dir_prev { 0 };
|
||||
uint8_t flash_timer { 0 };
|
||||
uint8_t txtidx { 0 };
|
||||
bool cursor { false };
|
||||
bool tracing { false };
|
||||
uint8_t stroke_index { 0 };
|
||||
uint8_t sample_skip { 0 }, move_wait { 0 };
|
||||
uint8_t stroke_list[8];
|
||||
Point start_pos, current_pos, last_pos;
|
||||
Point start_pos { }, current_pos { }, last_pos { };
|
||||
bool _lowercase = false;
|
||||
char txtinput[29] = { 0 }; // 28 chars max
|
||||
|
||||
|
@ -79,8 +79,8 @@ private:
|
|||
{ 8, 0, 232, 16 }
|
||||
};
|
||||
|
||||
std::array<Button, 10> num_buttons;
|
||||
std::array<Button, 5> special_buttons;
|
||||
std::array<Button, 10> num_buttons { };
|
||||
std::array<Button, 5> special_buttons { };
|
||||
|
||||
Button button_case {
|
||||
{ 8, 270, 32, 28 },
|
||||
|
|
|
@ -298,8 +298,8 @@ public:
|
|||
|
||||
private:
|
||||
bool entermode = false;
|
||||
uint32_t sequence = 0;
|
||||
uint8_t keycount, key_code;
|
||||
uint32_t sequence { 0 };
|
||||
uint8_t keycount { 0 }, key_code { };
|
||||
char sequence_txt[11] = { 0 };
|
||||
|
||||
Text text_sequence {
|
||||
|
|
|
@ -98,35 +98,45 @@ void TransmitterView::focus() {
|
|||
}
|
||||
|
||||
TransmitterView::TransmitterView(
|
||||
const Coord y, const uint32_t frequency_step, const uint32_t bandwidth
|
||||
) {
|
||||
const Coord y, const uint64_t frequency_step, const uint32_t bandwidth, const bool lock
|
||||
) : lock_ { lock }
|
||||
{
|
||||
set_parent_rect({ 0 * 8, y, 30 * 8, 6 * 8 });
|
||||
|
||||
add_children({
|
||||
&field_frequency,
|
||||
&text_gain,
|
||||
&field_gain,
|
||||
&field_bw,
|
||||
&text_kHz,
|
||||
&button_start
|
||||
});
|
||||
|
||||
set_transmitting(false);
|
||||
|
||||
if (lock_) {
|
||||
field_frequency.set_focusable(false);
|
||||
field_frequency.set_style(&style_locked);
|
||||
} else {
|
||||
add_children({
|
||||
&field_bw,
|
||||
&text_kHz
|
||||
});
|
||||
|
||||
field_bw.on_change = [this](int32_t bandwidth) {
|
||||
on_bandwidth_changed(bandwidth);
|
||||
};
|
||||
field_bw.set_value(bandwidth);
|
||||
}
|
||||
|
||||
field_frequency.set_value(receiver_model.tuning_frequency());
|
||||
field_frequency.set_step(frequency_step);
|
||||
field_frequency.on_change = [this](rf::Frequency f) {
|
||||
this->on_tuning_frequency_changed(f);
|
||||
on_tuning_frequency_changed(f);
|
||||
};
|
||||
field_frequency.on_edit = [this]() {
|
||||
if (on_edit_frequency)
|
||||
on_edit_frequency();
|
||||
};
|
||||
|
||||
field_bw.on_change = [this](int32_t bandwidth) {
|
||||
transmitter_model.set_bandwidth(bandwidth);
|
||||
};
|
||||
field_bw.set_value(bandwidth);
|
||||
|
||||
button_start.on_select = [this](Button&){
|
||||
if (transmitting_) {
|
||||
if (on_stop)
|
||||
|
|
|
@ -52,7 +52,13 @@ public:
|
|||
std::function<void(void)> on_start { };
|
||||
std::function<void(void)> on_stop { };
|
||||
|
||||
TransmitterView(const Coord y, const uint32_t frequency_step, const uint32_t bandwidth);
|
||||
TransmitterView(const Coord y, const uint64_t frequency_step, const uint32_t bandwidth, const bool lock);
|
||||
TransmitterView(
|
||||
const Coord y, const uint32_t frequency_step, const uint32_t bandwidth
|
||||
) : TransmitterView { y, frequency_step, bandwidth, false }
|
||||
{
|
||||
}
|
||||
|
||||
~TransmitterView();
|
||||
|
||||
void on_show() override;
|
||||
|
@ -72,15 +78,25 @@ private:
|
|||
.background = Color::black(),
|
||||
.foreground = Color::red(),
|
||||
};
|
||||
const Style style_locked {
|
||||
.font = font::fixed_8x16,
|
||||
.background = Color::black(),
|
||||
.foreground = Color::dark_grey(),
|
||||
};
|
||||
|
||||
bool lock_ { false };
|
||||
bool transmitting_ { false };
|
||||
|
||||
FrequencyField field_frequency {
|
||||
{ 0 * 8, 1 * 8 }
|
||||
};
|
||||
|
||||
Text text_gain {
|
||||
{ 0 * 8, 3 * 8, 5 * 8, 1 * 16 },
|
||||
"Gain:"
|
||||
};
|
||||
TXGainField field_gain {
|
||||
{ 10 * 8, 1 * 8 }
|
||||
{ 5 * 8, 3 * 8 }
|
||||
};
|
||||
|
||||
NumberField field_bw {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue