2017-10-05 05:38:45 +01: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"
|
|
|
|
#include "ui_rssi.hpp"
|
2022-01-02 05:56:55 -05:00
|
|
|
#include "ui_qrcode.hpp"
|
2017-10-27 18:54:50 +02:00
|
|
|
#include "ui_geomap.hpp"
|
2017-10-05 05:38:45 +01: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"
|
2017-10-05 05:38:45 +01:00
|
|
|
#include <cstddef>
|
|
|
|
#include <string>
|
|
|
|
|
2017-10-28 19:16:06 +02:00
|
|
|
class SondeLogger {
|
2017-10-05 05:38:45 +01: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 19:16:06 +02:00
|
|
|
};
|
2017-10-05 05:38:45 +01:00
|
|
|
|
|
|
|
namespace ui {
|
|
|
|
|
|
|
|
class SondeView : public View {
|
|
|
|
public:
|
|
|
|
static constexpr uint32_t sampling_rate = 2457600;
|
|
|
|
static constexpr uint32_t baseband_bandwidth = 1750000;
|
2021-06-08 23:07:37 +01:00
|
|
|
|
2017-10-05 05:38:45 +01:00
|
|
|
SondeView(NavigationView& nav);
|
|
|
|
~SondeView();
|
|
|
|
|
|
|
|
void focus() override;
|
|
|
|
|
2023-03-22 08:46:58 +01:00
|
|
|
std::string title() const override { return "Radiosnd RX"; };
|
2017-10-05 05:38:45 +01:00
|
|
|
|
2022-01-02 05:56:55 -05:00
|
|
|
|
|
|
|
|
2017-10-05 05:38:45 +01:00
|
|
|
private:
|
2017-10-28 19:16:06 +02:00
|
|
|
std::unique_ptr<SondeLogger> logger { };
|
2020-08-14 15:51:12 -03:00
|
|
|
uint32_t target_frequency_ { 402700000 };
|
2017-10-28 19:16:06 +02:00
|
|
|
bool logging { false };
|
2020-08-24 17:31:27 -03:00
|
|
|
bool use_crc { false };
|
2021-06-08 23:07:37 +01:00
|
|
|
bool beep { false };
|
|
|
|
|
2022-01-02 05:56:55 -05:00
|
|
|
char geo_uri[32] = {};
|
2022-04-15 08:43:44 -04:00
|
|
|
// app save settings
|
|
|
|
std::app_settings settings { };
|
|
|
|
std::app_settings::AppSettings app_settings { };
|
2022-01-02 05:56:55 -05:00
|
|
|
|
2021-01-27 17:10:37 +01:00
|
|
|
sonde::GPS_data gps_info { };
|
|
|
|
sonde::temp_humid temp_humid_info { };
|
|
|
|
std::string sonde_id { };
|
2017-10-27 18:54:50 +02:00
|
|
|
|
2021-06-08 23:07:37 +01:00
|
|
|
// AudioOutput audio_output { };
|
|
|
|
|
2017-10-27 18:54:50 +02:00
|
|
|
Labels labels {
|
2020-08-24 17:31:27 -03:00
|
|
|
{ { 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() }
|
2017-10-27 18:54:50 +02:00
|
|
|
};
|
2017-10-05 05:38:45 +01:00
|
|
|
|
|
|
|
FrequencyField field_frequency {
|
|
|
|
{ 0 * 8, 0 * 8 },
|
|
|
|
};
|
2020-08-24 17:31:27 -03:00
|
|
|
|
2017-10-05 05:38:45 +01: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 {
|
|
|
|
{ 21 * 8, 0, 6 * 8, 4 },
|
|
|
|
};
|
|
|
|
|
2021-06-08 23:07:37 +01:00
|
|
|
NumberField field_volume {
|
|
|
|
{ 28 * 8, 0 * 16 },
|
|
|
|
2,
|
|
|
|
{ 0, 99 },
|
|
|
|
1,
|
|
|
|
' ',
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
Checkbox check_beep {
|
|
|
|
{ 22 * 8, 6 * 16 },
|
|
|
|
3,
|
|
|
|
"Beep"
|
|
|
|
};
|
|
|
|
|
2017-10-28 19:16:06 +02:00
|
|
|
Checkbox check_log {
|
2021-06-08 23:07:37 +01:00
|
|
|
{ 22 * 8, 8 * 16 },
|
2017-10-28 19:16:06 +02:00
|
|
|
3,
|
|
|
|
"Log"
|
2017-10-05 05:38:45 +01:00
|
|
|
};
|
2017-10-27 18:54:50 +02:00
|
|
|
|
2020-08-24 17:31:27 -03:00
|
|
|
Checkbox check_crc {
|
2021-06-08 23:07:37 +01:00
|
|
|
{ 22 * 8, 10 * 16 },
|
2020-08-24 17:31:27 -03:00
|
|
|
3,
|
|
|
|
"CRC"
|
|
|
|
};
|
|
|
|
|
2017-10-27 18:54:50 +02:00
|
|
|
Text text_signature {
|
2020-08-24 17:31:27 -03:00
|
|
|
{ 9 * 8, 2 * 16, 10 * 8, 16 },
|
2017-10-28 19:16:06 +02:00
|
|
|
"..."
|
|
|
|
};
|
2020-08-24 17:31:27 -03:00
|
|
|
|
2017-10-28 19:16:06 +02:00
|
|
|
Text text_serial {
|
2020-08-24 17:31:27 -03:00
|
|
|
{ 9 * 8, 3 * 16, 11 * 8, 16 },
|
2017-10-27 18:54:50 +02:00
|
|
|
"..."
|
|
|
|
};
|
2020-08-24 17:31:27 -03:00
|
|
|
|
|
|
|
Text text_timestamp {
|
|
|
|
{ 9 * 8, 4 * 16, 11 * 8, 16 },
|
|
|
|
"..."
|
|
|
|
};
|
|
|
|
|
2017-10-28 19:16:06 +02:00
|
|
|
Text text_voltage {
|
2020-08-24 17:31:27 -03:00
|
|
|
{ 9 * 8, 5 * 16, 10 * 8, 16 },
|
2017-10-27 18:54:50 +02:00
|
|
|
"..."
|
|
|
|
};
|
2020-08-24 17:31:27 -03:00
|
|
|
|
|
|
|
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 },
|
|
|
|
"..."
|
|
|
|
};
|
|
|
|
|
2017-10-27 18:54:50 +02:00
|
|
|
GeoPos geopos {
|
2020-08-24 17:31:27 -03:00
|
|
|
{ 0, 12 * 16 },
|
2017-10-28 20:22:55 +02:00
|
|
|
GeoPos::alt_unit::METERS
|
2017-10-27 18:54:50 +02:00
|
|
|
};
|
2022-01-02 05:56:55 -05:00
|
|
|
|
|
|
|
|
|
|
|
Button button_see_qr {
|
|
|
|
{ 2 * 8, 15 * 16, 12 * 8, 3 * 16 },
|
|
|
|
"See QR"
|
|
|
|
};
|
|
|
|
|
2017-10-27 18:54:50 +02:00
|
|
|
Button button_see_map {
|
2022-01-02 05:56:55 -05:00
|
|
|
{ 16 * 8, 15 * 16, 12 * 8, 3 * 16 },
|
2017-10-27 18:54:50 +02:00
|
|
|
"See on map"
|
|
|
|
};
|
2017-10-05 05:38:45 +01:00
|
|
|
|
|
|
|
MessageHandlerRegistration message_handler_packet {
|
|
|
|
Message::ID::SondePacket,
|
|
|
|
[this](Message* const p) {
|
|
|
|
const auto message = static_cast<const SondePacketMessage*>(p);
|
2017-10-27 18:54:50 +02:00
|
|
|
const sonde::Packet packet { message->packet, message->type };
|
|
|
|
this->on_packet(packet);
|
2017-10-05 05:38:45 +01:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2017-10-27 18:54:50 +02:00
|
|
|
void on_packet(const sonde::Packet& packet);
|
2021-06-08 23:07:37 +01:00
|
|
|
void on_headphone_volume_changed(int32_t v);
|
2022-01-02 05:56:55 -05:00
|
|
|
char * float_to_char(float x, char *p);
|
2017-10-06 05:35:25 +01:00
|
|
|
void set_target_frequency(const uint32_t new_value);
|
2021-06-08 23:07:37 +01:00
|
|
|
|
2017-10-06 05:35:25 +01:00
|
|
|
uint32_t tuning_frequency() const;
|
2017-10-05 05:38:45 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
} /* namespace ui */
|
|
|
|
|
|
|
|
#endif/*__UI_SONDE_H__*/
|