2017-10-05 00:38:45 -04:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2015 Jared Boone, ShareBrained Technology, Inc.
|
|
|
|
* Copyright (C) 2017 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_SONDE_H__
|
|
|
|
#define __UI_SONDE_H__
|
|
|
|
|
|
|
|
#include "ui_navigation.hpp"
|
|
|
|
#include "ui_receiver.hpp"
|
2023-06-18 15:11:04 -04:00
|
|
|
#include "ui_freq_field.hpp"
|
2017-10-05 00:38:45 -04:00
|
|
|
#include "ui_rssi.hpp"
|
2022-01-02 05:56:55 -05:00
|
|
|
#include "ui_qrcode.hpp"
|
2017-10-27 12:54:50 -04:00
|
|
|
#include "ui_geomap.hpp"
|
2017-10-05 00:38:45 -04:00
|
|
|
|
|
|
|
#include "event_m0.hpp"
|
|
|
|
|
|
|
|
#include "log_file.hpp"
|
|
|
|
|
|
|
|
#include "sonde_packet.hpp"
|
2022-04-15 08:43:44 -04:00
|
|
|
#include "app_settings.hpp"
|
2023-06-14 03:57:20 -04:00
|
|
|
#include "radio_state.hpp"
|
2017-10-05 00:38:45 -04:00
|
|
|
#include <cstddef>
|
|
|
|
#include <string>
|
|
|
|
|
2017-10-28 13:16:06 -04:00
|
|
|
class SondeLogger {
|
2023-05-18 16:16:05 -04:00
|
|
|
public:
|
|
|
|
Optional<File::Error> append(const std::filesystem::path& filename) {
|
|
|
|
return log_file.append(filename);
|
|
|
|
}
|
|
|
|
|
|
|
|
void on_packet(const sonde::Packet& packet);
|
|
|
|
|
|
|
|
private:
|
|
|
|
LogFile log_file{};
|
2017-10-28 13:16:06 -04:00
|
|
|
};
|
2017-10-05 00:38:45 -04:00
|
|
|
|
|
|
|
namespace ui {
|
|
|
|
|
|
|
|
class SondeView : public View {
|
2023-05-18 16:16:05 -04:00
|
|
|
public:
|
2023-06-14 10:54:19 -04:00
|
|
|
static constexpr uint32_t initial_target_frequency = 402700000;
|
|
|
|
|
2023-05-18 16:16:05 -04:00
|
|
|
SondeView(NavigationView& nav);
|
|
|
|
~SondeView();
|
|
|
|
|
|
|
|
void focus() override;
|
|
|
|
|
|
|
|
std::string title() const override { return "Radiosnd RX"; };
|
|
|
|
|
|
|
|
private:
|
2023-06-18 15:11:04 -04:00
|
|
|
NavigationView& nav_;
|
2023-06-14 03:57:20 -04:00
|
|
|
RxRadioState radio_state_{
|
2023-10-14 12:33:52 -04:00
|
|
|
402700000 /* frequency */,
|
2023-06-14 03:57:20 -04:00
|
|
|
1750000 /* bandwidth */,
|
|
|
|
2457600 /* sampling rate */
|
|
|
|
};
|
2023-06-11 14:47:13 -04:00
|
|
|
app_settings::SettingsManager settings_{
|
|
|
|
"rx_sonde", app_settings::Mode::RX};
|
|
|
|
|
2023-05-18 16:16:05 -04:00
|
|
|
std::unique_ptr<SondeLogger> logger{};
|
|
|
|
bool logging{false};
|
|
|
|
bool use_crc{false};
|
|
|
|
bool beep{false};
|
|
|
|
|
|
|
|
char geo_uri[32] = {};
|
|
|
|
|
|
|
|
sonde::GPS_data gps_info{};
|
|
|
|
sonde::temp_humid temp_humid_info{};
|
|
|
|
std::string sonde_id{};
|
|
|
|
|
|
|
|
// AudioOutput audio_output { };
|
|
|
|
|
|
|
|
Labels labels{
|
|
|
|
{{4 * 8, 2 * 16}, "Type:", Color::light_grey()},
|
|
|
|
{{6 * 8, 3 * 16}, "ID:", Color::light_grey()},
|
|
|
|
{{0 * 8, 4 * 16}, "DateTime:", Color::light_grey()},
|
|
|
|
|
|
|
|
{{3 * 8, 5 * 16}, "Vbatt:", Color::light_grey()},
|
|
|
|
{{3 * 8, 6 * 16}, "Frame:", Color::light_grey()},
|
|
|
|
{{4 * 8, 7 * 16}, "Temp:", Color::light_grey()},
|
|
|
|
{{0 * 8, 8 * 16}, "Humidity:", Color::light_grey()}};
|
|
|
|
|
2023-06-18 15:11:04 -04:00
|
|
|
RxFrequencyField field_frequency{
|
2023-05-18 16:16:05 -04:00
|
|
|
{0 * 8, 0 * 8},
|
2023-06-18 15:11:04 -04:00
|
|
|
nav_};
|
2023-05-18 16:16:05 -04:00
|
|
|
|
|
|
|
RFAmpField field_rf_amp{
|
|
|
|
{13 * 8, 0 * 16}};
|
|
|
|
|
|
|
|
LNAGainField field_lna{
|
|
|
|
{15 * 8, 0 * 16}};
|
|
|
|
|
|
|
|
VGAGainField field_vga{
|
|
|
|
{18 * 8, 0 * 16}};
|
|
|
|
|
|
|
|
RSSI rssi{
|
2023-06-18 15:11:04 -04:00
|
|
|
{21 * 8, 0, 6 * 8, 4}};
|
2023-05-18 16:16:05 -04:00
|
|
|
|
2023-06-04 15:56:46 -04:00
|
|
|
AudioVolumeField field_volume{
|
|
|
|
{28 * 8, 0 * 16}};
|
2023-05-18 16:16:05 -04:00
|
|
|
|
|
|
|
Checkbox check_beep{
|
|
|
|
{22 * 8, 6 * 16},
|
|
|
|
3,
|
|
|
|
"Beep"};
|
|
|
|
|
|
|
|
Checkbox check_log{
|
|
|
|
{22 * 8, 8 * 16},
|
|
|
|
3,
|
|
|
|
"Log"};
|
|
|
|
|
|
|
|
Checkbox check_crc{
|
|
|
|
{22 * 8, 10 * 16},
|
|
|
|
3,
|
|
|
|
"CRC"};
|
|
|
|
|
|
|
|
Text text_signature{
|
|
|
|
{9 * 8, 2 * 16, 10 * 8, 16},
|
|
|
|
"..."};
|
|
|
|
|
|
|
|
Text text_serial{
|
|
|
|
{9 * 8, 3 * 16, 11 * 8, 16},
|
|
|
|
"..."};
|
|
|
|
|
|
|
|
Text text_timestamp{
|
|
|
|
{9 * 8, 4 * 16, 11 * 8, 16},
|
|
|
|
"..."};
|
|
|
|
|
|
|
|
Text text_voltage{
|
|
|
|
{9 * 8, 5 * 16, 10 * 8, 16},
|
|
|
|
"..."};
|
|
|
|
|
|
|
|
Text text_frame{
|
|
|
|
{9 * 8, 6 * 16, 10 * 8, 16},
|
|
|
|
"..."};
|
|
|
|
|
|
|
|
Text text_temp{
|
|
|
|
{9 * 8, 7 * 16, 10 * 8, 16},
|
|
|
|
"..."};
|
|
|
|
|
|
|
|
Text text_humid{
|
|
|
|
{9 * 8, 8 * 16, 10 * 8, 16},
|
|
|
|
"..."};
|
|
|
|
|
|
|
|
GeoPos geopos{
|
|
|
|
{0, 12 * 16},
|
2024-01-05 07:44:30 -05:00
|
|
|
GeoPos::alt_unit::METERS,
|
|
|
|
GeoPos::spd_unit::HIDDEN};
|
2023-05-18 16:16:05 -04:00
|
|
|
|
|
|
|
Button button_see_qr{
|
|
|
|
{2 * 8, 15 * 16, 12 * 8, 3 * 16},
|
|
|
|
"See QR"};
|
|
|
|
|
|
|
|
Button button_see_map{
|
|
|
|
{16 * 8, 15 * 16, 12 * 8, 3 * 16},
|
|
|
|
"See on map"};
|
|
|
|
|
|
|
|
MessageHandlerRegistration message_handler_packet{
|
|
|
|
Message::ID::SondePacket,
|
|
|
|
[this](Message* const p) {
|
|
|
|
const auto message = static_cast<const SondePacketMessage*>(p);
|
|
|
|
const sonde::Packet packet{message->packet, message->type};
|
|
|
|
this->on_packet(packet);
|
|
|
|
}};
|
|
|
|
|
|
|
|
void on_packet(const sonde::Packet& packet);
|
|
|
|
char* float_to_char(float x, char* p);
|
2017-10-05 00:38:45 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
} /* namespace ui */
|
|
|
|
|
2023-05-18 16:16:05 -04:00
|
|
|
#endif /*__UI_SONDE_H__*/
|