mirror of
https://github.com/eried/portapack-mayhem.git
synced 2024-12-24 06:49:24 -05:00
Started working on radiosonde RX
Removed some warnings Better handling of absent map file in GeoMap ?
This commit is contained in:
parent
34b99042ef
commit
d3222c27ca
@ -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__*/
|
@ -338,6 +338,13 @@ set(MODE_CPPSRC
|
||||
)
|
||||
DeclareTargets(PERT ert)
|
||||
|
||||
### Radiosonde
|
||||
|
||||
set(MODE_CPPSRC
|
||||
proc_sonde.cpp
|
||||
)
|
||||
DeclareTargets(PSON sonde)
|
||||
|
||||
### FSK TX
|
||||
|
||||
set(MODE_CPPSRC
|
||||
|
55
firmware/baseband/proc_sonde.cpp
Normal file
55
firmware/baseband/proc_sonde.cpp
Normal file
@ -0,0 +1,55 @@
|
||||
/*
|
||||
* 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 "proc_sonde.hpp"
|
||||
|
||||
#include "dsp_fir_taps.hpp"
|
||||
//#include "portapack_shared_memory.hpp"
|
||||
|
||||
#include "event_m4.hpp"
|
||||
|
||||
SondeProcessor::SondeProcessor() {
|
||||
decim_0.configure(taps_200k_decim_0.taps, 33554432);
|
||||
decim_1.configure(taps_200k_decim_1.taps, 131072);
|
||||
}
|
||||
|
||||
void SondeProcessor::execute(const buffer_c8_t& buffer) {
|
||||
/* 2.4576MHz, 2048 samples */
|
||||
|
||||
const auto decim_0_out = decim_0.execute(buffer, dst_buffer);
|
||||
const auto decimator_out = decim_1.execute(decim_0_out, dst_buffer);
|
||||
|
||||
/* 307.2kHz, 256 samples */
|
||||
feed_channel_stats(decimator_out);
|
||||
|
||||
for(size_t i=0; i<decimator_out.count; i++) {
|
||||
if( mf_38k4_1t_19k2.execute_once(decimator_out.p[i]) ) {
|
||||
clock_recovery_fsk_19k2(mf_38k4_1t_19k2.get_output());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int main() {
|
||||
EventDispatcher event_dispatcher { std::make_unique<SondeProcessor>() };
|
||||
event_dispatcher.run();
|
||||
return 0;
|
||||
}
|
89
firmware/baseband/proc_sonde.hpp
Normal file
89
firmware/baseband/proc_sonde.hpp
Normal file
@ -0,0 +1,89 @@
|
||||
/*
|
||||
* 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 __PROC_SONDE_H__
|
||||
#define __PROC_SONDE_H__
|
||||
|
||||
#include "baseband_processor.hpp"
|
||||
#include "baseband_thread.hpp"
|
||||
#include "rssi_thread.hpp"
|
||||
#include "proc_tpms.hpp"
|
||||
|
||||
#include "channel_decimator.hpp"
|
||||
#include "matched_filter.hpp"
|
||||
|
||||
#include "clock_recovery.hpp"
|
||||
#include "symbol_coding.hpp"
|
||||
#include "packet_builder.hpp"
|
||||
#include "baseband_packet.hpp"
|
||||
|
||||
#include "ook.hpp"
|
||||
|
||||
#include "message.hpp"
|
||||
#include "portapack_shared_memory.hpp"
|
||||
|
||||
#include <cstdint>
|
||||
#include <cstddef>
|
||||
#include <bitset>
|
||||
|
||||
class SondeProcessor : public BasebandProcessor {
|
||||
public:
|
||||
SondeProcessor();
|
||||
|
||||
void execute(const buffer_c8_t& buffer) override;
|
||||
|
||||
private:
|
||||
static constexpr size_t baseband_fs = 2457600;
|
||||
|
||||
BasebandThread baseband_thread { baseband_fs, this, NORMALPRIO + 20, baseband::Direction::Receive };
|
||||
RSSIThread rssi_thread { NORMALPRIO + 10 };
|
||||
|
||||
std::array<complex16_t, 512> dst { };
|
||||
const buffer_c16_t dst_buffer {
|
||||
dst.data(),
|
||||
dst.size()
|
||||
};
|
||||
|
||||
dsp::decimate::FIRC8xR16x24FS4Decim4 decim_0 { };
|
||||
dsp::decimate::FIRC16xR16x16Decim2 decim_1 { };
|
||||
|
||||
dsp::matched_filter::MatchedFilter mf_38k4_1t_19k2 { rect_taps_307k2_38k4_1t_19k2_p, 8 };
|
||||
|
||||
clock_recovery::ClockRecovery<clock_recovery::FixedErrorFilter> clock_recovery_fsk_19k2 {
|
||||
38400, 19200, { 0.0555f },
|
||||
[this](const float raw_symbol) {
|
||||
const uint_fast8_t sliced_symbol = (raw_symbol >= 0.0f) ? 1 : 0;
|
||||
this->packet_builder_fsk_4800_M10.execute(sliced_symbol);
|
||||
}
|
||||
};
|
||||
PacketBuilder<BitPattern, NeverMatch, FixedLength> packet_builder_fsk_4800_M10 {
|
||||
{ 0b11001100110011001010011001001100, 32, 1 },
|
||||
{ },
|
||||
{ 102 * 8 },
|
||||
[this](const baseband::Packet& packet) {
|
||||
const SondePacketMessage message { sonde::Packet::Type::M10, packet };
|
||||
shared_memory.application_queue.push(message);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
#endif/*__PROC_ERT_H__*/
|
@ -35,6 +35,7 @@
|
||||
#include "ert_packet.hpp"
|
||||
#include "tpms_packet.hpp"
|
||||
#include "pocsag_packet.hpp"
|
||||
#include "sonde_packet.hpp"
|
||||
#include "adsb_frame.hpp"
|
||||
#include "jammer.hpp"
|
||||
#include "dsp_fir_taps.hpp"
|
||||
@ -60,18 +61,19 @@ public:
|
||||
Shutdown = 8,
|
||||
AISPacket = 7,
|
||||
ERTPacket = 9,
|
||||
UpdateSpectrum = 10,
|
||||
NBFMConfigure = 11,
|
||||
WFMConfigure = 12,
|
||||
AMConfigure = 13,
|
||||
ChannelSpectrumConfig = 14,
|
||||
SpectrumStreamingConfig = 15,
|
||||
DisplaySleep = 16,
|
||||
CaptureConfig = 17,
|
||||
CaptureThreadDone = 18,
|
||||
ReplayConfig = 19,
|
||||
ReplayThreadDone = 20,
|
||||
AFSKRxConfigure = 21,
|
||||
SondePacket = 10,
|
||||
UpdateSpectrum = 11,
|
||||
NBFMConfigure = 12,
|
||||
WFMConfigure = 13,
|
||||
AMConfigure = 14,
|
||||
ChannelSpectrumConfig = 15,
|
||||
SpectrumStreamingConfig = 16,
|
||||
DisplaySleep = 17,
|
||||
CaptureConfig = 18,
|
||||
CaptureThreadDone = 19,
|
||||
ReplayConfig = 20,
|
||||
ReplayThreadDone = 21,
|
||||
AFSKRxConfigure = 22,
|
||||
|
||||
TXProgress = 30,
|
||||
Retune = 31,
|
||||
@ -372,6 +374,22 @@ public:
|
||||
baseband::Packet packet;
|
||||
};
|
||||
|
||||
class SondePacketMessage : public Message {
|
||||
public:
|
||||
constexpr SondePacketMessage(
|
||||
const sonde::Packet::Type type,
|
||||
const baseband::Packet& packet
|
||||
) : Message { ID::SondePacket },
|
||||
type { type },
|
||||
packet { packet }
|
||||
{
|
||||
}
|
||||
|
||||
sonde::Packet::Type type;
|
||||
|
||||
baseband::Packet packet;
|
||||
};
|
||||
|
||||
class UpdateSpectrumMessage : public Message {
|
||||
public:
|
||||
constexpr UpdateSpectrumMessage(
|
||||
|
97
firmware/common/sonde_packet.cpp
Normal file
97
firmware/common/sonde_packet.cpp
Normal file
@ -0,0 +1,97 @@
|
||||
/*
|
||||
* 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 "sonde_packet.hpp"
|
||||
|
||||
//#include "crc.hpp"
|
||||
|
||||
namespace sonde {
|
||||
|
||||
size_t Packet::length() const {
|
||||
return decoder_.symbols_count();
|
||||
}
|
||||
|
||||
bool Packet::is_valid() const {
|
||||
return true;
|
||||
}
|
||||
|
||||
Timestamp Packet::received_at() const {
|
||||
return packet_.timestamp();
|
||||
}
|
||||
|
||||
Packet::Type Packet::type() const {
|
||||
return type_;
|
||||
}
|
||||
|
||||
SN Packet::serial_number() const {
|
||||
if (type() == Type::M10) {
|
||||
// See https://github.com/rs1729/RS/blob/master/m10/m10x.c line 606
|
||||
return (reader_.read(2 * 8, 8) << 20) |
|
||||
(reader_.read(0, 4) << 16) |
|
||||
(reader_.read(4 * 8, 3) << 13) |
|
||||
(reader_.read(4 * 8 + 3, 5) << 8) |
|
||||
reader_.read(3 * 8, 8);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
FormattedSymbols Packet::symbols_formatted() const {
|
||||
return format_symbols(decoder_);
|
||||
}
|
||||
|
||||
bool Packet::crc_ok() const {
|
||||
switch(type()) {
|
||||
case Type::M10: return crc_ok_M10();
|
||||
default: return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool Packet::crc_ok_M10() const {
|
||||
uint16_t cs { 0 };
|
||||
uint32_t c0, c1, t, t6, t7, s,b ;
|
||||
|
||||
for (size_t i = 0; i < packet_.size(); i++) {
|
||||
b = packet_[i];
|
||||
c1 = cs & 0xFF;
|
||||
|
||||
// B
|
||||
b = (b >> 1) | ((b & 1) << 7);
|
||||
b ^= (b >> 2) & 0xFF;
|
||||
|
||||
// A1
|
||||
t6 = (cs & 1) ^ ((cs >> 2) & 1) ^ ((cs >> 4) & 1);
|
||||
t7 = ((cs >> 1) & 1) ^ ((cs >> 3) & 1) ^ ((cs >> 5) & 1);
|
||||
t = (cs & 0x3F) | (t6 << 6) | (t7 << 7);
|
||||
|
||||
// A2
|
||||
s = (cs >> 7) & 0xFF;
|
||||
s ^= (s >> 2) & 0xFF;
|
||||
|
||||
c0 = b ^ t ^ s;
|
||||
|
||||
cs = ((c1<<8) | c0) & 0xFFFF;
|
||||
}
|
||||
|
||||
return ((cs & 0xFFFF) == ((packet_[0x63] << 8) | (packet_[0x63 + 1])));
|
||||
}
|
||||
|
||||
} /* namespace sonde */
|
80
firmware/common/sonde_packet.hpp
Normal file
80
firmware/common/sonde_packet.hpp
Normal file
@ -0,0 +1,80 @@
|
||||
/*
|
||||
* 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 __SONDE_PACKET_H__
|
||||
#define __SONDE_PACKET_H__
|
||||
|
||||
#include <cstdint>
|
||||
#include <cstddef>
|
||||
|
||||
#include "field_reader.hpp"
|
||||
#include "baseband_packet.hpp"
|
||||
#include "manchester.hpp"
|
||||
|
||||
namespace sonde {
|
||||
|
||||
using SN = uint64_t;
|
||||
|
||||
class Packet {
|
||||
public:
|
||||
enum class Type : uint32_t {
|
||||
Unknown = 0,
|
||||
M10 = 1,
|
||||
};
|
||||
|
||||
Packet(
|
||||
const Type type,
|
||||
const baseband::Packet& packet
|
||||
) : packet_ { packet },
|
||||
decoder_ { packet_ },
|
||||
reader_ { decoder_ },
|
||||
type_ { type }
|
||||
{
|
||||
}
|
||||
|
||||
size_t length() const;
|
||||
|
||||
bool is_valid() const;
|
||||
|
||||
Timestamp received_at() const;
|
||||
|
||||
Type type() const;
|
||||
SN serial_number() const;
|
||||
|
||||
FormattedSymbols symbols_formatted() const;
|
||||
|
||||
bool crc_ok() const;
|
||||
|
||||
private:
|
||||
using Reader = FieldReader<ManchesterDecoder, BitRemapNone>;
|
||||
|
||||
const baseband::Packet packet_;
|
||||
const ManchesterDecoder decoder_;
|
||||
const Reader reader_;
|
||||
const Type type_;
|
||||
|
||||
bool crc_ok_M10() const;
|
||||
};
|
||||
|
||||
} /* namespace sonde */
|
||||
|
||||
#endif/*__SONDE_PACKET_H__*/
|
@ -70,23 +70,24 @@ constexpr image_tag_t image_tag_am_audio { 'P', 'A', 'M', 'A' };
|
||||
constexpr image_tag_t image_tag_capture { 'P', 'C', 'A', 'P' };
|
||||
constexpr image_tag_t image_tag_ert { 'P', 'E', 'R', 'T' };
|
||||
constexpr image_tag_t image_tag_nfm_audio { 'P', 'N', 'F', 'M' };
|
||||
constexpr image_tag_t image_tag_tpms { 'P', 'T', 'P', 'M' };
|
||||
constexpr image_tag_t image_tag_pocsag { 'P', 'P', 'O', 'C' };
|
||||
constexpr image_tag_t image_tag_sonde { 'P', 'S', 'O', 'N' };
|
||||
constexpr image_tag_t image_tag_tpms { 'P', 'T', 'P', 'M' };
|
||||
constexpr image_tag_t image_tag_wfm_audio { 'P', 'W', 'F', 'M' };
|
||||
constexpr image_tag_t image_tag_wideband_spectrum { 'P', 'S', 'P', 'E' };
|
||||
|
||||
constexpr image_tag_t image_tag_jammer { 'P', 'J', 'A', 'M' };
|
||||
constexpr image_tag_t image_tag_audio_tx { 'P', 'A', 'T', 'X' };
|
||||
constexpr image_tag_t image_tag_afsk { 'P', 'A', 'F', 'T' };
|
||||
constexpr image_tag_t image_tag_tones { 'P', 'T', 'O', 'N' };
|
||||
constexpr image_tag_t image_tag_rds { 'P', 'R', 'D', 'S' };
|
||||
constexpr image_tag_t image_tag_ook { 'P', 'O', 'O', 'K' };
|
||||
constexpr image_tag_t image_tag_adsb_tx { 'P', 'A', 'D', 'T' };
|
||||
constexpr image_tag_t image_tag_replay { 'P', 'R', 'E', 'P' };
|
||||
constexpr image_tag_t image_tag_afsk { 'P', 'A', 'F', 'T' };
|
||||
constexpr image_tag_t image_tag_audio_tx { 'P', 'A', 'T', 'X' };
|
||||
constexpr image_tag_t image_tag_fsktx { 'P', 'F', 'S', 'K' };
|
||||
constexpr image_tag_t image_tag_jammer { 'P', 'J', 'A', 'M' };
|
||||
constexpr image_tag_t image_tag_mic_tx { 'P', 'M', 'T', 'X' };
|
||||
constexpr image_tag_t image_tag_sstv_tx { 'P', 'S', 'T', 'X' };
|
||||
constexpr image_tag_t image_tag_ook { 'P', 'O', 'O', 'K' };
|
||||
constexpr image_tag_t image_tag_rds { 'P', 'R', 'D', 'S' };
|
||||
constexpr image_tag_t image_tag_replay { 'P', 'R', 'E', 'P' };
|
||||
constexpr image_tag_t image_tag_siggen { 'P', 'S', 'I', 'G' };
|
||||
constexpr image_tag_t image_tag_sstv_tx { 'P', 'S', 'T', 'X' };
|
||||
constexpr image_tag_t image_tag_tones { 'P', 'T', 'O', 'N' };
|
||||
|
||||
constexpr image_tag_t image_tag_noop { 'P', 'N', 'O', 'P' };
|
||||
|
||||
|
BIN
firmware/graphics/icon_sonde.png
Normal file
BIN
firmware/graphics/icon_sonde.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 121 B |
Binary file not shown.
Loading…
Reference in New Issue
Block a user