1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-02-21 11:54:15 +01:00

Merge remote-tracking branch 'origin/rel-14.10' into next

This commit is contained in:
Fredrik Larsson 2014-10-28 04:09:45 +11:00
commit 74ca3d9fd2
8 changed files with 539 additions and 428 deletions

View File

@ -46,9 +46,10 @@ 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(0)); ui->outputLevel->setText(QString(tr("%1 µs")).arg(OFF_PWM_OUTPUT_PULSE_LENGTH_MICROSECONDS));
connect(ui->startStopButton, SIGNAL(clicked()), this, SLOT(startStopButtonClicked())); connect(ui->startButton, SIGNAL(clicked()), this, SLOT(startButtonClicked()));
connect(ui->stopButton, SIGNAL(clicked()), this, SLOT(stopButtonClicked()));
connect(ui->securityCheckBox1, SIGNAL(toggled(bool)), this, SLOT(securityCheckBoxesToggled())); connect(ui->securityCheckBox1, SIGNAL(toggled(bool)), this, SLOT(securityCheckBoxesToggled()));
connect(ui->securityCheckBox2, SIGNAL(toggled(bool)), this, SLOT(securityCheckBoxesToggled())); connect(ui->securityCheckBox2, SIGNAL(toggled(bool)), this, SLOT(securityCheckBoxesToggled()));
@ -84,14 +85,16 @@ void EscCalibrationPage::resetAllSecurityCheckboxes()
ui->securityCheckBox3->setChecked(false); ui->securityCheckBox3->setChecked(false);
} }
void EscCalibrationPage::startStopButtonClicked() void EscCalibrationPage::startButtonClicked()
{ {
if (!m_isCalibrating) { if (!m_isCalibrating) {
m_isCalibrating = true; m_isCalibrating = true;
ui->startStopButton->setEnabled(false); ui->startButton->setEnabled(false);
enableButtons(false); enableButtons(false);
ui->outputHigh->setEnabled(true); ui->outputHigh->setEnabled(true);
ui->outputLow->setEnabled(false); ui->outputLow->setEnabled(false);
ui->nonconnectedLabel->setEnabled(false);
ui->connectedLabel->setEnabled(true);
ui->outputLevel->setText(QString(tr("%1 µs")).arg(HIGH_PWM_OUTPUT_PULSE_LENGTH_MICROSECONDS)); ui->outputLevel->setText(QString(tr("%1 µs")).arg(HIGH_PWM_OUTPUT_PULSE_LENGTH_MICROSECONDS));
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
UAVObjectManager *uavoManager = pm->getObject<UAVObjectManager>(); UAVObjectManager *uavoManager = pm->getObject<UAVObjectManager>();
@ -104,43 +107,59 @@ void EscCalibrationPage::startStopButtonClicked()
Q_ASSERT(field); Q_ASSERT(field);
if (field->getValue().toString() == field->getOptions().at(VehicleConfigurationHelper::MIXER_TYPE_MOTOR)) { if (field->getValue().toString() == field->getOptions().at(VehicleConfigurationHelper::MIXER_TYPE_MOTOR)) {
OutputCalibrationUtil *output = new OutputCalibrationUtil(); OutputCalibrationUtil *output = new OutputCalibrationUtil();
output->startChannelOutput(i, 0); output->startChannelOutput(i, OFF_PWM_OUTPUT_PULSE_LENGTH_MICROSECONDS);
output->setChannelOutputValue(HIGH_PWM_OUTPUT_PULSE_LENGTH_MICROSECONDS); output->setChannelOutputValue(HIGH_PWM_OUTPUT_PULSE_LENGTH_MICROSECONDS);
m_outputs << output; m_outputs << output;
} }
} }
ui->startStopButton->setText(tr("Stop")); ui->stopButton->setEnabled(true);
ui->startStopButton->setEnabled(true); }
} else { }
m_isCalibrating = false;
ui->startStopButton->setEnabled(false); void EscCalibrationPage::stopButtonClicked()
{
if (m_isCalibrating) {
ui->stopButton->setEnabled(false);
ui->outputHigh->setEnabled(false); ui->outputHigh->setEnabled(false);
// Set to low pwm out
foreach(OutputCalibrationUtil * output, m_outputs) { foreach(OutputCalibrationUtil * output, m_outputs) {
output->setChannelOutputValue(LOW_PWM_OUTPUT_PULSE_LENGTH_MICROSECONDS); output->setChannelOutputValue(LOW_PWM_OUTPUT_PULSE_LENGTH_MICROSECONDS);
} }
ui->outputLevel->setText(QString(tr("%1 µs")).arg(LOW_PWM_OUTPUT_PULSE_LENGTH_MICROSECONDS)); ui->outputLevel->setText(QString(tr("%1 µs")).arg(LOW_PWM_OUTPUT_PULSE_LENGTH_MICROSECONDS));
QApplication::processEvents();
QThread::msleep(2000);
qApp->processEvents(QEventLoop::AllEvents); // Ramp down to off pwm out
QThread::msleep(1000); for (int i = LOW_PWM_OUTPUT_PULSE_LENGTH_MICROSECONDS; i >= OFF_PWM_OUTPUT_PULSE_LENGTH_MICROSECONDS; i -= 10) {
foreach(OutputCalibrationUtil * output, m_outputs) {
output->setChannelOutputValue(i);
}
ui->outputLevel->setText(QString(tr("%1 µs")).arg(i));
QApplication::processEvents();
QThread::msleep(200);
}
// Stop output
foreach(OutputCalibrationUtil * output, m_outputs) { foreach(OutputCalibrationUtil * output, m_outputs) {
output->stopChannelOutput(); output->stopChannelOutput();
delete output; delete output;
} }
ui->outputLevel->setText(QString(tr("%1 µs")).arg(0)); ui->outputLevel->setText(QString(tr("%1 µs")).arg(OFF_PWM_OUTPUT_PULSE_LENGTH_MICROSECONDS));
ui->outputHigh->setEnabled(false); ui->outputHigh->setEnabled(false);
ui->outputLow->setEnabled(true); ui->outputLow->setEnabled(true);
ui->nonconnectedLabel->setEnabled(true);
ui->connectedLabel->setEnabled(false);
m_outputs.clear(); m_outputs.clear();
m_isCalibrating = false; m_isCalibrating = false;
resetAllSecurityCheckboxes(); resetAllSecurityCheckboxes();
ui->startStopButton->setText(tr("Start"));
enableButtons(true); enableButtons(true);
} }
} }
void EscCalibrationPage::securityCheckBoxesToggled() void EscCalibrationPage::securityCheckBoxesToggled()
{ {
ui->startStopButton->setEnabled(ui->securityCheckBox1->isChecked() && ui->startButton->setEnabled(ui->securityCheckBox1->isChecked() &&
ui->securityCheckBox2->isChecked() && ui->securityCheckBox2->isChecked() &&
ui->securityCheckBox3->isChecked()); ui->securityCheckBox3->isChecked());
} }

