aboutsummaryrefslogtreecommitdiff
path: root/apps/drivers/px4io/px4io.cpp
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2013-02-18 14:16:09 +1100
committerAndrew Tridgell <tridge@samba.org>2013-02-18 14:16:09 +1100
commit317515fb6a3d6e469681b53316d69c7669efdaf0 (patch)
tree8b7a08491c482c0d335e60b2c76a99ef68d4a60a /apps/drivers/px4io/px4io.cpp
parent1670b8afe13ba6c845800228d1c8829aa1bf31c9 (diff)
downloadpx4-firmware-317515fb6a3d6e469681b53316d69c7669efdaf0.tar.gz
px4-firmware-317515fb6a3d6e469681b53316d69c7669efdaf0.tar.bz2
px4-firmware-317515fb6a3d6e469681b53316d69c7669efdaf0.zip
px4io: added INAIR_RESTART enable/disable flags
the autopilot code needs to know that in-air restart may happen, so it should be something that is enabled, rather than on by default.
Diffstat (limited to 'apps/drivers/px4io/px4io.cpp')
-rw-r--r--apps/drivers/px4io/px4io.cpp18
1 files changed, 17 insertions, 1 deletions
diff --git a/apps/drivers/px4io/px4io.cpp b/apps/drivers/px4io/px4io.cpp
index b2e0c6ee4..adb894371 100644
--- a/apps/drivers/px4io/px4io.cpp
+++ b/apps/drivers/px4io/px4io.cpp
@@ -367,7 +367,12 @@ PX4IO::init()
if (ret != OK)
return ret;
- if (reg & PX4IO_P_SETUP_ARMING_ARM_OK) {
+ /*
+ * in-air restart is only tried if the IO board reports it is
+ * already armed, and has been configured for in-air restart
+ */
+ if ((reg & PX4IO_P_SETUP_ARMING_INAIR_RESTART_OK) &&
+ (reg & PX4IO_P_SETUP_ARMING_ARM_OK)) {
/* WARNING: COMMANDER app/vehicle status must be initialized.
* If this fails (or the app is not started), worst-case IO
@@ -450,6 +455,7 @@ PX4IO::init()
/* dis-arm IO before touching anything */
io_reg_modify(PX4IO_PAGE_SETUP, PX4IO_P_SETUP_ARMING,
PX4IO_P_SETUP_ARMING_ARM_OK |
+ PX4IO_P_SETUP_ARMING_INAIR_RESTART_OK |
PX4IO_P_SETUP_ARMING_MANUAL_OVERRIDE_OK |
PX4IO_P_SETUP_ARMING_VECTOR_FLIGHT_OK, 0);
@@ -1164,6 +1170,16 @@ PX4IO::ioctl(file *filep, int cmd, unsigned long arg)
ret = io_reg_modify(PX4IO_PAGE_SETUP, PX4IO_P_SETUP_ARMING, PX4IO_P_SETUP_ARMING_ARM_OK, 0);
break;
+ case PWM_SERVO_INAIR_RESTART_ENABLE:
+ /* set the 'in-air restart' bit */
+ ret = io_reg_modify(PX4IO_PAGE_SETUP, PX4IO_P_SETUP_ARMING, 0, PX4IO_P_SETUP_ARMING_INAIR_RESTART_OK);
+ break;
+
+ case PWM_SERVO_INAIR_RESTART_DISABLE:
+ /* unset the 'in-air restart' bit */
+ ret = io_reg_modify(PX4IO_PAGE_SETUP, PX4IO_P_SETUP_ARMING, PX4IO_P_SETUP_ARMING_INAIR_RESTART_OK, 0);
+ break;
+
case PWM_SERVO_SET_UPDATE_RATE:
/* set the requested rate */
if ((arg >= 50) && (arg <= 400)) {