Commit ce34b3fd authored by Lorenz Meier's avatar Lorenz Meier

Merge pull request #354 from tstellanova/solidify_param_handling

Solidify param handling
parents cb76cc55 6623bd76
...@@ -24,6 +24,7 @@ QGCUASParamManager* QGCUASParamManager::initWithUAS(UASInterface* uas) ...@@ -24,6 +24,7 @@ QGCUASParamManager* QGCUASParamManager::initWithUAS(UASInterface* uas)
// Load default values and tooltips for data model // Load default values and tooltips for data model
loadParamMetaInfoCSV(); loadParamMetaInfoCSV();
paramDataModel.setUASID(mav->getUASID());
paramCommsMgr = new UASParameterCommsMgr(this); paramCommsMgr = new UASParameterCommsMgr(this);
paramCommsMgr->initWithUAS(uas); paramCommsMgr->initWithUAS(uas);
......
...@@ -253,6 +253,8 @@ void UASParameterCommsMgr::silenceTimerExpired() ...@@ -253,6 +253,8 @@ void UASParameterCommsMgr::silenceTimerExpired()
qDebug() << "maxSilenceTimeout exceeded: " << totalElapsed; qDebug() << "maxSilenceTimeout exceeded: " << totalElapsed;
int missingReads, missingWrites; int missingReads, missingWrites;
clearRetransmissionLists(missingReads,missingWrites); clearRetransmissionLists(missingReads,missingWrites);
silenceTimer.stop();
lastSilenceTimerReset = curTime;
setParameterStatusMsg(tr("TIMEOUT: Abandoning %1 reads %2 writes after %3 seconds").arg(missingReads).arg(missingWrites).arg(totalElapsed/1000)); setParameterStatusMsg(tr("TIMEOUT: Abandoning %1 reads %2 writes after %3 seconds").arg(missingReads).arg(missingWrites).arg(totalElapsed/1000));
} }
else { else {
......
...@@ -264,13 +264,13 @@ void UASParameterDataModel::readUpdateParamsFromStream( QTextStream& stream) ...@@ -264,13 +264,13 @@ void UASParameterDataModel::readUpdateParamsFromStream( QTextStream& stream)
if (wpParams.size() == 5) { if (wpParams.size() == 5) {
// Only load parameters for right mav // Only load parameters for right mav
if (!userWarned && (uasId != lineMavId)) { if (!userWarned && (uasId != lineMavId)) {
//TODO warn the user somehow ?? //TODO warn the user somehow ?? Appears these are saved currently with mav ID 0 but mav ID is often nonzero?
QString msg = tr("The parameters in the stream have been saved from system %1, but the currently selected system has the ID %2.").arg(lineMavId).arg(uasId); QString msg = tr("The parameters in the stream have been saved from system %1, but the currently selected system has the ID %2.").arg(lineMavId).arg(uasId);
// MainWindow::instance()->showCriticalMessage( qWarning() << msg ;
// tr("Parameter loading warning"), //MainWindow::instance()->showCriticalMessage(
// tr("The parameters from the file %1 have been saved from system %2, but the currently selected system has the ID %3. If this is unintentional, please click on <READ> to revert to the parameters that are currently onboard").arg(fileName).arg(wpParams.at(0).toInt()).arg(mav->getUASID())); // tr("Parameter loading warning"),
// tr("The parameters from the file %1 have been saved from system %2, but the currently selected system has the ID %3. If this is unintentional, please click on <READ> to revert to the parameters that are currently onboard").arg(fileName).arg(wpParams.at(0).toInt()).arg(mav->getUASID()));
userWarned = true; userWarned = true;
return;
} }
bool changed = false; bool changed = false;
...@@ -286,8 +286,9 @@ void UASParameterDataModel::readUpdateParamsFromStream( QTextStream& stream) ...@@ -286,8 +286,9 @@ void UASParameterDataModel::readUpdateParamsFromStream( QTextStream& stream)
changed = true; changed = true;
} }
else { else {
if (fabs((static_cast<float>(onboardParameters.value(componentId)->value(key, dblVal).toDouble())) - (dblVal)) > QMap<QString,QVariant>* compParams = onboardParameters.value(componentId);
2.0f * FLT_EPSILON) { if (!compParams->contains(key) ||
(fabs((static_cast<float>(compParams->value(key).toDouble())) - (dblVal)) > 2.0f * FLT_EPSILON)) {
changed = true; changed = true;
qDebug() << "Changed" << key << "VAL" << dblVal; qDebug() << "Changed" << key << "VAL" << dblVal;
} }
......
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