2016-05-11 06:45:03 -04:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2015 Jared Boone, ShareBrained Technology, Inc.
|
|
|
|
* Copyright (C) 2016 Furrtek
|
|
|
|
*
|
|
|
|
* 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"
|
|
|
|
#include "ui_painter.hpp"
|
|
|
|
#include "ui_menu.hpp"
|
|
|
|
#include "ui_navigation.hpp"
|
|
|
|
#include "clock_manager.hpp"
|
|
|
|
#include "message.hpp"
|
|
|
|
#include "rf_path.hpp"
|
|
|
|
#include "volume.hpp"
|
|
|
|
#include "receiver_model.hpp"*/
|
|
|
|
|
|
|
|
#include "receiver_model.hpp"
|
|
|
|
|
|
|
|
#include "spectrum_color_lut.hpp"
|
|
|
|
|
|
|
|
#include "ui_receiver.hpp"
|
|
|
|
#include "ui_spectrum.hpp"
|
|
|
|
#include "ui_record_view.hpp"
|
|
|
|
|
|
|
|
#include "ui_font_fixed_8x16.hpp"
|
|
|
|
|
|
|
|
namespace ui {
|
|
|
|
|
2016-05-12 19:18:04 -04:00
|
|
|
#define CC_SLICE_WIDTH 3000000 //10000000
|
2016-05-11 17:57:22 -04:00
|
|
|
#define CC_BIN_NB 236
|
|
|
|
#define CC_BIN_WIDTH CC_SLICE_WIDTH/CC_BIN_NB
|
2016-05-11 06:45:03 -04:00
|
|
|
|
|
|
|
class CloseCallView : public View {
|
|
|
|
public:
|
|
|
|
CloseCallView(NavigationView& nav);
|
|
|
|
~CloseCallView();
|
|
|
|
|
|
|
|
void on_show() override;
|
|
|
|
void on_hide() override;
|
|
|
|
void focus() override;
|
2016-05-11 17:57:22 -04:00
|
|
|
std::string title() const override { return "Close Call"; };
|
2016-05-11 06:45:03 -04:00
|
|
|
|
|
|
|
private:
|
|
|
|
Coord last_pos = 0;
|
|
|
|
ChannelSpectrumFIFO* fifo { nullptr };
|
|
|
|
uint8_t detect_counter = 0, release_counter = 0;
|
|
|
|
uint8_t wait = 2;
|
2016-05-11 17:57:22 -04:00
|
|
|
uint8_t slice_trim;
|
2016-05-11 06:45:03 -04:00
|
|
|
uint32_t mean = 0;
|
2016-05-11 17:57:22 -04:00
|
|
|
uint32_t min_threshold = 80; // Todo: Put this in persistent / settings
|
2016-05-11 06:45:03 -04:00
|
|
|
rf::Frequency slice_start;
|
|
|
|
rf::Frequency slice_frequency;
|
|
|
|
uint8_t slices_max;
|
|
|
|
uint8_t slices_counter;
|
|
|
|
uint16_t last_channel;
|
2016-05-11 17:57:22 -04:00
|
|
|
rf::Frequency scan_span, locked_frequency;
|
|
|
|
uint8_t slicemax_db[32]; // Todo: Cap max slices !
|
2016-05-11 06:45:03 -04:00
|
|
|
uint8_t slicemax_idx[32];
|
2016-05-11 17:57:22 -04:00
|
|
|
uint8_t scan_counter;
|
2016-05-12 19:18:04 -04:00
|
|
|
SignalToken signal_token_tick_second;
|
2016-05-11 06:45:03 -04:00
|
|
|
bool ignore = true;
|
|
|
|
bool slicing;
|
|
|
|
bool locked = false;
|
|
|
|
void on_channel_spectrum(const ChannelSpectrum& spectrum);
|
|
|
|
void on_range_changed();
|
|
|
|
void do_detection();
|
2016-05-11 17:57:22 -04:00
|
|
|
void on_lna_changed(int32_t v_db);
|
|
|
|
void on_vga_changed(int32_t v_db);
|
2016-05-12 19:18:04 -04:00
|
|
|
void on_tick_second();
|
2016-05-11 06:45:03 -04:00
|
|
|
|
2016-05-11 17:57:22 -04:00
|
|
|
/* |012345678901234567890123456789|
|
|
|
|
* | Min: Max: LNA VGA |
|
|
|
|
* | 0000.0000 0000.0000 00 00 |
|
|
|
|
* | Threshold: 000 |
|
|
|
|
* | Slices: 00 Rate: 000Hz |
|
|
|
|
* |
|
|
|
|
* */
|
|
|
|
|
|
|
|
Text text_labels_a {
|
|
|
|
{ 1 * 8, 0 * 16, 28 * 8, 16 },
|
|
|
|
"Min: Max: LNA VGA"
|
|
|
|
};
|
|
|
|
Text text_labels_b {
|
|
|
|
{ 1 * 8, 2 * 16, 10 * 8, 16 },
|
|
|
|
"Threshold:"
|
|
|
|
};
|
|
|
|
Text text_labels_c {
|
|
|
|
{ 1 * 8, 3 * 16, 28 * 8, 16 },
|
|
|
|
"Slices: Rate: Hz"
|
|
|
|
};
|
|
|
|
|
|
|
|
NumberField field_threshold {
|
|
|
|
{ 12 * 8, 2 * 16 },
|
|
|
|
3,
|
|
|
|
{ 5, 250 },
|
|
|
|
5,
|
|
|
|
' '
|
|
|
|
};
|
|
|
|
|
2016-05-11 06:45:03 -04:00
|
|
|
FrequencyField field_frequency_min {
|
2016-05-11 17:57:22 -04:00
|
|
|
{ 1 * 8, 1 * 16 },
|
2016-05-11 06:45:03 -04:00
|
|
|
};
|
|
|
|
FrequencyField field_frequency_max {
|
2016-05-11 17:57:22 -04:00
|
|
|
{ 11 * 8, 1 * 16 },
|
2016-05-11 06:45:03 -04:00
|
|
|
};
|
|
|
|
|
2016-05-11 17:57:22 -04:00
|
|
|
LNAGainField field_lna {
|
|
|
|
{ 22 * 8, 1 * 16 }
|
|
|
|
};
|
|
|
|
VGAGainField field_vga {
|
|
|
|
{ 26 * 8, 1 * 16 }
|
|
|
|
};
|
|
|
|
|
|
|
|
Text text_slices {
|
|
|
|
{ 9 * 8, 3 * 16, 2 * 8, 16 },
|
2016-05-11 06:45:03 -04:00
|
|
|
"--"
|
|
|
|
};
|
2016-05-11 17:57:22 -04:00
|
|
|
Text text_rate {
|
|
|
|
{ 24 * 8, 3 * 16, 3 * 8, 16 },
|
|
|
|
"---"
|
|
|
|
};
|
2016-05-11 06:45:03 -04:00
|
|
|
|
|
|
|
Text text_infos {
|
2016-05-11 17:57:22 -04:00
|
|
|
{ 1 * 8, 6 * 16, 28 * 8, 16 },
|
|
|
|
"..."
|
|
|
|
};
|
|
|
|
|
|
|
|
BigFrequency big_display {
|
|
|
|
{ 4, 8 * 16, 28 * 8, 32 },
|
|
|
|
0
|
|
|
|
};
|
|
|
|
|
|
|
|
Text text_debug {
|
|
|
|
{ 1 * 8, 13 * 16, 28 * 8, 16 },
|
2016-05-11 06:45:03 -04:00
|
|
|
"..."
|
|
|
|
};
|
|
|
|
|
|
|
|
Button button_exit {
|
|
|
|
{ 92, 264, 56, 32 },
|
|
|
|
"Exit"
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
} /* namespace ui */
|