1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-12-01 09:24:10 +01:00

Merged in filnet/librepilot (pull request #141)

LP-183 fix GCS regression caused by UAVObject generator changes
This commit is contained in:
Philippe Renon 2015-12-20 20:44:06 +01:00
commit cefcacbbcf
4 changed files with 41 additions and 35 deletions

View File

@ -275,7 +275,7 @@ void ConfigStabilizationWidget::updateThrottleCurveFromObject()
field = stabBank->getField("EnableThrustPIDScaling");
Q_ASSERT(field);
bool enabled = field->getValue() == "TRUE";
bool enabled = field->getValue() == "True";
ui->enableThrustPIDScalingCheckBox->setChecked(enabled);
ui->thrustPIDScalingCurve->setEnabled(enabled);
setDirty(dirty);
@ -297,7 +297,7 @@ void ConfigStabilizationWidget::updateObjectFromThrottleCurve()
field = stabBank->getField("EnableThrustPIDScaling");
Q_ASSERT(field);
field->setValue(ui->enableThrustPIDScalingCheckBox->isChecked() ? "TRUE" : "FALSE");
field->setValue(ui->enableThrustPIDScalingCheckBox->isChecked() ? "True" : "False");
}
void ConfigStabilizationWidget::setupExpoPlot()
@ -371,7 +371,7 @@ void ConfigStabilizationWidget::resetThrottleCurveToDefault()
field = defaultStabBank->getField("EnableThrustPIDScaling");
Q_ASSERT(field);
bool enabled = field->getValue() == "TRUE";
bool enabled = field->getValue() == "True";
ui->enableThrustPIDScalingCheckBox->setChecked(enabled);
ui->thrustPIDScalingCurve->setEnabled(enabled);

View File

