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

LP-183 promote int8 and uint8 to their 16 bits equivalents

applies only to new Qml friendly properties
int16 will be silently cast to and from int8 !!!
This commit is contained in:
Philippe Renon 2015-12-18 23:22:34 +01:00
parent 1b486aafb2
commit 0137460d0b
2 changed files with 36 additions and 30 deletions

View File

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

View File

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