From ed2c3ac08b39f722fb2c545a10ff7f1fc1067eb4 Mon Sep 17 00:00:00 2001 From: Jon Beniston Date: Tue, 7 Nov 2023 09:42:13 +0000 Subject: [PATCH 1/3] Add altitude, speed and heading columns to log --- plugins/channelrx/demodradiosonde/radiosondedemod.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/plugins/channelrx/demodradiosonde/radiosondedemod.cpp b/plugins/channelrx/demodradiosonde/radiosondedemod.cpp index b9e1f9e8f2..0f49787711 100644 --- a/plugins/channelrx/demodradiosonde/radiosondedemod.cpp +++ b/plugins/channelrx/demodradiosonde/radiosondedemod.cpp @@ -233,11 +233,16 @@ bool RadiosondeDemod::handleMessage(const Message& cmd) if (frame->m_posValid) { m_logStream << frame->m_latitude << "," - << frame->m_longitude << ","; + << frame->m_longitude << "," + << frame->m_height << "," + << frame->m_speed << "," + << frame->m_verticalRate << "," + << frame->m_heading << "," + ; } else { - m_logStream << ",,"; + m_logStream << ",,,,,,"; } if (frame->m_measValid) { @@ -378,7 +383,7 @@ void RadiosondeDemod::applySettings(const RadiosondeDemodSettings& settings, boo if (newFile) { // Write header - m_logStream << "Date,Time,Data,Serial,Frame,Lat,Lon,P (hPa),T (C), U (%)\n"; + m_logStream << "Date,Time,Data,Serial,Frame,Lat,Lon,Alt (m),Speed (m/s),V/R (m/s),Heading,P (hPa),T (C), U (%)\n"; } } else From fbb2edbf1e8467e43c7bda17732a609899ea5487 Mon Sep 17 00:00:00 2001 From: Jon Beniston Date: Tue, 7 Nov 2023 09:43:10 +0000 Subject: [PATCH 2/3] Add range and frequency columns to table. --- .../demodradiosonde/radiosondedemodgui.cpp | 29 +++++++++++++++---- .../demodradiosonde/radiosondedemodgui.h | 6 ++-- .../demodradiosonde/radiosondedemodgui.ui | 16 ++++++++++ .../demodradiosonde/radiosondedemodsettings.h | 2 +- 4 files changed, 45 insertions(+), 8 deletions(-) diff --git a/plugins/channelrx/demodradiosonde/radiosondedemodgui.cpp b/plugins/channelrx/demodradiosonde/radiosondedemodgui.cpp index ebbb5d0de2..713549267c 100644 --- a/plugins/channelrx/demodradiosonde/radiosondedemodgui.cpp +++ b/plugins/channelrx/demodradiosonde/radiosondedemodgui.cpp @@ -86,6 +86,8 @@ void RadiosondeDemodGUI::resizeTable() ui->frames->setItem(row, FRAME_COL_GPS_SATS, new QTableWidgetItem("12")); ui->frames->setItem(row, FRAME_COL_ECC, new QTableWidgetItem("12")); ui->frames->setItem(row, FRAME_COL_CORR, new QTableWidgetItem("-500")); + ui->frames->setItem(row, FRAME_COL_RANGE, new QTableWidgetItem("200.0")); + ui->frames->setItem(row, FRAME_COL_FREQUENCY, new QTableWidgetItem("434.125")); ui->frames->resizeColumnsToContents(); ui->frames->removeRow(row); } @@ -172,7 +174,7 @@ bool RadiosondeDemodGUI::deserialize(const QByteArray& data) } // Add row to table -void RadiosondeDemodGUI::frameReceived(const QByteArray& frame, const QDateTime& dateTime, int errorsCorrected, int threshold) +void RadiosondeDemodGUI::frameReceived(const QByteArray& frame, const QDateTime& dateTime, int errorsCorrected, int threshold, bool loadCSV) { RS41Frame *radiosonde; @@ -214,6 +216,8 @@ void RadiosondeDemodGUI::frameReceived(const QByteArray& frame, const QDateTime& QTableWidgetItem *gpsSatsItem = new QTableWidgetItem(); QTableWidgetItem *eccItem = new QTableWidgetItem(); QTableWidgetItem *thItem = new QTableWidgetItem(); + QTableWidgetItem *rangeItem = new QTableWidgetItem(); + QTableWidgetItem *frequencyItem = new QTableWidgetItem(); ui->frames->setItem(row, FRAME_COL_DATE, dateItem); ui->frames->setItem(row, FRAME_COL_TIME, timeItem); @@ -241,6 +245,8 @@ void RadiosondeDemodGUI::frameReceived(const QByteArray& frame, const QDateTime& ui->frames->setItem(row, FRAME_COL_GPS_SATS, gpsSatsItem); ui->frames->setItem(row, FRAME_COL_ECC, eccItem); ui->frames->setItem(row, FRAME_COL_CORR, thItem); + ui->frames->setItem(row, FRAME_COL_RANGE, rangeItem); + ui->frames->setItem(row, FRAME_COL_FREQUENCY, frequencyItem); dateItem->setData(Qt::DisplayRole, dateTime.date()); timeItem->setData(Qt::DisplayRole, dateTime.time()); @@ -281,6 +287,14 @@ void RadiosondeDemodGUI::frameReceived(const QByteArray& frame, const QDateTime& verticalRateItem->setData(Qt::DisplayRole, radiosonde->m_verticalRate); headingItem->setData(Qt::DisplayRole, radiosonde->m_heading); gpsSatsItem->setData(Qt::DisplayRole, radiosonde->m_satellitesUsed); + // Calc distance from My Position to Radiosone + Real stationLatitude = MainCore::instance()->getSettings().getLatitude(); + Real stationLongitude = MainCore::instance()->getSettings().getLongitude(); + Real stationAltitude = MainCore::instance()->getSettings().getAltitude(); + QGeoCoordinate stationPosition(stationLatitude, stationLongitude, stationAltitude); + QGeoCoordinate radiosondePosition(radiosonde->m_latitude, radiosonde->m_longitude, radiosonde->m_height); + float distance = stationPosition.distanceTo(radiosondePosition); + rangeItem->setData(Qt::DisplayRole, (int)std::round(distance / 1000.0)); } if (radiosonde->m_gpsInfoValid) @@ -295,8 +309,12 @@ void RadiosondeDemodGUI::frameReceived(const QByteArray& frame, const QDateTime& humidityItem->setData(Qt::DisplayRole, radiosonde->getHumidityString(subframe)); } - eccItem->setData(Qt::DisplayRole, errorsCorrected); - thItem->setData(Qt::DisplayRole, threshold); + if (!loadCSV) + { + eccItem->setData(Qt::DisplayRole, errorsCorrected); + thItem->setData(Qt::DisplayRole, threshold); + frequencyItem->setData(Qt::DisplayRole, (m_deviceCenterFrequency + m_settings.m_inputFrequencyOffset) / 1000000.0); + } filterRow(row); ui->frames->setSortingEnabled(true); @@ -324,7 +342,7 @@ bool RadiosondeDemodGUI::handleMessage(const Message& frame) else if (RadiosondeDemod::MsgMessage::match(frame)) { RadiosondeDemod::MsgMessage& report = (RadiosondeDemod::MsgMessage&) frame; - frameReceived(report.getMessage(), report.getDateTime(), report.getErrorsCorrected(), report.getThreshold()); + frameReceived(report.getMessage(), report.getDateTime(), report.getErrorsCorrected(), report.getThreshold(), false); return true; } else if (DSPSignalNotification::match(frame)) @@ -643,6 +661,7 @@ RadiosondeDemodGUI::RadiosondeDemodGUI(PluginAPI* pluginAPI, DeviceUISet *device ui->frames->setItemDelegateForColumn(FRAME_COL_VERTICAL_RATE, new DecimalDelegate(1)); ui->frames->setItemDelegateForColumn(FRAME_COL_HEADING, new DecimalDelegate(1)); ui->frames->setItemDelegateForColumn(FRAME_COL_GPS_TIME, new DateTimeDelegate("yyyy/MM/dd hh:mm:ss")); + ui->frames->setItemDelegateForColumn(FRAME_COL_FREQUENCY, new DecimalDelegate(3)); ui->scopeContainer->setVisible(false); @@ -869,7 +888,7 @@ void RadiosondeDemodGUI::on_logOpen_clicked() QByteArray bytes = QByteArray::fromHex(cols[dataCol].toLatin1()); // Add to table - frameReceived(bytes, dateTime, 0, 0); + frameReceived(bytes, dateTime, 0, 0, true); // Forward to Radiosonde feature for (const auto& pipe : radiosondePipes) diff --git a/plugins/channelrx/demodradiosonde/radiosondedemodgui.h b/plugins/channelrx/demodradiosonde/radiosondedemodgui.h index 0e987abbd3..fa288179be 100644 --- a/plugins/channelrx/demodradiosonde/radiosondedemodgui.h +++ b/plugins/channelrx/demodradiosonde/radiosondedemodgui.h @@ -96,7 +96,7 @@ public slots: void blockApplySettings(bool block); void applySettings(bool force = false); void displaySettings(); - void frameReceived(const QByteArray& frame, const QDateTime& dateTime, int errorsCorrected, int threshold); + void frameReceived(const QByteArray& frame, const QDateTime& dateTime, int errorsCorrected, int threshold, bool loadCSV); bool handleMessage(const Message& message); void makeUIConnections(); void updateAbsoluteCenterFrequency(); @@ -133,7 +133,9 @@ public slots: FRAME_COL_GPS_TIME, FRAME_COL_GPS_SATS, FRAME_COL_ECC, - FRAME_COL_CORR + FRAME_COL_CORR, + FRAME_COL_RANGE, + FRAME_COL_FREQUENCY }; private slots: diff --git a/plugins/channelrx/demodradiosonde/radiosondedemodgui.ui b/plugins/channelrx/demodradiosonde/radiosondedemodgui.ui index 51a75c1b21..9d9f046ea1 100644 --- a/plugins/channelrx/demodradiosonde/radiosondedemodgui.ui +++ b/plugins/channelrx/demodradiosonde/radiosondedemodgui.ui @@ -846,6 +846,22 @@ Correlation + + + Range (km) + + + Range to Radiosonde in kilometres from My Position + + + + + Frequency (MHz) + + + Demodulator center frequency when frame was received + + diff --git a/plugins/channelrx/demodradiosonde/radiosondedemodsettings.h b/plugins/channelrx/demodradiosonde/radiosondedemodsettings.h index 46b5f21428..c7f1beadf6 100644 --- a/plugins/channelrx/demodradiosonde/radiosondedemodsettings.h +++ b/plugins/channelrx/demodradiosonde/radiosondedemodsettings.h @@ -27,7 +27,7 @@ class Serializable; // Number of columns in the tables -#define RADIOSONDEDEMOD_FRAME_COLUMNS 26 +#define RADIOSONDEDEMOD_FRAME_COLUMNS 28 struct RadiosondeDemodSettings { From 10748b1dee446081d6350fcc74052bbde9ba8347 Mon Sep 17 00:00:00 2001 From: Jon Beniston Date: Tue, 7 Nov 2023 10:18:42 +0000 Subject: [PATCH 3/3] Update docs --- plugins/channelrx/demodradiosonde/readme.md | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/plugins/channelrx/demodradiosonde/readme.md b/plugins/channelrx/demodradiosonde/readme.md index bdf70e9ec2..7ddc72ca00 100644 --- a/plugins/channelrx/demodradiosonde/readme.md +++ b/plugins/channelrx/demodradiosonde/readme.md @@ -1,4 +1,4 @@ -

Radiosonde demodulator plugin

+

Radiosonde demodulator plugin

Introduction

@@ -83,18 +83,18 @@ The received frames table displays information about each radiosonde frame recei * Serial - The serial number of the radiosonde. Double clicking on this column will search for the radiosonde on https://sondehub.org/ * Frame - Frame number * Phase - Flight phase: On ground, Ascent and Descent. -* Lat (�) - Latitude in degrees, North positive. Double clicking on this column will search for the radiosonde on the Map. -* Lon (�) - Longitude in degrees, East positive. Double clicking on this column will search for the radiosonde on the Map. +* Lat (°) - Latitude in degrees, North positive. Double clicking on this column will search for the radiosonde on the Map. +* Lon (°) - Longitude in degrees, East positive. Double clicking on this column will search for the radiosonde on the Map. * Alt (m) - Altitude in metres. * Spd (km/h) - Speed over ground in kilometres per hour. * VR (m/s) - Vertical climb rate in metres per second. -* Hdg (�) - Heading in degrees. +* Hdg (°) - Heading in degrees. * P (hPA) - Air pressure in hectopascals. Not all RS41s include a pressure sensor. A value ending with 'U' indicates a uncalibrated estimate and may be inaccurate. -* T (�C) - Air temperature in degrees Celsius. A value ending with 'U' indicates a uncalibrated estimate and may be inaccurate. +* T (°C) - Air temperature in degrees Celsius. A value ending with 'U' indicates a uncalibrated estimate and may be inaccurate. * U (%) - Relative humidity in percent. A value ending with 'U' indicates a uncalibrated estimate and may be inaccurate. * Bat (V) - Battery voltage in Volts. * Bat - Battery status: OK or low. -* PCB (�C) - Temperature of PCB. +* PCB (°C) - Temperature of PCB. * PWM (%) - Humidity sensor heater PWM (Pulse Width Modulation) setting, in percent. * TX (%) - Transmit power in percent. * Max SF - Maximum subframe number. @@ -104,5 +104,7 @@ The received frames table displays information about each radiosonde frame recei * GPS Sats - Number of GPS satellites used in position estimate. * ECC - Number of symbol errors corrected by Reed Solomon ECC. * Corr - Preamble correlation value calculated for the frame. This can be used to choose a value for TH (6). +* Range (km) - Distance from My Position to Radiosonde in kilometres. +* Frequency (MHz) - Demodulator centre frequency when frame received, in MHz. Right clicking on the table header allows you to select which columns to show. The columns can be reordered by left clicking and dragging the column header. Right clicking on an item in the table allows you to copy the value to the clipboard.