Skip to content
Snippets Groups Projects
QGCParamWidget.cc 39.2 KiB
Newer Older
  • Learn to ignore specific revisions
  •     for (i = changedValues.begin(); i != changedValues.end(); ++i) {
    
            // Iterate through the parameters of the component
            int compid = i.key();
    
            QMap<QString, QVariant>* comp = i.value();
    
                QMap<QString, QVariant>::iterator j;
    
                for (j = comp->begin(); j != comp->end(); ++j) {
    
                    setParameter(compid, j.key(), j.value());
    
    lm's avatar
    lm committed
        // Change transmission status if necessary
    
        if (parametersSent == 0) {
    
            statusLabel->setText(tr("No transmission: No changed values."));
    
            statusLabel->setText(tr("Transmitting %1 parameters.").arg(parametersSent));
    
    lm's avatar
    lm committed
            // Set timeouts
            transmissionActive = true;
            quint64 newTransmissionTimeout = QGC::groundTimeMilliseconds() + (parametersSent/retransmissionBurstRequestSize+5)*rewriteTimeout;
    
            if (newTransmissionTimeout > transmissionTimeout) {
    
    lm's avatar
    lm committed
                transmissionTimeout = newTransmissionTimeout;
            }
            // Enable guard
            setRetransmissionGuardEnabled(true);
    
    /**
     * Write the current onboard parameters from RAM into
     * permanent storage, e.g. EEPROM or harddisk
     */
    
        int changedParamCount = 0;
    
        QMap<int, QMap<QString, QVariant>*>::iterator i;
        for (i = changedValues.begin(); i != changedValues.end(); ++i)
        {
            // Iterate through the parameters of the component
            QMap<QString, QVariant>* comp = i.value();
            {
                QMap<QString, QVariant>::iterator j;
                for (j = comp->begin(); j != comp->end(); ++j)
                {
                    changedParamCount++;
                }
            }
        }
    
        if (changedParamCount > 0)
        {
            QMessageBox msgBox;
            msgBox.setText(tr("There are locally changed parameters. Please transmit them first (<TRANSMIT>) or update them with the onboard values (<REFRESH>) before storing onboard from RAM to ROM."));
            msgBox.exec();
        }
        else
        {
            if (!mav) return;
            mav->writeParametersToStorage();
        }
    
    }
    
    void QGCParamWidget::readParameters()
    {
    
        if (!mav) return;
    
        mav->readParametersFromStorage();
    
    /**
     * Clear all data in the parameter widget
     */
    
    pixhawk's avatar
    pixhawk committed
    void QGCParamWidget::clear()
    {
        tree->clear();
    
    lm's avatar
    lm committed
        components->clear();
    
    pixhawk's avatar
    pixhawk committed
    }