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.hpp"
|
|
|
|
#include "ui_widget.hpp"
|
2016-05-29 10:06:47 +00:00
|
|
|
#include "ui_textentry.hpp"
|
2015-08-28 18:50:42 +00:00
|
|
|
#include "message.hpp"
|
|
|
|
#include "transmitter_model.hpp"
|
|
|
|
|
|
|
|
namespace ui {
|
|
|
|
|
|
|
|
class LCRView : public View {
|
|
|
|
public:
|
2016-02-04 09:27:53 +00:00
|
|
|
LCRView(NavigationView& nav);
|
2015-08-28 18:50:42 +00:00
|
|
|
~LCRView();
|
|
|
|
|
|
|
|
void focus() override;
|
|
|
|
void paint(Painter& painter) override;
|
2016-07-27 19:26:03 +00:00
|
|
|
|
|
|
|
std::string title() const override { return "LCR transmit"; };
|
2015-08-28 18:50:42 +00:00
|
|
|
|
|
|
|
private:
|
2016-08-02 10:44:31 +00:00
|
|
|
struct scan_list_t {
|
|
|
|
uint8_t count;
|
|
|
|
const char * addresses;
|
2016-07-27 19:26:03 +00:00
|
|
|
};
|
2016-08-02 10:44:31 +00:00
|
|
|
|
2016-08-17 00:55:34 +00:00
|
|
|
const scan_list_t scan_list[2] = {
|
2016-08-02 10:44:31 +00:00
|
|
|
{ 36, &RGSB_list_Lille[0][0] },
|
2016-08-17 02:17:24 +00:00
|
|
|
{ 20, &RGSB_list_Reims[0][0] }
|
2016-08-02 10:44:31 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
const char RGSB_list_Lille[36][5] = {
|
2016-07-27 19:26:03 +00:00
|
|
|
"AI10", "AI20", "AI30", "AI40",
|
|
|
|
"AI50", "AI60", "AI70", "AJ10",
|
|
|
|
"AJ20", "AJ30", "AJ40", "AJ50",
|
|
|
|
"AJ60", "AJ70", "AK10",
|
2015-09-03 04:34:00 +00:00
|
|
|
"EAA0", "EAB0", "EAC0", "EAD0",
|
|
|
|
"EbA0", "EbB0", "EbC0", "EbD0",
|
|
|
|
"EbE0", "EbF0", "EbG0", "EbH0",
|
|
|
|
"EbI0", "EbJ0", "EbK0", "EbL0",
|
|
|
|
"EbM0", "EbN0", "EbO0", "EbP0",
|
2016-07-27 19:26:03 +00:00
|
|
|
"EbS0"
|
2015-09-03 04:34:00 +00:00
|
|
|
};
|
2016-08-02 10:44:31 +00:00
|
|
|
|
2016-08-17 02:17:24 +00:00
|
|
|
const char RGSB_list_Reims[20][5] = {
|
2016-08-02 10:44:31 +00:00
|
|
|
"AI10", "AI20", "AI30", "AI40",
|
|
|
|
"AI50", "AI60", "AI70",
|
|
|
|
"AJ10", "AJ20", "AJ30", "AJ40",
|
|
|
|
"AJ50", "AJ60", "AJ70",
|
|
|
|
"AK10", "AK20", "AK50", "AK60",
|
|
|
|
"AK70",
|
|
|
|
"AP10"
|
|
|
|
};
|
|
|
|
|
|
|
|
enum tx_modes {
|
|
|
|
IDLE = 0,
|
|
|
|
SINGLE,
|
|
|
|
SCAN
|
|
|
|
};
|
|
|
|
|
|
|
|
tx_modes tx_mode = IDLE;
|
|
|
|
bool abort_scan = false;
|
2016-08-17 00:55:34 +00:00
|
|
|
uint8_t scan_count, scan_index;
|
2016-08-02 10:44:31 +00:00
|
|
|
double scan_progress;
|
|
|
|
char litteral[5][8] = { { 0 }, { 0 }, { 0 }, { 0 }, { 0 } };
|
|
|
|
char rgsb[5] = { 0 };
|
2016-07-29 02:52:51 +00:00
|
|
|
char lcr_message[512];
|
|
|
|
char lcr_message_data[512];
|
2015-09-04 18:37:27 +00:00
|
|
|
char checksum = 0;
|
2015-09-05 18:17:43 +00:00
|
|
|
rf::Frequency f;
|
2016-07-27 22:08:05 +00:00
|
|
|
uint8_t repeat_index;
|
2016-05-27 07:26:43 +00:00
|
|
|
|
2016-07-27 19:26:03 +00:00
|
|
|
void generate_message();
|
2016-07-27 22:08:05 +00:00
|
|
|
void update_progress();
|
2016-07-27 19:26:03 +00:00
|
|
|
void start_tx(const bool scan);
|
2016-07-27 01:03:40 +00:00
|
|
|
void on_txdone(int n);
|
2016-07-27 22:08:05 +00:00
|
|
|
void on_button_setam(NavigationView& nav, Button& button);
|
2016-07-27 01:03:40 +00:00
|
|
|
|
2016-05-27 07:26:43 +00:00
|
|
|
const Style style_val {
|
|
|
|
.font = font::fixed_8x16,
|
2016-12-09 01:35:50 +00:00
|
|
|
.background = Color::black(),
|
|
|
|
.foreground = Color::green(),
|
2016-05-27 07:26:43 +00:00
|
|
|
};
|
|
|
|
const Style style_cancel {
|
|
|
|
.font = font::fixed_8x16,
|
2016-12-09 01:35:50 +00:00
|
|
|
.background = Color::black(),
|
|
|
|
.foreground = Color::red(),
|
2015-09-04 18:37:27 +00:00
|
|
|
};
|
2016-07-27 22:08:05 +00:00
|
|
|
|
|
|
|
std::array<Button, 5> buttons;
|
|
|
|
std::array<Checkbox, 5> checkboxes;
|
2016-07-29 02:52:51 +00:00
|
|
|
std::array<Rectangle, 5> rectangles;
|
2015-09-04 18:37:27 +00:00
|
|
|
|
|
|
|
Text text_recap {
|
2016-05-09 18:42:20 +00:00
|
|
|
{ 8, 6, 18 * 8, 16 },
|
2015-09-04 18:37:27 +00:00
|
|
|
"-"
|
|
|
|
};
|
2016-05-09 18:42:20 +00:00
|
|
|
|
2016-07-25 14:21:27 +00:00
|
|
|
OptionsField options_ec {
|
2016-07-27 22:08:05 +00:00
|
|
|
{ 21 * 8, 6 },
|
2016-07-27 01:03:40 +00:00
|
|
|
7,
|
2016-07-25 14:21:27 +00:00
|
|
|
{
|
2016-07-27 01:03:40 +00:00
|
|
|
{ "EC:Auto", 0 },
|
|
|
|
{ "EC:Jour", 1 },
|
2016-08-02 10:44:31 +00:00
|
|
|
{ "EC:Nuit", 2 },
|
|
|
|
{ "EC:S ? ", 3 }
|
2016-07-25 14:21:27 +00:00
|
|
|
}
|
2016-05-09 18:42:20 +00:00
|
|
|
};
|
2015-09-04 18:37:27 +00:00
|
|
|
|
2015-08-28 18:50:42 +00:00
|
|
|
Button button_setrgsb {
|
|
|
|
{ 16, 24, 96, 32 },
|
|
|
|
"Set RGSB"
|
|
|
|
};
|
2015-09-03 04:34:00 +00:00
|
|
|
Button button_txsetup {
|
2016-05-27 07:26:43 +00:00
|
|
|
{ 128, 24, 96, 32 },
|
2015-09-03 04:34:00 +00:00
|
|
|
"TX setup"
|
|
|
|
};
|
2015-09-05 18:17:43 +00:00
|
|
|
|
2015-09-04 18:37:27 +00:00
|
|
|
Button button_lcrdebug {
|
2016-05-27 07:26:43 +00:00
|
|
|
{ 168, 216, 56, 24 },
|
2015-09-04 18:37:27 +00:00
|
|
|
"DEBUG"
|
2015-08-28 18:50:42 +00:00
|
|
|
};
|
|
|
|
|
2016-08-02 10:44:31 +00:00
|
|
|
Button button_clear {
|
|
|
|
{ 174, 64, 50, 9 * 16 },
|
|
|
|
"CLEAR"
|
|
|
|
};
|
|
|
|
|
2016-05-27 07:26:43 +00:00
|
|
|
Text text_status {
|
|
|
|
{ 16, 224, 128, 16 },
|
|
|
|
"Ready"
|
|
|
|
};
|
|
|
|
ProgressBar progress {
|
|
|
|
{ 16, 224 + 20, 208, 16 }
|
|
|
|
};
|
|
|
|
|
2015-08-28 18:50:42 +00:00
|
|
|
Button button_transmit {
|
2016-05-27 07:26:43 +00:00
|
|
|
{ 16, 270, 64, 32 },
|
2015-09-03 04:34:00 +00:00
|
|
|
"TX"
|
|
|
|
};
|
2016-08-02 10:44:31 +00:00
|
|
|
Text text_scanlist {
|
|
|
|
{ 88, 268, 80, 16 },
|
|
|
|
"Scan list:"
|
|
|
|
};
|
|
|
|
OptionsField options_scanlist {
|
|
|
|
{ 88, 284 },
|
|
|
|
6,
|
|
|
|
{
|
|
|
|
{ "Lille ", 0 },
|
|
|
|
{ "Reims ", 1 }
|
|
|
|
}
|
|
|
|
};
|
2016-05-27 07:26:43 +00:00
|
|
|
Button button_scan {
|
2016-08-02 10:44:31 +00:00
|
|
|
{ 168, 270, 56, 32 },
|
2016-05-27 07:26:43 +00:00
|
|
|
"SCAN"
|
2015-08-28 18:50:42 +00:00
|
|
|
};
|
2016-07-27 01:03:40 +00:00
|
|
|
|
|
|
|
MessageHandlerRegistration message_handler_tx_done {
|
|
|
|
Message::ID::TXDone,
|
|
|
|
[this](const Message* const p) {
|
|
|
|
const auto message = *reinterpret_cast<const TXDoneMessage*>(p);
|
|
|
|
this->on_txdone(message.n);
|
|
|
|
}
|
|
|
|
};
|
2015-08-28 18:50:42 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} /* namespace ui */
|