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)
// Load default values and tooltips for data model
loadParamMetaInfoCSV();
paramDataModel.setUASID(mav->getUASID());
paramCommsMgr = new UASParameterCommsMgr(this);
paramCommsMgr->initWithUAS(uas);
......
......@@ -253,6 +253,8 @@ void UASParameterCommsMgr::silenceTimerExpired()
qDebug() << "maxSilenceTimeout exceeded: " << totalElapsed;
int 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));
}
else {
......
......@@ -264,13 +264,13 @@ void UASParameterDataModel::readUpdateParamsFromStream( QTextStream& stream)
if (wpParams.size() == 5) {
// Only load parameters for right mav
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);
// MainWindow::instance()->showCriticalMessage(
// 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()));
qWarning() << msg ;
//MainWindow::instance()->showCriticalMessage(
// 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;
return;
}
bool changed = false;
......@@ -286,8 +286,9 @@ void UASParameterDataModel::readUpdateParamsFromStream( QTextStream& stream)
changed = true;
}
else {
if (fabs((static_cast<float>(onboardParameters.value(componentId)->value(key, dblVal).toDouble())) - (dblVal)) >
2.0f * FLT_EPSILON) {
QMap<QString,QVariant>* compParams = onboardParameters.value(componentId);
if (!compParams->contains(key) ||
(fabs((static_cast<float>(compParams->value(key).toDouble())) - (dblVal)) > 2.0f * FLT_EPSILON)) {
changed = true;
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