mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-26 01:39:05 -05:00
Rotator controller: Fix initialisation of serial port. Fix crash when serial port not initialised
This commit is contained in:
parent
4fed3a7eab
commit
e6b54ccb1d
@ -163,6 +163,9 @@ GS232ControllerGUI::GS232ControllerGUI(PluginAPI* pluginAPI, FeatureUISet *featu
|
|||||||
ui->elevationCurrentText->setText("-");
|
ui->elevationCurrentText->setText("-");
|
||||||
|
|
||||||
updateSerialPortList();
|
updateSerialPortList();
|
||||||
|
if (ui->serialPort->currentIndex() >= 0) {
|
||||||
|
on_serialPort_currentIndexChanged(ui->serialPort->currentIndex());
|
||||||
|
}
|
||||||
|
|
||||||
m_settings.setRollupState(&m_rollupState);
|
m_settings.setRollupState(&m_rollupState);
|
||||||
|
|
||||||
|
@ -73,8 +73,10 @@ void GS232ControllerWorker::stopWork()
|
|||||||
{
|
{
|
||||||
qDebug() << "GS232ControllerWorker::stopWork";
|
qDebug() << "GS232ControllerWorker::stopWork";
|
||||||
disconnect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages()));
|
disconnect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages()));
|
||||||
if (m_device && m_device->isOpen()) {
|
if (m_device && m_device->isOpen())
|
||||||
|
{
|
||||||
m_device->close();
|
m_device->close();
|
||||||
|
m_device = nullptr;
|
||||||
}
|
}
|
||||||
disconnect(&m_serialPort, &QSerialPort::readyRead, this, &GS232ControllerWorker::readData);
|
disconnect(&m_serialPort, &QSerialPort::readyRead, this, &GS232ControllerWorker::readData);
|
||||||
disconnect(&m_socket, &QTcpSocket::readyRead, this, &GS232ControllerWorker::readData);
|
disconnect(&m_socket, &QTcpSocket::readyRead, this, &GS232ControllerWorker::readData);
|
||||||
@ -131,8 +133,10 @@ void GS232ControllerWorker::applySettings(const GS232ControllerSettings& setting
|
|||||||
|
|
||||||
if (settings.m_connection != m_settings.m_connection)
|
if (settings.m_connection != m_settings.m_connection)
|
||||||
{
|
{
|
||||||
if (m_device && m_device->isOpen()) {
|
if (m_device && m_device->isOpen())
|
||||||
|
{
|
||||||
m_device->close();
|
m_device->close();
|
||||||
|
m_device = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -151,6 +155,8 @@ void GS232ControllerWorker::applySettings(const GS232ControllerSettings& setting
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (m_device != nullptr)
|
||||||
|
{
|
||||||
// Apply offset then clamp
|
// Apply offset then clamp
|
||||||
|
|
||||||
float azimuth, elevation;
|
float azimuth, elevation;
|
||||||
@ -168,6 +174,7 @@ void GS232ControllerWorker::applySettings(const GS232ControllerSettings& setting
|
|||||||
{
|
{
|
||||||
setAzimuth(azimuth);
|
setAzimuth(azimuth);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
m_settings = settings;
|
m_settings = settings;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user