Commit 017e564a authored by Don Gagne's avatar Don Gagne

Fix double->float truncations

parent 96fd7a03
......@@ -353,8 +353,8 @@ void QGCFlightGearLink::readBytes()
// qDebug() << "sensorHilRawImuChanged " << xacc << yacc << zacc << rollspeed << pitchspeed << yawspeed << xmag << ymag << zmag << abs_pressure << diff_pressure << pressure_alt << temperature;
int gps_fix_type = 3;
float eph = 0.3;
float epv = 0.6;
float eph = 0.3f;
float epv = 0.6f;
float vel = sqrt(vx*vx + vy*vy + vz*vz);
float cog = yaw;
int satellites = 8;
......
......@@ -518,19 +518,19 @@ void QGCXPlaneLink::readBytes()
// X-Plane expresses yaw as 0..2 PI
if (yaw > M_PI) {
yaw -= 2.0 * M_PI;
yaw -= 2.0f * static_cast<float>(M_PI);
}
if (yaw < -M_PI) {
yaw += 2.0 * M_PI;
yaw += 2.0f * static_cast<float>(M_PI);
}
float yawmag = p.f[3] / 180.0f * M_PI;
if (yawmag > M_PI) {
yawmag -= 2.0 * M_PI;
yawmag -= 2.0f * static_cast<float>(M_PI);
}
if (yawmag < -M_PI) {
yawmag += 2.0 * M_PI;
yawmag += 2.0f * static_cast<float>(M_PI);
}
// Normal rotation matrix, but since we rotate the
......@@ -689,8 +689,8 @@ void QGCXPlaneLink::readBytes()
// XXX make these GUI-configurable and add randomness
int gps_fix_type = 3;
float eph = 0.3;
float epv = 0.6;
float eph = 0.3f;
float epv = 0.6f;
float vel = sqrt(vx*vx + vy*vy + vz*vz);
float cog = atan2(vy, vx);
int satellites = 8;
......
......@@ -3198,7 +3198,7 @@ void UAS::sendHilGps(quint64 time_us, double lat, double lon, double alt, int fi
float course = cog;
// map to 0..2pi
if (course < 0)
course += 2.0f * M_PI;
course += 2.0f * static_cast<float>(M_PI);
// scale from radians to degrees
course = (course / M_PI) * 180.0f;
......
......@@ -33,7 +33,7 @@ static const float PITCHTRANSLATION = 65;
// 5 degrees for each line
static const int PITCH_SCALE_RESOLUTION = 5;
static const float PITCH_SCALE_MAJORWIDTH = 0.1f;
static const float PITCH_SCALE_MINORWIDTH = 0.066;
static const float PITCH_SCALE_MINORWIDTH = 0.066f;
// Beginning from PITCH_SCALE_WIDTHREDUCTION_FROM degrees of +/- pitch, the
// width of the lines is reduced, down to PITCH_SCALE_WIDTHREDUCTION times
......@@ -49,18 +49,18 @@ static const int PITCH_SCALE_HALFRANGE = 15;
static const int COMPASS_DISK_MAJORTICK = 10;
static const int COMPASS_DISK_ARROWTICK = 45;
static const float COMPASS_DISK_MAJORLINEWIDTH = 0.006;
static const float COMPASS_DISK_MINORLINEWIDTH = 0.004;
static const float COMPASS_DISK_MAJORLINEWIDTH = 0.006f;
static const float COMPASS_DISK_MINORLINEWIDTH = 0.004f;
static const int COMPASS_DISK_RESOLUTION = 10;
static const float COMPASS_SEPARATE_DISK_RESOLUTION = 5;
static const float COMPASS_DISK_MARKERWIDTH = 0.2;
static const float COMPASS_DISK_MARKERHEIGHT = 0.133;
static const float COMPASS_SEPARATE_DISK_RESOLUTION = 5.0f;
static const float COMPASS_DISK_MARKERWIDTH = 0.2f;
static const float COMPASS_DISK_MARKERHEIGHT = 0.133f;
static const int CROSSTRACK_MAX = 1000;
static const float CROSSTRACK_RADIUS = 0.6;
static const float CROSSTRACK_RADIUS = 0.6f;
static const float TAPE_GAUGES_TICKWIDTH_MAJOR = 0.25;
static const float TAPE_GAUGES_TICKWIDTH_MINOR = 0.15;
static const float TAPE_GAUGES_TICKWIDTH_MAJOR = 0.25f;
static const float TAPE_GAUGES_TICKWIDTH_MINOR = 0.15f;
// The altitude difference between top and bottom of scale
static const int ALTIMETER_LINEAR_SPAN = 50;
......
......@@ -149,39 +149,39 @@ void BatteryMonitorConfig::monitorCurrentIndexChanged(int index)
}
void BatteryMonitorConfig::sensorCurrentIndexChanged(int index)
{
float maxvolt = 0.0;
float maxamps = 0.0;
float mvpervolt = 0.0;
float mvperamp = 0.0;
float topvolt = 0.0;
float topamps = 0.0;
float maxvolt = 0.0f;
float maxamps = 0.0f;
float mvpervolt = 0.0f;
float mvperamp = 0.0f;
float topvolt = 0.0f;
float topamps = 0.0f;
if (index == 1)
{
//atto 45 see https://www.sparkfun.com/products/10643
maxvolt = 13.6;
maxamps = 44.7;
maxvolt = 13.6f;
maxamps = 44.7f;
}
else if (index == 2)
{
//atto 90 see https://www.sparkfun.com/products/9028
maxvolt = 51.8;
maxamps = 89.4;
maxvolt = 51.8f;
maxamps = 89.4f;
}
else if (index == 3)
{
//atto 180 see https://www.sparkfun.com/products/10644
maxvolt = 51.8;
maxamps = 178.8;
maxvolt = 51.8f;
maxamps = 178.8f;
}
else if (index == 4)
{
//3dr
maxvolt = 50.0;
maxamps = 90.0;
maxvolt = 50.0f;
maxamps = 90.0f;
}
mvpervolt = calculatemVPerVolt(3.3,maxvolt);
mvperamp = calculatemVPerAmp(3.3,maxamps);
mvpervolt = calculatemVPerVolt(3.3f, maxvolt);
mvperamp = calculatemVPerAmp(3.3f, maxamps);
if (index == 0)
{
//Other
......
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