View File

@ -46,13 +46,15 @@ public:
void initializePage(); void initializePage();
private slots: private slots:
void startStopButtonClicked(); void startButtonClicked();
void stopButtonClicked();
void securityCheckBoxesToggled(); void securityCheckBoxesToggled();
void enableButtons(bool enable); void enableButtons(bool enable);
void resetAllSecurityCheckboxes(); void resetAllSecurityCheckboxes();
private: private:
static const int LOW_PWM_OUTPUT_PULSE_LENGTH_MICROSECONDS = 1000; static const int LOW_PWM_OUTPUT_PULSE_LENGTH_MICROSECONDS = 1050;
static const int OFF_PWM_OUTPUT_PULSE_LENGTH_MICROSECONDS = 900;
static const int HIGH_PWM_OUTPUT_PULSE_LENGTH_MICROSECONDS = 1900; static const int HIGH_PWM_OUTPUT_PULSE_LENGTH_MICROSECONDS = 1900;
Ui::EscCalibrationPage *ui; Ui::EscCalibrationPage *ui;
bool m_isCalibrating; bool m_isCalibrating;

View File

@ -7,7 +7,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>600</width> <width>600</width>
<height>507</height> <height>585</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -16,6 +16,12 @@
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QVBoxLayout" name="verticalLayout">
<item> <item>
<widget class="QLabel" name="label"> <widget class="QLabel" name="label">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="text"> <property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p align=&quot;center&quot;&gt;&lt;span style=&quot; font-size:12pt; font-weight:600;&quot;&gt;OpenPilot ESC Calibration Procedure&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot; font-size:10pt;&quot;&gt;As you have selected to use a MultiRotor and Fast / Flashed ESCs, we need to calibrate the endpoints of these ESCs so they can see the full throttle range sent from the flight controller. &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot; font-size:10pt;&quot;&gt;This part of the wizard will tell you to connect the battery to your aircraft, before doing so you absolutely &lt;/span&gt;&lt;span style=&quot; font-size:10pt; font-weight:600; color:#f30f1d;&quot;&gt;must remove the propellers from all motors&lt;/span&gt;&lt;span style=&quot; font-size:10pt;&quot;&gt;. &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot; font-size:10pt;&quot;&gt;The steps to perform this calibration are as follows:&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot; font-size:10pt;&quot;&gt;1. Confirm all safety questions&lt;br/&gt;2. Press the Start button when it becomes enabled&lt;br/&gt;3. Connect the battery to your airframe&lt;br/&gt;4. Wait for ESC calibration beep(s)&lt;br/&gt;5. Press the Stop button&lt;br/&gt;6. Wait for ESC confirmation beep(s)&lt;br/&gt;7. Disconnect battery&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string> <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p align=&quot;center&quot;&gt;&lt;span style=&quot; font-size:12pt; font-weight:600;&quot;&gt;OpenPilot ESC Calibration Procedure&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot; font-size:10pt;&quot;&gt;As you have selected to use a MultiRotor and Fast / Flashed ESCs, we need to calibrate the endpoints of these ESCs so they can see the full throttle range sent from the flight controller. &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot; font-size:10pt;&quot;&gt;This part of the wizard will tell you to connect the battery to your aircraft, before doing so you absolutely &lt;/span&gt;&lt;span style=&quot; font-size:10pt; font-weight:600; color:#f30f1d;&quot;&gt;must remove the propellers from all motors&lt;/span&gt;&lt;span style=&quot; font-size:10pt;&quot;&gt;. &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot; font-size:10pt;&quot;&gt;The steps to perform this calibration are as follows:&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot; font-size:10pt;&quot;&gt;1. Confirm all safety questions&lt;br/&gt;2. Press the Start button when it becomes enabled&lt;br/&gt;3. Connect the battery to your airframe&lt;br/&gt;4. Wait for ESC calibration beep(s)&lt;br/&gt;5. Press the Stop button&lt;br/&gt;6. Wait for ESC confirmation beep(s)&lt;br/&gt;7. Disconnect battery&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property> </property>
@ -65,19 +71,69 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QGroupBox" name="groupBox"> <layout class="QHBoxLayout" name="horizontalLayout_3">
<property name="title"> <property name="topMargin">
<string>ESC Output Level</string> <number>0</number>
</property> </property>
<layout class="QHBoxLayout" name="horizontalLayout_2"> <item>
<property name="leftMargin"> <widget class="QLabel" name="nonconnectedLabel">
<number>9</number> <property name="minimumSize">
<size>
<width>155</width>
<height>70</height>
</size>
</property> </property>
<property name="rightMargin"> <property name="maximumSize">
<number>9</number> <size>
<width>155</width>
<height>70</height>
</size>
</property> </property>
<property name="bottomMargin"> <property name="text">
<number>9</number> <string/>
</property>
<property name="pixmap">
<pixmap resource="../wizardResources.qrc">:/setupwizard/resources/not-connected.png</pixmap>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="connectedLabel">
<property name="enabled">
<bool>false</bool>
</property>
<property name="minimumSize">
<size>
<width>155</width>
<height>70</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>155</width>
<height>70</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="../wizardResources.qrc">:/setupwizard/resources/connected.png</pixmap>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<property name="topMargin">
<number>0</number>
</property> </property>
<item> <item>
<widget class="QPushButton" name="outputLow"> <widget class="QPushButton" name="outputLow">
@ -412,7 +468,6 @@
</widget> </widget>
</item> </item>
</layout> </layout>
</widget>
</item> </item>
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout"> <layout class="QHBoxLayout" name="horizontalLayout">
@ -433,7 +488,7 @@
</spacer> </spacer>
</item> </item>
<item> <item>
<widget class="QPushButton" name="startStopButton"> <widget class="QPushButton" name="startButton">
<property name="enabled"> <property name="enabled">
<bool>false</bool> <bool>false</bool>
</property> </property>
@ -448,6 +503,22 @@
</property> </property>
</widget> </widget>
</item> </item>
<item>
<widget class="QPushButton" name="stopButton">
<property name="enabled">
<bool>false</bool>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Stop</string>
</property>
</widget>
</item>
<item> <item>
<spacer name="horizontalSpacer_2"> <spacer name="horizontalSpacer_2">
<property name="orientation"> <property name="orientation">
@ -482,8 +553,10 @@
<tabstop>securityCheckBox1</tabstop> <tabstop>securityCheckBox1</tabstop>
<tabstop>securityCheckBox2</tabstop> <tabstop>securityCheckBox2</tabstop>
<tabstop>securityCheckBox3</tabstop> <tabstop>securityCheckBox3</tabstop>
<tabstop>startStopButton</tabstop> <tabstop>startButton</tabstop>
</tabstops> </tabstops>
<resources/> <resources>
<include location="../wizardResources.qrc"/>
</resources>
<connections/> <connections/>
</ui> </ui>

