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

OP-1761 Changed code to not allow PWMSync to be configured if CC or CC3D and > Hexa

This commit is contained in:
m_thread 2015-03-06 00:05:38 +01:00
parent d77c317e37
commit 25c52d6430
4 changed files with 30 additions and 20 deletions

View File

@ -47,7 +47,12 @@ bool EscPage::validatePage()
if (ui->oneshotESCButton->isChecked()) {
getWizard()->setEscType(SetupWizard::ESC_ONESHOT);
} else if (ui->rapidESCButton->isChecked()) {
getWizard()->setEscType(SetupWizard::ESC_RAPID);
if (isSynchOrOneShotAvalable()) {
getWizard()->setEscType(SetupWizard::ESC_SYNCHED);
} else {
getWizard()->setEscType(SetupWizard::ESC_RAPID);
}
} else if (ui->defaultESCButton->isChecked()) {
getWizard()->setEscType(SetupWizard::ESC_STANDARD);
}
@ -58,7 +63,18 @@ bool EscPage::validatePage()
void EscPage::initializePage()
{
bool enabled = true;
bool enabled = isSynchOrOneShotAvalable();
ui->oneshotESCButton->setEnabled(enabled);
if (ui->oneshotESCButton->isChecked() && !enabled) {
ui->oneshotESCButton->setChecked(false);
ui->rapidESCButton->setChecked(true);
}
}
bool EscPage::isSynchOrOneShotAvalable()
{
bool available = true;
switch (getWizard()->getControllerType()) {
case SetupWizard::CONTROLLER_CC:
@ -70,10 +86,10 @@ void EscPage::initializePage()
case SetupWizard::MULTI_ROTOR_QUAD_X:
case SetupWizard::MULTI_ROTOR_QUAD_H:
case SetupWizard::MULTI_ROTOR_QUAD_PLUS:
enabled = getWizard()->getInputType() != SetupWizard::INPUT_PWM;
available = getWizard()->getInputType() != SetupWizard::INPUT_PWM;
break;
default:
enabled = false;
available = false;
break;
}
break;
@ -82,9 +98,5 @@ void EscPage::initializePage()
break;
default: break;
}
ui->oneshotESCButton->setEnabled(enabled);
if (ui->oneshotESCButton->isChecked() && !enabled) {
ui->oneshotESCButton->setChecked(false);
ui->rapidESCButton->setChecked(true);
}
return available;
}

View File

@ -45,6 +45,7 @@ public:
private:
Ui::EscPage *ui;
bool isSynchOrOneShotAvailable();
};
#endif // ESCPAGE_H

View File

@ -151,7 +151,7 @@ void VehicleConfigurationHelper::applyHardwareConfiguration()
break;
case VehicleConfigurationSource::INPUT_PPM:
if (m_configSource->getEscType() == VehicleConfigurationSource::ESC_ONESHOT ||
m_configSource->getEscType() == VehicleConfigurationSource::ESC_RAPID) {
m_configSource->getEscType() == VehicleConfigurationSource::ESC_SYNCHED) {
data.CC_RcvrPort = HwSettings::CC_RCVRPORT_PPM_PIN8ONESHOT;
} else {
data.CC_RcvrPort = HwSettings::CC_RCVRPORT_PPMNOONESHOT;
@ -377,15 +377,12 @@ void VehicleConfigurationHelper::applyActuatorConfiguration()
bankMode = ActuatorSettings::BANKMODE_PWM;
break;
case VehicleConfigurationSource::ESC_RAPID:
if ((m_configSource->getControllerType() == VehicleConfigurationSource::CONTROLLER_CC ||
m_configSource->getControllerType() == VehicleConfigurationSource::CONTROLLER_CC3D) &&
m_configSource->getInputType() == VehicleConfigurationSource::INPUT_PWM) {
bankMode = ActuatorSettings::BANKMODE_PWM;
escFrequence = RAPID_ESC_FREQUENCY;
} else {
bankMode = ActuatorSettings::BANKMODE_PWMSYNC;
escFrequence = PWMSYNC_ESC_FREQUENCY;
}
bankMode = ActuatorSettings::BANKMODE_PWM;
escFrequence = RAPID_ESC_FREQUENCY;
break;
case VehicleConfigurationSource::ESC_SYNCHED:
bankMode = ActuatorSettings::BANKMODE_PWMSYNC;
escFrequence = PWMSYNC_ESC_FREQUENCY;
break;
case VehicleConfigurationSource::ESC_ONESHOT:
bankMode = ActuatorSettings::BANKMODE_ONESHOT125;

View File

@ -64,7 +64,7 @@ public:
MULTI_ROTOR_OCTO_X, MULTI_ROTOR_OCTO_V, MULTI_ROTOR_OCTO_COAX_X, MULTI_ROTOR_OCTO_COAX_PLUS,
FIXED_WING_DUAL_AILERON, FIXED_WING_AILERON, FIXED_WING_ELEVON, FIXED_WING_VTAIL, HELI_CCPM,
GROUNDVEHICLE_MOTORCYCLE, GROUNDVEHICLE_CAR, GROUNDVEHICLE_DIFFERENTIAL };
enum ESC_TYPE { ESC_ONESHOT, ESC_RAPID, ESC_STANDARD, ESC_UNKNOWN };
enum ESC_TYPE { ESC_ONESHOT, ESC_SYNCHED, ESC_RAPID, ESC_STANDARD, ESC_UNKNOWN };
enum SERVO_TYPE { SERVO_ANALOG, SERVO_DIGITAL, SERVO_UNKNOWN };
enum INPUT_TYPE { INPUT_PWM, INPUT_PPM, INPUT_SBUS, INPUT_DSM, INPUT_UNKNOWN };
enum AIRSPEED_TYPE { AIRSPEED_ESTIMATE, AIRSPEED_EAGLETREE, AIRSPEED_MS4525, AIRSPEED_DISABLED };