From 282aa15c2eb6f6d6bed7c8dc0025b28d55115d59 Mon Sep 17 00:00:00 2001 From: pixhawk Date: Wed, 24 Nov 2010 10:31:54 +0100 Subject: [PATCH] Fixed MSVC2008 compilation issues --- src/GAudioOutput.cc | 5 +++-- src/MG.h | 2 +- src/comm/MAVLinkSimulationLink.cc | 6 +++--- src/uas/UAS.cc | 2 +- src/ui/HDDisplay.cc | 4 +++- src/ui/HSIDisplay.cc | 2 +- src/ui/HUD.cc | 3 +++ src/ui/WaypointView.cc | 3 +++ 8 files changed, 18 insertions(+), 9 deletions(-) diff --git a/src/GAudioOutput.cc b/src/GAudioOutput.cc index 6d35f6215..e10d7fa4d 100644 --- a/src/GAudioOutput.cc +++ b/src/GAudioOutput.cc @@ -41,7 +41,8 @@ This file is part of the QGROUNDCONTROL project #endif // Speech synthesis is only supported with MSVC compiler -#if _MSC_VER +#if _MSC_VER2 +// Documentation: http://msdn.microsoft.com/en-us/library/ee125082%28v=VS.85%29.aspx #include using System; using System.Speech.Synthesis; @@ -111,7 +112,7 @@ bool GAudioOutput::say(QString text, int severity) { // Speech synthesis is only supported with MSVC compiler -#ifdef _MSC_VER +#ifdef _MSC_VER2 SpeechSynthesizer synth = new SpeechSynthesizer(); synth.SelectVoice("Microsoft Anna"); synth.SpeakText(text.toStdString().c_str()); diff --git a/src/MG.h b/src/MG.h index bde9c3d37..2e82de2c0 100644 --- a/src/MG.h +++ b/src/MG.h @@ -264,7 +264,7 @@ namespace MG * @param screenDiameter The screen diameter in mm, e.g. 13.3" = 338 mm. */ static void setPixelSize(int horizontalResolution, int verticalResolution, double screenDiameter) { - pixelSize = screenDiameter / sqrt((horizontalResolution^(2)) + (verticalResolution^(2))); + pixelSize = screenDiameter / sqrt(static_cast(horizontalResolution*horizontalResolution + verticalResolution*verticalResolution)); } private: diff --git a/src/comm/MAVLinkSimulationLink.cc b/src/comm/MAVLinkSimulationLink.cc index d63474ad6..56337c48a 100644 --- a/src/comm/MAVLinkSimulationLink.cc +++ b/src/comm/MAVLinkSimulationLink.cc @@ -380,9 +380,9 @@ void MAVLinkSimulationLink::mainloop() // Move X Position - x = x*0.93f + 0.07f*(x+sin(QGC::groundTimeUsecs()) * 0.08f); - y = y*0.93f + 0.07f*(y+sin(QGC::groundTimeUsecs()) * 0.5f); - z = z*0.93f + 0.07f*(z+sin(QGC::groundTimeUsecs()*100000) * 0.1f); + x = x*0.93f + 0.07f*(x+sin(static_cast(QGC::groundTimeUsecs()) * 0.08f)); + y = y*0.93f + 0.07f*(y+sin(static_cast(QGC::groundTimeUsecs()) * 0.5f)); + z = z*0.93f + 0.07f*(z+sin(static_cast(QGC::groundTimeUsecs()*0.001f)) * 0.1f); x = 5247273.0f; y = 465955.0f; // x = (x > 5.0f) ? 5.0f : x; diff --git a/src/uas/UAS.cc b/src/uas/UAS.cc index 3b4f13618..b895e5ad9 100644 --- a/src/uas/UAS.cc +++ b/src/uas/UAS.cc @@ -729,7 +729,7 @@ quint64 UAS::getUnixTime(quint64 time) // 60 seconds // 1000 milliseconds // 1000 microseconds - else if (time < 1261440000000000LLU) + else if (time < 1261440000000000) { if (onboardTimeOffset == 0) { diff --git a/src/ui/HDDisplay.cc b/src/ui/HDDisplay.cc index 5d9a44915..1f8f11208 100644 --- a/src/ui/HDDisplay.cc +++ b/src/ui/HDDisplay.cc @@ -38,7 +38,9 @@ This file is part of the PIXHAWK project #include "HDDisplay.h" #include "ui_HDDisplay.h" #include "MG.h" - +#ifndef M_PI +#define M_PI 3.14159265358979323846 +#endif #include HDDisplay::HDDisplay(QStringList* plotList, QWidget *parent) : diff --git a/src/ui/HSIDisplay.cc b/src/ui/HSIDisplay.cc index e7b0944df..a9a993a02 100644 --- a/src/ui/HSIDisplay.cc +++ b/src/ui/HSIDisplay.cc @@ -478,7 +478,7 @@ void HSIDisplay::updateSpeed(UASInterface* uas, double vx, double vy, double vz, this->vx = vx; this->vy = vy; this->vz = vz; - this->speed = sqrt(pow(vx, 2.0f) + pow(vy, 2.0f) + pow(vz, 2.0f)); + this->speed = sqrt(pow(vx, 2.0) + pow(vy, 2.0) + pow(vz, 2.0)); } void HSIDisplay::setBodySetpointCoordinateXY(double x, double y) diff --git a/src/ui/HUD.cc b/src/ui/HUD.cc index 2267a3f51..872f2b965 100644 --- a/src/ui/HUD.cc +++ b/src/ui/HUD.cc @@ -31,6 +31,9 @@ This file is part of the QGROUNDCONTROL project #include #include +#ifndef M_PI +#define M_PI 3.14159265358979323846 +#endif #include #include "UASManager.h" diff --git a/src/ui/WaypointView.cc b/src/ui/WaypointView.cc index 7e5244a8b..6732b0b79 100644 --- a/src/ui/WaypointView.cc +++ b/src/ui/WaypointView.cc @@ -35,6 +35,9 @@ This file is part of the PIXHAWK project #include #include //M_PI +#ifndef M_PI +#define M_PI 3.14159265358979323846 +#endif #include "WaypointView.h" #include "ui_WaypointView.h" -- 2.22.0