1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-26 01:39:05 -05:00

Add rotator az/el and offset to table.

This commit is contained in:
Jon Beniston 2023-08-26 14:40:13 +01:00
parent 6105212bd4
commit 0e1f2f43ce
6 changed files with 150 additions and 3 deletions

View File

@ -57,6 +57,7 @@
#include "feature/featurewebapiutils.h" #include "feature/featurewebapiutils.h"
#include "feature/feature.h" #include "feature/feature.h"
#include "feature/featureset.h" #include "feature/featureset.h"
#include "webapi/webapiutils.h"
#include "radioastronomy.h" #include "radioastronomy.h"
#include "radioastronomysink.h" #include "radioastronomysink.h"
@ -287,6 +288,10 @@ void RadioAstronomyGUI::resizePowerTable()
ui->powerTable->setItem(row, POWER_COL_SENSOR_1, new QTableWidgetItem("1.0000000")); ui->powerTable->setItem(row, POWER_COL_SENSOR_1, new QTableWidgetItem("1.0000000"));
ui->powerTable->setItem(row, POWER_COL_SENSOR_2, new QTableWidgetItem("1.0000000")); ui->powerTable->setItem(row, POWER_COL_SENSOR_2, new QTableWidgetItem("1.0000000"));
ui->powerTable->setItem(row, POWER_COL_UTC, new QTableWidgetItem("15/04/2016 10:17:00")); ui->powerTable->setItem(row, POWER_COL_UTC, new QTableWidgetItem("15/04/2016 10:17:00"));
ui->powerTable->setItem(row, POWER_COL_ROT_AZ, new QTableWidgetItem("359.0"));
ui->powerTable->setItem(row, POWER_COL_ROT_EL, new QTableWidgetItem("-90.0"));
ui->powerTable->setItem(row, POWER_COL_ROT_AZ_OFF, new QTableWidgetItem("-10.0"));
ui->powerTable->setItem(row, POWER_COL_ROT_EL_OFF, new QTableWidgetItem("-10.0"));
ui->powerTable->resizeColumnsToContents(); ui->powerTable->resizeColumnsToContents();
ui->powerTable->removeRow(row); ui->powerTable->removeRow(row);
} }
@ -635,6 +640,10 @@ void RadioAstronomyGUI::powerMeasurementReceived(FFTMeasurement *fft, bool skipC
QTableWidgetItem* sensor1Item = new QTableWidgetItem(); QTableWidgetItem* sensor1Item = new QTableWidgetItem();
QTableWidgetItem* sensor2Item = new QTableWidgetItem(); QTableWidgetItem* sensor2Item = new QTableWidgetItem();
QTableWidgetItem* utcItem = new QTableWidgetItem(); QTableWidgetItem* utcItem = new QTableWidgetItem();
QTableWidgetItem* rotAzItem = new QTableWidgetItem();
QTableWidgetItem* rotElItem = new QTableWidgetItem();
QTableWidgetItem* rotAzOffItem = new QTableWidgetItem();
QTableWidgetItem* rotElOffItem = new QTableWidgetItem();
ui->powerTable->setItem(row, POWER_COL_DATE, dateItem); ui->powerTable->setItem(row, POWER_COL_DATE, dateItem);
ui->powerTable->setItem(row, POWER_COL_TIME, timeItem); ui->powerTable->setItem(row, POWER_COL_TIME, timeItem);
@ -664,6 +673,10 @@ void RadioAstronomyGUI::powerMeasurementReceived(FFTMeasurement *fft, bool skipC
ui->powerTable->setItem(row, POWER_COL_SENSOR_1, sensor1Item); ui->powerTable->setItem(row, POWER_COL_SENSOR_1, sensor1Item);
ui->powerTable->setItem(row, POWER_COL_SENSOR_2, sensor2Item); ui->powerTable->setItem(row, POWER_COL_SENSOR_2, sensor2Item);
ui->powerTable->setItem(row, POWER_COL_UTC, utcItem); ui->powerTable->setItem(row, POWER_COL_UTC, utcItem);
ui->powerTable->setItem(row, POWER_COL_ROT_AZ, rotAzItem);
ui->powerTable->setItem(row, POWER_COL_ROT_EL, rotElItem);
ui->powerTable->setItem(row, POWER_COL_ROT_AZ_OFF, rotAzOffItem);
ui->powerTable->setItem(row, POWER_COL_ROT_EL_OFF, rotElOffItem);
ui->powerTable->setSortingEnabled(true); ui->powerTable->setSortingEnabled(true);
@ -696,6 +709,13 @@ void RadioAstronomyGUI::powerMeasurementReceived(FFTMeasurement *fft, bool skipC
airTempItem->setData(Qt::DisplayRole, fft->m_airTemp); airTempItem->setData(Qt::DisplayRole, fft->m_airTemp);
sensor1Item->setData(Qt::DisplayRole, fft->m_sensor[0]); sensor1Item->setData(Qt::DisplayRole, fft->m_sensor[0]);
sensor2Item->setData(Qt::DisplayRole, fft->m_sensor[1]); sensor2Item->setData(Qt::DisplayRole, fft->m_sensor[1]);
if (fft->m_rotValid)
{
rotAzItem->setData(Qt::DisplayRole, fft->m_rotAz);
rotElItem->setData(Qt::DisplayRole, fft->m_rotEl);
rotAzOffItem->setData(Qt::DisplayRole, fft->m_rotAzOff);
rotElOffItem->setData(Qt::DisplayRole, fft->m_rotElOff);
}
addToPowerSeries(fft, skipCalcs); addToPowerSeries(fft, skipCalcs);
} }
@ -2130,6 +2150,10 @@ RadioAstronomyGUI::RadioAstronomyGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUI
ui->powerTable->setItemDelegateForColumn(POWER_COL_VBCRS, new DecimalDelegate(1)); ui->powerTable->setItemDelegateForColumn(POWER_COL_VBCRS, new DecimalDelegate(1));
ui->powerTable->setItemDelegateForColumn(POWER_COL_VLSR, new DecimalDelegate(1)); ui->powerTable->setItemDelegateForColumn(POWER_COL_VLSR, new DecimalDelegate(1));
ui->powerTable->setItemDelegateForColumn(POWER_COL_AIR_TEMP, new DecimalDelegate(1)); ui->powerTable->setItemDelegateForColumn(POWER_COL_AIR_TEMP, new DecimalDelegate(1));
ui->powerTable->setItemDelegateForColumn(POWER_COL_ROT_AZ, new DecimalDelegate(0));
ui->powerTable->setItemDelegateForColumn(POWER_COL_ROT_EL, new DecimalDelegate(0));
ui->powerTable->setItemDelegateForColumn(POWER_COL_ROT_AZ_OFF, new DecimalDelegate(0));
ui->powerTable->setItemDelegateForColumn(POWER_COL_ROT_EL_OFF, new DecimalDelegate(0));
resizeSpectrumMarkerTable(); resizeSpectrumMarkerTable();
ui->spectrumMarkerTable->setItemDelegateForColumn(SPECTRUM_MARKER_COL_FREQ, new DecimalDelegate(6)); ui->spectrumMarkerTable->setItemDelegateForColumn(SPECTRUM_MARKER_COL_FREQ, new DecimalDelegate(6));
@ -2733,12 +2757,20 @@ void RadioAstronomyGUI::setColumnPrecisionFromRotator()
((DecimalDelegate *)ui->powerTable->itemDelegateForColumn(POWER_COL_GAL_LON))->setPrecision(precision); ((DecimalDelegate *)ui->powerTable->itemDelegateForColumn(POWER_COL_GAL_LON))->setPrecision(precision);
((DecimalDelegate *)ui->powerTable->itemDelegateForColumn(POWER_COL_AZ))->setPrecision(precision); ((DecimalDelegate *)ui->powerTable->itemDelegateForColumn(POWER_COL_AZ))->setPrecision(precision);
((DecimalDelegate *)ui->powerTable->itemDelegateForColumn(POWER_COL_EL))->setPrecision(precision); ((DecimalDelegate *)ui->powerTable->itemDelegateForColumn(POWER_COL_EL))->setPrecision(precision);
((DecimalDelegate *)ui->powerTable->itemDelegateForColumn(POWER_COL_ROT_AZ))->setPrecision(precision);
((DecimalDelegate *)ui->powerTable->itemDelegateForColumn(POWER_COL_ROT_EL))->setPrecision(precision);
((DecimalDelegate *)ui->powerTable->itemDelegateForColumn(POWER_COL_ROT_AZ_OFF))->setPrecision(precision);
((DecimalDelegate *)ui->powerTable->itemDelegateForColumn(POWER_COL_ROT_EL_OFF))->setPrecision(precision);
if (precision > old) if (precision > old)
{ {
ui->powerTable->resizeColumnToContents(POWER_COL_GAL_LAT); ui->powerTable->resizeColumnToContents(POWER_COL_GAL_LAT);
ui->powerTable->resizeColumnToContents(POWER_COL_GAL_LON); ui->powerTable->resizeColumnToContents(POWER_COL_GAL_LON);
ui->powerTable->resizeColumnToContents(POWER_COL_AZ); ui->powerTable->resizeColumnToContents(POWER_COL_AZ);
ui->powerTable->resizeColumnToContents(POWER_COL_EL); ui->powerTable->resizeColumnToContents(POWER_COL_EL);
ui->powerTable->resizeColumnToContents(POWER_COL_ROT_AZ);
ui->powerTable->resizeColumnToContents(POWER_COL_ROT_EL);
ui->powerTable->resizeColumnToContents(POWER_COL_ROT_AZ_OFF);
ui->powerTable->resizeColumnToContents(POWER_COL_ROT_EL_OFF);
} }
ui->powerTable->viewport()->update(); ui->powerTable->viewport()->update();
} }
@ -3712,6 +3744,8 @@ void RadioAstronomyGUI::calCompletetReceived(const RadioAstronomy::MsgCalComplet
} }
fft->m_tSys0 = calcTSys0(); fft->m_tSys0 = calcTSys0();
fft->m_baseline = m_settings.m_spectrumBaseline; fft->m_baseline = m_settings.m_spectrumBaseline;
getRotatorData(fft);
if (!hot) { if (!hot) {
ui->calTsky->setText(QString::number(m_skyTemp, 'f', 1)); ui->calTsky->setText(QString::number(m_skyTemp, 'f', 1));
@ -4650,6 +4684,66 @@ void RadioAstronomyGUI::addFFT(FFTMeasurement *fft, bool skipCalcs)
} }
} }
void RadioAstronomyGUI::getRotatorData(FFTMeasurement *fft)
{
const QRegExp re("F([0-9]+):([0-9]+)");
if (re.indexIn(m_settings.m_rotator) >= 0)
{
int rotatorFeatureSetIndex = re.capturedTexts()[1].toInt();
int rotatorFeatureIndex = re.capturedTexts()[2].toInt();
SWGSDRangel::SWGFeatureReport featureReport;
double value;
qDebug() << m_settings.m_rotator << rotatorFeatureSetIndex << rotatorFeatureIndex;
if (ChannelWebAPIUtils::getFeatureReport(rotatorFeatureSetIndex, rotatorFeatureIndex, featureReport))
{
QJsonObject *jsonObj = featureReport.asJsonObject();
qDebug() << *jsonObj;
if (WebAPIUtils::getSubObjectDouble(*jsonObj, "currentAzimuth", value)) {
fft->m_rotAz = value;
} else {
qDebug() << "RadioAstronomyGUI::getRotatorData: getSubObjectDouble currentAzimuth failed";
}
if (WebAPIUtils::getSubObjectDouble(*jsonObj, "currentElevation", value)) {
fft->m_rotEl = value;
} else {
qDebug() << "RadioAstronomyGUI::getRotatorData: getSubObjectDouble currentElevation failed";
}
}
else
{
qDebug() << "RadioAstronomyGUI::getRotatorData: getFeatureReport failed";
}
SWGSDRangel::SWGFeatureSettings featureSettingsResponse;
Feature *feature;
if (ChannelWebAPIUtils::getFeatureSettings(rotatorFeatureSetIndex, rotatorFeatureIndex, featureSettingsResponse, feature))
{
QJsonObject *jsonObj = featureSettingsResponse.asJsonObject();
qDebug() << *jsonObj;
if (WebAPIUtils::getSubObjectDouble(*jsonObj, "azimuthOffset", value)) {
fft->m_rotAzOff = value;
} else {
qDebug() << "RadioAstronomyGUI::getRotatorData: getSubObjectDouble azimuthOffset failed";
}
if (WebAPIUtils::getSubObjectDouble(*jsonObj, "elevationOffset", value)) {
fft->m_rotElOff = value;
} else {
qDebug() << "RadioAstronomyGUI::getRotatorData: getSubObjectDouble elevationOffset ";
}
}
else
{
qDebug() << "RadioAstronomyGUI::getRotatorData: getFeatureSettings failed";
}
fft->m_rotValid = true;
}
else
qDebug() << "Couldn't parse rotator feature " << m_settings.m_rotator;
}
void RadioAstronomyGUI::fftMeasurementReceived(const RadioAstronomy::MsgFFTMeasurement& measurement) void RadioAstronomyGUI::fftMeasurementReceived(const RadioAstronomy::MsgFFTMeasurement& measurement)
{ {
FFTMeasurement *fft = new FFTMeasurement(); FFTMeasurement *fft = new FFTMeasurement();
@ -4681,6 +4775,7 @@ void RadioAstronomyGUI::fftMeasurementReceived(const RadioAstronomy::MsgFFTMeasu
fft->m_sweepIndex = m_sweepIndex++; fft->m_sweepIndex = m_sweepIndex++;
fft->m_tSys0 = calcTSys0(); fft->m_tSys0 = calcTSys0();
fft->m_baseline = m_settings.m_spectrumBaseline; fft->m_baseline = m_settings.m_spectrumBaseline;
getRotatorData(fft);
calcFFTPower(fft); calcFFTPower(fft);
calcFFTTotalPower(fft); calcFFTTotalPower(fft);

View File

@ -98,6 +98,12 @@ class RadioAstronomyGUI : public ChannelGUI {
float m_skyTemp; float m_skyTemp;
float m_sensor[RADIOASTRONOMY_SENSORS]; float m_sensor[RADIOASTRONOMY_SENSORS];
bool m_rotValid;
float m_rotAz;
float m_rotEl;
float m_rotAzOff;
float m_rotElOff;
int m_sweepIndex; int m_sweepIndex;
FFTMeasurement() : FFTMeasurement() :
@ -121,6 +127,11 @@ class RadioAstronomyGUI : public ChannelGUI {
m_coordsValid(false), m_coordsValid(false),
m_airTemp(0.0), m_airTemp(0.0),
m_skyTemp(0.0), m_skyTemp(0.0),
m_rotValid(false),
m_rotAz(0.0),
m_rotEl(0.0),
m_rotAzOff(0.0),
m_rotElOff(0.0),
m_sweepIndex(0) m_sweepIndex(0)
{ {
} }
@ -450,6 +461,7 @@ private:
void calcSpectrumChartTickCount(QValueAxis *axis, int width); void calcSpectrumChartTickCount(QValueAxis *axis, int width);
int powerYUnitsToIndex(RadioAstronomySettings::PowerYUnits units); int powerYUnitsToIndex(RadioAstronomySettings::PowerYUnits units);
void setColumnPrecisionFromRotator(); void setColumnPrecisionFromRotator();
void getRotatorData(FFTMeasurement *fft);
void leaveEvent(QEvent*); void leaveEvent(QEvent*);
void enterEvent(EnterEventType*); void enterEvent(EnterEventType*);
@ -487,7 +499,11 @@ private:
POWER_COL_AIR_TEMP, POWER_COL_AIR_TEMP,
POWER_COL_SENSOR_1, POWER_COL_SENSOR_1,
POWER_COL_SENSOR_2, POWER_COL_SENSOR_2,
POWER_COL_UTC POWER_COL_UTC,
POWER_COL_ROT_AZ,
POWER_COL_ROT_EL,
POWER_COL_ROT_AZ_OFF,
POWER_COL_ROT_EL_OFF
}; };
enum PowerMarkerTable { enum PowerMarkerTable {

View File

@ -5147,6 +5147,38 @@ This should be close to the expected difference in power between hot and cold ca
<string>UTC date and time measurement finished</string> <string>UTC date and time measurement finished</string>
</property> </property>
</column> </column>
<column>
<property name="text">
<string>Az (Rot)</string>
</property>
<property name="toolTip">
<string>Azimuth of rotator controller in degrees</string>
</property>
</column>
<column>
<property name="text">
<string>El (Rot)</string>
</property>
<property name="toolTip">
<string>Elevation of rotator controller in degrees</string>
</property>
</column>
<column>
<property name="text">
<string>Az Off (Rot)</string>
</property>
<property name="toolTip">
<string>Azimuth offset of rotator controller in degrees</string>
</property>
</column>
<column>
<property name="text">
<string>El Off (Rot)</string>
</property>
<property name="toolTip">
<string>Elevation offset of rotator controller in degrees</string>
</property>
</column>
</widget> </widget>
</item> </item>
</layout> </layout>

View File

@ -28,7 +28,7 @@
class Serializable; class Serializable;
// Number of columns in the tables // Number of columns in the tables
#define RADIOASTRONOMY_POWERTABLE_COLUMNS 28 #define RADIOASTRONOMY_POWERTABLE_COLUMNS 32
// Number of sensors // Number of sensors
#define RADIOASTRONOMY_SENSORS 2 #define RADIOASTRONOMY_SENSORS 2

View File

@ -792,6 +792,10 @@ The columns in the table include:
- Sensor 1 - Data recorded for Sensor 1. - Sensor 1 - Data recorded for Sensor 1.
- Sensor 2 - Data recorded for Sensor 2. - Sensor 2 - Data recorded for Sensor 2.
- UTC - UTC date and time at the end of the measurement. - UTC - UTC date and time at the end of the measurement.
- Az (Rot) - Azimuth of rotator controller in degrees at the end of measurement.
- El (Rot) - Elevation of rotator controller in degrees at then end of measurement.
- Az Off (Rot) - Azimimuth offset of rotator controller in degrees at the end of measurement.
- El Off (Rot) - Elevation offset of rotator controller in degrees at the end of measurement.
Right clicking on the table shows a popup menu that supports: Right clicking on the table shows a popup menu that supports:

View File

@ -81,13 +81,13 @@ public:
static bool getChannelReportValue(unsigned int deviceIndex, unsigned int channelIndex, const QString &key, int &value); static bool getChannelReportValue(unsigned int deviceIndex, unsigned int channelIndex, const QString &key, int &value);
static bool getChannelReportValue(unsigned int deviceIndex, unsigned int channelIndex, const QString &key, double &value); static bool getChannelReportValue(unsigned int deviceIndex, unsigned int channelIndex, const QString &key, double &value);
static bool getChannelReportValue(unsigned int deviceIndex, unsigned int channelIndex, const QString &key, QString &value); static bool getChannelReportValue(unsigned int deviceIndex, unsigned int channelIndex, const QString &key, QString &value);
protected:
static bool getDeviceSettings(unsigned int deviceIndex, SWGSDRangel::SWGDeviceSettings &deviceSettingsResponse, DeviceSet *&deviceSet); static bool getDeviceSettings(unsigned int deviceIndex, SWGSDRangel::SWGDeviceSettings &deviceSettingsResponse, DeviceSet *&deviceSet);
static bool getDeviceReport(unsigned int deviceIndex, SWGSDRangel::SWGDeviceReport &deviceReport); static bool getDeviceReport(unsigned int deviceIndex, SWGSDRangel::SWGDeviceReport &deviceReport);
static bool getFeatureSettings(unsigned int featureSetIndex, unsigned int featureIndex, SWGSDRangel::SWGFeatureSettings &featureSettingsResponse, Feature *&feature); static bool getFeatureSettings(unsigned int featureSetIndex, unsigned int featureIndex, SWGSDRangel::SWGFeatureSettings &featureSettingsResponse, Feature *&feature);
static bool getFeatureReport(unsigned int featureSetIndex, unsigned int featureIndex, SWGSDRangel::SWGFeatureReport &featureReport); static bool getFeatureReport(unsigned int featureSetIndex, unsigned int featureIndex, SWGSDRangel::SWGFeatureReport &featureReport);
static bool getChannelSettings(unsigned int deviceIndex, unsigned int channelIndex, SWGSDRangel::SWGChannelSettings &channelSettingsResponse, ChannelAPI *&channel); static bool getChannelSettings(unsigned int deviceIndex, unsigned int channelIndex, SWGSDRangel::SWGChannelSettings &channelSettingsResponse, ChannelAPI *&channel);
static bool getChannelReport(unsigned int deviceIndex, unsigned int channelIndex, SWGSDRangel::SWGChannelReport &channelReport); static bool getChannelReport(unsigned int deviceIndex, unsigned int channelIndex, SWGSDRangel::SWGChannelReport &channelReport);
protected:
static QString getDeviceHardwareId(unsigned int deviceIndex); static QString getDeviceHardwareId(unsigned int deviceIndex);
}; };