2022-09-11 10:07:08 -04:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2014 Jared Boone, ShareBrained Technology, Inc.
|
|
|
|
* Copyright (C) 2016 Furrtek
|
2023-05-22 16:17:28 -04:00
|
|
|
* Copyright (C) 2023 gullradriel, Nilorea Studio Inc.
|
2022-09-11 10:07:08 -04: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.
|
|
|
|
*/
|
|
|
|
|
2023-05-14 15:20:10 -04:00
|
|
|
#ifndef _UI_RECON_SETTINGS
|
|
|
|
#define _UI_RECON_SETTINGS
|
|
|
|
|
2022-09-11 10:07:08 -04:00
|
|
|
#include "serializer.hpp"
|
|
|
|
#include "ui.hpp"
|
|
|
|
#include "ui_widget.hpp"
|
|
|
|
#include "ui_tabview.hpp"
|
|
|
|
#include "ui_navigation.hpp"
|
|
|
|
#include "string_format.hpp"
|
2023-12-28 05:25:53 -05:00
|
|
|
#include "ui_styles.hpp"
|
2022-09-11 10:07:08 -04:00
|
|
|
|
2023-05-14 15:20:10 -04:00
|
|
|
// 1Mhz helper
|
|
|
|
#ifdef OneMHz
|
2023-05-15 04:50:21 -04:00
|
|
|
#undef OneMHz
|
2023-05-14 15:20:10 -04:00
|
|
|
#endif
|
|
|
|
#define OneMHz 1000000
|
|
|
|
|
2024-03-09 19:45:54 -05:00
|
|
|
// main app mode
|
2023-05-14 15:20:10 -04:00
|
|
|
#define RECON_MATCH_CONTINUOUS 0
|
|
|
|
#define RECON_MATCH_SPARSE 1
|
|
|
|
|
2024-03-09 19:45:54 -05:00
|
|
|
// repeater mode
|
|
|
|
#define RECON_REPEAT_AND_DELETE 0
|
|
|
|
#define RECON_REPEAT_AND_KEEP 1
|
|
|
|
|
2023-05-15 04:50:21 -04:00
|
|
|
// statistics update interval in ms (change here if the statistics API is changing it's pace)
|
2023-05-14 15:20:10 -04:00
|
|
|
#define STATS_UPDATE_INTERVAL 100
|
|
|
|
|
2023-05-15 04:50:21 -04:00
|
|
|
// maximum lock duration
|
|
|
|
#define RECON_MAX_LOCK_DURATION 9900
|
2023-07-17 14:43:37 -04:00
|
|
|
#define RECON_DEF_SQUELCH -14
|
|
|
|
|
2023-05-14 15:20:10 -04:00
|
|
|
// default number of match to have a lock
|
|
|
|
#define RECON_DEF_NB_MATCH 3
|
2023-05-18 16:16:05 -04:00
|
|
|
#define RECON_MIN_LOCK_DURATION 100 // have to be >= and a multiple of STATS_UPDATE_INTERVAL
|
|
|
|
#define RECON_DEF_WAIT_DURATION 1000 // will be incremented/decremented by STATS_UPDATE_INTERVAL steps
|
2023-05-14 15:20:10 -04:00
|
|
|
|
|
|
|
// screen size helper
|
|
|
|
#define SCREEN_W 240
|
|
|
|
//#define SCREEN_H 320
|
|
|
|
|
|
|
|
// recon settings nb params
|
2023-06-05 14:09:50 -04:00
|
|
|
#define RECON_SETTINGS_NB_PARAMS 7
|
2023-05-14 15:20:10 -04:00
|
|
|
|
2022-09-11 10:07:08 -04:00
|
|
|
namespace ui {
|
|
|
|
|
2023-05-18 16:16:05 -04:00
|
|
|
class ReconSetupViewMain : public View {
|
|
|
|
public:
|
|
|
|
ReconSetupViewMain(NavigationView& nav, Rect parent_rect, std::string input_file, std::string output_file);
|
2023-05-21 16:31:03 -04:00
|
|
|
void save(std::string& input_file, std::string& output_file);
|
2023-05-18 16:16:05 -04:00
|
|
|
void focus() override;
|
|
|
|
|
|
|
|
private:
|
2023-06-16 01:50:04 -04:00
|
|
|
std::string _input_file{"RECON"};
|
|
|
|
std::string _output_file{"RECON_RESULTS"};
|
2023-05-18 16:16:05 -04:00
|
|
|
|
2023-10-30 17:54:37 -04:00
|
|
|
Button button_input_file{
|
2023-05-18 16:16:05 -04:00
|
|
|
{1 * 8, 12, 18 * 8, 22},
|
|
|
|
"select input file"};
|
|
|
|
Text text_input_file{
|
|
|
|
{1 * 8, 4 + 2 * 16, 18 * 8, 22},
|
|
|
|
"RECON"};
|
|
|
|
|
2023-10-30 17:54:37 -04:00
|
|
|
Button button_choose_output_file{
|
2023-05-18 16:16:05 -04:00
|
|
|
{1 * 8, 4 * 16 - 8, 18 * 8, 22},
|
|
|
|
"select output file"};
|
2023-10-30 17:54:37 -04:00
|
|
|
|
|
|
|
Button button_choose_output_name{
|
2023-05-18 16:16:05 -04:00
|
|
|
{1 * 8, 5 * 16 - 2, 18 * 8, 22},
|
|
|
|
"RECON_RESULTS"};
|
|
|
|
|
|
|
|
Checkbox checkbox_autosave_freqs{
|
|
|
|
{1 * 8, 7 * 16 - 4},
|
|
|
|
3,
|
|
|
|
"autosave freqs"};
|
|
|
|
|
|
|
|
Checkbox checkbox_autostart_recon{
|
|
|
|
{1 * 8, 9 * 16 - 4},
|
|
|
|
3,
|
|
|
|
"autostart recon"};
|
|
|
|
|
|
|
|
Checkbox checkbox_clear_output{
|
2023-06-16 01:50:04 -04:00
|
|
|
{1 * 8, 11 * 16 - 4},
|
2023-05-18 16:16:05 -04:00
|
|
|
3,
|
|
|
|
"clear output at start"};
|
|
|
|
};
|
|
|
|
|
|
|
|
class ReconSetupViewMore : public View {
|
|
|
|
public:
|
2023-06-11 12:49:28 -04:00
|
|
|
ReconSetupViewMore(NavigationView& nav, Rect parent_rect);
|
2023-05-18 16:16:05 -04:00
|
|
|
|
2023-06-11 12:49:28 -04:00
|
|
|
void save();
|
2023-05-18 16:16:05 -04:00
|
|
|
|
|
|
|
void focus() override;
|
|
|
|
|
|
|
|
private:
|
|
|
|
Checkbox checkbox_load_freqs{
|
|
|
|
{1 * 8, 12},
|
|
|
|
3,
|
2023-12-28 05:25:53 -05:00
|
|
|
"load freq",
|
|
|
|
true};
|
|
|
|
|
|
|
|
Checkbox checkbox_load_repeaters{
|
|
|
|
{14 * 8, 12},
|
|
|
|
3,
|
|
|
|
"load repeater",
|
|
|
|
true};
|
2023-05-18 16:16:05 -04:00
|
|
|
|
|
|
|
Checkbox checkbox_load_ranges{
|
|
|
|
{1 * 8, 42},
|
|
|
|
3,
|
2023-12-28 05:25:53 -05:00
|
|
|
"load range",
|
|
|
|
true};
|
2023-05-18 16:16:05 -04:00
|
|
|
|
|
|
|
Checkbox checkbox_load_hamradios{
|
|
|
|
{1 * 8, 72},
|
|
|
|
3,
|
2023-12-28 05:25:53 -05:00
|
|
|
"load hamradio",
|
|
|
|
true};
|
2023-05-18 16:16:05 -04:00
|
|
|
|
|
|
|
Checkbox checkbox_update_ranges_when_recon{
|
|
|
|
{1 * 8, 102},
|
|
|
|
3,
|
|
|
|
"auto update m-ranges"};
|
2023-12-28 05:25:53 -05:00
|
|
|
|
2023-06-25 02:16:49 -04:00
|
|
|
Checkbox checkbox_auto_record_locked{
|
|
|
|
{1 * 8, 132},
|
|
|
|
3,
|
2023-07-05 05:08:29 -04:00
|
|
|
"record locked periods"};
|
2023-12-28 05:25:53 -05:00
|
|
|
|
|
|
|
Checkbox checkbox_repeat_recorded{
|
|
|
|
{1 * 8, 162},
|
2024-03-09 19:45:54 -05:00
|
|
|
0,
|
|
|
|
""};
|
|
|
|
|
|
|
|
OptionsField field_repeat_file_mode{
|
|
|
|
{4 * 8 + 3, 165},
|
|
|
|
13,
|
|
|
|
{{"repeat,delete", RECON_REPEAT_AND_DELETE},
|
|
|
|
{"repeat,keep ", RECON_REPEAT_AND_KEEP}}};
|
2023-12-28 05:25:53 -05:00
|
|
|
|
|
|
|
Text text_repeat_nb{
|
2024-03-09 19:45:54 -05:00
|
|
|
{20 * 8, 165, 3 * 8, 22},
|
2023-12-28 05:25:53 -05:00
|
|
|
"nb:"};
|
|
|
|
|
|
|
|
NumberField field_repeat_nb{
|
2024-03-09 19:45:54 -05:00
|
|
|
{23 * 8, 165},
|
2023-12-28 05:25:53 -05:00
|
|
|
2,
|
|
|
|
{1, 99},
|
|
|
|
1,
|
|
|
|
' ',
|
|
|
|
};
|
|
|
|
|
|
|
|
Checkbox checkbox_repeat_amp{
|
|
|
|
{1 * 8, 192},
|
|
|
|
3,
|
|
|
|
"AMP,"};
|
|
|
|
|
|
|
|
Text text_repeat_gain{
|
2023-12-30 16:32:41 -05:00
|
|
|
{9 * 8, 196, 5 * 8, 22},
|
2023-12-28 05:25:53 -05:00
|
|
|
"GAIN:"};
|
|
|
|
|
|
|
|
NumberField field_repeat_gain{
|
2023-12-30 16:32:41 -05:00
|
|
|
{14 * 8, 196},
|
2023-12-28 05:25:53 -05:00
|
|
|
2,
|
|
|
|
{0, 47},
|
|
|
|
1,
|
|
|
|
' ',
|
|
|
|
};
|
2023-12-30 16:32:41 -05:00
|
|
|
|
|
|
|
Text text_repeat_delay{
|
|
|
|
{16 * 8, 196, 8 * 8, 22},
|
|
|
|
", delay:"};
|
|
|
|
|
|
|
|
NumberField field_repeat_delay{
|
|
|
|
{24 * 8, 196},
|
|
|
|
3,
|
|
|
|
{0, 254},
|
|
|
|
1,
|
|
|
|
' ',
|
|
|
|
};
|
2023-05-18 16:16:05 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
class ReconSetupView : public View {
|
|
|
|
public:
|
2023-06-11 12:49:28 -04:00
|
|
|
ReconSetupView(NavigationView& nav, std::string _input_file, std::string _output_file);
|
2023-05-18 16:16:05 -04:00
|
|
|
|
|
|
|
std::function<void(std::vector<std::string> messages)> on_changed{};
|
|
|
|
|
|
|
|
void focus() override;
|
|
|
|
|
|
|
|
std::string title() const override { return "Recon setup"; };
|
|
|
|
|
|
|
|
private:
|
|
|
|
NavigationView& nav_;
|
|
|
|
|
2023-06-16 01:50:04 -04:00
|
|
|
std::string input_file{"RECON"};
|
|
|
|
std::string output_file{"RECON_RESULTS"};
|
2023-05-18 16:16:05 -04:00
|
|
|
|
2023-06-16 01:50:04 -04:00
|
|
|
Rect view_rect{0, 3 * 8, SCREEN_W, 230};
|
2023-05-18 16:16:05 -04:00
|
|
|
|
|
|
|
ReconSetupViewMain viewMain{nav_, view_rect, input_file, output_file};
|
2023-06-11 12:49:28 -04:00
|
|
|
ReconSetupViewMore viewMore{nav_, view_rect};
|
2023-05-18 16:16:05 -04:00
|
|
|
|
|
|
|
TabView tab_view{
|
|
|
|
{"Main", Color::cyan(), &viewMain},
|
|
|
|
{"More", Color::green(), &viewMore}};
|
2023-05-21 03:11:58 -04:00
|
|
|
|
2023-05-18 16:16:05 -04:00
|
|
|
Button button_save{
|
|
|
|
{9 * 8, 255, 14 * 8, 40},
|
|
|
|
"SAVE"};
|
|
|
|
};
|
2022-09-11 10:07:08 -04:00
|
|
|
|
|
|
|
} /* namespace ui */
|
2023-05-14 15:20:10 -04:00
|
|
|
|
|
|
|
#endif
|