From ac5211108532c0e5a5c0252c41e0f01777906afa Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 11 Feb 2014 15:55:40 +1100 Subject: px4io: support PX4IO_P_SETUP_FORCE_SAFETY_OFF this allows the FMU to force the safety off on the IO board. Useful in two cases: 1) vehicles where the safety switch is impractical or not useful (eg. HAB planes or internal combustion motors) 2) doing ESC calibration on multi-copters --- src/modules/px4iofirmware/protocol.h | 4 ++++ src/modules/px4iofirmware/registers.c | 6 ++++++ 2 files changed, 10 insertions(+) (limited to 'src/modules') diff --git a/src/modules/px4iofirmware/protocol.h b/src/modules/px4iofirmware/protocol.h index a978d483a..6c20d6006 100644 --- a/src/modules/px4iofirmware/protocol.h +++ b/src/modules/px4iofirmware/protocol.h @@ -211,6 +211,10 @@ enum { /* DSM bind states */ /* 12 occupied by CRC */ #define PX4IO_P_SETUP_RC_THR_FAILSAFE_US 13 /**< the throttle failsafe pulse length in microseconds */ +#define PX4IO_P_SETUP_FORCE_SAFETY_OFF 12 /* force safety switch into + 'armed' (PWM enabled) state */ +#define PX4IO_FORCE_SAFETY_MAGIC 22027 /* required argument for force safety (random) */ + /* autopilot control values, -10000..10000 */ #define PX4IO_PAGE_CONTROLS 51 /**< actuator control groups, one after the other, 8 wide */ #define PX4IO_P_CONTROLS_GROUP_0 (PX4IO_PROTOCOL_MAX_CONTROL_COUNT * 0) /**< 0..PX4IO_PROTOCOL_MAX_CONTROL_COUNT - 1 */ diff --git a/src/modules/px4iofirmware/registers.c b/src/modules/px4iofirmware/registers.c index 6752e7b4b..9e5d7e7e2 100644 --- a/src/modules/px4iofirmware/registers.c +++ b/src/modules/px4iofirmware/registers.c @@ -570,6 +570,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_OFF: + if (value == PX4IO_FORCE_SAFETY_MAGIC) { + r_status_flags |= PX4IO_P_STATUS_FLAGS_SAFETY_OFF; + } + break; + default: return -1; } -- cgit v1.2.3