diff options
author | Andrew Tridgell <tridge@samba.org> | 2014-10-09 15:35:18 +1100 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2014-10-30 08:44:00 +1100 |
commit | dd23d0acbcce9f4c79e120ec782a522164a25d83 (patch) | |
tree | ea8c19c5e8698f1b56a52d0f7cfae4ccca675012 /src/modules | |
parent | 2e33683630002aef5881734c96383685b7e8443f (diff) | |
download | px4-firmware-dd23d0acbcce9f4c79e120ec782a522164a25d83.tar.gz px4-firmware-dd23d0acbcce9f4c79e120ec782a522164a25d83.tar.bz2 px4-firmware-dd23d0acbcce9f4c79e120ec782a522164a25d83.zip |
drivers: allow forcing the safety switch on
This allows forcing the safety switch to the on position from software
which stops the pwm outputs
Diffstat (limited to 'src/modules')
-rw-r--r-- | src/modules/px4iofirmware/protocol.h | 1 | ||||
-rw-r--r-- | src/modules/px4iofirmware/registers.c | 6 |
2 files changed, 7 insertions, 0 deletions
diff --git a/src/modules/px4iofirmware/protocol.h b/src/modules/px4iofirmware/protocol.h index a3e8a58d3..9b2e047cb 100644 --- a/src/modules/px4iofirmware/protocol.h +++ b/src/modules/px4iofirmware/protocol.h @@ -221,6 +221,7 @@ enum { /* DSM bind states */ hence index 12 can safely be used. */ #define PX4IO_P_SETUP_RC_THR_FAILSAFE_US 13 /**< the throttle failsafe pulse length in microseconds */ +#define PX4IO_P_SETUP_FORCE_SAFETY_ON 14 /* force safety switch into 'disarmed' (PWM disabled state) */ #define PX4IO_FORCE_SAFETY_MAGIC 22027 /* required argument for force safety (random) */ /* autopilot control values, -10000..10000 */ diff --git a/src/modules/px4iofirmware/registers.c b/src/modules/px4iofirmware/registers.c index 7f19e983f..49c2a9f56 100644 --- a/src/modules/px4iofirmware/registers.c +++ b/src/modules/px4iofirmware/registers.c @@ -603,6 +603,12 @@ registers_set_one(uint8_t page, uint8_t offset, uint16_t value) dsm_bind(value & 0x0f, (value >> 4) & 0xF); break; + case PX4IO_P_SETUP_FORCE_SAFETY_ON: + if (value == PX4IO_FORCE_SAFETY_MAGIC) { + r_status_flags &= ~PX4IO_P_STATUS_FLAGS_SAFETY_OFF; + } + break; + case PX4IO_P_SETUP_FORCE_SAFETY_OFF: if (value == PX4IO_FORCE_SAFETY_MAGIC) { r_status_flags |= PX4IO_P_STATUS_FLAGS_SAFETY_OFF; |