aboutsummaryrefslogtreecommitdiff
path: root/src/drivers/px4io/px4io.cpp
diff options
context:
space:
mode:
authorLorenz Meier <lm@inf.ethz.ch>2013-08-31 11:22:41 +0200
committerLorenz Meier <lm@inf.ethz.ch>2013-08-31 11:22:41 +0200
commit669a8029212a715118bf380a524fb7ced64ccacc (patch)
treec54456bca4c7168add51903e8ce8df03081ddfec /src/drivers/px4io/px4io.cpp
parentacc06e7eb1dafa8b4bc22b34c2b2c567d67e6b37 (diff)
downloadpx4-firmware-669a8029212a715118bf380a524fb7ced64ccacc.tar.gz
px4-firmware-669a8029212a715118bf380a524fb7ced64ccacc.tar.bz2
px4-firmware-669a8029212a715118bf380a524fb7ced64ccacc.zip
Hotfix: Better PX4IO detection feedbak
Diffstat (limited to 'src/drivers/px4io/px4io.cpp')
-rw-r--r--src/drivers/px4io/px4io.cpp19
1 files changed, 12 insertions, 7 deletions
diff --git a/src/drivers/px4io/px4io.cpp b/src/drivers/px4io/px4io.cpp
index 47baa5770..c88abe59a 100644
--- a/src/drivers/px4io/px4io.cpp
+++ b/src/drivers/px4io/px4io.cpp
@@ -497,7 +497,13 @@ PX4IO::detect()
/* get some parameters */
unsigned protocol = io_reg_get(PX4IO_PAGE_CONFIG, PX4IO_P_CONFIG_PROTOCOL_VERSION);
if (protocol != PX4IO_PROTOCOL_VERSION) {
- log("IO not installed");
+ if (protocol == _io_reg_get_error) {
+ log("IO not installed");
+ } else {
+ log("IO version error");
+ mavlink_log_emergency(_mavlink_fd, "IO VERSION MISMATCH, PLEASE UPGRADE SOFTWARE!");
+ }
+
return -1;
}
log("IO found");
@@ -914,7 +920,6 @@ PX4IO::set_max_values(const uint16_t *vals, unsigned len)
int
PX4IO::set_idle_values(const uint16_t *vals, unsigned len)
{
- uint16_t regs[_max_actuators];
if (len > _max_actuators)
/* fail with error */
@@ -1612,7 +1617,7 @@ PX4IO::print_status()
}
printf("failsafe");
for (unsigned i = 0; i < _max_actuators; i++)
- printf(" %u\n", io_reg_get(PX4IO_PAGE_FAILSAFE_PWM, i));
+ printf(" %u", io_reg_get(PX4IO_PAGE_FAILSAFE_PWM, i));
printf("\nidle values");
for (unsigned i = 0; i < _max_actuators; i++)
printf(" %u", io_reg_get(PX4IO_PAGE_IDLE_PWM, i));
@@ -2233,7 +2238,7 @@ px4io_main(int argc, char *argv[])
/* set values for first 8 channels, fill unassigned channels with 1500. */
uint16_t failsafe[8];
- for (int i = 0; i < sizeof(failsafe) / sizeof(failsafe[0]); i++) {
+ for (unsigned i = 0; i < sizeof(failsafe) / sizeof(failsafe[0]); i++) {
/* set channel to commandline argument or to 900 for non-provided channels */
if (argc > i + 2) {
@@ -2265,7 +2270,7 @@ px4io_main(int argc, char *argv[])
/* set values for first 8 channels, fill unassigned channels with 900. */
uint16_t min[8];
- for (int i = 0; i < sizeof(min) / sizeof(min[0]); i++)
+ for (unsigned i = 0; i < sizeof(min) / sizeof(min[0]); i++)
{
/* set channel to commanline argument or to 900 for non-provided channels */
if (argc > i + 2) {
@@ -2300,7 +2305,7 @@ px4io_main(int argc, char *argv[])
/* set values for first 8 channels, fill unassigned channels with 2100. */
uint16_t max[8];
- for (int i = 0; i < sizeof(max) / sizeof(max[0]); i++)
+ for (unsigned i = 0; i < sizeof(max) / sizeof(max[0]); i++)
{
/* set channel to commanline argument or to 2100 for non-provided channels */
if (argc > i + 2) {
@@ -2335,7 +2340,7 @@ px4io_main(int argc, char *argv[])
/* set values for first 8 channels, fill unassigned channels with 0. */
uint16_t idle[8];
- for (int i = 0; i < sizeof(idle) / sizeof(idle[0]); i++)
+ for (unsigned i = 0; i < sizeof(idle) / sizeof(idle[0]); i++)
{
/* set channel to commanline argument or to 0 for non-provided channels */
if (argc > i + 2) {