コード例 #1
0
void OutputCalibrationPage::onStartButtonToggle(QAbstractButton *button, QList<quint16> &channels,
                                                quint16 value, quint16 safeValue, QSlider *slider)
{
    if (button->isChecked()) {
        // Start calibration
        if (checkAlarms()) {
            enableButtons(false);
            enableServoSliders(true);
            m_calibrationUtil->startChannelOutput(channels, safeValue);
            slider->setValue(value);
            m_calibrationUtil->setChannelOutputValue(value);
        } else {
            button->setChecked(false);
        }
    } else {
        // Stop calibration
        quint16 channel = channels[0];
        if ((button == ui->motorNeutralButton) && !m_actuatorSettings[channel].isReversableMotor) {
            // Normal motor
            m_calibrationUtil->startChannelOutput(channels, m_actuatorSettings[channel].channelMin);
        } else {
            // Servos and ReversableMotors
            m_calibrationUtil->startChannelOutput(channels, m_actuatorSettings[channel].channelNeutral);
        }

        m_calibrationUtil->stopChannelOutput();

        enableServoSliders(false);
        enableButtons(true);
    }
    debugLogChannelValues();
}
コード例 #2
0
void OutputCalibrationPage::on_servoMaxAngleSlider_valueChanged(int position)
{
    Q_UNUSED(position);
    quint16 value = ui->servoMaxAngleSlider->value();
    m_calibrationUtil->setChannelOutputValue(value);
    m_actuatorSettings[getCurrentChannel()].channelMax = value;

    // Adjust neutral and min
    if (ui->reverseCheckbox->isChecked()) {
        if (value >= m_actuatorSettings[getCurrentChannel()].channelNeutral) {
            ui->servoCenterAngleSlider->setValue(value);
        }
        if (value >= m_actuatorSettings[getCurrentChannel()].channelMin) {
            ui->servoMinAngleSlider->setValue(value);
        }
    } else {
        if (value <= m_actuatorSettings[getCurrentChannel()].channelNeutral) {
            ui->servoCenterAngleSlider->setValue(value);
        }
        if (value <= m_actuatorSettings[getCurrentChannel()].channelMin) {
            ui->servoMinAngleSlider->setValue(value);
        }
    }
    debugLogChannelValues();
}
コード例 #3
0
void OutputCalibrationPage::on_servoCenterAngleSlider_valueChanged(int position)
{
    Q_UNUSED(position);
    quint16 value   = ui->servoCenterAngleSlider->value();
    m_calibrationUtil->setChannelOutputValue(value);
    quint16 channel = getCurrentChannel();
    m_actuatorSettings[channel].channelNeutral = value;
    ui->servoPWMValue->setText(tr("Output value : <b>%1</b> µs").arg(value));

    // Adjust min and max
    if (ui->reverseCheckbox->isChecked()) {
        if (value >= m_actuatorSettings[channel].channelMin) {
            ui->servoMinAngleSlider->setValue(value);
        }
        if (value <= m_actuatorSettings[channel].channelMax) {
            ui->servoMaxAngleSlider->setValue(value);
        }
    } else {
        if (value <= m_actuatorSettings[channel].channelMin) {
            ui->servoMinAngleSlider->setValue(value);
        }
        if (value >= m_actuatorSettings[channel].channelMax) {
            ui->servoMaxAngleSlider->setValue(value);
        }
    }
    debugLogChannelValues();
}
コード例 #4
0
void OutputCalibrationPage::on_servoMaxAngleSlider_valueChanged(int position)
{
    Q_UNUSED(position);
    if (ui->servoMaxAngleButton->isChecked()) {
        quint16 value = ui->servoMaxAngleSlider->value();
        m_calibrationUtil->setChannelOutputValue(value);
        m_actuatorSettings[getCurrentChannel()].channelMax = value;
        debugLogChannelValues();
    }
}
コード例 #5
0
void OutputCalibrationPage::on_motorNeutralSlider_valueChanged(int value)
{
    Q_UNUSED(value);
    if (ui->motorNeutralButton->isChecked()) {
        quint16 value = ui->motorNeutralSlider->value();
        m_calibrationUtil->setChannelOutputValue(value);
        m_actuatorSettings[getCurrentChannel()].channelNeutral = value;
        debugLogChannelValues();
    }
}
コード例 #6
0
void OutputCalibrationPage::on_motorNeutralSlider_valueChanged(int value)
{
    Q_UNUSED(value);
    ui->motorPWMValue->setText(tr("Output value : <b>%1</b> µs").arg(value));

    if (ui->motorNeutralButton->isChecked()) {
        quint16 value = ui->motorNeutralSlider->value();
        m_calibrationUtil->setChannelOutputValue(value);

        QList<quint16> currentChannels;
        getCurrentChannels(currentChannels);
        foreach(quint16 channel, currentChannels) {
            m_actuatorSettings[channel].channelNeutral = value;
        }
        debugLogChannelValues();
    }
コード例 #7
0
void OutputCalibrationPage::onStartButtonToggle(QAbstractButton *button, quint16 channel, quint16 value, quint16 safeValue, QSlider *slider)
{
    if (button->isChecked()) {
        if (checkAlarms()) {
            enableButtons(false);
            m_calibrationUtil->startChannelOutput(channel, safeValue);
            slider->setValue(value);
            m_calibrationUtil->setChannelOutputValue(value);
        } else {
            button->setChecked(false);
        }
    } else {
        m_calibrationUtil->stopChannelOutput();
        enableButtons(true);
    }
    debugLogChannelValues();
}
コード例 #8
0
void OutputCalibrationPage::on_servoCenterSlider_valueChanged(int position)
{
    Q_UNUSED(position);
    if (ui->servoCenterButton->isChecked()) {
        quint16 value   = ui->servoCenterSlider->value();
        m_calibrationUtil->setChannelOutputValue(value);
        quint16 channel = getCurrentChannel();
        m_actuatorSettings[channel].channelNeutral = value;

        // Adjust min and max
        if (value < m_actuatorSettings[channel].channelMin) {
            m_actuatorSettings[channel].channelMin = value;
        }
        if (value > m_actuatorSettings[channel].channelMax) {
            m_actuatorSettings[channel].channelMax = value;
        }
        debugLogChannelValues();
    }
}