mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-03-15 07:29:15 +01:00
OP-1512 Fixed issues found in review.
This commit is contained in:
parent
ada27f2568
commit
9872a95bc3
@ -33,6 +33,7 @@
|
||||
#include "extensionsystem/pluginmanager.h"
|
||||
#include "uavobjectmanager.h"
|
||||
#include "vehicleconfigurationhelper.h"
|
||||
#include "actuatorsettings.h"
|
||||
|
||||
EscCalibrationPage::EscCalibrationPage(SetupWizard *wizard, QWidget *parent) :
|
||||
AbstractWizardPage(wizard, parent),
|
||||
@ -73,13 +74,13 @@ void EscCalibrationPage::startStopButtonClicked()
|
||||
MixerSettings *mSettings = MixerSettings::GetInstance(uavoManager);
|
||||
Q_ASSERT(mSettings);
|
||||
QString mixerTypePattern = "Mixer%1Type";
|
||||
for (int i = 0; i < 12; i++) {
|
||||
for (int i = 0; i < ActuatorSettings::CHANNELADDR_NUMELEM; i++) {
|
||||
UAVObjectField *field = mSettings->getField(mixerTypePattern.arg(i + 1));
|
||||
Q_ASSERT(field);
|
||||
if (field->getValue().toString() == field->getOptions().at(VehicleConfigurationHelper::MIXER_TYPE_MOTOR)) {
|
||||
OutputCalibrationUtil *output = new OutputCalibrationUtil();
|
||||
output->startChannelOutput(i, LOW_OUTPUT_VALUE);
|
||||
output->setChannelOutputValue(HIGH_OUTPUT_VALUE);
|
||||
output->startChannelOutput(i, LOW_PWM_OUTPUT_PULSE_LENGTH_MICROSECONDS);
|
||||
output->setChannelOutputValue(HIGH_PWM_OUTPUT_PULSE_LENGTH_MICROSECONDS);
|
||||
m_outputs << output;
|
||||
}
|
||||
}
|
||||
@ -94,7 +95,7 @@ void EscCalibrationPage::startStopButtonClicked()
|
||||
}
|
||||
m_outputs.clear();
|
||||
m_isCalibrating = false;
|
||||
ui->startStopButton->setText("Start");
|
||||
ui->startStopButton->setText(tr("Start"));
|
||||
ui->startStopButton->setEnabled(true);
|
||||
enableButtons(true);
|
||||
}
|
||||
|
@ -49,8 +49,8 @@ private slots:
|
||||
void enableButtons(bool enable);
|
||||
|
||||
private:
|
||||
const int LOW_OUTPUT_VALUE = 1000;
|
||||
const int HIGH_OUTPUT_VALUE = 2000;
|
||||
const int LOW_PWM_OUTPUT_PULSE_LENGTH_MICROSECONDS = 1000;
|
||||
const int HIGH_PWM_OUTPUT_PULSE_LENGTH_MICROSECONDS = 2000;
|
||||
Ui::EscCalibrationPage *ui;
|
||||
bool m_isCalibrating;
|
||||
|
||||
|
@ -333,26 +333,26 @@ void VehicleConfigurationHelper::applyActuatorConfiguration()
|
||||
{
|
||||
ActuatorSettings *actSettings = ActuatorSettings::GetInstance(m_uavoManager);
|
||||
|
||||
qint16 escFrequence = LEGACY_ESC_FREQUENCE;
|
||||
qint16 escFrequence = LEGACY_ESC_FREQUENCY;
|
||||
|
||||
switch (m_configSource->getEscType()) {
|
||||
case VehicleConfigurationSource::ESC_STANDARD:
|
||||
escFrequence = LEGACY_ESC_FREQUENCE;
|
||||
escFrequence = LEGACY_ESC_FREQUENCY;
|
||||
break;
|
||||
case VehicleConfigurationSource::ESC_RAPID:
|
||||
escFrequence = RAPID_ESC_FREQUENCE;
|
||||
escFrequence = RAPID_ESC_FREQUENCY;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
qint16 servoFrequence = ANALOG_SERVO_FREQUENCE;
|
||||
qint16 servoFrequence = ANALOG_SERVO_FREQUENCY;
|
||||
switch (m_configSource->getServoType()) {
|
||||
case VehicleConfigurationSource::SERVO_ANALOG:
|
||||
servoFrequence = ANALOG_SERVO_FREQUENCE;
|
||||
servoFrequence = ANALOG_SERVO_FREQUENCY;
|
||||
break;
|
||||
case VehicleConfigurationSource::SERVO_DIGITAL:
|
||||
servoFrequence = DIGITAL_SERVO_FREQUENCE;
|
||||
servoFrequence = DIGITAL_SERVO_FREQUENCY;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -375,7 +375,7 @@ void VehicleConfigurationHelper::applyActuatorConfiguration()
|
||||
data.MotorsSpinWhileArmed = ActuatorSettings::MOTORSSPINWHILEARMED_FALSE;
|
||||
|
||||
for (quint16 i = 0; i < ActuatorSettings::CHANNELUPDATEFREQ_NUMELEM; i++) {
|
||||
data.ChannelUpdateFreq[i] = LEGACY_ESC_FREQUENCE;
|
||||
data.ChannelUpdateFreq[i] = LEGACY_ESC_FREQUENCY;
|
||||
}
|
||||
|
||||
switch (m_configSource->getVehicleSubType()) {
|
||||
@ -592,7 +592,7 @@ void VehicleConfigurationHelper::applyMixerConfiguration(mixerChannelSettings ch
|
||||
// Set Mixer types and values
|
||||
QString mixerTypePattern = "Mixer%1Type";
|
||||
QString mixerVectorPattern = "Mixer%1Vector";
|
||||
for (int i = 0; i < 12; i++) {
|
||||
for (int i = 0; i < ActuatorSettings::CHANNELADDR_NUMELEM; i++) {
|
||||
UAVObjectField *field = mSettings->getField(mixerTypePattern.arg(i + 1));
|
||||
Q_ASSERT(field);
|
||||
field->setValue(field->getOptions().at(channels[i].type));
|
||||
|
@ -57,11 +57,11 @@ public:
|
||||
VehicleConfigurationHelper(VehicleConfigurationSource *configSource);
|
||||
bool setupVehicle(bool save = true);
|
||||
bool setupHardwareSettings(bool save = true);
|
||||
static const qint16 LEGACY_ESC_FREQUENCE = 50;
|
||||
static const qint16 RAPID_ESC_FREQUENCE = 400;
|
||||
static const qint16 ANALOG_SERVO_FREQUENCE = 50;
|
||||
static const qint16 DIGITAL_SERVO_FREQUENCE = 333;
|
||||
static const int MIXER_TYPE_DISABLED = 0;
|
||||
static const qint16 LEGACY_ESC_FREQUENCY = 50;
|
||||
static const qint16 RAPID_ESC_FREQUENCY = 500;
|
||||
static const qint16 ANALOG_SERVO_FREQUENCY = 50;
|
||||
static const qint16 DIGITAL_SERVO_FREQUENCY = 333;
|
||||
static const int MIXER_TYPE_NONE = 0;
|
||||
static const int MIXER_TYPE_MOTOR = 1;
|
||||
static const int MIXER_TYPE_REVERSABLEMOTOR = 2;
|
||||
static const int MIXER_TYPE_SERVO = 3;
|
||||
|
Loading…
x
Reference in New Issue
Block a user