Commit db4ab216 authored by Nate Weibley's avatar Nate Weibley

Show the user some positive feedback when parameters load from cache. For #3114

parent 064513e9
......@@ -32,8 +32,10 @@
#include "FirmwarePlugin.h"
#include "UAS.h"
#include <QEasingCurve>
#include <QFile>
#include <QDebug>
#include <QVariantAnimation>
/* types for local parameter cache */
typedef QPair<int, QVariant> ParamTypeVal;
......@@ -711,6 +713,26 @@ void ParameterLoader::_tryCacheHashLoad(int uasId, int componentId, QVariant has
mavlink_message_t msg;
mavlink_msg_param_set_encode(_mavlink->getSystemId(), _mavlink->getComponentId(), &msg, &p);
_vehicle->sendMessageOnLink(_vehicle->priorityLink(), msg);
// Give the user some feedback things loaded properly
QVariantAnimation *ani = new QVariantAnimation(this);
ani->setEasingCurve(QEasingCurve::OutCubic);
ani->setStartValue(0.0);
ani->setEndValue(1.0);
ani->setDuration(750);
connect(ani, &QVariantAnimation::valueChanged, [this](const QVariant &value) {
emit parameterListProgress(value.toFloat());
});
// Hide 500ms after animation finishes
connect(ani, &QVariantAnimation::finished, [this](){
QTimer::singleShot(500, [this]() {
emit parameterListProgress(0);
});
});
ani->start(QAbstractAnimation::DeleteWhenStopped);
}
}
......
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