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:
commit
c368b4dfa5
@ -47,7 +47,7 @@ EscCalibrationPage::EscCalibrationPage(SetupWizard *wizard, QWidget *parent) :
|
|||||||
ui->outputHigh->setEnabled(false);
|
ui->outputHigh->setEnabled(false);
|
||||||
ui->outputLow->setEnabled(true);
|
ui->outputLow->setEnabled(true);
|
||||||
ui->outputLevel->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->startButton, SIGNAL(clicked()), this, SLOT(startButtonClicked()));
|
||||||
connect(ui->stopButton, SIGNAL(clicked()), this, SLOT(stopButtonClicked()));
|
connect(ui->stopButton, SIGNAL(clicked()), this, SLOT(stopButtonClicked()));
|
||||||
@ -149,6 +149,7 @@ void EscCalibrationPage::stopButtonClicked()
|
|||||||
if (m_isCalibrating) {
|
if (m_isCalibrating) {
|
||||||
ui->stopButton->setEnabled(false);
|
ui->stopButton->setEnabled(false);
|
||||||
ui->outputHigh->setEnabled(false);
|
ui->outputHigh->setEnabled(false);
|
||||||
|
ui->outputLow->setEnabled(true);
|
||||||
|
|
||||||
// Set to low pwm out
|
// Set to low pwm out
|
||||||
m_outputUtil.setChannelOutputValue(LOW_PWM_OUTPUT_PULSE_LENGTH_MICROSECONDS);
|
m_outputUtil.setChannelOutputValue(LOW_PWM_OUTPUT_PULSE_LENGTH_MICROSECONDS);
|
||||||
@ -156,21 +157,10 @@ void EscCalibrationPage::stopButtonClicked()
|
|||||||
QApplication::processEvents();
|
QApplication::processEvents();
|
||||||
QThread::msleep(2000);
|
QThread::msleep(2000);
|
||||||
|
|
||||||
// Ramp down to off pwm out
|
// Stop output, back to minimal value (1000) defined in vehicleconfigurationsource.h
|
||||||
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
|
|
||||||
m_outputUtil.stopChannelOutput();
|
m_outputUtil.stopChannelOutput();
|
||||||
OutputCalibrationUtil::stopOutputCalibration();
|
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->nonconnectedLabel->setEnabled(true);
|
||||||
ui->connectedLabel->setEnabled(false);
|
ui->connectedLabel->setEnabled(false);
|
||||||
m_outputChannels.clear();
|
m_outputChannels.clear();
|
||||||
|
@ -54,8 +54,10 @@ private slots:
|
|||||||
void resetAllSecurityCheckboxes();
|
void resetAllSecurityCheckboxes();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static const int LOW_PWM_OUTPUT_PULSE_LENGTH_MICROSECONDS = 1050;
|
|
||||||
static const int OFF_PWM_OUTPUT_PULSE_LENGTH_MICROSECONDS = 900;
|
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_PWM_OUTPUT_PULSE_LENGTH_MICROSECONDS = 1900;
|
||||||
static const int HIGH_ONESHOT125_OUTPUT_PULSE_LENGTH_MICROSECONDS = 2000;
|
static const int HIGH_ONESHOT125_OUTPUT_PULSE_LENGTH_MICROSECONDS = 2000;
|
||||||
Ui::EscCalibrationPage *ui;
|
Ui::EscCalibrationPage *ui;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user