From a6ca7c45ac7094c54271d58e7ed1cb8a98f77480 Mon Sep 17 00:00:00 2001 From: pixhawk Date: Wed, 9 Feb 2011 15:09:36 +0100 Subject: [PATCH] Fixed windows MSC compile warnings (Visual Studio) --- src/QGC.cc | 8 +++--- src/comm/MAVLinkSimulationMAV.cc | 2 +- src/ui/HSIDisplay.cc | 52 +++++++++++++++++++------------------- src/ui/map3D/QGCGoogleEarthView.cc | 14 +--------- 4 files changed, 32 insertions(+), 44 deletions(-) diff --git a/src/QGC.cc b/src/QGC.cc index 867be31..eaef767 100644 --- a/src/QGC.cc +++ b/src/QGC.cc @@ -39,14 +39,14 @@ quint64 groundTimeUsecs() float limitAngleToPMPIf(float angle) { - while (angle > (M_PI+FLT_EPSILON)) + while (angle > ((float)M_PI+FLT_EPSILON)) { - angle -= 2 * M_PI; + angle -= 2.0f * (float)M_PI; } - while (angle <= -(M_PI+FLT_EPSILON)) + while (angle <= -((float)M_PI+FLT_EPSILON)) { - angle += 2 * M_PI; + angle += 2.0f * (float)M_PI; } return angle; diff --git a/src/comm/MAVLinkSimulationMAV.cc b/src/comm/MAVLinkSimulationMAV.cc index e896909..69863fe 100644 --- a/src/comm/MAVLinkSimulationMAV.cc +++ b/src/comm/MAVLinkSimulationMAV.cc @@ -169,7 +169,7 @@ void MAVLinkSimulationMAV::mainloop() hud.groundspeed = 9; hud.alt = 123; hud.heading = 90; - hud.climb = 0.1; + hud.climb = 0.1f; hud.throttle = 90; mavlink_msg_vfr_hud_encode(systemid, MAV_COMP_ID_IMU, &msg, &hud); link->sendMAVLinkMessage(&msg); diff --git a/src/ui/HSIDisplay.cc b/src/ui/HSIDisplay.cc index c0eaf6a..49a28a2 100644 --- a/src/ui/HSIDisplay.cc +++ b/src/ui/HSIDisplay.cc @@ -49,30 +49,30 @@ HSIDisplay::HSIDisplay(QWidget *parent) : HDDisplay(NULL, "HSI", parent), gpsSatellites(), satellitesUsed(0), - attXSet(0), - attYSet(0), - attYawSet(0), - altitudeSet(1.0), - posXSet(0), - posYSet(0), - posZSet(0), + attXSet(0.0f), + attYSet(0.0f), + attYawSet(0.0f), + altitudeSet(1.0f), + posXSet(0.0f), + posYSet(0.0f), + posZSet(0.0f), attXSaturation(0.5f), attYSaturation(0.5f), attYawSaturation(0.5f), - posXSaturation(0.05), - posYSaturation(0.05), - altitudeSaturation(1.0), - lat(0), - lon(0), - alt(0), + posXSaturation(0.05f), + posYSaturation(0.05f), + altitudeSaturation(1.0f), + lat(0.0f), + lon(0.0f), + alt(0.0f), globalAvailable(0), - x(0), - y(0), - z(0), - vx(0), - vy(0), - vz(0), - speed(0), + x(0.0f), + y(0.0f), + z(0.0f), + vx(0.0f), + vy(0.0f), + vz(0.0f), + speed(0.0f), localAvailable(0), roll(0.0f), pitch(0.0f), @@ -85,7 +85,7 @@ HSIDisplay::HSIDisplay(QWidget *parent) : uiYSetCoordinate(0.0f), uiZSetCoordinate(0.0f), uiYawSet(0.0f), - metricWidth(4.0f), + metricWidth(4.0), positionLock(false), attControlEnabled(false), xyControlEnabled(false), @@ -105,8 +105,8 @@ HSIDisplay::HSIDisplay(QWidget *parent) : columns = 1; this->setAutoFillBackground(true); - vwidth = 80; - vheight = 80; + vwidth = 80.0f; + vheight = 80.0f; xCenterPos = vwidth/2.0f; yCenterPos = vheight/2.0f + topMargin - bottomMargin; @@ -797,7 +797,7 @@ void HSIDisplay::drawSetpointXY(float x, float y, float yaw, const QColor &color // Scale from metric to screen reference coordinates QPointF p = metricBodyToRef(in); drawCircle(p.x(), p.y(), radius, 0.4f, color, &painter); - radius *= 0.8; + radius *= 0.8f; drawLine(p.x(), p.y(), p.x()+sin(yaw) * radius, p.y()-cos(yaw) * radius, refLineWidthToPen(0.4f), color, &painter); painter.setBrush(color); drawCircle(p.x(), p.y(), radius * 0.1f, 0.1f, color, &painter); @@ -984,7 +984,7 @@ void HSIDisplay::drawPositionDirection(float xRef, float yRef, float radius, con const float minWidth = maxWidth * 0.3f; float angle = atan2(posXSet, -posYSet); - angle -= M_PI/2.0f; + angle -= (float)M_PI/2.0f; QPolygonF p(6); @@ -1022,7 +1022,7 @@ void HSIDisplay::drawAttitudeDirection(float xRef, float yRef, float radius, con const float minWidth = maxWidth * 0.3f; float angle = atan2(attXSet, attYSet); - angle -= M_PI/2.0f; + angle -= (float)M_PI/2.0f; radius *= sqrt(pow(attXSet, 2) + pow(attYSet, 2)) / sqrt(attXSaturation + attYSaturation); diff --git a/src/ui/map3D/QGCGoogleEarthView.cc b/src/ui/map3D/QGCGoogleEarthView.cc index ca397c9..1dfa985 100644 --- a/src/ui/map3D/QGCGoogleEarthView.cc +++ b/src/ui/map3D/QGCGoogleEarthView.cc @@ -183,18 +183,6 @@ void QGCGoogleEarthView::updateWaypoint(int uas, Waypoint* wp) { javaScript(QString("updateWaypoint(%1,%2,%3,%4,%5,%6);").arg(uas).arg(wpindex).arg(wp->getY()).arg(wp->getX()).arg(wp->getZ()).arg(wp->getAction())); } - - } - else - { - // Check if the index of this waypoint is larger than the global - // waypoint list. This implies that the coordinate frame of this - // waypoint was changed and the list containing only global - // waypoints was shortened. Thus update the whole list - // if (waypointPath->points().count() > UASManager::instance()->getUASForId(uas)->getWaypointManager()->getGlobalFrameCount()) - // { - // updateWaypointList(uas); - // } } } @@ -355,7 +343,7 @@ void QGCGoogleEarthView::initializeGoogleEarth() #endif #ifdef _MSC_VER QAxObject* doc = webViewWin->querySubObject("Document()"); - IDispatch* Disp; + //IDispatch* Disp; IDispatch* winDoc = NULL; //332C4425-26CB-11D0-B483-00C04FD90119 IHTMLDocument2