aboutsummaryrefslogtreecommitdiff
path: root/apps/px4io/safety.c
diff options
context:
space:
mode:
authorLorenz Meier <lm@inf.ethz.ch>2012-12-13 11:12:34 +0100
committerLorenz Meier <lm@inf.ethz.ch>2012-12-13 11:12:34 +0100
commit1fc0a6546e30cfc913de8c0c03cfc625fba5d2ae (patch)
tree65cf4f9b03e9dc63ffdf05ff698272f326d76908 /apps/px4io/safety.c
parent26faab64e5e1679d15afe88ef0edebd598f47dc7 (diff)
parent03076a72ca75917cf62d7889c6c6d0de36866b04 (diff)
downloadpx4-firmware-1fc0a6546e30cfc913de8c0c03cfc625fba5d2ae.tar.gz
px4-firmware-1fc0a6546e30cfc913de8c0c03cfc625fba5d2ae.tar.bz2
px4-firmware-1fc0a6546e30cfc913de8c0c03cfc625fba5d2ae.zip
Merged IO feature branch
Diffstat (limited to 'apps/px4io/safety.c')
-rw-r--r--apps/px4io/safety.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/apps/px4io/safety.c b/apps/px4io/safety.c
index 88e7aeac6..9ce4589b7 100644
--- a/apps/px4io/safety.c
+++ b/apps/px4io/safety.c
@@ -63,15 +63,16 @@ static unsigned counter = 0;
/*
* Define the various LED flash sequences for each system state.
*/
-#define LED_PATTERN_SAFE 0xffff // always on
-#define LED_PATTERN_FMU_ARMED 0x4444 // slow blinking
-#define LED_PATTERN_IO_ARMED 0x5555 // fast blinking
-#define LED_PATTERN_IO_FMU_ARMED 0x5050 // long off then double blink
+#define LED_PATTERN_SAFE 0xffff /**< always on */
+#define LED_PATTERN_VECTOR_FLIGHT_MODE_OK 0x3000 /**< always on with short break */
+#define LED_PATTERN_FMU_ARMED 0x4444 /**< slow blinking */
+#define LED_PATTERN_IO_ARMED 0x5555 /**< fast blinking */
+#define LED_PATTERN_IO_FMU_ARMED 0x5050 /**< long off then double blink */
static unsigned blink_counter = 0;
#define ARM_COUNTER_THRESHOLD 10
-#define DISARM_COUNTER_THRESHOLD 2
+#define DISARM_COUNTER_THRESHOLD 4
static bool safety_button_pressed;
@@ -101,10 +102,6 @@ safety_check_button(void *arg)
*/
safety_button_pressed = BUTTON_SAFETY;
- if(safety_button_pressed) {
- //printf("Pressed, Arm counter: %d, Disarm counter: %d\n", arm_counter, disarm_counter);
- }
-
/* Keep pressed for a while to arm */
if (safety_button_pressed && !system_state.armed) {
if (counter < ARM_COUNTER_THRESHOLD) {
@@ -139,6 +136,8 @@ safety_check_button(void *arg)
}
} else if (system_state.arm_ok) {
pattern = LED_PATTERN_FMU_ARMED;
+ } else if (system_state.vector_flight_mode_ok) {
+ pattern = LED_PATTERN_VECTOR_FLIGHT_MODE_OK;
}
/* Turn the LED on if we have a 1 at the current bit position */
@@ -165,7 +164,7 @@ failsafe_blink(void *arg)
static bool failsafe = false;
/* blink the failsafe LED if we don't have FMU input */
- if (!system_state.mixer_use_fmu) {
+ if (!system_state.mixer_fmu_available) {
failsafe = !failsafe;
} else {
failsafe = false;