Merge pull request #1491 from srcejon/rotator_tcp

Rotator controller: Fix support for using Serial or TCP for any protocol
This commit is contained in:
Edouard Griffiths 2022-10-28 16:57:19 +02:00 committed by GitHub
commit d0f4ff08d6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 4 deletions

View File

@ -228,7 +228,7 @@ void GS232ControllerWorker::setAzimuth(float azimuth)
{ {
QString cmd = QString("M%1\r\n").arg((int)std::round(azimuth), 3, 10, QLatin1Char('0')); QString cmd = QString("M%1\r\n").arg((int)std::round(azimuth), 3, 10, QLatin1Char('0'));
QByteArray data = cmd.toLatin1(); QByteArray data = cmd.toLatin1();
m_serialPort.write(data); m_device->write(data);
} }
else else
{ {
@ -243,7 +243,7 @@ void GS232ControllerWorker::setAzimuthElevation(float azimuth, float elevation)
{ {
QString cmd = QString("W%1 %2\r\n").arg((int)std::round(azimuth), 3, 10, QLatin1Char('0')).arg((int)std::round(elevation), 3, 10, QLatin1Char('0')); QString cmd = QString("W%1 %2\r\n").arg((int)std::round(azimuth), 3, 10, QLatin1Char('0')).arg((int)std::round(elevation), 3, 10, QLatin1Char('0'));
QByteArray data = cmd.toLatin1(); QByteArray data = cmd.toLatin1();
m_serialPort.write(data); m_device->write(data);
} }
else if (m_settings.m_protocol == GS232ControllerSettings::SPID) else if (m_settings.m_protocol == GS232ControllerSettings::SPID)
{ {
@ -267,7 +267,7 @@ void GS232ControllerWorker::setAzimuthElevation(float azimuth, float elevation)
cmd[11] = 0x2f; // Set cmd cmd[11] = 0x2f; // Set cmd
cmd[12] = 0x20; // End cmd[12] = 0x20; // End
m_serialPort.write(cmd); m_device->write(cmd);
m_spidSetSent = true; m_spidSetSent = true;
} }
@ -279,7 +279,7 @@ void GS232ControllerWorker::setAzimuthElevation(float azimuth, float elevation)
} else { } else {
QString cmd = QString("P %1 %2\n").arg(azimuth).arg(elevation); QString cmd = QString("P %1 %2\n").arg(azimuth).arg(elevation);
QByteArray data = cmd.toLatin1(); QByteArray data = cmd.toLatin1();
m_socket.write(data); m_device->write(data);
} }
m_lastAzimuth = azimuth; m_lastAzimuth = azimuth;
m_lastElevation = elevation; m_lastElevation = elevation;