1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-12-23 10:05:46 -05:00

Rotator Controller: Use floats for az/el offsets. For #1739

This commit is contained in:
Jon Beniston 2023-07-27 14:57:57 +01:00
parent d484b4d9f7
commit 46f9c1a493
8 changed files with 70 additions and 63 deletions

View File

@ -633,6 +633,8 @@ void GS232ControllerGUI::setPrecision()
ui->coord1->setDecimals(m_settings.m_precision); ui->coord1->setDecimals(m_settings.m_precision);
ui->coord2->setDecimals(m_settings.m_precision); ui->coord2->setDecimals(m_settings.m_precision);
ui->tolerance->setDecimals(m_settings.m_precision); ui->tolerance->setDecimals(m_settings.m_precision);
ui->azimuthOffset->setDecimals(m_settings.m_precision);
ui->elevationOffset->setDecimals(m_settings.m_precision);
} }
void GS232ControllerGUI::on_protocol_currentIndexChanged(int index) void GS232ControllerGUI::on_protocol_currentIndexChanged(int index)
@ -699,22 +701,22 @@ void GS232ControllerGUI::on_coord2_valueChanged(double value)
ui->targetName->setText(""); ui->targetName->setText("");
} }
void GS232ControllerGUI::on_azimuthOffset_valueChanged(int value) void GS232ControllerGUI::on_azimuthOffset_valueChanged(double value)
{ {
if (!m_inputUpdate) { if (!m_inputUpdate) {
m_inputAzOffset = value; m_inputAzOffset = value;
} }
m_settings.m_azimuthOffset = value; m_settings.m_azimuthOffset = (float) value;
m_settingsKeys.append("azimuthOffset"); m_settingsKeys.append("azimuthOffset");
applySettings(); applySettings();
} }
void GS232ControllerGUI::on_elevationOffset_valueChanged(int value) void GS232ControllerGUI::on_elevationOffset_valueChanged(double value)
{ {
if (!m_inputUpdate) { if (!m_inputUpdate) {
m_inputElOffset = value; m_inputElOffset = value;
} }
m_settings.m_elevationOffset = value; m_settings.m_elevationOffset = (float) value;
m_settingsKeys.append("elevationOffset"); m_settingsKeys.append("elevationOffset");
applySettings(); applySettings();
} }
@ -948,8 +950,8 @@ void GS232ControllerGUI::makeUIConnections()
QObject::connect(ui->coord1, qOverload<double>(&QDoubleSpinBox::valueChanged), this, &GS232ControllerGUI::on_coord1_valueChanged); QObject::connect(ui->coord1, qOverload<double>(&QDoubleSpinBox::valueChanged), this, &GS232ControllerGUI::on_coord1_valueChanged);
QObject::connect(ui->coord2, qOverload<double>(&QDoubleSpinBox::valueChanged), this, &GS232ControllerGUI::on_coord2_valueChanged); QObject::connect(ui->coord2, qOverload<double>(&QDoubleSpinBox::valueChanged), this, &GS232ControllerGUI::on_coord2_valueChanged);
QObject::connect(ui->sources, &QComboBox::currentTextChanged, this, &GS232ControllerGUI::on_sources_currentTextChanged); QObject::connect(ui->sources, &QComboBox::currentTextChanged, this, &GS232ControllerGUI::on_sources_currentTextChanged);
QObject::connect(ui->azimuthOffset, qOverload<int>(&QSpinBox::valueChanged), this, &GS232ControllerGUI::on_azimuthOffset_valueChanged); QObject::connect(ui->azimuthOffset, qOverload<double>(&QDoubleSpinBox::valueChanged), this, &GS232ControllerGUI::on_azimuthOffset_valueChanged);
QObject::connect(ui->elevationOffset, qOverload<int>(&QSpinBox::valueChanged), this, &GS232ControllerGUI::on_elevationOffset_valueChanged); QObject::connect(ui->elevationOffset, qOverload<double>(&QDoubleSpinBox::valueChanged), this, &GS232ControllerGUI::on_elevationOffset_valueChanged);
QObject::connect(ui->azimuthMin, qOverload<int>(&QSpinBox::valueChanged), this, &GS232ControllerGUI::on_azimuthMin_valueChanged); QObject::connect(ui->azimuthMin, qOverload<int>(&QSpinBox::valueChanged), this, &GS232ControllerGUI::on_azimuthMin_valueChanged);
QObject::connect(ui->azimuthMax, qOverload<int>(&QSpinBox::valueChanged), this, &GS232ControllerGUI::on_azimuthMax_valueChanged); QObject::connect(ui->azimuthMax, qOverload<int>(&QSpinBox::valueChanged), this, &GS232ControllerGUI::on_azimuthMax_valueChanged);
QObject::connect(ui->elevationMin, qOverload<int>(&QSpinBox::valueChanged), this, &GS232ControllerGUI::on_elevationMin_valueChanged); QObject::connect(ui->elevationMin, qOverload<int>(&QSpinBox::valueChanged), this, &GS232ControllerGUI::on_elevationMin_valueChanged);

