mirror of
https://github.com/portapack-mayhem/mayhem-firmware.git
synced 2025-12-05 16:32:15 +00:00
Started working on radiosonde RX
Removed some warnings Better handling of absent map file in GeoMap ?
This commit is contained in:
@@ -203,6 +203,7 @@ set(CPPSRC
|
||||
# ui_sd_card_debug.cpp
|
||||
ui_setup.cpp
|
||||
ui_siggen.cpp
|
||||
ui_sonde.cpp
|
||||
ui_soundboard.cpp
|
||||
ui_spectrum.cpp
|
||||
ui_sstvtx.cpp
|
||||
@@ -225,6 +226,7 @@ set(CPPSRC
|
||||
${COMMON}/morse.cpp
|
||||
${COMMON}/adsb_frame.cpp
|
||||
${COMMON}/adsb.cpp
|
||||
${COMMON}/sonde_packet.cpp
|
||||
ais_app.cpp
|
||||
tpms_app.cpp
|
||||
pocsag_app.cpp
|
||||
|
||||
@@ -705,6 +705,28 @@ static constexpr Bitmap bitmap_icon_notepad {
|
||||
{ 16, 16 }, bitmap_icon_notepad_data
|
||||
};
|
||||
|
||||
static constexpr uint8_t bitmap_icon_sonde_data[] = {
|
||||
0xE0, 0x03,
|
||||
0x90, 0x07,
|
||||
0xE8, 0x0F,
|
||||
0xF8, 0x0F,
|
||||
0xF8, 0x0F,
|
||||
0xF0, 0x07,
|
||||
0xF0, 0x07,
|
||||
0xE0, 0x03,
|
||||
0xE0, 0x03,
|
||||
0xC0, 0x01,
|
||||
0xC0, 0x01,
|
||||
0x80, 0x00,
|
||||
0x80, 0x00,
|
||||
0x80, 0x02,
|
||||
0xC0, 0x01,
|
||||
0xC0, 0x01,
|
||||
};
|
||||
static constexpr Bitmap bitmap_icon_sonde {
|
||||
{ 16, 16 }, bitmap_icon_sonde_data
|
||||
};
|
||||
|
||||
static constexpr uint8_t bitmap_icon_setup_data[] = {
|
||||
0x00, 0x00,
|
||||
0x18, 0x18,
|
||||
|
||||
@@ -72,7 +72,7 @@ private:
|
||||
int32_t delay;
|
||||
} credits_t;
|
||||
|
||||
const credits_t credits[20] = {
|
||||
const credits_t credits[22] = {
|
||||
{ 60, "PortaPack|HAVOC", 0 },
|
||||
{ 7 * 8, "Git hash " GIT_REVISION, 16 },
|
||||
{ 11 * 8, "Gurus J. Boone", 0 },
|
||||
@@ -80,6 +80,8 @@ private:
|
||||
{ 11 * 8, "HAVOC Furrtek", 16 },
|
||||
{ 7 * 8, "POCSAG rx T. Sailer", 0 },
|
||||
{ 18 * 8, "E. Oenal", 16 },
|
||||
{ 0 * 8, "Radiosonde infos F4GMU", 0 },
|
||||
{ 18 * 8, "RS1729", 16 },
|
||||
{ 4 * 8, "RDS waveform C. Jacquet", 16 },
|
||||
{ 7 * 8, "Xy. infos cLx", 16 },
|
||||
{ 2 * 8, "OOK scan trick Samy Kamkar", 16 },
|
||||
|
||||
@@ -261,7 +261,7 @@ DebugPeripheralsMenuView::DebugPeripheralsMenuView(NavigationView& nav) {
|
||||
[](const size_t register_number) { return portapack::clock_generator.read_register(register_number); }
|
||||
); } },
|
||||
{ audio::debug::codec_name(), ui::Color::white(), nullptr, [&nav](){ nav.push<RegistersView>(
|
||||
audio::debug::codec_name(), RegistersWidgetConfig { (int)audio::debug::reg_count(), (int)audio::debug::reg_bits() },
|
||||
audio::debug::codec_name(), RegistersWidgetConfig { (size_t)audio::debug::reg_count(), (size_t)audio::debug::reg_bits() },
|
||||
[](const size_t register_number) { return audio::debug::reg_read(register_number); }
|
||||
); } },
|
||||
});
|
||||
|
||||
@@ -30,7 +30,7 @@ using namespace portapack;
|
||||
namespace ui {
|
||||
|
||||
EncodersConfigView::EncodersConfigView(
|
||||
NavigationView& nav, Rect parent_rect
|
||||
NavigationView&, Rect parent_rect
|
||||
) {
|
||||
using option_t = std::pair<std::string, int32_t>;
|
||||
std::vector<option_t> enc_options;
|
||||
@@ -171,7 +171,7 @@ void EncodersScanView::focus() {
|
||||
}
|
||||
|
||||
EncodersScanView::EncodersScanView(
|
||||
NavigationView& nav, Rect parent_rect
|
||||
NavigationView&, Rect parent_rect
|
||||
) {
|
||||
set_parent_rect(parent_rect);
|
||||
hidden(true);
|
||||
|
||||
@@ -173,9 +173,8 @@ void GeoMap::move(const float lon, const float lat) {
|
||||
|
||||
bool GeoMap::init() {
|
||||
auto result = map_file.open("ADSB/world_map.bin");
|
||||
if (result.is_valid()) {
|
||||
if (result.is_valid())
|
||||
return false;
|
||||
}
|
||||
|
||||
map_file.read(&map_width, 2);
|
||||
map_file.read(&map_height, 2);
|
||||
@@ -210,9 +209,9 @@ void GeoMap::draw_bearing(const Point origin, const uint32_t angle, uint32_t siz
|
||||
}
|
||||
|
||||
void GeoMapView::focus() {
|
||||
if (!file_error) {
|
||||
geopos.focus();
|
||||
} else
|
||||
geopos.focus();
|
||||
|
||||
if (!file_error)
|
||||
nav_.display_modal("No map", "No world_map.bin file in\n/ADSB/ directory", ABORT, nullptr);
|
||||
}
|
||||
|
||||
@@ -226,10 +225,7 @@ void GeoMapView::update_position(float lat, float lon) {
|
||||
}
|
||||
|
||||
void GeoMapView::setup() {
|
||||
add_children({
|
||||
&geopos,
|
||||
&geomap
|
||||
});
|
||||
add_child(&geomap);
|
||||
|
||||
geopos.set_altitude(altitude_);
|
||||
geopos.set_lat(lat_);
|
||||
@@ -282,6 +278,8 @@ GeoMapView::GeoMapView(
|
||||
{
|
||||
mode_ = DISPLAY;
|
||||
|
||||
add_child(&geopos);
|
||||
|
||||
file_error = !geomap.init();
|
||||
if (file_error) return;
|
||||
|
||||
@@ -308,6 +306,8 @@ GeoMapView::GeoMapView(
|
||||
{
|
||||
mode_ = PROMPT;
|
||||
|
||||
add_child(&geopos);
|
||||
|
||||
file_error = !geomap.init();
|
||||
if (file_error) return;
|
||||
|
||||
|
||||
@@ -50,6 +50,7 @@
|
||||
#include "ui_nuoptix.hpp"
|
||||
#include "ui_playdead.hpp"
|
||||
#include "ui_pocsag_tx.hpp"
|
||||
#include "ui_sonde.hpp"
|
||||
#include "ui_rds.hpp"
|
||||
#include "ui_sd_wipe.hpp"
|
||||
#include "ui_scanner.hpp"
|
||||
@@ -294,6 +295,7 @@ ReceiversMenuView::ReceiversMenuView(NavigationView& nav) {
|
||||
{ "POCSAG", ui::Color::green(), &bitmap_icon_pocsag, [&nav](){ nav.push<POCSAGAppView>(); } },
|
||||
{ "SIGFOX", ui::Color::grey(), &bitmap_icon_fox, [&nav](){ nav.push<NotImplementedView>(); } }, // SIGFRXView
|
||||
{ "LoRa", ui::Color::grey(), nullptr, [&nav](){ nav.push<NotImplementedView>(); } },
|
||||
{ "Radiosondes", ui::Color::red(), &bitmap_icon_sonde, [&nav](){ nav.push<SondeView>(); } },
|
||||
{ "SSTV", ui::Color::grey(), &bitmap_icon_sstv, [&nav](){ nav.push<NotImplementedView>(); } },
|
||||
{ "TPMS: Cars", ui::Color::green(), &bitmap_icon_tpms, [&nav](){ nav.push<TPMSAppView>(); } },
|
||||
});
|
||||
|
||||
103
firmware/application/ui_sonde.cpp
Normal file
103
firmware/application/ui_sonde.cpp
Normal file
@@ -0,0 +1,103 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include "ui_sonde.hpp"
|
||||
|
||||
#include "baseband_api.hpp"
|
||||
|
||||
#include "portapack.hpp"
|
||||
using namespace portapack;
|
||||
|
||||
//#include "manchester.hpp"
|
||||
|
||||
#include "string_format.hpp"
|
||||
|
||||
/*void SondeLogger::on_packet(const sonde::Packet& packet) {
|
||||
const auto formatted = packet.symbols_formatted();
|
||||
log_file.write_entry(packet.received_at(), formatted.data + "/" + formatted.errors);
|
||||
}*/
|
||||
|
||||
namespace ui {
|
||||
|
||||
SondeView::SondeView(NavigationView& nav) {
|
||||
baseband::run_image(portapack::spi_flash::image_tag_sonde);
|
||||
|
||||
add_children({
|
||||
&field_frequency,
|
||||
&text_debug,
|
||||
&field_rf_amp,
|
||||
&field_lna,
|
||||
&field_vga,
|
||||
&rssi
|
||||
});
|
||||
|
||||
field_frequency.set_value(receiver_model.tuning_frequency());
|
||||
field_frequency.set_step(receiver_model.frequency_step());
|
||||
field_frequency.on_change = [this](rf::Frequency f) {
|
||||
receiver_model.set_tuning_frequency(f);
|
||||
field_frequency.set_value(f);
|
||||
};
|
||||
field_frequency.on_edit = [this, &nav]() {
|
||||
// TODO: Provide separate modal method/scheme?
|
||||
auto new_view = nav.push<FrequencyKeypadView>(receiver_model.tuning_frequency());
|
||||
new_view->on_changed = [this](rf::Frequency f) {
|
||||
receiver_model.set_tuning_frequency(f);
|
||||
field_frequency.set_value(f);
|
||||
};
|
||||
};
|
||||
|
||||
radio::enable({
|
||||
receiver_model.tuning_frequency(),
|
||||
sampling_rate,
|
||||
baseband_bandwidth,
|
||||
rf::Direction::Receive,
|
||||
receiver_model.rf_amp(),
|
||||
static_cast<int8_t>(receiver_model.lna()),
|
||||
static_cast<int8_t>(receiver_model.vga()),
|
||||
});
|
||||
|
||||
/*logger = std::make_unique<SondeLogger>();
|
||||
if( logger ) {
|
||||
logger->append(u"sonde.txt");
|
||||
}*/
|
||||
}
|
||||
|
||||
SondeView::~SondeView() {
|
||||
radio::disable();
|
||||
baseband::shutdown();
|
||||
}
|
||||
|
||||
void SondeView::focus() {
|
||||
field_vga.focus();
|
||||
}
|
||||
|
||||
void SondeView::on_packet(const sonde::Packet& packet) {
|
||||
text_debug.set("Got frame !");
|
||||
/*if( logger ) {
|
||||
logger->on_packet(packet);
|
||||
}*/
|
||||
|
||||
/*if( packet.crc_ok() ) {
|
||||
}*/
|
||||
}
|
||||
|
||||
} /* namespace ui */
|
||||
109
firmware/application/ui_sonde.hpp
Normal file
109
firmware/application/ui_sonde.hpp
Normal file
@@ -0,0 +1,109 @@
|
||||
/*
|
||||
* 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"
|
||||
#include "ui_channel.hpp"
|
||||
|
||||
#include "event_m0.hpp"
|
||||
|
||||
#include "log_file.hpp"
|
||||
|
||||
#include "sonde_packet.hpp"
|
||||
|
||||
#include "recent_entries.hpp"
|
||||
|
||||
#include <cstddef>
|
||||
#include <string>
|
||||
|
||||
/*class SondeLogger {
|
||||
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 { };
|
||||
};*/
|
||||
|
||||
namespace ui {
|
||||
|
||||
class SondeView : public View {
|
||||
public:
|
||||
static constexpr uint32_t sampling_rate = 2457600;
|
||||
static constexpr uint32_t baseband_bandwidth = 1750000;
|
||||
|
||||
SondeView(NavigationView& nav);
|
||||
~SondeView();
|
||||
|
||||
void focus() override;
|
||||
|
||||
std::string title() const override { return "Radiosonde RX"; };
|
||||
|
||||
private:
|
||||
//std::unique_ptr<SondeLogger> logger { };
|
||||
|
||||
FrequencyField field_frequency {
|
||||
{ 0 * 8, 0 * 8 },
|
||||
};
|
||||
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 },
|
||||
};
|
||||
|
||||
Text text_debug {
|
||||
{ 0, 32, 240, 16 },
|
||||
"Waiting for frame..."
|
||||
};
|
||||
|
||||
MessageHandlerRegistration message_handler_packet {
|
||||
Message::ID::SondePacket,
|
||||
[this](Message* const p) {
|
||||
const auto message = static_cast<const SondePacketMessage*>(p);
|
||||
const sonde::Packet packet { message->type, message->packet };
|
||||
this->on_packet(packet);
|
||||
}
|
||||
};
|
||||
|
||||
void on_packet(const sonde::Packet& packet);
|
||||
};
|
||||
|
||||
} /* namespace ui */
|
||||
|
||||
#endif/*__UI_SONDE_H__*/
|
||||
Reference in New Issue
Block a user