View File

@ -376,12 +376,7 @@ void OutputCalibrationPage::on_motorNeutralButton_toggled(bool checked)
ui->motorNeutralButton->setText(checked ? tr("Stop") : tr("Start")); ui->motorNeutralButton->setText(checked ? tr("Stop") : tr("Start"));
ui->motorNeutralSlider->setEnabled(checked); ui->motorNeutralSlider->setEnabled(checked);
quint16 channel = getCurrentChannel(); quint16 channel = getCurrentChannel();
quint16 safeValue = 0; quint16 safeValue = m_actuatorSettings[channel].channelMin;
if (!checked) {
// Set pwm output to 1000/low for 500ms before turning it to 0
m_calibrationUtil->setChannelOutputValue(1000);
QThread::msleep(500);
}
onStartButtonToggle(ui->motorNeutralButton, channel, m_actuatorSettings[channel].channelNeutral, safeValue, ui->motorNeutralSlider); onStartButtonToggle(ui->motorNeutralButton, channel, m_actuatorSettings[channel].channelNeutral, safeValue, ui->motorNeutralSlider);
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 421 KiB

After

Width:  |  Height:  |  Size: 422 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

View File

@ -48,5 +48,7 @@
<file>resources/bttn-flash-up.png</file> <file>resources/bttn-flash-up.png</file>
<file>resources/bttn-upgrade-down.png</file> <file>resources/bttn-upgrade-down.png</file>
<file>resources/bttn-upgrade-up.png</file> <file>resources/bttn-upgrade-up.png</file>
<file>resources/not-connected.png</file>
<file>resources/connected.png</file>
</qresource> </qresource>
</RCC> </RCC>