Commit a8d4af86 authored by Don Gagne's avatar Don Gagne

Merge pull request #1441 from DonLakeFlyer/CompilerWarning

Fix new clang warnings
parents 999a4a87 4eb16a06
......@@ -264,7 +264,7 @@ void PrimaryFlightDisplay::updateAttitude(UASInterface* uas, double roll, double
float rolldeg = roll * (180.0 / M_PI);
if (fabsf(roll - rolldeg) > 2.5f) {
if (fabsf((float)roll - rolldeg) > 2.5f) {
_valuesChanged = true;
}
......@@ -277,7 +277,7 @@ void PrimaryFlightDisplay::updateAttitude(UASInterface* uas, double roll, double
float pitchdeg = pitch * (180.0 / M_PI);
if (fabsf(pitch - pitchdeg) > 2.5f) {
if (fabsf((float)pitch - pitchdeg) > 2.5f) {
_valuesChanged = true;
}
......@@ -291,7 +291,7 @@ void PrimaryFlightDisplay::updateAttitude(UASInterface* uas, double roll, double
yaw = yaw * (180.0 / M_PI);
if (yaw<0) yaw+=360;
if (fabsf(heading - yaw) > 10.0f) {
if (fabs(heading - yaw) > 10.0) {
_valuesChanged = true;
}
......@@ -311,11 +311,11 @@ void PrimaryFlightDisplay::updateSpeed(UASInterface* uas, double _groundSpeed, d
Q_UNUSED(uas);
Q_UNUSED(timestamp);
if (fabsf(groundSpeed - _groundSpeed) > 0.5f) {
if (fabs(groundSpeed - _groundSpeed) > 0.5) {
_valuesChanged = true;
}
if (fabsf(airSpeed - _airSpeed) > 1.0f) {
if (fabs(airSpeed - _airSpeed) > 1.0) {
_valuesChanged = true;
}
......@@ -327,19 +327,19 @@ void PrimaryFlightDisplay::updateAltitude(UASInterface* uas, double _altitudeAMS
Q_UNUSED(uas);
Q_UNUSED(timestamp);
if (fabsf(altitudeAMSL - _altitudeAMSL) > 0.5f) {
if (fabs(altitudeAMSL - _altitudeAMSL) > 0.5) {
_valuesChanged = true;
}
if (fabsf(altitudeWGS84 - _altitudeWGS84) > 0.5f) {
if (fabs(altitudeWGS84 - _altitudeWGS84) > 0.5) {
_valuesChanged = true;
}
if (fabsf(altitudeRelative - _altitudeRelative) > 0.5f) {
if (fabs(altitudeRelative - _altitudeRelative) > 0.5) {
_valuesChanged = true;
}
if (fabsf(climbRate - _climbRate) > 0.5f) {
if (fabs(climbRate - _climbRate) > 0.5) {
_valuesChanged = true;
}
......@@ -657,7 +657,7 @@ void PrimaryFlightDisplay::drawPitchScale(
// f(p) = (90-p) * 1/(90-PITCH_SCALE_WIDTHREDUCTION_FROM)
// or PITCH_SCALE_WIDTHREDUCTION + f(pitch) - f(pitch) * PITCH_SCALE_WIDTHREDUCTION
// or PITCH_SCALE_WIDTHREDUCTION (1-f(pitch)) + f(pitch)
int fromVertical = abs(pitch>=0 ? 90-pitch : -90-pitch);
int fromVertical = fabs(pitch>=0 ? 90-pitch : -90-pitch);
float temp = fromVertical * 1/(90.0f-PITCH_SCALE_WIDTHREDUCTION_FROM);
linewidth *= (PITCH_SCALE_WIDTHREDUCTION * (1-temp) + temp);
}
......@@ -882,7 +882,7 @@ void PrimaryFlightDisplay::drawAICompassDisk(QPainter& painter, QRectF area, flo
// TODO : Sign might be wrong?
// TODO : The case where error exceeds max. Truncate to max. and make that visible somehow.
bool errorBeyondRadius = false;
if (abs(navigationCrosstrackError) > CROSSTRACK_MAX) {
if (fabs(navigationCrosstrackError) > CROSSTRACK_MAX) {
errorBeyondRadius = true;
navigationCrosstrackError = navigationCrosstrackError>0 ? CROSSTRACK_MAX : -CROSSTRACK_MAX;
}
......@@ -1026,7 +1026,7 @@ void PrimaryFlightDisplay::drawAltimeter(
painter.drawLine(vvArrowBegin, vvArrowEnd);
// Yeah this is a repetition of above code but we are going to trash it all anyway, so no fix.
float vvArowHeadSize = abs(vvPixHeight - markerHalfHeight*vvSign);
float vvArowHeadSize = fabs(vvPixHeight - markerHalfHeight*vvSign);
if (vvArowHeadSize > w*ALTIMETER_VVI_WIDTH/3) vvArowHeadSize = w*ALTIMETER_VVI_WIDTH/3;
float xcenter = rightEdge-w*ALTIMETER_VVI_WIDTH/2;
......
......@@ -145,7 +145,7 @@ void QGCFlightDisplay::_updateAttitude(UASInterface*, double roll, double pitch,
} else {
bool update = false;
float rolldeg = roll * (180.0 / M_PI);
if (fabsf(roll - rolldeg) > 2.5f) {
if (fabs(roll - rolldeg) > 2.5) {
update = true;
}
_roll = rolldeg;
......@@ -160,7 +160,7 @@ void QGCFlightDisplay::_updateAttitude(UASInterface*, double roll, double pitch,
} else {
bool update = false;
float pitchdeg = pitch * (180.0 / M_PI);
if (fabsf(pitch - pitchdeg) > 2.5f) {
if (fabs(pitch - pitchdeg) > 2.5) {
update = true;
}
_pitch = pitchdeg;
......@@ -176,7 +176,7 @@ void QGCFlightDisplay::_updateAttitude(UASInterface*, double roll, double pitch,
bool update = false;
yaw = yaw * (180.0 / M_PI);
if (yaw < 0) yaw += 360;
if (fabsf(_heading - yaw) > 10.0f) {
if (fabs(_heading - yaw) > 10.0) {
update = true;
}
_heading = yaw;
......@@ -199,11 +199,11 @@ void QGCFlightDisplay::_updateSpeed(UASInterface*, double groundSpeed, double ai
double oldairSpeed = _airSpeed;
_groundSpeed = groundSpeed;
_airSpeed = airSpeed;
if (fabsf(oldgroundSpeed - groundSpeed) > 0.5f) {
if (fabs(oldgroundSpeed - groundSpeed) > 0.5) {
if(_refreshTimer->isActive()) emit groundSpeedChanged();
_valuesChanged = true;
}
if (fabsf(oldairSpeed - airSpeed) > 1.0f) {
if (fabs(oldairSpeed - airSpeed) > 1.0) {
if(_refreshTimer->isActive()) emit airSpeedChanged();
_valuesChanged = true;
}
......@@ -221,19 +221,19 @@ void QGCFlightDisplay::_updateAltitude(UASInterface*, double altitudeAMSL, doubl
if(_climbRate > -0.01 && _climbRate < 0.01) {
_climbRate = 0.0;
}
if (fabsf(oldaltitudeAMSL - altitudeAMSL) > 0.5f) {
if (fabs(oldaltitudeAMSL - altitudeAMSL) > 0.5) {
if(_refreshTimer->isActive()) emit altitudeAMSLChanged();
_valuesChanged = true;
}
if (fabsf(oldaltitudeWGS84 - altitudeWGS84) > 0.5f) {
if (fabs(oldaltitudeWGS84 - altitudeWGS84) > 0.5) {
if(_refreshTimer->isActive()) emit altitudeWGS84Changed();
_valuesChanged = true;
}
if (fabsf(oldaltitudeRelative - altitudeRelative) > 0.5f) {
if (fabs(oldaltitudeRelative - altitudeRelative) > 0.5) {
if(_refreshTimer->isActive()) emit altitudeRelativeChanged();
_valuesChanged = true;
}
if (fabsf(oldclimbRate - climbRate) > 0.5f) {
if (fabs(oldclimbRate - climbRate) > 0.5) {
if(_refreshTimer->isActive()) emit climbRateChanged();
_valuesChanged = true;
}
......
......@@ -307,7 +307,7 @@ void Waypoint2DIcon::paint(QPainter *painter, const QStyleOptionGraphicsItem *op
penDash.setWidth(1);
//penDash.setStyle(Qt::DotLine);
// A negative radius indicates counter-clockwise rotation, but we still want to draw it positive
const int loiter = map->metersToPixels(fabsf(waypoint->getLoiterOrbit()), Coord());
const int loiter = map->metersToPixels(fabs(waypoint->getLoiterOrbit()), Coord());
if (loiter > picture.width()/2)
{
painter->setPen(penBlack);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment