From 6d994de4d1f7dc27cceb9605be047ebf6b285b15 Mon Sep 17 00:00:00 2001 From: Mariano Lizarraga Date: Wed, 17 Nov 2010 16:39:19 -0600 Subject: [PATCH] Trying to find memory leak bug --- src/uas/SlugsMAV.cc | 6 +++--- src/uas/UAS.cc | 5 ----- src/ui/SlugsPIDControl.cpp | 18 +++++++++++------- src/ui/slugshilsim.cc | 22 ++-------------------- src/ui/slugshilsim.h | 1 - 5 files changed, 16 insertions(+), 36 deletions(-) diff --git a/src/uas/SlugsMAV.cc b/src/uas/SlugsMAV.cc index 2f497457f..a34f18928 100644 --- a/src/uas/SlugsMAV.cc +++ b/src/uas/SlugsMAV.cc @@ -26,7 +26,7 @@ void SlugsMAV::receiveMessage(LinkInterface* link, mavlink_message_t message) { case MAVLINK_MSG_ID_HEARTBEAT: { - qDebug() << "SLUGS RECEIVED HEARTBEAT"; + //qDebug() << "SLUGS RECEIVED HEARTBEAT"; break; } @@ -299,7 +299,7 @@ void SlugsMAV::receiveMessage(LinkInterface* link, mavlink_message_t message) } case MAVLINK_MSG_ID_ACTION_ACK: { - qDebug()<<"-------->>>>>>>>>>>>>>> EMITIENDO MAVLINK_MSG_ID_ACTION_ACK"; + qDebug()<<"--->>>> EMITIENDO MAVLINK_MSG_ID_ACTION_ACK"; mavlink_action_ack_t ack; mavlink_msg_action_ack_decode(&message,&ack); @@ -348,7 +348,7 @@ void SlugsMAV::receiveMessage(LinkInterface* link, mavlink_message_t message) #endif default: - qDebug() << "\nSLUGS RECEIVED MESSAGE WITH ID" << message.msgid; + //qDebug() << "\nSLUGS RECEIVED MESSAGE WITH ID" << message.msgid; break; } } diff --git a/src/uas/UAS.cc b/src/uas/UAS.cc index 347244ea1..703ae4f21 100644 --- a/src/uas/UAS.cc +++ b/src/uas/UAS.cc @@ -611,11 +611,6 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message) throttle << radioMsg.throttle[i]; QPointer radioData = new RadioCalibrationData(aileron, - elevator, - rudder, - gyro, - pitch, - throttle); emit radioCalibrationReceived(radioData); delete radioData; } diff --git a/src/ui/SlugsPIDControl.cpp b/src/ui/SlugsPIDControl.cpp index 31a10501b..b5e21b8ce 100644 --- a/src/ui/SlugsPIDControl.cpp +++ b/src/ui/SlugsPIDControl.cpp @@ -44,6 +44,7 @@ void SlugsPIDControl::activeUasSet(UASInterface* uas) { SlugsMAV* slugsMav = dynamic_cast(uas); + if (slugsMav != NULL) { connect(slugsMav,SIGNAL(slugsActionAck(int,uint8_t,uint8_t)),this,SLOT(recibeMensaje(int,uint8_t,uint8_t))); @@ -154,23 +155,26 @@ void SlugsPIDControl::changeColor_RED_AirSpeed_groupBox(QString text) void SlugsPIDControl::changeColor_GREEN_AirSpeed_groupBox() { - //create the packet + + SlugsMAV* slugsMav = dynamic_cast(activeUAS); + + if (slugsMav != NULL) + { + + //create the packet pidMessage.target = activeUAS->getUASID(); pidMessage.idx = 0; pidMessage.pVal = ui->dT_P_set->text().toFloat(); pidMessage.iVal = ui->dT_I_set->text().toFloat(); pidMessage.dVal = ui->dT_D_set->text().toFloat(); - UAS *uas = dynamic_cast(UASManager::instance()->getActiveUAS()); - mavlink_message_t msg; mavlink_msg_pid_encode(MG::SYSTEM::ID,MG::SYSTEM::COMPID, &msg, &pidMessage); - uas->sendMessage(msg); - - + slugsMav->sendMessage(msg); - ui->AirSpeedHold_groupBox->setStyleSheet(GREENcolorStyle); + ui->AirSpeedHold_groupBox->setStyleSheet(GREENcolorStyle); + } } diff --git a/src/ui/slugshilsim.cc b/src/ui/slugshilsim.cc index 9b6b12516..5cf3175e6 100644 --- a/src/ui/slugshilsim.cc +++ b/src/ui/slugshilsim.cc @@ -57,19 +57,6 @@ SlugsHilSim::~SlugsHilSim() delete ui; } -void SlugsHilSim::linkAdded(void){ - -// ui->cb_mavlinkLinks->clear(); - -// QList linkList; -// linkList.append(LinkManager::instance()->getLinks()) ; - -// for (int i = 0; i< linkList.size(); i++){ -// ui->cb_mavlinkLinks->addItem((linkList.takeFirst())->getName()); -// } - -} - void SlugsHilSim::addToCombo(LinkInterface* theLink){ ui->cb_mavlinkLinks->addItem(theLink->getName()); @@ -177,12 +164,12 @@ void SlugsHilSim::processHilDatagram(const QByteArray* datagram){ tmpGpsTime.visSat = datagram->at(i++); mavlink_msg_gps_date_time_encode(MG::SYSTEM::ID,MG::SYSTEM::COMPID, &msg, &tmpGpsTime); - activeUas->sendMessage(hilLink,&msg); + activeUas->sendMessage(hilLink, msg); memset(&msg, 0, sizeof(mavlink_message_t)); mavlink_msg_gps_raw_encode(MG::SYSTEM::ID,MG::SYSTEM::COMPID, &msg, &tmpGpsRaw); - activeUas->sendMessage(hilLink,&msg); + activeUas->sendMessage(hilLink,msg); // TODO: this is legacy of old HIL datagram. Need to remove from Simulink model i++; @@ -200,11 +187,6 @@ float SlugsHilSim::getFloatFromDatagram (const QByteArray* datagram, unsigned ch tmpF2C.chData[2] = datagram->at((*i)++); tmpF2C.chData[3] = datagram->at((*i)++); - -// if (uas != NULL) { -// //activeUas = uas; -// } - return tmpF2C.flData; } diff --git a/src/ui/slugshilsim.h b/src/ui/slugshilsim.h index cd6f42ac4..dc0d8d1d7 100644 --- a/src/ui/slugshilsim.h +++ b/src/ui/slugshilsim.h @@ -60,7 +60,6 @@ protected: UAS* activeUas; public slots: - void linkAdded (void); /** * @brief Adds a link to the combo box listing so the user can select a link -- 2.22.0