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

Merge pull request #1744 from srcejon/fix_1739

Rotator Controller: Use floats for az/el offsets.
This commit is contained in:
Edouard Griffiths 2023-07-27 21:57:42 +02:00 committed by GitHub
commit 29a819b18e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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->coord2->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)
@ -699,22 +701,22 @@ void GS232ControllerGUI::on_coord2_valueChanged(double value)
ui->targetName->setText("");
}
void GS232ControllerGUI::on_azimuthOffset_valueChanged(int value)
void GS232ControllerGUI::on_azimuthOffset_valueChanged(double value)
{
if (!m_inputUpdate) {
m_inputAzOffset = value;
}
m_settings.m_azimuthOffset = value;
m_settings.m_azimuthOffset = (float) value;
m_settingsKeys.append("azimuthOffset");
applySettings();
}
void GS232ControllerGUI::on_elevationOffset_valueChanged(int value)
void GS232ControllerGUI::on_elevationOffset_valueChanged(double value)
{
if (!m_inputUpdate) {
m_inputElOffset = value;
}
m_settings.m_elevationOffset = value;
m_settings.m_elevationOffset = (float) value;
m_settingsKeys.append("elevationOffset");
applySettings();
}
@ -948,8 +950,8 @@ void GS232ControllerGUI::makeUIConnections()
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->sources, &QComboBox::currentTextChanged, this, &GS232ControllerGUI::on_sources_currentTextChanged);
QObject::connect(ui->azimuthOffset, qOverload<int>(&QSpinBox::valueChanged), this, &GS232ControllerGUI::on_azimuthOffset_valueChanged);
QObject::connect(ui->elevationOffset, qOverload<int>(&QSpinBox::valueChanged), this, &GS232ControllerGUI::on_elevationOffset_valueChanged);
QObject::connect(ui->azimuthOffset, qOverload<double>(&QDoubleSpinBox::valueChanged), this, &GS232ControllerGUI::on_azimuthOffset_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->azimuthMax, qOverload<int>(&QSpinBox::valueChanged), this, &GS232ControllerGUI::on_azimuthMax_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_coord2_valueChanged(double value);
void on_sources_currentTextChanged(const QString& text);
void on_azimuthOffset_valueChanged(int value);
void on_elevationOffset_valueChanged(int value);
void on_azimuthOffset_valueChanged(double value);
void on_elevationOffset_valueChanged(double value);
void on_azimuthMin_valueChanged(int value);
void on_azimuthMax_valueChanged(int value);
void on_elevationMin_valueChanged(int value);

View File

@ -406,22 +406,6 @@
</property>
</widget>
</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">
<widget class="QComboBox" name="protocol">
<property name="toolTip">
@ -628,19 +612,6 @@
</property>
</widget>
</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">
<widget class="QDoubleSpinBox" name="tolerance">
<property name="toolTip">
@ -759,6 +730,38 @@
</item>
</layout>
</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>
</item>
</layout>

View File

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

View File

@ -51,8 +51,8 @@ struct GS232ControllerSettings
int m_port;
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
int m_azimuthOffset;
int m_elevationOffset;
float m_azimuthOffset;
float m_elevationOffset;
int m_azimuthMin;
int m_azimuthMax;
int m_elevationMin;

View File

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

View File

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

View File

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