1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-30 15:52:12 +01:00

LP-245 config: fix OPLinkManager infinite loop whith modem less boards

This commit is contained in:
Philippe Renon 2016-09-16 23:35:59 +02:00
parent 602a2e9811
commit 66ff3934ee

View File

@ -70,7 +70,8 @@ void OPLinkManager::onDeviceConnect()
m_opLinkStatus = OPLinkStatus::GetInstance(objManager); m_opLinkStatus = OPLinkStatus::GetInstance(objManager);
Q_ASSERT(m_opLinkStatus); Q_ASSERT(m_opLinkStatus);
onOPLinkStatusUpdate(); // start monitoring OPLinkStatus
connect(m_opLinkStatus, SIGNAL(objectUpdated(UAVObject *)), this, SLOT(onOPLinkStatusUpdate()), Qt::UniqueConnection);
} }
void OPLinkManager::onDeviceDisconnect() void OPLinkManager::onDeviceDisconnect()
@ -80,7 +81,7 @@ void OPLinkManager::onDeviceDisconnect()
void OPLinkManager::onOPLinkStatusUpdate() void OPLinkManager::onOPLinkStatusUpdate()
{ {
quint8 type = m_opLinkStatus->getBoardType(); int type = m_opLinkStatus->boardType();
switch (type) { switch (type) {
case 0x03: case 0x03:
@ -93,10 +94,8 @@ void OPLinkManager::onOPLinkStatusUpdate()
break; break;
default: default:
m_opLinkType = OPLINK_UNKNOWN; m_opLinkType = OPLINK_UNKNOWN;
// disconnect if connected // stop monitoring status updates...
onOPLinkDisconnect(); m_opLinkStatus->disconnect(this);
// and start monitoring OPLinkStatus to see if a board shows up
connect(m_opLinkStatus, SIGNAL(objectUpdated(UAVObject *)), this, SLOT(onOPLinkStatusUpdate()));
break; break;
} }
} }
@ -106,7 +105,7 @@ void OPLinkManager::onOPLinkConnect()
if (m_isConnected) { if (m_isConnected) {
return; return;
} }
// stop listening to status updates... // stop monitoring status updates...
m_opLinkStatus->disconnect(this); m_opLinkStatus->disconnect(this);
m_isConnected = true; m_isConnected = true;
@ -118,7 +117,7 @@ void OPLinkManager::onOPLinkDisconnect()
if (!m_isConnected) { if (!m_isConnected) {
return; return;
} }
// stop listening to status updates... // stop monitoring status updates...
m_opLinkStatus->disconnect(this); m_opLinkStatus->disconnect(this);
m_isConnected = false; m_isConnected = false;