Commit b3460589 authored by Lorenz Meier's avatar Lorenz Meier

Merge pull request #376 from jean-m-cyr/config

Fix Spektrum pair buton such that it works every time.
parents 7e482b03 8216b137
...@@ -223,6 +223,8 @@ win32-msvc2008|win32-msvc2010 { ...@@ -223,6 +223,8 @@ win32-msvc2008|win32-msvc2010 {
QMAKE_POST_LINK += $$quote(xcopy /D /Y "$$(QTDIR)\\bin\\QtWebKitd4.dll" "$$TARGETDIR_WIN\\debug"$$escape_expand(\\n)) QMAKE_POST_LINK += $$quote(xcopy /D /Y "$$(QTDIR)\\bin\\QtWebKitd4.dll" "$$TARGETDIR_WIN\\debug"$$escape_expand(\\n))
QMAKE_POST_LINK += $$quote(xcopy /D /Y "$$(QTDIR)\\bin\\QtXmld4.dll" "$$TARGETDIR_WIN\\debug"$$escape_expand(\\n)) QMAKE_POST_LINK += $$quote(xcopy /D /Y "$$(QTDIR)\\bin\\QtXmld4.dll" "$$TARGETDIR_WIN\\debug"$$escape_expand(\\n))
QMAKE_POST_LINK += $$quote(xcopy /D /Y "$$(QTDIR)\\bin\\QtXmlPatternsd4.dll" "$$TARGETDIR_WIN\\debug"$$escape_expand(\\n)) QMAKE_POST_LINK += $$quote(xcopy /D /Y "$$(QTDIR)\\bin\\QtXmlPatternsd4.dll" "$$TARGETDIR_WIN\\debug"$$escape_expand(\\n))
QMAKE_POST_LINK += $$quote(xcopy /D /Y "$$(QTDIR)\\bin\\QtDeclaratived4.dll" "$$TARGETDIR_WIN\\debug"$$escape_expand(\\n))
QMAKE_POST_LINK += $$quote(xcopy /D /Y "$$(QTDIR)\\bin\\QtScriptd4.dll" "$$TARGETDIR_WIN\\debug"$$escape_expand(\\n))
} }
CONFIG(release, debug|release) { CONFIG(release, debug|release) {
...@@ -242,6 +244,8 @@ win32-msvc2008|win32-msvc2010 { ...@@ -242,6 +244,8 @@ win32-msvc2008|win32-msvc2010 {
QMAKE_POST_LINK += $$quote(xcopy /D /Y "$$(QTDIR)\\bin\\QtWebKit4.dll" "$$TARGETDIR_WIN\\release"$$escape_expand(\\n)) QMAKE_POST_LINK += $$quote(xcopy /D /Y "$$(QTDIR)\\bin\\QtWebKit4.dll" "$$TARGETDIR_WIN\\release"$$escape_expand(\\n))
QMAKE_POST_LINK += $$quote(xcopy /D /Y "$$(QTDIR)\\bin\\QtXml4.dll" "$$TARGETDIR_WIN\\release"$$escape_expand(\\n)) QMAKE_POST_LINK += $$quote(xcopy /D /Y "$$(QTDIR)\\bin\\QtXml4.dll" "$$TARGETDIR_WIN\\release"$$escape_expand(\\n))
QMAKE_POST_LINK += $$quote(xcopy /D /Y "$$(QTDIR)\\bin\\QtXmlPatterns4.dll" "$$TARGETDIR_WIN\\release"$$escape_expand(\\n)) QMAKE_POST_LINK += $$quote(xcopy /D /Y "$$(QTDIR)\\bin\\QtXmlPatterns4.dll" "$$TARGETDIR_WIN\\release"$$escape_expand(\\n))
QMAKE_POST_LINK += $$quote(xcopy /D /Y "$$(QTDIR)\\bin\\QtDeclarative4.dll" "$$TARGETDIR_WIN\\debug"$$escape_expand(\\n))
QMAKE_POST_LINK += $$quote(xcopy /D /Y "$$(QTDIR)\\bin\\QtScript4.dll" "$$TARGETDIR_WIN\\debug"$$escape_expand(\\n))
QMAKE_POST_LINK += $$quote(del /F "$$TARGETDIR_WIN\\release\\qupgrade.exp"$$escape_expand(\\n)) QMAKE_POST_LINK += $$quote(del /F "$$TARGETDIR_WIN\\release\\qupgrade.exp"$$escape_expand(\\n))
QMAKE_POST_LINK += $$quote(del /F "$$TARGETDIR_WIN\\release\\qupgrade.lib"$$escape_expand(\\n)) QMAKE_POST_LINK += $$quote(del /F "$$TARGETDIR_WIN\\release\\qupgrade.lib"$$escape_expand(\\n))
......
...@@ -124,21 +124,21 @@ void QGCUASParamManager::setParameter(int compId, QString paramName, QVariant va ...@@ -124,21 +124,21 @@ void QGCUASParamManager::setParameter(int compId, QString paramName, QVariant va
paramDataModel.updatePendingParamWithValue(compId,paramName,value); paramDataModel.updatePendingParamWithValue(compId,paramName,value);
} }
void QGCUASParamManager::sendPendingParameters(bool persistAfterSend) void QGCUASParamManager::sendPendingParameters(bool persistAfterSend, bool forceSend)
{ {
paramCommsMgr->sendPendingParameters(persistAfterSend); paramCommsMgr->sendPendingParameters(persistAfterSend, forceSend);
} }
void QGCUASParamManager::setPendingParam(int compId, const QString& paramName, const QVariant& value) void QGCUASParamManager::setPendingParam(int compId, const QString& paramName, const QVariant& value, bool forceSend)
{ {
if ((0 == compId) || (-1 == compId)) { if ((0 == compId) || (-1 == compId)) {
//attempt to get an actual component ID //attempt to get an actual component ID
compId = paramDataModel.getDefaultComponentId(); compId = paramDataModel.getDefaultComponentId();
} }
paramDataModel.updatePendingParamWithValue(compId,paramName,value); paramDataModel.updatePendingParamWithValue(compId,paramName,value, forceSend);
} }
......
...@@ -90,7 +90,7 @@ public slots: ...@@ -90,7 +90,7 @@ public slots:
/** @brief Send all pending parameters to the MAV, for storage in transient (RAM) memory /** @brief Send all pending parameters to the MAV, for storage in transient (RAM) memory
* @param persistAfterSend If true, all parameters will be written to persistent storage as well * @param persistAfterSend If true, all parameters will be written to persistent storage as well
*/ */
virtual void sendPendingParameters(bool persistAfterSend = false); virtual void sendPendingParameters(bool persistAfterSend = false, bool forceSend = false);
/** @brief Request list of parameters from MAV */ /** @brief Request list of parameters from MAV */
...@@ -100,7 +100,7 @@ public slots: ...@@ -100,7 +100,7 @@ public slots:
virtual void requestParameterListIfEmpty(); virtual void requestParameterListIfEmpty();
/** @brief queue a pending parameter for sending to the MAV */ /** @brief queue a pending parameter for sending to the MAV */
virtual void setPendingParam(int componentId, const QString& key, const QVariant& value); virtual void setPendingParam(int componentId, const QString& key, const QVariant& value, bool forceSend = false);
/** @brief remove all params from the pending list */ /** @brief remove all params from the pending list */
virtual void clearAllPendingParams(); virtual void clearAllPendingParams();
......
...@@ -307,7 +307,7 @@ void UASParameterCommsMgr::requestRcCalibrationParamsUpdate() ...@@ -307,7 +307,7 @@ void UASParameterCommsMgr::requestRcCalibrationParamsUpdate()
* @param parameterName name of the parameter, as delivered by the system * @param parameterName name of the parameter, as delivered by the system
* @param value value of the parameter * @param value value of the parameter
*/ */
void UASParameterCommsMgr::setParameter(int compId, QString paramName, QVariant value) void UASParameterCommsMgr::setParameter(int compId, QString paramName, QVariant value, bool forceSend)
{ {
if (paramName.isEmpty()) { if (paramName.isEmpty()) {
return; return;
...@@ -328,14 +328,16 @@ void UASParameterCommsMgr::setParameter(int compId, QString paramName, QVariant ...@@ -328,14 +328,16 @@ void UASParameterCommsMgr::setParameter(int compId, QString paramName, QVariant
return; return;
} }
QVariant onboardVal; if (!forceSend) {
paramDataModel->getOnboardParamValue(compId,paramName,onboardVal); QVariant onboardVal;
if (onboardVal == value) { paramDataModel->getOnboardParamValue(compId,paramName,onboardVal);
setParameterStatusMsg(tr("REJ. %1 already %2").arg(paramName).arg(dblValue), if (onboardVal == value) {
ParamCommsStatusLevel_Warning setParameterStatusMsg(tr("REJ. %1 already %2").arg(paramName).arg(dblValue),
); ParamCommsStatusLevel_Warning
return; );
} return;
}
}
emitPendingParameterCommit(compId, paramName, value); emitPendingParameterCommit(compId, paramName, value);
...@@ -501,7 +503,7 @@ void UASParameterCommsMgr::writeParamsToPersistentStorage() ...@@ -501,7 +503,7 @@ void UASParameterCommsMgr::writeParamsToPersistentStorage()
} }
void UASParameterCommsMgr::sendPendingParameters(bool copyToPersistent) void UASParameterCommsMgr::sendPendingParameters(bool copyToPersistent, bool forceSend)
{ {
persistParamsAfterSend |= copyToPersistent; persistParamsAfterSend |= copyToPersistent;
...@@ -517,7 +519,7 @@ void UASParameterCommsMgr::sendPendingParameters(bool copyToPersistent) ...@@ -517,7 +519,7 @@ void UASParameterCommsMgr::sendPendingParameters(bool copyToPersistent)
setParameterStatusMsg(tr("%1 pending params for component %2").arg(paramList->count()).arg(compId)); setParameterStatusMsg(tr("%1 pending params for component %2").arg(paramList->count()).arg(compId));
for (j = paramList->begin(); j != paramList->end(); ++j) { for (j = paramList->begin(); j != paramList->end(); ++j) {
setParameter(compId, j.key(), j.value()); setParameter(compId, j.key(), j.value(), forceSend);
parametersSent++; parametersSent++;
} }
} }
......
...@@ -71,13 +71,13 @@ signals: ...@@ -71,13 +71,13 @@ signals:
public slots: public slots:
/** @brief Iterate through all components, through all pending parameters and send them to UAS */ /** @brief Iterate through all components, through all pending parameters and send them to UAS */
virtual void sendPendingParameters(bool copyToPersistent = false); virtual void sendPendingParameters(bool copyToPersistent = false, bool forceSend = false);
/** @brief Write the current onboard parameters from transient RAM into persistent storage, e.g. EEPROM or harddisk */ /** @brief Write the current onboard parameters from transient RAM into persistent storage, e.g. EEPROM or harddisk */
virtual void writeParamsToPersistentStorage(); virtual void writeParamsToPersistentStorage();
/** @brief Write one parameter to the MAV */ /** @brief Write one parameter to the MAV */
virtual void setParameter(int component, QString parameterName, QVariant value); virtual void setParameter(int component, QString parameterName, QVariant value, bool forceSend = false);
/** @brief Request list of parameters from MAV */ /** @brief Request list of parameters from MAV */
virtual void requestParameterList(); virtual void requestParameterList();
......
...@@ -46,19 +46,21 @@ int UASParameterDataModel::countOnboardParams() ...@@ -46,19 +46,21 @@ int UASParameterDataModel::countOnboardParams()
} }
bool UASParameterDataModel::updatePendingParamWithValue(int compId, const QString& key, const QVariant& value) bool UASParameterDataModel::updatePendingParamWithValue(int compId, const QString& key, const QVariant& value, bool forceSend)
{ {
bool pending = true; bool pending = true;
//ensure we have this component in our onboard and pending lists already //ensure we have this component in our onboard and pending lists already
addComponent(compId); addComponent(compId);
QMap<QString, QVariant>* existParams = getOnboardParamsForComponent(compId); if (!forceSend) {
if (existParams->contains(key)) { QMap<QString, QVariant>* existParams = getOnboardParamsForComponent(compId);
QVariant existValue = existParams->value(key); if (existParams->contains(key)) {
if (existValue == value) { QVariant existValue = existParams->value(key);
pending = false; if (existValue == value) {
} pending = false;
} }
}
}
if (pending) { if (pending) {
setPendingParam(compId,key,value); setPendingParam(compId,key,value);
......
...@@ -53,7 +53,7 @@ public: ...@@ -53,7 +53,7 @@ public:
/** @brief add this parameter to pending list iff it has changed from onboard value /** @brief add this parameter to pending list iff it has changed from onboard value
* @return true if the parameter is now pending * @return true if the parameter is now pending
*/ */
virtual bool updatePendingParamWithValue(int componentId, const QString &key, const QVariant &value); virtual bool updatePendingParamWithValue(int componentId, const QString &key, const QVariant &value, bool forceSend = false);
virtual void handleParamUpdate(int componentId, const QString& key, const QVariant& value); virtual void handleParamUpdate(int componentId, const QString& key, const QVariant& value);
virtual bool getOnboardParamValue(int componentId, const QString& key, QVariant& value) const; virtual bool getOnboardParamValue(int componentId, const QString& key, QVariant& value) const;
......
...@@ -156,7 +156,7 @@ QGCPX4VehicleConfig::QGCPX4VehicleConfig(QWidget *parent) : ...@@ -156,7 +156,7 @@ QGCPX4VehicleConfig::QGCPX4VehicleConfig(QWidget *parent) :
ui->rcCalibrationButton->setCheckable(true); ui->rcCalibrationButton->setCheckable(true);
ui->rcCalibrationButton->setEnabled(false); ui->rcCalibrationButton->setEnabled(false);
connect(ui->rcCalibrationButton, SIGNAL(clicked(bool)), this, SLOT(toggleCalibrationRC(bool))); connect(ui->rcCalibrationButton, SIGNAL(clicked(bool)), this, SLOT(toggleCalibrationRC(bool)));
ui->spektrumPairButton->setCheckable(true); ui->spektrumPairButton->setCheckable(false);
ui->spektrumPairButton->setEnabled(false); ui->spektrumPairButton->setEnabled(false);
connect(ui->spektrumPairButton, SIGNAL(clicked(bool)), this, SLOT(toggleSpektrumPairing(bool))); connect(ui->spektrumPairButton, SIGNAL(clicked(bool)), this, SLOT(toggleSpektrumPairing(bool)));
...@@ -345,22 +345,13 @@ void QGCPX4VehicleConfig::toggleSpektrumPairing(bool enabled) ...@@ -345,22 +345,13 @@ void QGCPX4VehicleConfig::toggleSpektrumPairing(bool enabled)
(void)warnMsgBox.exec(); (void)warnMsgBox.exec();
} }
if (enabled) int mode = 1; // DSM2
{ if (ui->dsmxRadioButton->isChecked())
int mode = 1; // DSM2 mode = 2; // DSMX
if (ui->dsmxRadioButton->isChecked())
mode = 2; // DSMX
mav->getParamManager()->setPendingParam(0, "RC_DSM_BIND", mode); mav->getParamManager()->setPendingParam(0, "RC_DSM_BIND", mode, true);
// Do not save this parameter, just set in RAM // Do not save this parameter, just set in RAM
mav->getParamManager()->sendPendingParameters(); mav->getParamManager()->sendPendingParameters(false, true);
}
else
{
mav->getParamManager()->setPendingParam(0, "RC_DSM_BIND", (int)0);
// Do not save this parameter, just set in RAM
mav->getParamManager()->sendPendingParameters();
}
} }
void QGCPX4VehicleConfig::setTrimPositions() void QGCPX4VehicleConfig::setTrimPositions()
......
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