Fix -Wdouble-promotion warnings
We want to avoid using doubles where unnessesary since many embedded targets have only a single precision FPU or no FPU at all. Passing doubles is unavoidable with the printf family of functions, so use an explicit cast to silence the warning.
This commit is contained in:
parent
61fe38d503
commit
748707b6ee
|
|
@ -218,7 +218,7 @@ void Adafruit_GPS::parseLat(char *p) {
|
|||
long minutes = 50 * atol(degreebuff) / 3;
|
||||
latitude_fixed = degree + minutes;
|
||||
latitude = degree / 100000 + minutes * 0.000006F;
|
||||
latitudeDegrees = (latitude - 100 * int(latitude / 100)) / 60.0;
|
||||
latitudeDegrees = (latitude - 100 * int(latitude / 100)) / 60.0f;
|
||||
latitudeDegrees += int(latitude / 100);
|
||||
}
|
||||
}
|
||||
|
|
@ -233,7 +233,7 @@ void Adafruit_GPS::parseLat(char *p) {
|
|||
bool Adafruit_GPS::parseLatDir(char *p) {
|
||||
if (p[0] == 'S') {
|
||||
lat = 'S';
|
||||
latitudeDegrees *= -1.0;
|
||||
latitudeDegrees *= -1.0f;
|
||||
latitude_fixed *= -1;
|
||||
} else if (p[0] == 'N') {
|
||||
lat = 'N';
|
||||
|
|
@ -267,7 +267,7 @@ void Adafruit_GPS::parseLon(char *p) {
|
|||
minutes = 50 * atol(degreebuff) / 3;
|
||||
longitude_fixed = degree + minutes;
|
||||
longitude = degree / 100000 + minutes * 0.000006F;
|
||||
longitudeDegrees = (longitude - 100 * int(longitude / 100)) / 60.0;
|
||||
longitudeDegrees = (longitude - 100 * int(longitude / 100)) / 60.0f;
|
||||
longitudeDegrees += int(longitude / 100);
|
||||
}
|
||||
}
|
||||
|
|
@ -283,7 +283,7 @@ bool Adafruit_GPS::parseLonDir(char *p) {
|
|||
if (!isEmpty(p)) {
|
||||
if (p[0] == 'W') {
|
||||
lon = 'W';
|
||||
longitudeDegrees *= -1.0;
|
||||
longitudeDegrees *= -1.0f;
|
||||
longitude_fixed *= -1;
|
||||
} else if (p[0] == 'E') {
|
||||
lon = 'E';
|
||||
|
|
|
|||
|
|
@ -108,8 +108,8 @@ char *Adafruit_GPS::build(char *nmea, const char *thisSource,
|
|||
// 15) Checksum
|
||||
sprintf(p, "%09.2f,%09.4f,%c,%010.4f,%c,%d,%02d,%f,%f,M,%f,M,,",
|
||||
hour * 10000L + minute * 100L + seconds + milliseconds / 1000.,
|
||||
latitude, lat, longitude, lon, fixquality, satellites, HDOP,
|
||||
altitude, geoidheight);
|
||||
(double)latitude, lat, (double)longitude, lon, fixquality,
|
||||
satellites, (double)HDOP, (double)altitude, (double)geoidheight);
|
||||
|
||||
} else if (!strcmp(thisSentence,
|
||||
"GLL")) { //********************************************GLL
|
||||
|
|
@ -124,7 +124,8 @@ char *Adafruit_GPS::build(char *nmea, const char *thisSource,
|
|||
// 5) Time (UTC)
|
||||
// 6) Status A - Data Valid, V - Data Invalid
|
||||
// 7) Checksum
|
||||
sprintf(p, "%09.4f,%c,%010.4f,%c,%09.2f,A", latitude, lat, longitude, lon,
|
||||
sprintf(p, "%09.4f,%c,%010.4f,%c,%09.2f,A", (double)latitude, lat,
|
||||
(double)longitude, lon,
|
||||
hour * 10000L + minute * 100L + seconds + milliseconds / 1000.);
|
||||
|
||||
} else if (!strcmp(thisSentence,
|
||||
|
|
@ -166,8 +167,9 @@ char *Adafruit_GPS::build(char *nmea, const char *thisSource,
|
|||
// 12) Checksum
|
||||
sprintf(p, "%09.2f,A,%09.4f,%c,%010.4f,%c,%f,%f,%06d,%f,%c",
|
||||
hour * 10000L + minute * 100L + seconds + milliseconds / 1000.,
|
||||
latitude, lat, longitude, lon, speed, angle,
|
||||
day * 10000 + month * 100 + year, magvariation, mag);
|
||||
(double)latitude, lat, (double)longitude, lon, (double)speed,
|
||||
(double)angle, day * 10000 + month * 100 + year,
|
||||
(double)magvariation, mag);
|
||||
|
||||
} else if (!strcmp(thisSentence,
|
||||
"TXT")) { //********************************************TXT
|
||||
|
|
|
|||
Loading…
Reference in New Issue