View File

@ -110,8 +110,8 @@ private slots:
void on_coord1_valueChanged(double value); void on_coord1_valueChanged(double value);
void on_coord2_valueChanged(double value); void on_coord2_valueChanged(double value);
void on_sources_currentTextChanged(const QString& text); void on_sources_currentTextChanged(const QString& text);
void on_azimuthOffset_valueChanged(int value); void on_azimuthOffset_valueChanged(double value);
void on_elevationOffset_valueChanged(int value); void on_elevationOffset_valueChanged(double value);
void on_azimuthMin_valueChanged(int value); void on_azimuthMin_valueChanged(int value);
void on_azimuthMax_valueChanged(int value); void on_azimuthMax_valueChanged(int value);
void on_elevationMin_valueChanged(int value); void on_elevationMin_valueChanged(int value);

View File

@ -406,22 +406,6 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="3">
<widget class="QSpinBox" name="elevationOffset">
<property name="toolTip">
<string>Specify an offset angle in degrees that will be added to the target elevation to correct for misalignment</string>
</property>
<property name="minimum">
<number>-180</number>
</property>
<property name="maximum">
<number>180</number>
</property>
<property name="singleStep">
<number>1</number>
</property>
</widget>
</item>
<item row="0" column="1"> <item row="0" column="1">
<widget class="QComboBox" name="protocol"> <widget class="QComboBox" name="protocol">
<property name="toolTip"> <property name="toolTip">
@ -628,19 +612,6 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="1">
<widget class="QSpinBox" name="azimuthOffset">
<property name="toolTip">
<string>Specify an offset angel in degrees that will be added to the target azimuth to correct for misalignment</string>
</property>
<property name="minimum">
<number>-360</number>
</property>
<property name="maximum">
<number>360</number>
</property>
</widget>
</item>
<item row="6" column="1"> <item row="6" column="1">
<widget class="QDoubleSpinBox" name="tolerance"> <widget class="QDoubleSpinBox" name="tolerance">
<property name="toolTip"> <property name="toolTip">
@ -759,6 +730,38 @@
</item> </item>
</layout> </layout>
</item> </item>
<item row="3" column="1">
<widget class="QDoubleSpinBox" name="azimuthOffset">
<property name="toolTip">
<string>Specify an offset angle in degrees that will be added to the target azimuth to correct for misalignment</string>
</property>
<property name="decimals">
<number>0</number>
</property>
<property name="minimum">
<double>-360.000000000000000</double>
</property>
<property name="maximum">
<double>360.000000000000000</double>
</property>
</widget>
</item>
<item row="3" column="3">
<widget class="QDoubleSpinBox" name="elevationOffset">
<property name="toolTip">
<string>Specify an offset angle in degrees that will be added to the target elevation to correct for misalignment</string>
</property>
<property name="decimals">
<number>0</number>
</property>
<property name="minimum">
<double>-180.000000000000000</double>
</property>
<property name="maximum">
<double>180.000000000000000</double>
</property>
</widget>
</item>
</layout> </layout>
</item> </item>
</layout> </layout>

View File

