From fbdbeae3d2310e45b937a37f08973567ae1066cb Mon Sep 17 00:00:00 2001 From: pixhawk Date: Tue, 4 May 2010 08:48:34 +0200 Subject: [PATCH] Finished commenting new parameter widget. --- src/ui/MainWindow.cc | 17 ++++++------ src/ui/QGCParamWidget.cc | 57 ++++++++++++++++++++++++++++++++++++++-- src/ui/QGCParamWidget.h | 32 ++++++++++++++++++++++ 3 files changed, 96 insertions(+), 10 deletions(-) diff --git a/src/ui/MainWindow.cc b/src/ui/MainWindow.cc index c30c18224..88856b62c 100644 --- a/src/ui/MainWindow.cc +++ b/src/ui/MainWindow.cc @@ -1,31 +1,32 @@ /*===================================================================== -PIXHAWK Micro Air Vehicle Flying Robotics Toolkit +QGroundControl Open Source Ground Control Station -(c) 2009, 2010 PIXHAWK PROJECT +(c) 2009, 2010 QGROUNDCONTROL/PIXHAWK PROJECT + + -This file is part of the PIXHAWK project +This file is part of the QGROUNDCONTROL project - PIXHAWK is free software: you can redistribute it and/or modify + QGROUNDCONTROL is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - PIXHAWK is distributed in the hope that it will be useful, + QGROUNDCONTROL is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with PIXHAWK. If not, see . + along with QGROUNDCONTROL. If not, see . ======================================================================*/ /** * @file * @brief Implementation of class MainWindow - * @author Lorenz Meier - * + * @author Lorenz Meier */ #include diff --git a/src/ui/QGCParamWidget.cc b/src/ui/QGCParamWidget.cc index d31af497a..f43096eb1 100644 --- a/src/ui/QGCParamWidget.cc +++ b/src/ui/QGCParamWidget.cc @@ -1,3 +1,34 @@ +/*===================================================================== + +QGroundControl Open Source Ground Control Station + +(c) 2009, 2010 QGROUNDCONTROL/PIXHAWK PROJECT + + + +This file is part of the QGROUNDCONTROL project + + QGROUNDCONTROL is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + QGROUNDCONTROL is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with QGROUNDCONTROL. If not, see . + +======================================================================*/ + +/** + * @file + * @brief Implementation of class QGCParamWidget + * @author Lorenz Meier + */ + #include #include @@ -5,6 +36,10 @@ #include "UASInterface.h" #include +/** + * @param uas MAV to set the parameters on + * @param parent Parent widget + */ QGCParamWidget::QGCParamWidget(UASInterface* uas, QWidget *parent) : QWidget(parent), mav(uas), @@ -51,6 +86,10 @@ QGCParamWidget::QGCParamWidget(UASInterface* uas, QWidget *parent) : connect(uas, SIGNAL(parameterChanged(int,int,QString,float)), this, SLOT(addParameter(int,int,QString,float))); } +/** + * @return The MAV of this widget. Unless the MAV object has been destroyed, this + * pointer is never zero. + */ UASInterface* QGCParamWidget::getUAS() { return mav; @@ -106,6 +145,10 @@ void QGCParamWidget::addParameter(int uas, int component, QString parameterName, tree->update(); } +/** + * Send a request to deliver the list of onboard parameters + * to the MAV. + */ void QGCParamWidget::requestParameterList() { // Clear view and request param list @@ -120,9 +163,12 @@ void QGCParamWidget::requestParameterList() */ void QGCParamWidget::setParameter(int component, QString parameterName, float value) { - + emit parameterChanged(component, parameterName, value); } +/** + * Set all parameter in the parameter tree on the MAV + */ void QGCParamWidget::setParameters() { //mav->setParameter(component, parameterName, value); @@ -140,7 +186,7 @@ void QGCParamWidget::setParameters() // First column is name, second column value bool ok = true; QString key = param->data(0, Qt::DisplayRole).toString(); - float value = param->data(1, Qt::DisplayRole).toFloat(&ok); + float value = param->data(1, Qt::DisplayRole).toDouble(&ok); // Send parameter to MAV if (ok) { @@ -158,11 +204,18 @@ void QGCParamWidget::setParameters() qDebug() << __FILE__ << __LINE__ << "SETTING ALL PARAMETERS"; } +/** + * Write the current onboard parameters from RAM into + * permanent storage, e.g. EEPROM or harddisk + */ void QGCParamWidget::writeParameters() { mav->writeParameters(); } +/** + * Clear all data in the parameter widget + */ void QGCParamWidget::clear() { tree->clear(); diff --git a/src/ui/QGCParamWidget.h b/src/ui/QGCParamWidget.h index e794ba2cf..43f766a94 100644 --- a/src/ui/QGCParamWidget.h +++ b/src/ui/QGCParamWidget.h @@ -1,3 +1,34 @@ +/*===================================================================== + +QGroundControl Open Source Ground Control Station + +(c) 2009, 2010 QGROUNDCONTROL/PIXHAWK PROJECT + + + +This file is part of the QGROUNDCONTROL project + + QGROUNDCONTROL is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + QGROUNDCONTROL is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with QGROUNDCONTROL. If not, see . + +======================================================================*/ + +/** + * @file + * @brief Declaration of class QGCParamWidget + * @author Lorenz Meier + */ + #ifndef QGCPARAMWIDGET_H #define QGCPARAMWIDGET_H @@ -19,6 +50,7 @@ public: /** @brief Get the UAS of this widget */ UASInterface* getUAS(); signals: + /** @brief A parameter was changed in the widget, NOT onboard */ void parameterChanged(int component, QString parametername, float value); public slots: /** @brief Add a component to the list */ -- 2.22.0