1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-19 04:52:12 +01:00

Merged in f5soh/librepilot/LP-447_Wizard_Esc_calibration_rel-16.09 (pull request #356)

LP-447 Simple Wizard Esc calibration
This commit is contained in:
Philippe Renon 2016-11-19 11:14:43 +00:00
commit c368b4dfa5
2 changed files with 6 additions and 14 deletions

View File

@ -47,7 +47,7 @@ EscCalibrationPage::EscCalibrationPage(SetupWizard *wizard, QWidget *parent) :
ui->outputHigh->setEnabled(false);
ui->outputLow->setEnabled(true);
ui->outputLevel->setEnabled(true);
ui->outputLevel->setText(QString(tr("%1 µs")).arg(OFF_PWM_OUTPUT_PULSE_LENGTH_MICROSECONDS));
ui->outputLevel->setText(QString(tr("%1 µs")).arg(LOW_PWM_OUTPUT_PULSE_LENGTH_MICROSECONDS));
connect(ui->startButton, SIGNAL(clicked()), this, SLOT(startButtonClicked()));
connect(ui->stopButton, SIGNAL(clicked()), this, SLOT(stopButtonClicked()));
@ -149,6 +149,7 @@ void EscCalibrationPage::stopButtonClicked()
if (m_isCalibrating) {
ui->stopButton->setEnabled(false);
ui->outputHigh->setEnabled(false);
ui->outputLow->setEnabled(true);
// Set to low pwm out
m_outputUtil.setChannelOutputValue(LOW_PWM_OUTPUT_PULSE_LENGTH_MICROSECONDS);
@ -156,21 +157,10 @@ void EscCalibrationPage::stopButtonClicked()
QApplication::processEvents();
QThread::msleep(2000);
// Ramp down to off pwm out
for (int i = LOW_PWM_OUTPUT_PULSE_LENGTH_MICROSECONDS; i >= OFF_PWM_OUTPUT_PULSE_LENGTH_MICROSECONDS; i -= 10) {
m_outputUtil.setChannelOutputValue(i);
ui->outputLevel->setText(QString(tr("%1 µs")).arg(i));
QApplication::processEvents();
QThread::msleep(200);
}
// Stop output
// Stop output, back to minimal value (1000) defined in vehicleconfigurationsource.h
m_outputUtil.stopChannelOutput();
OutputCalibrationUtil::stopOutputCalibration();
ui->outputLevel->setText(QString(tr("%1 µs")).arg(OFF_PWM_OUTPUT_PULSE_LENGTH_MICROSECONDS));
ui->outputHigh->setEnabled(false);
ui->outputLow->setEnabled(true);
ui->nonconnectedLabel->setEnabled(true);
ui->connectedLabel->setEnabled(false);
m_outputChannels.clear();

View File

@ -54,8 +54,10 @@ private slots:
void resetAllSecurityCheckboxes();
private:
static const int LOW_PWM_OUTPUT_PULSE_LENGTH_MICROSECONDS = 1050;
static const int OFF_PWM_OUTPUT_PULSE_LENGTH_MICROSECONDS = 900;
// Min value should match min value defined in vehicleconfigurationsource.h
static const int LOW_PWM_OUTPUT_PULSE_LENGTH_MICROSECONDS = 1000;
static const int HIGH_PWM_OUTPUT_PULSE_LENGTH_MICROSECONDS = 1900;
static const int HIGH_ONESHOT125_OUTPUT_PULSE_LENGTH_MICROSECONDS = 2000;
Ui::EscCalibrationPage *ui;