@ -770,30 +770,30 @@ void VehicleConfigurationHelper::applyMixerConfiguration(mixerChannelSettings ch
case VehicleConfigurationSource::MULTI_ROTOR_HEXA:
case VehicleConfigurationSource::MULTI_ROTOR_HEXA_H:
case VehicleConfigurationSource::MULTI_ROTOR_HEXA_X:
mSettings->setMixerValueRoll(100);
mSettings->setMixerValuePitch(100);
mSettings->setMixerValueYaw(100);
mSettings->setMixerValueRoll((qint8) 100);
mSettings->setMixerValuePitch((qint8) 100);
mSettings->setMixerValueYaw((qint8) 100);
break;
case VehicleConfigurationSource::MULTI_ROTOR_QUAD_X:
mSettings->setMixerValueRoll(50);
mSettings->setMixerValuePitch(50);
mSettings->setMixerValueYaw(50);
mSettings->setMixerValueRoll((qint8) 50);
mSettings->setMixerValuePitch((qint8) 50);
mSettings->setMixerValueYaw((qint8) 50);
break;
case VehicleConfigurationSource::MULTI_ROTOR_QUAD_PLUS:
mSettings->setMixerValueRoll(100);
mSettings->setMixerValuePitch(100);
mSettings->setMixerValueYaw(50);
mSettings->setMixerValueRoll((qint8) 100);
mSettings->setMixerValuePitch((qint8) 100);
mSettings->setMixerValueYaw((qint8) 50);
break;
case VehicleConfigurationSource::MULTI_ROTOR_HEXA_COAX_Y:
mSettings->setMixerValueRoll(100);
mSettings->setMixerValuePitch(50);
mSettings->setMixerValueYaw(66);
mSettings->setMixerValueRoll((qint8) 100);
mSettings->setMixerValuePitch((qint8) 50);
mSettings->setMixerValueYaw((qint8) 66);
break;
case VehicleConfigurationSource::MULTI_ROTOR_OCTO:
case VehicleConfigurationSource::MULTI_ROTOR_OCTO_X:
mSettings->setMixerValueRoll(100);
mSettings->setMixerValuePitch(100);
mSettings->setMixerValueYaw(100);
mSettings->setMixerValueRoll((qint8) 100);
mSettings->setMixerValuePitch((qint8) 100);
mSettings->setMixerValueYaw((qint8) 100);
break;
case VehicleConfigurationSource::MULTI_ROTOR_OCTO_COAX_X:
case VehicleConfigurationSource::MULTI_ROTOR_OCTO_COAX_PLUS:
@ -805,9 +805,9 @@ void VehicleConfigurationHelper::applyMixerConfiguration(mixerChannelSettings ch
break;
}
case VehicleConfigurationSource::VEHICLE_FIXEDWING:
mSettings->setMixerValueRoll(100);
mSettings->setMixerValuePitch(100);
mSettings->setMixerValueYaw(100);
mSettings->setMixerValueRoll((qint8) 100);
mSettings->setMixerValuePitch((qint8) 100);
mSettings->setMixerValueYaw((qint8) 100);
maxThrottle = 1;
break;
case VehicleConfigurationSource::VEHICLE_HELI:
@ -816,22 +816,22 @@ void VehicleConfigurationHelper::applyMixerConfiguration(mixerChannelSettings ch
{
switch (m_configSource->getVehicleSubType()) {
case VehicleConfigurationSource::GROUNDVEHICLE_MOTORCYCLE:
mSettings->setMixerValueRoll(100);
mSettings->setMixerValuePitch(100);
mSettings->setMixerValueYaw(100);
mSettings->setMixerValueRoll((qint8) 100);
mSettings->setMixerValuePitch((qint8) 100);
mSettings->setMixerValueYaw((qint8) 100);
maxThrottle = 1;
break;
case VehicleConfigurationSource::GROUNDVEHICLE_CAR:
mSettings->setMixerValueRoll(100);
mSettings->setMixerValuePitch(100);
mSettings->setMixerValueYaw(100);
mSettings->setMixerValueRoll((qint8) 100);
mSettings->setMixerValuePitch((qint8) 100);
mSettings->setMixerValueYaw((qint8) 100);
maxThrottle = 1;
minThrottle = 0;
break;
case VehicleConfigurationSource::GROUNDVEHICLE_DIFFERENTIAL:
mSettings->setMixerValueRoll(100);
mSettings->setMixerValuePitch(100);
mSettings->setMixerValueYaw(100);
mSettings->setMixerValueRoll((qint8) 100);
mSettings->setMixerValuePitch((qint8) 100);
mSettings->setMixerValueYaw((qint8) 100);
maxThrottle = 0.8;
minThrottle = 0;
break;

View File

@ -912,7 +912,7 @@ QVariant ConfigTaskWidget::getVariantFromWidget(QWidget *widget, WidgetBinding *
} else if (QSlider * cb = qobject_cast<QSlider *>(widget)) {
return (double)(cb->value() * scale);
} else if (QCheckBox * cb = qobject_cast<QCheckBox *>(widget)) {
return (QString)(cb->isChecked() ? "TRUE" : "FALSE");
return (QString)(cb->isChecked() ? "True" : "False");
} else if (QLineEdit * cb = qobject_cast<QLineEdit *>(widget)) {
QString value = (QString)cb->displayText();
if (binding->units() == "hex") {
@ -955,7 +955,7 @@ bool ConfigTaskWidget::setWidgetFromVariant(QWidget *widget, QVariant value, Wid
cb->setValue((int)qRound(value.toDouble() / scale));
return true;
} else if (QCheckBox * cb = qobject_cast<QCheckBox *>(widget)) {
bool bvalue = value.toString() == "TRUE";
bool bvalue = value.toString() == "True";
cb->setChecked(bvalue);
return true;
} else if (QLineEdit * cb = qobject_cast<QLineEdit *>(widget)) {

View File

@ -630,12 +630,18 @@ bool UAVObjectGeneratorGCS::process_object(ObjectInfo *object)
fieldCtxt.ucPropName = toPropertyName(field->name);
fieldCtxt.propName = toLowerCamelCase(fieldCtxt.ucPropName);
fieldCtxt.propType = fieldCtxt.fieldType;
fieldCtxt.propRefType = fieldCtxt.fieldType;
if (field->type == FIELDTYPE_ENUM) {
if (field->type == FIELDTYPE_INT8) {
fieldCtxt.propType = fieldTypeStrCPP(FIELDTYPE_INT16);
}
else if (field->type == FIELDTYPE_UINT8) {
fieldCtxt.propType = fieldTypeStrCPP(FIELDTYPE_UINT16);
}
else if (field->type == FIELDTYPE_ENUM) {
QString enumClassName = object->name + "_" + fieldCtxt.ucPropName;
fieldCtxt.propType = enumClassName + "::Enum";
fieldCtxt.propRefType = fieldCtxt.propType;
}
// reference type
fieldCtxt.propRefType = fieldCtxt.propType;
// deprecation
fieldCtxt.hasDeprecatedProperty = (fieldCtxt.fieldName != fieldCtxt.propName) && DEPRECATED;