@ -53,8 +53,8 @@ void GS232ControllerSettings::resetToDefaults()
m_port = 4533; m_port = 4533;
m_track = false; m_track = false;
m_source = ""; m_source = "";
m_azimuthOffset = 0; m_azimuthOffset = 0.0f;
m_elevationOffset = 0; m_elevationOffset = 0.0f;
m_azimuthMin = 0; m_azimuthMin = 0;
m_azimuthMax = 450; m_azimuthMax = 450;
m_elevationMin = 0; m_elevationMin = 0;
@ -97,8 +97,8 @@ QByteArray GS232ControllerSettings::serialize() const
s.writeU32(12, m_reverseAPIPort); s.writeU32(12, m_reverseAPIPort);
s.writeU32(13, m_reverseAPIFeatureSetIndex); s.writeU32(13, m_reverseAPIFeatureSetIndex);
s.writeU32(14, m_reverseAPIFeatureIndex); s.writeU32(14, m_reverseAPIFeatureIndex);
s.writeS32(15, m_azimuthOffset); s.writeFloat(15, m_azimuthOffset);
s.writeS32(16, m_elevationOffset); s.writeFloat(16, m_elevationOffset);
s.writeS32(17, m_azimuthMin); s.writeS32(17, m_azimuthMin);
s.writeS32(18, m_azimuthMax); s.writeS32(18, m_azimuthMax);
s.writeS32(19, m_elevationMin); s.writeS32(19, m_elevationMin);
@ -165,8 +165,8 @@ bool GS232ControllerSettings::deserialize(const QByteArray& data)
m_reverseAPIFeatureSetIndex = utmp > 99 ? 99 : utmp; m_reverseAPIFeatureSetIndex = utmp > 99 ? 99 : utmp;
d.readU32(14, &utmp, 0); d.readU32(14, &utmp, 0);
m_reverseAPIFeatureIndex = utmp > 99 ? 99 : utmp; m_reverseAPIFeatureIndex = utmp > 99 ? 99 : utmp;
d.readS32(15, &m_azimuthOffset, 0); d.readFloat(15, &m_azimuthOffset, 0.0f);
d.readS32(16, &m_elevationOffset, 0); d.readFloat(16, &m_elevationOffset, 0.0f);
d.readS32(17, &m_azimuthMin, 0); d.readS32(17, &m_azimuthMin, 0);
d.readS32(18, &m_azimuthMax, 450); d.readS32(18, &m_azimuthMax, 450);
d.readS32(19, &m_elevationMin, 0); d.readS32(19, &m_elevationMin, 0);

View File

@ -51,8 +51,8 @@ struct GS232ControllerSettings
int m_port; int m_port;
bool m_track; bool m_track;
QString m_source; // Plugin to get az/el from. E.g: "R0:0 ADSBDemod". Use a string, so can be set via WebAPI QString m_source; // Plugin to get az/el from. E.g: "R0:0 ADSBDemod". Use a string, so can be set via WebAPI
int m_azimuthOffset; float m_azimuthOffset;
int m_elevationOffset; float m_elevationOffset;
int m_azimuthMin; int m_azimuthMin;
int m_azimuthMax; int m_azimuthMax;
int m_elevationMin; int m_elevationMin;

View File

@ -29,10 +29,12 @@ GS232ControllerSettings:
type: string type: string
azimuthOffset: azimuthOffset:
description: Azimuth offset in degrees description: Azimuth offset in degrees
type: integer type: number
format: float
elevationOffset: elevationOffset:
description: Elevation offset in degrees description: Elevation offset in degrees
type: integer type: number
format: float
azimuthMin: azimuthMin:
description: Minimum azimuth the controller will output description: Minimum azimuth the controller will output
type: integer type: integer

View File

