1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2026-06-05 07:24:44 -04:00

GS-232 Controller Updates

Fix broken pipe #1006.
Add onTarget and current and target aziumth and elevation to web report.
Set run/stop button background to yellow when rotator is rotating (not onTarget).
Use floating point value for tolerance setting.
This commit is contained in:
Jon Beniston
2021-10-05 14:03:31 +01:00
parent dc7232ee4f
commit 750f556eaa
16 changed files with 286 additions and 62 deletions
@@ -63,7 +63,7 @@ void GS232ControllerSettings::resetToDefaults()
m_azimuthMax = 450;
m_elevationMin = 0;
m_elevationMax = 180;
m_tolerance = 0;
m_tolerance = 0.0f;
m_protocol = GS232;
}
@@ -90,7 +90,7 @@ QByteArray GS232ControllerSettings::serialize() const
s.writeS32(18, m_azimuthMax);
s.writeS32(19, m_elevationMin);
s.writeS32(20, m_elevationMax);
s.writeS32(21, m_tolerance);
s.writeFloat(21, m_tolerance);
s.writeS32(22, (int)m_protocol);
return s.final();
@@ -140,7 +140,7 @@ bool GS232ControllerSettings::deserialize(const QByteArray& data)
d.readS32(18, &m_azimuthMax, 450);
d.readS32(19, &m_elevationMin, 0);
d.readS32(20, &m_elevationMax, 180);
d.readS32(21, &m_tolerance, 0);
d.readFloat(21, &m_tolerance, 0.0f);
d.readS32(22, (int*)&m_protocol, GS232);
return true;
@@ -151,3 +151,18 @@ bool GS232ControllerSettings::deserialize(const QByteArray& data)
return false;
}
}
void GS232ControllerSettings::calcTargetAzEl(float& targetAz, float& targetEl) const
{
// Apply offset then clamp
targetAz = m_azimuth;
targetAz += m_azimuthOffset;
targetAz = std::max(targetAz, (float)m_azimuthMin);
targetAz = std::min(targetAz, (float)m_azimuthMax);
targetEl = m_elevation;
targetEl += m_elevationOffset;
targetEl = std::max(targetEl, (float)m_elevationMin);
targetEl = std::min(targetEl, (float)m_elevationMax);
}