2015-08-28 18:50:42 +00:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2015 Jared Boone, ShareBrained Technology, Inc.
|
2016-05-27 07:26:43 +00:00
|
|
|
* Copyright (C) 2016 Furrtek
|
2015-08-28 18:50:42 +00:00
|
|
|
*
|
|
|
|
* 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_lcr.hpp"
|
2015-09-04 18:37:27 +00:00
|
|
|
#include "ui_afsksetup.hpp"
|
|
|
|
#include "ui_debug.hpp"
|
2015-08-28 18:50:42 +00:00
|
|
|
|
2016-07-27 01:03:40 +00:00
|
|
|
#include "baseband_api.hpp"
|
2016-02-04 09:27:53 +00:00
|
|
|
#include "string_format.hpp"
|
|
|
|
|
2015-09-03 04:34:00 +00:00
|
|
|
#include "portapack_persistent_memory.hpp"
|
2015-08-28 18:50:42 +00:00
|
|
|
|
|
|
|
#include <cstring>
|
|
|
|
#include <stdio.h>
|
|
|
|
|
2016-02-04 09:27:53 +00:00
|
|
|
using namespace portapack;
|
2015-08-28 18:50:42 +00:00
|
|
|
|
|
|
|
namespace ui {
|
|
|
|
|
|
|
|
void LCRView::focus() {
|
2015-09-05 18:17:43 +00:00
|
|
|
button_setrgsb.focus();
|
2015-08-28 18:50:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
LCRView::~LCRView() {
|
2016-07-27 19:26:03 +00:00
|
|
|
transmitter_model.disable();
|
|
|
|
baseband::shutdown();
|
2015-08-28 18:50:42 +00:00
|
|
|
}
|
|
|
|
|
2016-07-27 19:26:03 +00:00
|
|
|
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)
|
2016-07-25 14:21:27 +00:00
|
|
|
const char ec_lut[3][2] = { { 'A', 0x00 },
|
|
|
|
{ 'J', 0x00 },
|
2016-07-27 19:26:03 +00:00
|
|
|
{ 'N', 0x00 } };
|
|
|
|
char eom[3] = { 3, 0, 0 }; // EOM and space for checksum
|
|
|
|
uint8_t i, pm, bit;
|
2015-09-03 04:34:00 +00:00
|
|
|
uint16_t dp;
|
|
|
|
uint8_t cp, pp, cur_byte, new_byte;
|
2015-08-28 18:50:42 +00:00
|
|
|
|
2016-07-25 14:21:27 +00:00
|
|
|
button_setrgsb.set_text(rgsb);
|
|
|
|
|
|
|
|
// Pad litterals to 7 chars (not required ?)
|
2015-09-04 18:37:27 +00:00
|
|
|
for (i = 0; i < 5; i++) {
|
2015-08-28 18:50:42 +00:00
|
|
|
while (strlen(litteral[i]) < 7) {
|
|
|
|
strcat(litteral[i], " ");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-07-27 19:26:03 +00:00
|
|
|
// Compose LCR message
|
2016-07-29 02:52:51 +00:00
|
|
|
memset(lcr_message, 0, 512);
|
2016-07-27 19:26:03 +00:00
|
|
|
memcpy(lcr_message, lcr_init, 8);
|
2016-05-09 18:42:20 +00:00
|
|
|
|
2016-07-27 19:26:03 +00:00
|
|
|
strcat(lcr_message, rgsb); // Address
|
|
|
|
strcat(lcr_message, "PA ");
|
2016-07-25 14:21:27 +00:00
|
|
|
|
2016-07-27 22:08:05 +00:00
|
|
|
for (i = 0; i < 5; i++) {
|
|
|
|
if (checkboxes[i].value() == true) {
|
|
|
|
strcat(lcr_message, "AM=");
|
2016-07-29 02:52:51 +00:00
|
|
|
strcat(lcr_message, to_string_dec_uint(i + 1, 1).c_str());
|
2016-07-27 22:08:05 +00:00
|
|
|
strcat(lcr_message, " AF=\"");
|
|
|
|
strcat(lcr_message, litteral[i]);
|
|
|
|
strcat(lcr_message, "\" CL=0 ");
|
|
|
|
}
|
2015-09-05 18:17:43 +00:00
|
|
|
}
|
2016-07-27 19:26:03 +00:00
|
|
|
strcat(lcr_message, "EC=");
|
|
|
|
strcat(lcr_message, ec_lut[options_ec.selected_index()]);
|
|
|
|
strcat(lcr_message, " SAB=0");
|
2015-08-28 18:50:42 +00:00
|
|
|
|
2016-07-25 14:21:27 +00:00
|
|
|
// Checksum
|
2015-09-04 18:37:27 +00:00
|
|
|
checksum = 0;
|
2016-07-25 14:21:27 +00:00
|
|
|
i = 7; // Skip modem sync
|
2016-07-27 19:26:03 +00:00
|
|
|
while (lcr_message[i]) {
|
|
|
|
checksum ^= lcr_message[i];
|
2015-08-28 18:50:42 +00:00
|
|
|
i++;
|
|
|
|
}
|
2016-07-25 14:21:27 +00:00
|
|
|
checksum ^= eom[0]; // EOM char
|
2016-07-27 19:26:03 +00:00
|
|
|
checksum &= 0x7F; // Trim
|
2015-08-28 18:50:42 +00:00
|
|
|
eom[1] = checksum;
|
|
|
|
|
2016-07-27 19:26:03 +00:00
|
|
|
strcat(lcr_message, eom);
|
2015-08-28 18:50:42 +00:00
|
|
|
|
2015-09-10 18:36:39 +00:00
|
|
|
//if (persistent_memory::afsk_config() & 2)
|
2015-09-05 18:17:43 +00:00
|
|
|
pm = 0; // Even parity
|
2015-09-10 18:36:39 +00:00
|
|
|
//else
|
|
|
|
// pm = 1; // Odd parity
|
2015-09-05 18:17:43 +00:00
|
|
|
|
2016-07-25 14:21:27 +00:00
|
|
|
if (!(persistent_memory::afsk_config() & 8)) {
|
2016-07-27 19:26:03 +00:00
|
|
|
// Normal format
|
|
|
|
for (dp = 0; dp < strlen(lcr_message); dp++) {
|
2015-09-05 18:17:43 +00:00
|
|
|
pp = pm;
|
|
|
|
new_byte = 0;
|
2016-07-27 19:26:03 +00:00
|
|
|
cur_byte = lcr_message[dp];
|
2016-05-27 07:26:43 +00:00
|
|
|
for (cp = 0; cp < 7; cp++) {
|
2016-07-27 19:26:03 +00:00
|
|
|
bit = (cur_byte >> cp) & 1;
|
|
|
|
pp += bit;
|
|
|
|
new_byte |= (bit << (7 - cp));
|
2015-09-05 18:17:43 +00:00
|
|
|
}
|
2016-07-27 19:26:03 +00:00
|
|
|
lcr_message_data[dp] = new_byte | (pp & 1);
|
2015-09-05 18:17:43 +00:00
|
|
|
}
|
2016-07-29 02:52:51 +00:00
|
|
|
lcr_message_data[dp++] = 0;
|
2016-07-27 19:26:03 +00:00
|
|
|
lcr_message_data[dp] = 0;
|
2016-07-25 14:21:27 +00:00
|
|
|
} else {
|
|
|
|
// Alt format
|
2016-07-27 19:26:03 +00:00
|
|
|
for (dp = 0; dp < strlen(lcr_message); dp++) {
|
2016-07-25 14:21:27 +00:00
|
|
|
pp = pm;
|
2016-08-01 18:06:17 +00:00
|
|
|
// Do not apply LUT on checksum (last byte) ?
|
|
|
|
if (dp != strlen(lcr_message) - 1)
|
|
|
|
cur_byte = alt_lookup[(uint8_t)lcr_message[dp] & 0x7F];
|
|
|
|
else
|
|
|
|
cur_byte = lcr_message[dp];
|
2016-07-25 14:21:27 +00:00
|
|
|
for (cp = 0; cp < 8; cp++) {
|
|
|
|
if ((cur_byte >> cp) & 1) pp++;
|
|
|
|
}
|
2016-07-27 19:26:03 +00:00
|
|
|
lcr_message_data[dp * 2] = cur_byte;
|
2016-07-29 02:52:51 +00:00
|
|
|
lcr_message_data[(dp * 2) + 1] = 0xFE | (pp & 1);
|
2016-07-25 14:21:27 +00:00
|
|
|
}
|
2016-07-27 19:26:03 +00:00
|
|
|
lcr_message_data[dp * 2] = 0;
|
2016-07-29 02:52:51 +00:00
|
|
|
lcr_message_data[(dp * 2) + 1] = 0;
|
2016-07-25 14:21:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//if (persistent_memory::afsk_config() & 1) {
|
|
|
|
// LSB first
|
|
|
|
// See above
|
2015-09-10 18:36:39 +00:00
|
|
|
/*} else {
|
2015-09-05 18:17:43 +00:00
|
|
|
// MSB first
|
2016-07-27 19:26:03 +00:00
|
|
|
for (dp=0;dp<strlen(lcr_message);dp++) {
|
2015-09-05 18:17:43 +00:00
|
|
|
pp = pm;
|
2016-07-27 19:26:03 +00:00
|
|
|
cur_byte = lcr_message[dp];
|
2015-09-05 18:17:43 +00:00
|
|
|
for (cp=0;cp<7;cp++) {
|
|
|
|
if ((cur_byte>>cp)&1) pp++;
|
|
|
|
}
|
2016-07-27 19:26:03 +00:00
|
|
|
lcr_message_data[dp] = (cur_byte<<1)|(pp&1);
|
2015-09-03 04:34:00 +00:00
|
|
|
}
|
2015-09-10 18:36:39 +00:00
|
|
|
}*/
|
2015-09-04 18:37:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void LCRView::paint(Painter& painter) {
|
2015-09-10 18:36:39 +00:00
|
|
|
uint8_t i;
|
2016-07-25 14:21:27 +00:00
|
|
|
char finalstr[24] = {0};
|
2015-09-10 18:36:39 +00:00
|
|
|
|
2015-09-04 18:37:27 +00:00
|
|
|
static constexpr Style style_orange {
|
|
|
|
.font = font::fixed_8x16,
|
|
|
|
.background = Color::black(),
|
|
|
|
.foreground = Color::orange(),
|
|
|
|
};
|
|
|
|
|
|
|
|
Point offset = {
|
2015-09-05 18:17:43 +00:00
|
|
|
static_cast<Coord>(104),
|
2016-05-27 07:26:43 +00:00
|
|
|
static_cast<Coord>(68)
|
2015-09-04 18:37:27 +00:00
|
|
|
};
|
2015-09-03 04:34:00 +00:00
|
|
|
|
2015-09-10 18:36:39 +00:00
|
|
|
for (i = 0; i < 5; i++) {
|
|
|
|
painter.draw_string(
|
|
|
|
screen_pos() + offset,
|
|
|
|
style_orange,
|
|
|
|
litteral[i]
|
|
|
|
);
|
2016-05-27 07:26:43 +00:00
|
|
|
offset.y += 32;
|
|
|
|
}
|
2016-05-29 10:06:47 +00:00
|
|
|
|
|
|
|
button_setrgsb.set_text(rgsb);
|
2016-07-25 14:21:27 +00:00
|
|
|
|
2016-07-27 19:26:03 +00:00
|
|
|
// Recap: freq @ bps / ALT
|
2016-07-25 14:21:27 +00:00
|
|
|
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());
|
2016-07-27 22:08:05 +00:00
|
|
|
strcat(finalstr, "bps ");
|
2016-07-27 19:26:03 +00:00
|
|
|
if (portapack::persistent_memory::afsk_config() & 8)
|
2016-07-27 22:08:05 +00:00
|
|
|
strcat(finalstr, "ALT");
|
2016-07-27 19:26:03 +00:00
|
|
|
else
|
2016-07-27 22:08:05 +00:00
|
|
|
strcat(finalstr, "NRM");
|
2016-07-25 14:21:27 +00:00
|
|
|
text_recap.set(finalstr);
|
2016-05-27 07:26:43 +00:00
|
|
|
}
|
|
|
|
|
2016-07-27 22:08:05 +00:00
|
|
|
void LCRView::update_progress() {
|
2016-07-27 01:03:40 +00:00
|
|
|
char str[16];
|
|
|
|
|
2016-07-27 22:08:05 +00:00
|
|
|
text_status.set(" ");
|
|
|
|
|
|
|
|
if (tx_mode == SINGLE) {
|
|
|
|
strcpy(str, to_string_dec_uint(repeat_index).c_str());
|
|
|
|
strcat(str, "/");
|
|
|
|
strcat(str, to_string_dec_uint(portapack::persistent_memory::afsk_repeats()).c_str());
|
2016-07-27 01:03:40 +00:00
|
|
|
text_status.set(str);
|
2016-07-27 22:08:05 +00:00
|
|
|
progress.set_value(repeat_index);
|
|
|
|
} else if (tx_mode == SCAN) {
|
|
|
|
strcpy(str, to_string_dec_uint(repeat_index).c_str());
|
|
|
|
strcat(str, "/");
|
|
|
|
strcat(str, to_string_dec_uint(portapack::persistent_memory::afsk_repeats()).c_str());
|
|
|
|
strcat(str, " ");
|
|
|
|
strcat(str, to_string_dec_uint(scan_index + 1).c_str());
|
|
|
|
strcat(str, "/");
|
|
|
|
strcat(str, to_string_dec_uint(LCR_SCAN_COUNT).c_str());
|
|
|
|
text_status.set(str);
|
|
|
|
progress.set_value(scan_progress);
|
|
|
|
} else {
|
|
|
|
text_status.set("Ready");
|
2016-07-27 01:03:40 +00:00
|
|
|
progress.set_value(0);
|
|
|
|
}
|
2016-07-27 22:08:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void LCRView::on_txdone(int n) {
|
|
|
|
char str[16];
|
2016-07-27 01:03:40 +00:00
|
|
|
|
|
|
|
if (n > 0) {
|
2016-07-28 03:25:33 +00:00
|
|
|
// Repeating...
|
2016-07-27 22:08:05 +00:00
|
|
|
repeat_index = n + 1;
|
2016-07-27 19:26:03 +00:00
|
|
|
if (tx_mode == SCAN) {
|
2016-07-27 22:08:05 +00:00
|
|
|
scan_progress++;
|
|
|
|
update_progress();
|
2016-07-27 01:03:40 +00:00
|
|
|
} else {
|
2016-07-27 22:08:05 +00:00
|
|
|
update_progress();
|
2016-07-27 01:03:40 +00:00
|
|
|
}
|
|
|
|
} else {
|
2016-07-28 03:25:33 +00:00
|
|
|
// Done transmitting
|
2016-07-27 22:08:05 +00:00
|
|
|
if ((tx_mode == SCAN) && (scan_index < (LCR_SCAN_COUNT - 1))) {
|
2016-07-27 19:26:03 +00:00
|
|
|
transmitter_model.disable();
|
2016-07-27 22:08:05 +00:00
|
|
|
if (abort_scan) {
|
2016-07-28 03:25:33 +00:00
|
|
|
// Kill scan process
|
2016-07-27 22:08:05 +00:00
|
|
|
strcpy(str, "Abort @");
|
|
|
|
strcat(str, rgsb);
|
|
|
|
text_status.set(str);
|
|
|
|
progress.set_value(0);
|
|
|
|
tx_mode = IDLE;
|
|
|
|
abort_scan = false;
|
|
|
|
button_scan.set_style(&style_val);
|
|
|
|
button_scan.set_text("SCAN");
|
|
|
|
} else {
|
|
|
|
// Next address
|
|
|
|
scan_index++;
|
|
|
|
strcpy(rgsb, RGSB_list[scan_index]);
|
|
|
|
scan_progress++;
|
|
|
|
repeat_index = 1;
|
|
|
|
update_progress();
|
|
|
|
start_tx(true);
|
|
|
|
}
|
2016-07-27 01:03:40 +00:00
|
|
|
} else {
|
2016-07-27 19:26:03 +00:00
|
|
|
transmitter_model.disable();
|
|
|
|
tx_mode = IDLE;
|
2016-07-27 22:08:05 +00:00
|
|
|
update_progress();
|
2016-07-27 01:03:40 +00:00
|
|
|
button_scan.set_style(&style_val);
|
|
|
|
button_scan.set_text("SCAN");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-07-27 19:26:03 +00:00
|
|
|
void LCRView::start_tx(const bool scan) {
|
|
|
|
bool afsk_alt_format;
|
2016-07-27 22:08:05 +00:00
|
|
|
uint8_t afsk_repeats;
|
|
|
|
|
|
|
|
afsk_repeats = portapack::persistent_memory::afsk_repeats();
|
2016-05-27 07:26:43 +00:00
|
|
|
|
2016-07-27 19:26:03 +00:00
|
|
|
if (scan) {
|
2016-07-27 22:08:05 +00:00
|
|
|
if (tx_mode != SCAN) {
|
|
|
|
scan_index = 0;
|
|
|
|
scan_progress = 1;
|
|
|
|
repeat_index = 1;
|
|
|
|
tx_mode = SCAN;
|
|
|
|
strcpy(rgsb, RGSB_list[0]);
|
|
|
|
progress.set_max(LCR_SCAN_COUNT * afsk_repeats);
|
|
|
|
update_progress();
|
|
|
|
}
|
2016-07-27 19:26:03 +00:00
|
|
|
} else {
|
|
|
|
tx_mode = SINGLE;
|
2016-07-27 22:08:05 +00:00
|
|
|
repeat_index = 1;
|
|
|
|
progress.set_max(afsk_repeats);
|
|
|
|
update_progress();
|
2016-05-27 07:26:43 +00:00
|
|
|
}
|
|
|
|
|
2016-07-27 19:26:03 +00:00
|
|
|
generate_message();
|
2016-05-27 07:26:43 +00:00
|
|
|
|
2016-07-27 19:26:03 +00:00
|
|
|
if (portapack::persistent_memory::afsk_config() & 8)
|
|
|
|
afsk_alt_format = true;
|
|
|
|
else
|
|
|
|
afsk_alt_format = false;
|
2016-05-27 07:26:43 +00:00
|
|
|
|
2016-07-27 19:26:03 +00:00
|
|
|
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,
|
2016-07-27 22:08:05 +00:00
|
|
|
afsk_repeats,
|
2016-07-27 19:26:03 +00:00
|
|
|
portapack::persistent_memory::afsk_bw() * 115, // See proc_fsk_lcr.cpp
|
|
|
|
afsk_alt_format
|
|
|
|
);
|
2015-08-28 18:50:42 +00:00
|
|
|
}
|
|
|
|
|
2016-07-27 22:08:05 +00:00
|
|
|
void LCRView::on_button_setam(NavigationView& nav, Button& button) {
|
|
|
|
textentry(nav, litteral[button.id], 7);
|
|
|
|
}
|
|
|
|
|
2016-07-27 01:03:40 +00:00
|
|
|
LCRView::LCRView(NavigationView& nav) {
|
2016-07-27 22:08:05 +00:00
|
|
|
std::string label;
|
|
|
|
|
2016-07-27 19:26:03 +00:00
|
|
|
baseband::run_image(portapack::spi_flash::image_tag_afsk);
|
2016-02-04 09:27:53 +00:00
|
|
|
|
2016-05-27 07:26:43 +00:00
|
|
|
memset(litteral, 0, 5 * 8);
|
2015-08-28 18:50:42 +00:00
|
|
|
memset(rgsb, 0, 5);
|
|
|
|
|
2016-05-27 07:26:43 +00:00
|
|
|
strcpy(rgsb, RGSB_list[0]);
|
2015-08-28 18:50:42 +00:00
|
|
|
|
|
|
|
add_children({ {
|
2015-09-04 18:37:27 +00:00
|
|
|
&text_recap,
|
2016-07-25 14:21:27 +00:00
|
|
|
&options_ec,
|
2015-08-28 18:50:42 +00:00
|
|
|
&button_setrgsb,
|
2015-09-03 04:34:00 +00:00
|
|
|
&button_txsetup,
|
2015-09-04 18:37:27 +00:00
|
|
|
&text_status,
|
2016-05-27 07:26:43 +00:00
|
|
|
&progress,
|
2015-09-04 18:37:27 +00:00
|
|
|
&button_lcrdebug,
|
2015-08-28 18:50:42 +00:00
|
|
|
&button_transmit,
|
2016-05-27 07:26:43 +00:00
|
|
|
&button_scan,
|
|
|
|
&button_clear
|
2015-08-28 18:50:42 +00:00
|
|
|
} });
|
|
|
|
|
2016-07-27 22:08:05 +00:00
|
|
|
const auto button_setam_fn = [this, &nav](Button& button) {
|
|
|
|
this->on_button_setam(nav, button);
|
|
|
|
};
|
2016-07-27 19:26:03 +00:00
|
|
|
|
2016-07-27 22:08:05 +00:00
|
|
|
size_t n = 0;
|
|
|
|
for(auto& button : buttons) {
|
|
|
|
button.on_select = button_setam_fn;
|
|
|
|
button.id = n;
|
2016-07-29 02:52:51 +00:00
|
|
|
label = "AM " + to_string_dec_uint(n + 1, 1);;
|
2016-07-27 22:08:05 +00:00
|
|
|
button.set_text(label);
|
|
|
|
button.set_parent_rect({
|
|
|
|
static_cast<Coord>(48),
|
|
|
|
static_cast<Coord>(n * 32 + 64),
|
|
|
|
48, 24
|
|
|
|
});
|
|
|
|
add_child(&button);
|
|
|
|
n++;
|
|
|
|
}
|
2016-07-25 14:21:27 +00:00
|
|
|
|
2016-07-27 22:08:05 +00:00
|
|
|
n = 0;
|
|
|
|
for(auto& checkbox : checkboxes) {
|
|
|
|
checkbox.set_parent_rect({
|
|
|
|
static_cast<Coord>(16),
|
|
|
|
static_cast<Coord>(n * 32 + 64),
|
|
|
|
48, 24
|
|
|
|
});
|
|
|
|
checkbox.set_value(false);
|
|
|
|
add_child(&checkbox);
|
|
|
|
n++;
|
|
|
|
}
|
|
|
|
|
2016-07-29 02:52:51 +00:00
|
|
|
n = 0;
|
|
|
|
for(auto& rectangle : rectangles) {
|
|
|
|
rectangle.set_parent_rect({
|
|
|
|
static_cast<Coord>(104 - 2),
|
|
|
|
static_cast<Coord>(n * 32 + 68 - 2),
|
|
|
|
56 + 4, 16 + 4
|
|
|
|
});
|
|
|
|
rectangle.set_color(ui::Color::grey());
|
|
|
|
rectangle.set_outline(true);
|
|
|
|
add_child(&rectangle);
|
|
|
|
n++;
|
|
|
|
}
|
|
|
|
|
2016-07-27 22:08:05 +00:00
|
|
|
button_setrgsb.set_text(rgsb);
|
|
|
|
options_ec.set_selected_index(0); // Auto
|
|
|
|
checkboxes[0].set_value(true);
|
2015-09-05 18:17:43 +00:00
|
|
|
|
2015-09-04 18:37:27 +00:00
|
|
|
button_transmit.set_style(&style_val);
|
2016-05-27 07:26:43 +00:00
|
|
|
button_scan.set_style(&style_val);
|
2015-09-04 18:37:27 +00:00
|
|
|
|
2016-05-27 07:26:43 +00:00
|
|
|
button_setrgsb.on_select = [this,&nav](Button&) {
|
2016-05-29 10:06:47 +00:00
|
|
|
textentry(nav, rgsb, 4);
|
2015-08-28 18:50:42 +00:00
|
|
|
};
|
|
|
|
|
2016-05-27 07:26:43 +00:00
|
|
|
button_txsetup.on_select = [&nav](Button&) {
|
|
|
|
nav.push<AFSKSetupView>();
|
2015-08-28 18:50:42 +00:00
|
|
|
};
|
|
|
|
|
2016-07-29 02:52:51 +00:00
|
|
|
button_lcrdebug.on_select = [this, &nav](Button&) {
|
2016-07-27 19:26:03 +00:00
|
|
|
generate_message();
|
2016-07-29 02:52:51 +00:00
|
|
|
nav.push<DebugLCRView>(std::string(lcr_message), checksum);
|
2015-08-28 18:50:42 +00:00
|
|
|
};
|
2016-05-27 07:26:43 +00:00
|
|
|
|
|
|
|
button_transmit.on_select = [this](Button&) {
|
2016-07-27 19:26:03 +00:00
|
|
|
if (tx_mode == IDLE) start_tx(false);
|
2016-05-09 18:42:20 +00:00
|
|
|
};
|
2016-05-27 07:26:43 +00:00
|
|
|
|
|
|
|
button_scan.on_select = [this](Button&) {
|
2016-07-27 19:26:03 +00:00
|
|
|
if (tx_mode == IDLE) {
|
2016-05-27 07:26:43 +00:00
|
|
|
button_scan.set_style(&style_cancel);
|
|
|
|
button_scan.set_text("ABORT");
|
2016-07-27 19:26:03 +00:00
|
|
|
start_tx(true);
|
2016-05-27 07:26:43 +00:00
|
|
|
} else {
|
|
|
|
abort_scan = true;
|
|
|
|
}
|
2015-09-04 18:37:27 +00:00
|
|
|
};
|
2015-08-28 18:50:42 +00:00
|
|
|
|
2016-05-27 07:26:43 +00:00
|
|
|
button_clear.on_select = [this, &nav](Button&) {
|
2016-07-28 03:25:33 +00:00
|
|
|
uint8_t n;
|
|
|
|
|
2016-07-27 19:26:03 +00:00
|
|
|
if (tx_mode == IDLE) {
|
2016-07-25 14:21:27 +00:00
|
|
|
memset(litteral, 0, 5 * 8);
|
2016-07-28 03:25:33 +00:00
|
|
|
options_ec.set_selected_index(0); // Auto
|
|
|
|
for (n = 0; n < 5; n++)
|
|
|
|
checkboxes[n].set_value(true);
|
2016-07-25 14:21:27 +00:00
|
|
|
set_dirty();
|
2016-07-27 19:26:03 +00:00
|
|
|
start_tx(false);
|
2016-07-28 03:25:33 +00:00
|
|
|
} else if (tx_mode == SCAN) {
|
|
|
|
abort_scan = true;
|
2016-07-25 14:21:27 +00:00
|
|
|
}
|
2015-08-28 18:50:42 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
} /* namespace ui */
|