void ConfigStabilizationWidget::resetThrottleCurveToDefault() { UAVDataObject *defaultStabBank = (UAVDataObject *)getObjectManager()->getObject(QString(m_stabTabBars.at(0)->tabData(m_currentStabSettingsBank).toString())); Q_ASSERT(defaultStabBank); defaultStabBank = defaultStabBank->dirtyClone(); UAVObjectField *field = defaultStabBank->getField("ThrustPIDScaleCurve"); Q_ASSERT(field); QList<double> curve; for (quint32 i = 0; i < field->getNumElements(); i++) { curve.append(field->getValue(i).toDouble()); } ui->thrustPIDScalingCurve->setCurve(&curve); field = defaultStabBank->getField("EnableThrustPIDScaling"); Q_ASSERT(field); bool enabled = field->getValue() == "TRUE"; ui->enableThrustPIDScalingCheckBox->setChecked(enabled); ui->thrustPIDScalingCurve->setEnabled(enabled); delete defaultStabBank; }
void ConfigStabilizationWidget::resetStabBank(int bank) { UAVDataObject *stabBankObject = dynamic_cast<UAVDataObject *>(getStabBankObject(bank)); if (stabBankObject) { UAVDataObject *defaultStabBankObject = stabBankObject->dirtyClone(); quint8 data[stabBankObject->getNumBytes()]; defaultStabBankObject->pack(data); stabBankObject->unpack(data); } }