Fix bugs found through compiler warnings

This commit is contained in:
Don Gagne
2014-06-29 12:01:43 -07:00
parent 94c69e11ae
commit d5b5dcef24
10 changed files with 33 additions and 14 deletions
+1
View File
@@ -603,6 +603,7 @@ bool handle_command(struct vehicle_status_s *status, const struct safety_s *safe
// XXX TODO
}
return true;
}
int commander_thread_main(int argc, char *argv[])
@@ -1986,7 +1986,7 @@ void AttPosEKF::calcposNED(float (&posNED)[3], double lat, double lon, float hgt
posNED[2] = -(hgt - hgtRef);
}
void AttPosEKF::calcLLH(float (&posNED)[3], float lat, float lon, float hgt, float latRef, float lonRef, float hgtRef)
void AttPosEKF::calcLLH(float posNED[3], float &lat, float &lon, float &hgt, float latRef, float lonRef, float hgtRef)
{
lat = latRef + posNED[0] * earthRadiusInv;
lon = lonRef + posNED[1] * earthRadiusInv / cos(latRef);
@@ -301,7 +301,7 @@ static void calcvelNED(float (&velNED)[3], float gpsCourse, float gpsGndSpd, flo
static void calcposNED(float (&posNED)[3], double lat, double lon, float hgt, double latRef, double lonRef, float hgtRef);
static void calcLLH(float (&posNED)[3], float lat, float lon, float hgt, float latRef, float lonRef, float hgtRef);
static void calcLLH(float posNED[3], float &lat, float &lon, float &hgt, float latRef, float lonRef, float hgtRef);
static void quat2Tnb(Mat3f &Tnb, const float (&quat)[4]);
+2 -1
View File
@@ -189,7 +189,8 @@ int gpio_led_main(int argc, char *argv[])
} else if (!strcmp(argv[1], "stop")) {
if (gpio_led_started) {
gpio_led_started = false;
warnx("stop");
// FIXME: Is this correct? changed from warnx
errx(0, "stop");
} else {
errx(1, "not running");
+8 -2
View File
@@ -119,13 +119,19 @@ sbus_init(const char *device)
bool
sbus1_output(uint16_t *values, uint16_t num_values)
{
write(sbus_fd, 'A', 1);
// FIXME: I assume this was previously NYI?
ssize_t cBytes = num_values * sizeof(values[0]);
ssize_t cBytesWritten = write(sbus_fd, values, cBytes);
return cBytesWritten == cBytes;
}
bool
sbus2_output(uint16_t *values, uint16_t num_values)
{
write(sbus_fd, 'B', 1);
// FIXME: I assume this was previously NYI?
ssize_t cBytes = num_values * sizeof(values[0]);
ssize_t cBytesWritten = write(sbus_fd, values, cBytes);
return cBytesWritten == cBytes;
}
bool