aboutsummaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
authorDon Gagne <don@thegagnes.com>2014-06-29 12:01:43 -0700
committerDon Gagne <don@thegagnes.com>2014-06-29 12:01:43 -0700
commitd5b5dcef24a7f5c7b2ed98081dd69a05f8d46959 (patch)
tree7e0e12ed525d6699c0128eb4137061a6ad0248f3 /src/modules
parent94c69e11ae1ec44c80eec1c979201c7d7e51cdb0 (diff)
downloadpx4-firmware-d5b5dcef24a7f5c7b2ed98081dd69a05f8d46959.tar.gz
px4-firmware-d5b5dcef24a7f5c7b2ed98081dd69a05f8d46959.tar.bz2
px4-firmware-d5b5dcef24a7f5c7b2ed98081dd69a05f8d46959.zip
Fix bugs found through compiler warnings
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/commander/commander.cpp1
-rw-r--r--src/modules/ekf_att_pos_estimator/estimator.cpp2
-rw-r--r--src/modules/ekf_att_pos_estimator/estimator.h2
-rw-r--r--src/modules/gpio_led/gpio_led.c3
-rw-r--r--src/modules/px4iofirmware/sbus.c10
5 files changed, 13 insertions, 5 deletions
diff --git a/src/modules/commander/commander.cpp b/src/modules/commander/commander.cpp
index 1535967b1..3cd250458 100644
--- a/src/modules/commander/commander.cpp
+++ b/src/modules/commander/commander.cpp
@@ -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[])
diff --git a/src/modules/ekf_att_pos_estimator/estimator.cpp b/src/modules/ekf_att_pos_estimator/estimator.cpp
index 1320b4668..f8b9e9fbd 100644
--- a/src/modules/ekf_att_pos_estimator/estimator.cpp
+++ b/src/modules/ekf_att_pos_estimator/estimator.cpp
@@ -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);
diff --git a/src/modules/ekf_att_pos_estimator/estimator.h b/src/modules/ekf_att_pos_estimator/estimator.h
index e821089f2..69d8cfce8 100644
--- a/src/modules/ekf_att_pos_estimator/estimator.h
+++ b/src/modules/ekf_att_pos_estimator/estimator.h
@@ -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]);
diff --git a/src/modules/gpio_led/gpio_led.c b/src/modules/gpio_led/gpio_led.c
index 839a7890b..1fc6d1295 100644
--- a/src/modules/gpio_led/gpio_led.c
+++ b/src/modules/gpio_led/gpio_led.c
@@ -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");
diff --git a/src/modules/px4iofirmware/sbus.c b/src/modules/px4iofirmware/sbus.c
index 0e7dc621c..8ed69678c 100644
--- a/src/modules/px4iofirmware/sbus.c
+++ b/src/modules/px4iofirmware/sbus.c
@@ -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