@ -44,9 +44,9 @@ SWGGS232ControllerSettings::SWGGS232ControllerSettings() {
m_track_isSet = false; m_track_isSet = false;
source = nullptr; source = nullptr;
m_source_isSet = false; m_source_isSet = false;
azimuth_offset = 0; azimuth_offset = 0.0f;
m_azimuth_offset_isSet = false; m_azimuth_offset_isSet = false;
elevation_offset = 0; elevation_offset = 0.0f;
m_elevation_offset_isSet = false; m_elevation_offset_isSet = false;
azimuth_min = 0; azimuth_min = 0;
m_azimuth_min_isSet = false; m_azimuth_min_isSet = false;
@ -108,9 +108,9 @@ SWGGS232ControllerSettings::init() {
m_track_isSet = false; m_track_isSet = false;
source = new QString(""); source = new QString("");
m_source_isSet = false; m_source_isSet = false;
azimuth_offset = 0; azimuth_offset = 0.0f;
m_azimuth_offset_isSet = false; m_azimuth_offset_isSet = false;
elevation_offset = 0; elevation_offset = 0.0f;
m_elevation_offset_isSet = false; m_elevation_offset_isSet = false;
azimuth_min = 0; azimuth_min = 0;
m_azimuth_min_isSet = false; m_azimuth_min_isSet = false;
@ -223,9 +223,9 @@ SWGGS232ControllerSettings::fromJsonObject(QJsonObject &pJson) {
::SWGSDRangel::setValue(&source, pJson["source"], "QString", "QString"); ::SWGSDRangel::setValue(&source, pJson["source"], "QString", "QString");
::SWGSDRangel::setValue(&azimuth_offset, pJson["azimuthOffset"], "qint32", ""); ::SWGSDRangel::setValue(&azimuth_offset, pJson["azimuthOffset"], "float", "");
::SWGSDRangel::setValue(&elevation_offset, pJson["elevationOffset"], "qint32", ""); ::SWGSDRangel::setValue(&elevation_offset, pJson["elevationOffset"], "float", "");
::SWGSDRangel::setValue(&azimuth_min, pJson["azimuthMin"], "qint32", ""); ::SWGSDRangel::setValue(&azimuth_min, pJson["azimuthMin"], "qint32", "");
@ -447,22 +447,22 @@ SWGGS232ControllerSettings::setSource(QString* source) {
this->m_source_isSet = true; this->m_source_isSet = true;
} }
qint32 float
SWGGS232ControllerSettings::getAzimuthOffset() { SWGGS232ControllerSettings::getAzimuthOffset() {
return azimuth_offset; return azimuth_offset;
} }
void void
SWGGS232ControllerSettings::setAzimuthOffset(qint32 azimuth_offset) { SWGGS232ControllerSettings::setAzimuthOffset(float azimuth_offset) {
this->azimuth_offset = azimuth_offset; this->azimuth_offset = azimuth_offset;
this->m_azimuth_offset_isSet = true; this->m_azimuth_offset_isSet = true;
} }
qint32 float
SWGGS232ControllerSettings::getElevationOffset() { SWGGS232ControllerSettings::getElevationOffset() {
return elevation_offset; return elevation_offset;
} }
void void
SWGGS232ControllerSettings::setElevationOffset(qint32 elevation_offset) { SWGGS232ControllerSettings::setElevationOffset(float elevation_offset) {
this->elevation_offset = elevation_offset; this->elevation_offset = elevation_offset;
this->m_elevation_offset_isSet = true; this->m_elevation_offset_isSet = true;
} }

View File

@ -67,11 +67,11 @@ public:
QString* getSource(); QString* getSource();
void setSource(QString* source); void setSource(QString* source);
qint32 getAzimuthOffset(); float getAzimuthOffset();
void setAzimuthOffset(qint32 azimuth_offset); void setAzimuthOffset(float azimuth_offset);
qint32 getElevationOffset(); float getElevationOffset();
void setElevationOffset(qint32 elevation_offset); void setElevationOffset(float elevation_offset);
qint32 getAzimuthMin(); qint32 getAzimuthMin();
void setAzimuthMin(qint32 azimuth_min); void setAzimuthMin(qint32 azimuth_min);
@ -155,10 +155,10 @@ private:
QString* source; QString* source;
bool m_source_isSet; bool m_source_isSet;
qint32 azimuth_offset; float azimuth_offset;
bool m_azimuth_offset_isSet; bool m_azimuth_offset_isSet;
qint32 elevation_offset; float elevation_offset;
bool m_elevation_offset_isSet; bool m_elevation_offset_isSet;
qint32 azimuth_min; qint32 azimuth_min;