Commit d683fa33 authored by tstellanova's avatar tstellanova

Move requestCalibrationRC into commsmgr

parent 764e22c9
...@@ -5,6 +5,8 @@ ...@@ -5,6 +5,8 @@
#include "QGCUASParamManager.h" #include "QGCUASParamManager.h"
#include "UASInterface.h" #include "UASInterface.h"
#define RC_CAL_CHAN_MAX 8
UASParameterCommsMgr::UASParameterCommsMgr(QObject *parent, UASInterface *uas) : UASParameterCommsMgr::UASParameterCommsMgr(QObject *parent, UASInterface *uas) :
QObject(parent), QObject(parent),
mav(uas), mav(uas),
...@@ -212,6 +214,35 @@ void UASParameterCommsMgr::requestParameterUpdate(int component, const QString& ...@@ -212,6 +214,35 @@ void UASParameterCommsMgr::requestParameterUpdate(int component, const QString&
} }
} }
void UASParameterCommsMgr::requestRcCalibrationParamsUpdate()
{
if (!transmissionListMode) {
QString minTpl("RC%1_MIN");
QString maxTpl("RC%1_MAX");
QString trimTpl("RC%1_TRIM");
QString revTpl("RC%1_REV");
// Do not request the RC type, as these values depend on this
// active onboard parameter
for (unsigned int i = 1; i < (RC_CAL_CHAN_MAX+1); ++i) {
qDebug() << "Request RC " << i;
mav->requestParameter(0, minTpl.arg(i));
QGC::SLEEP::usleep(5000);
mav->requestParameter(0, trimTpl.arg(i));
QGC::SLEEP::usleep(5000);
mav->requestParameter(0, maxTpl.arg(i));
QGC::SLEEP::usleep(5000);
mav->requestParameter(0, revTpl.arg(i));
QGC::SLEEP::usleep(5000);
}
}
else {
qDebug() << __FILE__ << __LINE__ << "Ignoring requestRcCalibrationParamsUpdate because we're receiving params list";
}
}
/** /**
* @param component the subsystem which has the parameter * @param component the subsystem which has the parameter
* @param parameterName name of the parameter, as delivered by the system * @param parameterName name of the parameter, as delivered by the system
......
...@@ -68,6 +68,9 @@ public slots: ...@@ -68,6 +68,9 @@ public slots:
/** @brief Request a single parameter update by name */ /** @brief Request a single parameter update by name */
virtual void requestParameterUpdate(int component, const QString& parameter); virtual void requestParameterUpdate(int component, const QString& parameter);
/** @brief Request an update of RC parameters */
virtual void requestRcCalibrationParamsUpdate();
virtual void receivedParameterUpdate(int uas, int compId, int paramCount, int paramId, QString paramName, QVariant value); virtual void receivedParameterUpdate(int uas, int compId, int paramCount, int paramId, QString paramName, QVariant value);
//protected slots: //protected slots:
......
...@@ -13,9 +13,11 @@ ...@@ -13,9 +13,11 @@
#include <QMessageBox> #include <QMessageBox>
#include "QGCPX4VehicleConfig.h" #include "QGCPX4VehicleConfig.h"
#include "UASManager.h"
#include "QGC.h" #include "QGC.h"
#include "QGCToolWidget.h" #include "QGCToolWidget.h"
#include "UASManager.h"
#include "UASParameterCommsMgr.h"
#include "ui_QGCPX4VehicleConfig.h" #include "ui_QGCPX4VehicleConfig.h"
...@@ -976,28 +978,8 @@ void QGCPX4VehicleConfig::writeCalibrationRC() ...@@ -976,28 +978,8 @@ void QGCPX4VehicleConfig::writeCalibrationRC()
void QGCPX4VehicleConfig::requestCalibrationRC() void QGCPX4VehicleConfig::requestCalibrationRC()
{ {
if (!mav ) { if (mav) {
return; mav->getParamCommsMgr()->requestRcCalibrationParamsUpdate();
}
QString minTpl("RC%1_MIN");
QString maxTpl("RC%1_MAX");
QString trimTpl("RC%1_TRIM");
QString revTpl("RC%1_REV");
// Do not request the RC type, as these values depend on this
// active onboard parameter
for (unsigned int i = 1; i < (chanMax+1); ++i) {
qDebug() << "Request RC " << i;
mav->requestParameter(0, minTpl.arg(i));
QGC::SLEEP::usleep(5000);
mav->requestParameter(0, trimTpl.arg(i));
QGC::SLEEP::usleep(5000);
mav->requestParameter(0, maxTpl.arg(i));
QGC::SLEEP::usleep(5000);
mav->requestParameter(0, revTpl.arg(i));
QGC::SLEEP::usleep(5000);
} }
} }
......
...@@ -13,9 +13,11 @@ ...@@ -13,9 +13,11 @@
#include <QMessageBox> #include <QMessageBox>
#include "QGCVehicleConfig.h" #include "QGCVehicleConfig.h"
#include "UASManager.h"
#include "QGC.h" #include "QGC.h"
#include "QGCToolWidget.h" #include "QGCToolWidget.h"
#include "UASManager.h"
#include "UASParameterCommsMgr.h"
#include "ui_QGCVehicleConfig.h" #include "ui_QGCVehicleConfig.h"
QGCVehicleConfig::QGCVehicleConfig(QWidget *parent) : QGCVehicleConfig::QGCVehicleConfig(QWidget *parent) :
...@@ -972,26 +974,8 @@ void QGCVehicleConfig::writeCalibrationRC() ...@@ -972,26 +974,8 @@ void QGCVehicleConfig::writeCalibrationRC()
void QGCVehicleConfig::requestCalibrationRC() void QGCVehicleConfig::requestCalibrationRC()
{ {
if (!mav) return; if (mav) {
mav->getParamCommsMgr()->requestRcCalibrationParamsUpdate();
QString minTpl("RC%1_MIN");
QString maxTpl("RC%1_MAX");
QString trimTpl("RC%1_TRIM");
QString revTpl("RC%1_REV");
// Do not request the RC type, as these values depend on this
// active onboard parameter
for (unsigned int i = 0; i < chanMax; ++i)
{
mav->requestParameter(0, minTpl.arg(i+1));
QGC::SLEEP::usleep(5000);
mav->requestParameter(0, trimTpl.arg(i+1));
QGC::SLEEP::usleep(5000);
mav->requestParameter(0, maxTpl.arg(i+1));
QGC::SLEEP::usleep(5000);
mav->requestParameter(0, revTpl.arg(i+1));
QGC::SLEEP::usleep(5000);
} }
} }
......
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