aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2014-02-11 15:55:40 +1100
committerLorenz Meier <lm@inf.ethz.ch>2014-04-28 11:45:20 +0200
commitac5211108532c0e5a5c0252c41e0f01777906afa (patch)
tree7fb0c35009ab2023cf66183d1f77de8bc607422a /src
parent9f2c4b7513adb6c543fd2c0f729f11ed3d195f72 (diff)
downloadpx4-firmware-ac5211108532c0e5a5c0252c41e0f01777906afa.tar.gz
px4-firmware-ac5211108532c0e5a5c0252c41e0f01777906afa.tar.bz2
px4-firmware-ac5211108532c0e5a5c0252c41e0f01777906afa.zip
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
Diffstat (limited to 'src')
-rw-r--r--src/modules/px4iofirmware/protocol.h4
-rw-r--r--src/modules/px4iofirmware/registers.c6
2 files changed, 10 insertions, 0 deletions
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;
}