Skip to content

Commit

Permalink
Merge pull request f4exb#1881 from srcejon/fix_1880
Browse files Browse the repository at this point in the history
Radiosonde updates for f4exb#1880
  • Loading branch information
f4exb authored Nov 8, 2023
2 parents 44d61e2 + 10748b1 commit 8337e2c
Show file tree
Hide file tree
Showing 6 changed files with 61 additions and 17 deletions.
11 changes: 8 additions & 3 deletions plugins/channelrx/demodradiosonde/radiosondedemod.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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
Expand Down
29 changes: 24 additions & 5 deletions plugins/channelrx/demodradiosonde/radiosondedemodgui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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());
Expand Down Expand Up @@ -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)
Expand All @@ -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);
Expand Down Expand Up @@ -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))
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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)
Expand Down
6 changes: 4 additions & 2 deletions plugins/channelrx/demodradiosonde/radiosondedemodgui.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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:
Expand Down
16 changes: 16 additions & 0 deletions plugins/channelrx/demodradiosonde/radiosondedemodgui.ui
Original file line number Diff line number Diff line change
Expand Up @@ -846,6 +846,22 @@
<string>Correlation</string>
</property>
</column>
<column>
<property name="text">
<string>Range (km)</string>
</property>
<property name="toolTip">
<string>Range to Radiosonde in kilometres from My Position</string>
</property>
</column>
<column>
<property name="text">
<string>Frequency (MHz)</string>
</property>
<property name="toolTip">
<string>Demodulator center frequency when frame was received</string>
</property>
</column>
</widget>
</item>
</layout>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
class Serializable;

// Number of columns in the tables
#define RADIOSONDEDEMOD_FRAME_COLUMNS 26
#define RADIOSONDEDEMOD_FRAME_COLUMNS 28

struct RadiosondeDemodSettings
{
Expand Down
14 changes: 8 additions & 6 deletions plugins/channelrx/demodradiosonde/readme.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<h1>Radiosonde demodulator plugin</h1>
<h1>Radiosonde demodulator plugin</h1>

<h2>Introduction</h2>

Expand Down Expand Up @@ -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.
Expand All @@ -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.

0 comments on commit 8337e2c

Please sign in to comment.