2017-01-30 13:10:30 +00:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2014 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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __UI_TRANSMITTER_H__
|
|
|
|
#define __UI_TRANSMITTER_H__
|
|
|
|
|
|
|
|
#include "ui.hpp"
|
|
|
|
#include "ui_navigation.hpp"
|
|
|
|
#include "ui_painter.hpp"
|
|
|
|
#include "ui_widget.hpp"
|
|
|
|
#include "ui_receiver.hpp"
|
|
|
|
#include "ui_font_fixed_8x16.hpp"
|
|
|
|
|
|
|
|
#include "rf_path.hpp"
|
|
|
|
|
|
|
|
#include <cstddef>
|
|
|
|
#include <cstdint>
|
|
|
|
#include <algorithm>
|
|
|
|
#include <functional>
|
|
|
|
|
2020-04-16 23:58:06 +02:00
|
|
|
#define POWER_THRESHOLD_HIGH 47
|
|
|
|
#define POWER_THRESHOLD_MED 38
|
|
|
|
#define POWER_THRESHOLD_LOW 17
|
|
|
|
|
2017-01-30 13:10:30 +00:00
|
|
|
namespace ui {
|
|
|
|
|
|
|
|
class TXGainField : public NumberField {
|
|
|
|
public:
|
|
|
|
std::function<void(void)> on_show_options { };
|
|
|
|
|
|
|
|
TXGainField(Point parent_pos);
|
|
|
|
};
|
|
|
|
|
|
|
|
class TransmitterView : public View {
|
|
|
|
public:
|
|
|
|
std::function<void(void)> on_edit_frequency { };
|
|
|
|
std::function<void(void)> on_start { };
|
|
|
|
std::function<void(void)> on_stop { };
|
|
|
|
|
2017-08-12 19:28:57 +01:00
|
|
|
TransmitterView(const Coord y, const uint64_t frequency_step, const uint32_t channel_bandwidth, const bool lock);
|
2017-02-12 04:05:21 +00:00
|
|
|
TransmitterView(
|
2017-08-12 19:28:57 +01:00
|
|
|
const Coord y, const uint32_t frequency_step, const uint32_t channel_bandwidth
|
|
|
|
) : TransmitterView { y, frequency_step, channel_bandwidth, false }
|
2017-02-12 04:05:21 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2017-01-30 13:10:30 +00:00
|
|
|
~TransmitterView();
|
|
|
|
|
|
|
|
void on_show() override;
|
2017-02-07 22:12:20 +00:00
|
|
|
void paint(Painter& painter) override;
|
2017-02-07 17:48:17 +00:00
|
|
|
void focus() override;
|
2017-01-30 13:10:30 +00:00
|
|
|
|
|
|
|
void set_transmitting(const bool transmitting);
|
|
|
|
|
|
|
|
private:
|
|
|
|
const Style style_start {
|
|
|
|
.font = font::fixed_8x16,
|
|
|
|
.background = Color::black(),
|
|
|
|
.foreground = Color::green(),
|
|
|
|
};
|
|
|
|
const Style style_stop {
|
|
|
|
.font = font::fixed_8x16,
|
|
|
|
.background = Color::black(),
|
|
|
|
.foreground = Color::red(),
|
|
|
|
};
|
2017-02-12 04:05:21 +00:00
|
|
|
const Style style_locked {
|
|
|
|
.font = font::fixed_8x16,
|
|
|
|
.background = Color::black(),
|
|
|
|
.foreground = Color::dark_grey(),
|
|
|
|
};
|
2020-04-16 23:58:06 +02:00
|
|
|
const Style style_power_low {
|
|
|
|
.font = font::fixed_8x16,
|
|
|
|
.background = Color::black(),
|
|
|
|
.foreground = Color::yellow(),
|
|
|
|
};
|
|
|
|
const Style style_power_med {
|
|
|
|
.font = font::fixed_8x16,
|
|
|
|
.background = Color::black(),
|
|
|
|
.foreground = Color::orange(),
|
|
|
|
};
|
|
|
|
const Style style_power_high {
|
|
|
|
.font = font::fixed_8x16,
|
|
|
|
.background = Color::black(),
|
|
|
|
.foreground = Color::red(),
|
|
|
|
};
|
|
|
|
|
2017-02-12 04:05:21 +00:00
|
|
|
bool lock_ { false };
|
2017-01-30 13:10:30 +00:00
|
|
|
bool transmitting_ { false };
|
|
|
|
|
|
|
|
FrequencyField field_frequency {
|
2017-04-07 06:20:24 +01:00
|
|
|
{ 0, 1 * 8 }
|
2017-01-30 13:10:30 +00:00
|
|
|
};
|
|
|
|
|
2017-02-12 04:05:21 +00:00
|
|
|
Text text_gain {
|
2017-04-07 06:20:24 +01:00
|
|
|
{ 0, 3 * 8, 5 * 8, 1 * 16 },
|
2017-02-12 04:05:21 +00:00
|
|
|
"Gain:"
|
|
|
|
};
|
2017-01-30 13:10:30 +00:00
|
|
|
|
2020-04-16 23:58:06 +02:00
|
|
|
NumberField field_gain {
|
|
|
|
{ 5 * 8, 3 * 8 },
|
|
|
|
2,
|
|
|
|
{ max2837::tx::gain_db_range.minimum, max2837::tx::gain_db_range.maximum },
|
|
|
|
max2837::tx::gain_db_step,
|
|
|
|
' '
|
|
|
|
};
|
|
|
|
|
2017-04-07 06:20:24 +01:00
|
|
|
Text text_bw {
|
2021-05-14 22:49:26 +03:00
|
|
|
{ 18 * 8, 1 * 8, 3 * 8, 1 * 16 },
|
|
|
|
"kHz"
|
2017-04-07 06:20:24 +01:00
|
|
|
};
|
2017-01-30 13:10:30 +00:00
|
|
|
NumberField field_bw {
|
2021-05-14 23:00:09 +03:00
|
|
|
{ 15 * 8, 1 * 8 },
|
2017-02-02 09:29:14 +00:00
|
|
|
3,
|
|
|
|
{ 1, 150 },
|
2017-01-30 13:10:30 +00:00
|
|
|
1,
|
|
|
|
' '
|
|
|
|
};
|
|
|
|
|
2020-04-16 23:58:06 +02:00
|
|
|
Text text_amp {
|
|
|
|
{ 11 * 8, 3 * 8, 5 * 8, 1 * 16 },
|
|
|
|
"Amp:"
|
|
|
|
};
|
|
|
|
|
|
|
|
NumberField field_amp {
|
|
|
|
{ 16 * 8, 3 * 8 },
|
|
|
|
2,
|
|
|
|
{ 0, 14 },
|
|
|
|
14,
|
|
|
|
' '
|
|
|
|
};
|
|
|
|
|
2017-01-30 13:10:30 +00:00
|
|
|
Button button_start {
|
2017-04-07 06:20:24 +01:00
|
|
|
{ 21 * 8, 1 * 8, 9 * 8, 32 },
|
2017-01-30 13:10:30 +00:00
|
|
|
"START"
|
|
|
|
};
|
2021-05-14 22:49:26 +03:00
|
|
|
|
|
|
|
FrequencyStepView field_frequency_step {
|
|
|
|
{ 10 * 8 - 4, 1 * 8 },
|
|
|
|
};
|
2017-01-30 13:10:30 +00:00
|
|
|
|
|
|
|
void on_tuning_frequency_changed(rf::Frequency f);
|
2017-08-12 19:28:57 +01:00
|
|
|
void on_channel_bandwidth_changed(uint32_t channel_bandwidth);
|
2020-04-16 23:58:06 +02:00
|
|
|
void on_tx_gain_changed(int32_t tx_gain);
|
|
|
|
void on_tx_amp_changed(bool rf_amp);
|
|
|
|
|
|
|
|
void update_gainlevel_styles(void);
|
2017-01-30 13:10:30 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} /* namespace ui */
|
|
|
|
|
|
|
|
#endif/*__UI_TRANSMITTER_H__*/
|