Commit b6c11a8d authored by Lorenz Meier's avatar Lorenz Meier

System switching fixed and tested

parent 0519924a
...@@ -170,17 +170,16 @@ PrimaryFlightDisplay::PrimaryFlightDisplay(int width, int height, QWidget *paren ...@@ -170,17 +170,16 @@ PrimaryFlightDisplay::PrimaryFlightDisplay(int width, int height, QWidget *paren
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
// Connect with UAS signal // Connect with UAS signal
connect(UASManager::instance(), SIGNAL(UASCreated(UASInterface*)), this, SLOT(addUAS(UASInterface*))); //connect(UASManager::instance(), SIGNAL(UASCreated(UASInterface*)), this, SLOT(addUAS(UASInterface*)));
// connect(UASManager::instance(), SIGNAL(UASDeleted(UASInterface*)), this, SLOT(forgetUAS(UASInterface*))); connect(UASManager::instance(), SIGNAL(UASDeleted(UASInterface*)), this, SLOT(forgetUAS(UASInterface*)));
connect(UASManager::instance(), SIGNAL(activeUASSet(UASInterface*)), this, SLOT(setActiveUAS(UASInterface*))); connect(UASManager::instance(), SIGNAL(activeUASSet(UASInterface*)), this, SLOT(setActiveUAS(UASInterface*)));
// Get a list of all existing UAS and - well attach to one of them. The first one. // // Get a list of all existing UAS and - well attach to one of them. The first one.
foreach (UASInterface* uas, UASManager::instance()->getUASList()) { // foreach (UASInterface* uas, UASManager::instance()->getUASList()) {
addUAS(uas); // addUAS(uas);
} // }
if (UASManager::instance()->getActiveUAS() != NULL) setActiveUAS(UASManager::instance()->getActiveUAS()); setActiveUAS(UASManager::instance()->getActiveUAS());
// Refresh timer // Refresh timer
refreshTimer->setInterval(updateInterval); refreshTimer->setInterval(updateInterval);
...@@ -250,27 +249,23 @@ void PrimaryFlightDisplay::paintEvent(QPaintEvent *event) ...@@ -250,27 +249,23 @@ void PrimaryFlightDisplay::paintEvent(QPaintEvent *event)
doPaint(); doPaint();
} }
/* ///*
* Interface towards qgroundcontrol // * Interface towards qgroundcontrol
*/ // */
void PrimaryFlightDisplay::addUAS(UASInterface* uas) //void PrimaryFlightDisplay::addUAS(UASInterface* uas)
{ //{
if (uas) // if (uas)
{ // {
if (!this->uas) // if (!this->uas)
{ // {
setActiveUAS(uas); // setActiveUAS(uas);
} // }
} // }
} //}
/** void PrimaryFlightDisplay::forgetUAS(UASInterface* uas)
*
* @param uas the UAS/MAV to monitor/display with the HUD
*/
void PrimaryFlightDisplay::setActiveUAS(UASInterface* uas)
{ {
if (this->uas != NULL) { if (this->uas != NULL && this->uas == uas) {
// Disconnect any previously connected active MAV // Disconnect any previously connected active MAV
disconnect(this->uas, SIGNAL(attitudeChanged(UASInterface*,double,double,double,quint64)), this, SLOT(updateAttitude(UASInterface*, double, double, double, quint64))); disconnect(this->uas, SIGNAL(attitudeChanged(UASInterface*,double,double,double,quint64)), this, SLOT(updateAttitude(UASInterface*, double, double, double, quint64)));
disconnect(this->uas, SIGNAL(attitudeChanged(UASInterface*,int,double,double,double,quint64)), this, SLOT(updateAttitude(UASInterface*,int,double, double, double, quint64))); disconnect(this->uas, SIGNAL(attitudeChanged(UASInterface*,int,double,double,double,quint64)), this, SLOT(updateAttitude(UASInterface*,int,double, double, double, quint64)));
...@@ -290,6 +285,16 @@ void PrimaryFlightDisplay::setActiveUAS(UASInterface* uas) ...@@ -290,6 +285,16 @@ void PrimaryFlightDisplay::setActiveUAS(UASInterface* uas)
//disconnect(this->uas, SIGNAL(satelliteCountChanged(double, QString)), this, SLOT(updateSatelliteCount(double, QString))); //disconnect(this->uas, SIGNAL(satelliteCountChanged(double, QString)), this, SLOT(updateSatelliteCount(double, QString)));
//disconnect(this->uas, SIGNAL(localizationChanged(UASInterface* uas, int fix)), this, SLOT(updateGPSFixType(UASInterface*,int))); //disconnect(this->uas, SIGNAL(localizationChanged(UASInterface* uas, int fix)), this, SLOT(updateGPSFixType(UASInterface*,int)));
} }
}
/**
*
* @param uas the UAS/MAV to monitor/display with the HUD
*/
void PrimaryFlightDisplay::setActiveUAS(UASInterface* uas)
{
// Disconnect the previous one (if any)
forgetUAS(this->uas);
if (uas) { if (uas) {
// Now connect the new UAS // Now connect the new UAS
......
...@@ -26,8 +26,8 @@ public slots: ...@@ -26,8 +26,8 @@ public slots:
void updateNavigationControllerErrors(UASInterface* uas, double altitudeError, double speedError, double xtrackError); void updateNavigationControllerErrors(UASInterface* uas, double altitudeError, double speedError, double xtrackError);
/** @brief Set the currently monitored UAS */ /** @brief Set the currently monitored UAS */
void addUAS(UASInterface* uas); //void addUAS(UASInterface* uas);
//void forgetUAS(UASInterface* uas); void forgetUAS(UASInterface* uas);
void setActiveUAS(UASInterface* uas); void setActiveUAS(UASInterface* uas);
protected: protected:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment