From 01d963affd0fa966f0ebed2a6ec1a9f12af5c57b Mon Sep 17 00:00:00 2001 From: Alessio Morale Date: Thu, 1 Aug 2013 01:28:50 +0200 Subject: [PATCH] OP-1058 uncrustify --- .../fixedwingpathfollower.c | 18 ++++---- flight/modules/ManualControl/manualcontrol.c | 42 +++++++++---------- flight/modules/PathPlanner/pathplanner.c | 18 ++++---- flight/modules/Sensors/sensors.c | 6 +-- flight/modules/Stabilization/relay_tuning.c | 12 +++--- flight/modules/Stabilization/stabilization.c | 2 +- .../VtolPathFollower/vtolpathfollower.c | 2 +- .../flight/uavobjectgeneratorflight.cpp | 13 +++--- 8 files changed, 56 insertions(+), 57 deletions(-) diff --git a/flight/modules/FixedWingPathFollower/fixedwingpathfollower.c b/flight/modules/FixedWingPathFollower/fixedwingpathfollower.c index f6af6717e..00681358c 100644 --- a/flight/modules/FixedWingPathFollower/fixedwingpathfollower.c +++ b/flight/modules/FixedWingPathFollower/fixedwingpathfollower.c @@ -358,7 +358,7 @@ static void updateFixedAttitude(float *attitude) stabDesired.Pitch = attitude[1]; stabDesired.Yaw = attitude[2]; stabDesired.Throttle = attitude[3]; - stabDesired.StabilizationMode.fields.Roll = STABILIZATIONDESIRED_STABILIZATIONMODE_ATTITUDE; + stabDesired.StabilizationMode.fields.Roll = STABILIZATIONDESIRED_STABILIZATIONMODE_ATTITUDE; stabDesired.StabilizationMode.fields.Pitch = STABILIZATIONDESIRED_STABILIZATIONMODE_ATTITUDE; stabDesired.StabilizationMode.fields.Yaw = STABILIZATIONDESIRED_STABILIZATIONMODE_RATE; StabilizationDesiredSet(&stabDesired); @@ -494,9 +494,9 @@ static uint8_t updateFixedDesiredAttitude() speedErrorToPowerCommandComponent; // Output internal state to telemetry - fixedwingpathfollowerStatus.Error.fields.Power = descentspeedError; + fixedwingpathfollowerStatus.Error.fields.Power = descentspeedError; fixedwingpathfollowerStatus.ErrorInt.fields.Power = powerIntegral; - fixedwingpathfollowerStatus.Command.fields.Power = powerCommand; + fixedwingpathfollowerStatus.Command.fields.Power = powerCommand; // set throttle stabDesired.Throttle = bound(fixedwingpathfollowerSettings.ThrottleLimit.fields.Neutral + powerCommand, @@ -519,7 +519,7 @@ static uint8_t updateFixedDesiredAttitude() velocityState.Down < 0 && // we ARE going up descentspeedDesired > 0 && // we WANT to go down airspeedError < 0 && // we are too fast already - fixedwingpathfollowerSettings.Safetymargins.fields.Highpower > 0.5f) { // alarm switched on + fixedwingpathfollowerSettings.Safetymargins.fields.Highpower > 0.5f) { // alarm switched on fixedwingpathfollowerStatus.Errors.fields.Highpower = 1; result = 0; } @@ -547,9 +547,9 @@ static uint8_t updateFixedDesiredAttitude() + airspeedErrorInt * fixedwingpathfollowerSettings.SpeedPI.fields.Ki ) + verticalSpeedToPitchCommandComponent; - fixedwingpathfollowerStatus.Error.fields.Speed = airspeedError; + fixedwingpathfollowerStatus.Error.fields.Speed = airspeedError; fixedwingpathfollowerStatus.ErrorInt.fields.Speed = airspeedErrorInt; - fixedwingpathfollowerStatus.Command.fields.Speed = pitchCommand; + fixedwingpathfollowerStatus.Command.fields.Speed = pitchCommand; stabDesired.Pitch = bound(fixedwingpathfollowerSettings.PitchLimit.fields.Neutral + pitchCommand, fixedwingpathfollowerSettings.PitchLimit.fields.Min, @@ -561,7 +561,7 @@ static uint8_t updateFixedDesiredAttitude() velocityState.Down > 0 && // we ARE going down descentspeedDesired < 0 && // we WANT to go up airspeedError < 0 && // we are too fast already - fixedwingpathfollowerSettings.Safetymargins.fields.Pitchcontrol > 0.5f) { // alarm switched on + fixedwingpathfollowerSettings.Safetymargins.fields.Pitchcontrol > 0.5f) { // alarm switched on fixedwingpathfollowerStatus.Errors.fields.Pitchcontrol = 1; result = 0; } @@ -614,9 +614,9 @@ static uint8_t updateFixedDesiredAttitude() courseCommand = (courseError * fixedwingpathfollowerSettings.CoursePI.fields.Kp + courseIntegral); - fixedwingpathfollowerStatus.Error.fields.Course = courseError; + fixedwingpathfollowerStatus.Error.fields.Course = courseError; fixedwingpathfollowerStatus.ErrorInt.fields.Course = courseIntegral; - fixedwingpathfollowerStatus.Command.fields.Course = courseCommand; + fixedwingpathfollowerStatus.Command.fields.Course = courseCommand; stabDesired.Roll = bound(fixedwingpathfollowerSettings.RollLimit.fields.Neutral + courseCommand, diff --git a/flight/modules/ManualControl/manualcontrol.c b/flight/modules/ManualControl/manualcontrol.c index 7e7ad5062..42640f542 100644 --- a/flight/modules/ManualControl/manualcontrol.c +++ b/flight/modules/ManualControl/manualcontrol.c @@ -686,17 +686,17 @@ static void updateStabilizationDesired(ManualControlCommandData *cmd, ManualCont } // TOOD: Add assumption about order of stabilization desired and manual control stabilization mode fields having same order - stabilization.StabilizationMode.fields.Roll = stab_settings[0]; + stabilization.StabilizationMode.fields.Roll = stab_settings[0]; stabilization.StabilizationMode.fields.Pitch = stab_settings[1]; - stabilization.StabilizationMode.fields.Yaw = stab_settings[2]; + stabilization.StabilizationMode.fields.Yaw = stab_settings[2]; stabilization.Roll = (stab_settings[0] == STABILIZATIONDESIRED_STABILIZATIONMODE_NONE) ? cmd->Roll : - (stab_settings[0] == STABILIZATIONDESIRED_STABILIZATIONMODE_RATE) ? cmd->Roll * stabSettings.ManualRate.fields.Roll: + (stab_settings[0] == STABILIZATIONDESIRED_STABILIZATIONMODE_RATE) ? cmd->Roll * stabSettings.ManualRate.fields.Roll : (stab_settings[0] == STABILIZATIONDESIRED_STABILIZATIONMODE_WEAKLEVELING) ? cmd->Roll * stabSettings.ManualRate.fields.Roll : (stab_settings[0] == STABILIZATIONDESIRED_STABILIZATIONMODE_ATTITUDE) ? cmd->Roll * stabSettings.RollMax : - (stab_settings[0] == STABILIZATIONDESIRED_STABILIZATIONMODE_AXISLOCK) ? cmd->Roll * stabSettings.ManualRate.fields.Roll: + (stab_settings[0] == STABILIZATIONDESIRED_STABILIZATIONMODE_AXISLOCK) ? cmd->Roll * stabSettings.ManualRate.fields.Roll : (stab_settings[0] == STABILIZATIONDESIRED_STABILIZATIONMODE_VIRTUALBAR) ? cmd->Roll : (stab_settings[0] == STABILIZATIONDESIRED_STABILIZATIONMODE_RELAYRATE) ? cmd->Roll * stabSettings.ManualRate.fields.Roll : @@ -757,11 +757,11 @@ static void updatePathDesired(__attribute__((unused)) ManualControlCommandData * pathDesired.Start.fields.North = 0; pathDesired.Start.fields.East = 0; pathDesired.Start.fields.Down = positionState.Down - settings.ReturnToHomeAltitudeOffset; - pathDesired.End.fields.North = 0; - pathDesired.End.fields.East = 0; - pathDesired.End.fields.Down = positionState.Down - settings.ReturnToHomeAltitudeOffset; - pathDesired.StartingVelocity = 1; - pathDesired.EndingVelocity = 0; + pathDesired.End.fields.North = 0; + pathDesired.End.fields.East = 0; + pathDesired.End.fields.Down = positionState.Down - settings.ReturnToHomeAltitudeOffset; + pathDesired.StartingVelocity = 1; + pathDesired.EndingVelocity = 0; pathDesired.Mode = PATHDESIRED_MODE_FLYENDPOINT; PathDesiredSet(&pathDesired); } else if (changed) { @@ -772,13 +772,13 @@ static void updatePathDesired(__attribute__((unused)) ManualControlCommandData * PathDesiredData pathDesired; PathDesiredGet(&pathDesired); pathDesired.Start.fields.North = positionState.North; - pathDesired.Start.fields.East = positionState.East; - pathDesired.Start.fields.Down = positionState.Down; - pathDesired.End.fields.North = positionState.North; - pathDesired.End.fields.East = positionState.East; - pathDesired.End.fields.Down = positionState.Down; - pathDesired.StartingVelocity = 1; - pathDesired.EndingVelocity = 0; + pathDesired.Start.fields.East = positionState.East; + pathDesired.Start.fields.Down = positionState.Down; + pathDesired.End.fields.North = positionState.North; + pathDesired.End.fields.East = positionState.East; + pathDesired.End.fields.Down = positionState.Down; + pathDesired.StartingVelocity = 1; + pathDesired.EndingVelocity = 0; pathDesired.Mode = PATHDESIRED_MODE_FLYENDPOINT; PathDesiredSet(&pathDesired); /* Disable this section, until such time as proper discussion can be had about how to implement it for all types of crafts. @@ -816,11 +816,11 @@ static void updateLandDesired(__attribute__((unused)) ManualControlCommandData * pathDesired.Start.fields.North = positionState.North; pathDesired.Start.fields.East = positionState.East; pathDesired.Start.fields.Down = positionState.Down; - pathDesired.End.fields.North = positionState.North; - pathDesired.End.fields.East = positionState.East; - pathDesired.End.fields.Down = positionState.Down; - pathDesired.StartingVelocity = 1; - pathDesired.EndingVelocity = 0; + pathDesired.End.fields.North = positionState.North; + pathDesired.End.fields.East = positionState.East; + pathDesired.End.fields.Down = positionState.Down; + pathDesired.StartingVelocity = 1; + pathDesired.EndingVelocity = 0; pathDesired.Mode = PATHDESIRED_MODE_FLYENDPOINT; } pathDesired.End.fields.Down = positionState.Down + 5; diff --git a/flight/modules/PathPlanner/pathplanner.c b/flight/modules/PathPlanner/pathplanner.c index 003d97a3b..da5ef0225 100644 --- a/flight/modules/PathPlanner/pathplanner.c +++ b/flight/modules/PathPlanner/pathplanner.c @@ -227,9 +227,9 @@ void updatePathDesired(__attribute__((unused)) UAVObjEvent *ev) WaypointInstGet(waypointActiveData.Index, &waypointData); PathActionInstGet(waypointData.Action, &pathActionData); - pathDesired.End.fields.North = waypointData.Position.fields.North; - pathDesired.End.fields.East = waypointData.Position.fields.East; - pathDesired.End.fields.Down = waypointData.Position.fields.Down; + pathDesired.End.fields.North = waypointData.Position.fields.North; + pathDesired.End.fields.East = waypointData.Position.fields.East; + pathDesired.End.fields.Down = waypointData.Position.fields.Down; pathDesired.EndingVelocity = waypointData.Velocity; pathDesired.Mode = pathActionData.Mode; pathDesired.ModeParameters[0] = pathActionData.ModeParameters[0]; @@ -247,18 +247,18 @@ void updatePathDesired(__attribute__((unused)) UAVObjEvent *ev) pathDesired.Start[PATHDESIRED_START_EAST] = waypoint.Position[WAYPOINT_POSITION_EAST]; pathDesired.Start[PATHDESIRED_START_DOWN] = waypoint.Position[WAYPOINT_POSITION_DOWN];*/ pathDesired.Start.fields.North = positionState.North; - pathDesired.Start.fields.East = positionState.East; - pathDesired.Start.fields.Down = positionState.Down; - pathDesired.StartingVelocity = pathDesired.EndingVelocity; + pathDesired.Start.fields.East = positionState.East; + pathDesired.Start.fields.Down = positionState.Down; + pathDesired.StartingVelocity = pathDesired.EndingVelocity; } else { // Get previous waypoint as start point WaypointData waypointPrev; WaypointInstGet(waypointActive.Index - 1, &waypointPrev); pathDesired.Start.fields.North = waypointPrev.Position.fields.North; - pathDesired.Start.fields.East = waypointPrev.Position.fields.East; - pathDesired.Start.fields.Down = waypointPrev.Position.fields.Down; - pathDesired.StartingVelocity = waypointPrev.Velocity; + pathDesired.Start.fields.East = waypointPrev.Position.fields.East; + pathDesired.Start.fields.Down = waypointPrev.Position.fields.Down; + pathDesired.StartingVelocity = waypointPrev.Velocity; } PathDesiredSet(&pathDesired); } diff --git a/flight/modules/Sensors/sensors.c b/flight/modules/Sensors/sensors.c index 0f716848c..77660a63c 100644 --- a/flight/modules/Sensors/sensors.c +++ b/flight/modules/Sensors/sensors.c @@ -446,14 +446,14 @@ static void settingsUpdatedCb(__attribute__((unused)) UAVObjEvent *objEv) AttitudeSettingsGet(&attitudeSettings); // Indicates not to expend cycles on rotation - if (attitudeSettings.BoardRotation.fields.Roll== 0 && attitudeSettings.BoardRotation.fields.Pitch == 0 && + if (attitudeSettings.BoardRotation.fields.Roll == 0 && attitudeSettings.BoardRotation.fields.Pitch == 0 && attitudeSettings.BoardRotation.fields.Yaw == 0) { rotate = 0; } else { float rotationQuat[4]; const float rpy[3] = { attitudeSettings.BoardRotation.fields.Roll, - attitudeSettings.BoardRotation.fields.Pitch , - attitudeSettings.BoardRotation.fields.Yaw}; + attitudeSettings.BoardRotation.fields.Pitch, + attitudeSettings.BoardRotation.fields.Yaw }; RPY2Quaternion(rpy, rotationQuat); Quaternion2R(rotationQuat, R); rotate = 1; diff --git a/flight/modules/Stabilization/relay_tuning.c b/flight/modules/Stabilization/relay_tuning.c index 6b01b8f57..4f2bbffe4 100644 --- a/flight/modules/Stabilization/relay_tuning.c +++ b/flight/modules/Stabilization/relay_tuning.c @@ -70,9 +70,9 @@ int stabilization_relay_rate(float error, float *output, int axis, bool reinit) // On first run initialize estimates to something reasonable if (reinit) { - rateRelayRunning[axis] = false; - relay.Period.data[axis] = 200; - relay.Gain.data[axis] = 0; + rateRelayRunning[axis] = false; + relay.Period.data[axis] = 200; + relay.Gain.data[axis] = 0; accum_sin = 0; accum_cos = 0; @@ -124,9 +124,9 @@ int stabilization_relay_rate(float error, float *output, int axis, bool reinit) accum_cos = 0; if (rateRelayRunning[axis] == false) { - rateRelayRunning[axis] = true; - relay.Period.data[axis] = 200; - relay.Gain.data[axis] = 0; + rateRelayRunning[axis] = true; + relay.Period.data[axis] = 200; + relay.Gain.data[axis] = 0; } else { // Low pass filter each amplitude and period relay.Gain.data[axis] = relay.Gain.data[axis] * AMPLITUDE_ALPHA + this_gain * (1 - AMPLITUDE_ALPHA); diff --git a/flight/modules/Stabilization/stabilization.c b/flight/modules/Stabilization/stabilization.c index a95b39dd4..7e8ecac87 100644 --- a/flight/modules/Stabilization/stabilization.c +++ b/flight/modules/Stabilization/stabilization.c @@ -503,7 +503,7 @@ static void SettingsUpdatedCb(__attribute__((unused)) UAVObjEvent *ev) lowThrottleZeroIntegral = settings.LowThrottleZeroIntegral == STABILIZATIONSETTINGS_LOWTHROTTLEZEROINTEGRAL_TRUE; // Whether to suppress (zero) the StabilizationDesired output for each axis while disarmed or throttle is low - lowThrottleZeroAxis[ROLL] = settings.LowThrottleZeroAxis.fields.Roll== STABILIZATIONSETTINGS_LOWTHROTTLEZEROAXIS_TRUE; + lowThrottleZeroAxis[ROLL] = settings.LowThrottleZeroAxis.fields.Roll == STABILIZATIONSETTINGS_LOWTHROTTLEZEROAXIS_TRUE; lowThrottleZeroAxis[PITCH] = settings.LowThrottleZeroAxis.fields.Pitch == STABILIZATIONSETTINGS_LOWTHROTTLEZEROAXIS_TRUE; lowThrottleZeroAxis[YAW] = settings.LowThrottleZeroAxis.fields.Yaw == STABILIZATIONSETTINGS_LOWTHROTTLEZEROAXIS_TRUE; diff --git a/flight/modules/VtolPathFollower/vtolpathfollower.c b/flight/modules/VtolPathFollower/vtolpathfollower.c index f2f8421f8..cdc813bfa 100644 --- a/flight/modules/VtolPathFollower/vtolpathfollower.c +++ b/flight/modules/VtolPathFollower/vtolpathfollower.c @@ -673,7 +673,7 @@ static void updateVtolDesiredAttitude(bool yaw_attitude) stabDesired.Throttle = manualControl.Throttle; } - stabDesired.StabilizationMode.fields.Roll = STABILIZATIONDESIRED_STABILIZATIONMODE_ATTITUDE; + stabDesired.StabilizationMode.fields.Roll = STABILIZATIONDESIRED_STABILIZATIONMODE_ATTITUDE; stabDesired.StabilizationMode.fields.Pitch = STABILIZATIONDESIRED_STABILIZATIONMODE_ATTITUDE; if (yaw_attitude) { stabDesired.StabilizationMode.fields.Yaw = STABILIZATIONDESIRED_STABILIZATIONMODE_ATTITUDE; diff --git a/ground/uavobjgenerator/generators/flight/uavobjectgeneratorflight.cpp b/ground/uavobjgenerator/generators/flight/uavobjectgeneratorflight.cpp index 9722fc50d..25eebe6ff 100644 --- a/ground/uavobjgenerator/generators/flight/uavobjectgeneratorflight.cpp +++ b/ground/uavobjgenerator/generators/flight/uavobjectgeneratorflight.cpp @@ -125,12 +125,12 @@ bool UAVObjectGeneratorFlight::process_object(ObjectInfo *info) // Append field // Check if it a named set and creates structures accordingly if (info->fields[n]->numElements > 1) { - if(info->fields[n]->elementNames[0].compare(QString("0")) != 0){ + if (info->fields[n]->elementNames[0].compare(QString("0")) != 0) { QString unionTypeName = QString("%1%2Data").arg(info->name).arg(info->fields[n]->name); - QString unionType = QString("typedef union {\n"); + QString unionType = QString("typedef union {\n"); unionType.append(QString(" %1 data[%2];\n").arg(type).arg(info->fields[n]->numElements)); unionType.append(QString(" struct __attribute__ ((__packed__)) {\n")); - for(int f =0; f < info->fields[n]->elementNames.count(); f++){ + for (int f = 0; f < info->fields[n]->elementNames.count(); f++) { unionType.append(QString(" %1 %2;\n").arg(type).arg(info->fields[n]->elementNames[f])); } unionType.append(QString(" } fields;\n")); @@ -140,10 +140,9 @@ bool UAVObjectGeneratorFlight::process_object(ObjectInfo *info) fields.append(QString(" %1 %2;\n").arg(unionTypeName) .arg(info->fields[n]->name)); - } else { - fields.append(QString(" %1 %2[%3];\n").arg(type) - .arg(info->fields[n]->name).arg(info->fields[n]->numElements)); + fields.append(QString(" %1 %2[%3];\n").arg(type) + .arg(info->fields[n]->name).arg(info->fields[n]->numElements)); } } else { fields.append(QString(" %1 %2;\n").arg(type).arg(info->fields[n]->name)); @@ -227,7 +226,7 @@ bool UAVObjectGeneratorFlight::process_object(ObjectInfo *info) // Initialize all fields in the array for (int idx = 0; idx < info->fields[n]->numElements; ++idx) { QString optIdentifier; - if(info->fields[n]->elementNames[0].compare(QString("0")) != 0){ + if (info->fields[n]->elementNames[0].compare(QString("0")) != 0) { optIdentifier = QString(".data"); }