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(); }
void OutputCalibrationPage::on_servoMaxAngleButton_toggled(bool checked) { ui->servoMaxAngleButton->setText(checked ? tr("Stop") : tr("Start")); quint16 channel = getCurrentChannel(); quint16 safeValue = m_actuatorSettings[channel].channelNeutral; onStartButtonToggle(ui->servoMaxAngleButton, channel, m_actuatorSettings[channel].channelMax, safeValue, ui->servoMaxAngleSlider); }
void OutputCalibrationPage::setWizardPage() { qDebug() << "Wizard index: " << m_currentWizardIndex; m_calibrationUtil->stopChannelOutput(); QApplication::processEvents(); int currentPageIndex = m_wizardIndexes[m_currentWizardIndex]; qDebug() << "Current page: " << currentPageIndex; ui->calibrationStack->setCurrentIndex(currentPageIndex); int currentChannel = getCurrentChannel(); qDebug() << "Current channel: " << currentChannel; if (currentChannel >= 0) { if (currentPageIndex == 1) { ui->motorNeutralSlider->setValue(m_actuatorSettings[currentChannel].channelNeutral); } else if (currentPageIndex == 2) { ui->servoCenterSlider->setValue(m_actuatorSettings[currentChannel].channelNeutral); } else if (currentPageIndex == 3) { ui->servoMinAngleSlider->setMaximum(m_actuatorSettings[currentChannel].channelNeutral); ui->servoMinAngleSlider->setValue(m_actuatorSettings[currentChannel].channelMin); } else if (currentPageIndex == 4) { ui->servoMaxAngleSlider->setMinimum(m_actuatorSettings[currentChannel].channelNeutral); ui->servoMaxAngleSlider->setValue(m_actuatorSettings[currentChannel].channelMax); } } setupVehicleHighlightedPart(); }
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(); }
void OutputCalibrationPage::debugLogChannelValues() { quint16 channel = getCurrentChannel(); qDebug() << "ChannelMin : " << m_actuatorSettings[channel].channelMin; qDebug() << "ChannelNeutral: " << m_actuatorSettings[channel].channelNeutral; qDebug() << "ChannelMax : " << m_actuatorSettings[channel].channelMax; }
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(); } }
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(); } }
void OutputCalibrationPage::on_motorNeutralButton_toggled(bool checked) { ui->motorNeutralButton->setText(checked ? tr("Stop") : tr("Start")); ui->motorNeutralSlider->setEnabled(checked); quint16 channel = getCurrentChannel(); quint16 safeValue = m_actuatorSettings[channel].channelMin; if (m_actuatorSettings[channel].isReversableMotor) { safeValue = m_actuatorSettings[channel].channelNeutral; } onStartButtonToggle(ui->motorNeutralButton, channel, m_actuatorSettings[channel].channelNeutral, safeValue, ui->motorNeutralSlider); }
void OutputCalibrationPage::setWizardPage() { qDebug() << "Wizard index: " << m_currentWizardIndex; QApplication::processEvents(); int currentPageIndex = m_wizardIndexes[m_currentWizardIndex]; qDebug() << "Current page: " << currentPageIndex; ui->calibrationStack->setCurrentIndex(currentPageIndex); int currentChannel = getCurrentChannel(); qDebug() << "Current channel: " << currentChannel + 1; if (currentChannel >= 0) { if (currentPageIndex == 1) { ui->motorNeutralSlider->setValue(m_actuatorSettings[currentChannel].channelNeutral); ui->motorPWMValue->setText(QString(tr("Output value : <b>%1</b> µs")).arg(m_actuatorSettings[currentChannel].channelNeutral)); // Reversable motor found if (m_actuatorSettings[currentChannel].isReversableMotor) { ui->motorNeutralSlider->setMinimum(m_actuatorSettings[currentChannel].channelMin); ui->motorNeutralSlider->setMaximum(m_actuatorSettings[currentChannel].channelMax); ui->motorInfo->setText(tr("<html><head/><body><p><span style=\" font-size:10pt;\">To find </span><span style=\" font-size:10pt; font-weight:600;\">the neutral rate for this reversable motor</span><span style=\" font-size:10pt;\">, press the Start button below and slide the slider to the right or left until you find the value where the motor doesn't start. <br/><br/>When done press button again to stop.</span></p></body></html>")); } } else if (currentPageIndex == 2) { ui->servoPWMValue->setText(tr("Output value : <b>%1</b> µs").arg(m_actuatorSettings[currentChannel].channelNeutral)); if (m_actuatorSettings[currentChannel].channelMax < m_actuatorSettings[currentChannel].channelMin && !ui->reverseCheckbox->isChecked()) { ui->reverseCheckbox->setChecked(true); } else { ui->reverseCheckbox->setChecked(false); } enableServoSliders(false); if (ui->reverseCheckbox->isChecked()) { ui->servoMaxAngleSlider->setValue(m_actuatorSettings[currentChannel].channelMax); ui->servoCenterAngleSlider->setValue(m_actuatorSettings[currentChannel].channelNeutral); ui->servoMinAngleSlider->setValue(m_actuatorSettings[currentChannel].channelMin); } else { ui->servoMinAngleSlider->setValue(m_actuatorSettings[currentChannel].channelMin); ui->servoCenterAngleSlider->setValue(m_actuatorSettings[currentChannel].channelNeutral); ui->servoMaxAngleSlider->setValue(m_actuatorSettings[currentChannel].channelMax); } } } setupVehicleHighlightedPart(); }
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(); } }
void OutputCalibrationPage::on_motorNeutralButton_toggled(bool checked) { ui->motorNeutralButton->setText(checked ? tr("Stop") : tr("Start")); quint16 channel = getCurrentChannel(); onStartButtonToggle(ui->motorNeutralButton, channel, m_actuatorSettings[channel].channelNeutral, m_actuatorSettings[channel].channelMin, ui->motorNeutralSlider); }
void TekSettings::setChannel() { if(channel_ == getCurrentChannel() ) return; channel_ = getCurrentChannel(); module_->setChannel( channel_ ); module_->notify(); }
void OutputCalibrationPage::on_reverseCheckbox_toggled(bool checked) { if (checked && m_actuatorSettings[getCurrentChannel()].channelMax > m_actuatorSettings[getCurrentChannel()].channelMin) { quint16 oldMax = m_actuatorSettings[getCurrentChannel()].channelMax; m_actuatorSettings[getCurrentChannel()].channelMax = m_actuatorSettings[getCurrentChannel()].channelMin; m_actuatorSettings[getCurrentChannel()].channelMin = oldMax; } else if (!checked && m_actuatorSettings[getCurrentChannel()].channelMax < m_actuatorSettings[getCurrentChannel()].channelMin) { quint16 oldMax = m_actuatorSettings[getCurrentChannel()].channelMax; m_actuatorSettings[getCurrentChannel()].channelMax = m_actuatorSettings[getCurrentChannel()].channelMin; m_actuatorSettings[getCurrentChannel()].channelMin = oldMax; } ui->servoCenterAngleSlider->setInvertedAppearance(checked); ui->servoCenterAngleSlider->setInvertedControls(checked); ui->servoMinAngleSlider->setInvertedAppearance(checked); ui->servoMinAngleSlider->setInvertedControls(checked); ui->servoMaxAngleSlider->setInvertedAppearance(checked); ui->servoMaxAngleSlider->setInvertedControls(checked); if (ui->reverseCheckbox->isChecked()) { ui->servoMaxAngleSlider->setValue(m_actuatorSettings[getCurrentChannel()].channelMax); ui->servoCenterAngleSlider->setValue(m_actuatorSettings[getCurrentChannel()].channelNeutral); ui->servoMinAngleSlider->setValue(m_actuatorSettings[getCurrentChannel()].channelMin); } else { ui->servoMinAngleSlider->setValue(m_actuatorSettings[getCurrentChannel()].channelMin); ui->servoCenterAngleSlider->setValue(m_actuatorSettings[getCurrentChannel()].channelNeutral); ui->servoMaxAngleSlider->setValue(m_actuatorSettings[getCurrentChannel()].channelMax); } }