diff options
author | Lorenz Meier <lm@inf.ethz.ch> | 2013-03-07 19:47:43 +0100 |
---|---|---|
committer | Lorenz Meier <lm@inf.ethz.ch> | 2013-03-07 19:47:43 +0100 |
commit | ebac51cad8e144b64938e6726e26bdc23aaf45e5 (patch) | |
tree | 918bbe5135e9d27754ad6bd6719a075cf58f0f71 /apps/px4io | |
parent | 7013eb5e10c63f0d2be5b82d0fdeff31166f5000 (diff) | |
download | px4-firmware-ebac51cad8e144b64938e6726e26bdc23aaf45e5.tar.gz px4-firmware-ebac51cad8e144b64938e6726e26bdc23aaf45e5.tar.bz2 px4-firmware-ebac51cad8e144b64938e6726e26bdc23aaf45e5.zip |
Working on restart resilience, hunting down multi-load mixer issue (still present)
Diffstat (limited to 'apps/px4io')
-rw-r--r-- | apps/px4io/mixer.cpp | 16 | ||||
-rw-r--r-- | apps/px4io/registers.c | 7 |
2 files changed, 20 insertions, 3 deletions
diff --git a/apps/px4io/mixer.cpp b/apps/px4io/mixer.cpp index 0fba2cbe5..54584e685 100644 --- a/apps/px4io/mixer.cpp +++ b/apps/px4io/mixer.cpp @@ -108,9 +108,11 @@ mixer_tick(void) /* * Decide which set of controls we're using. */ - if (r_status_flags & PX4IO_P_STATUS_FLAGS_RAW_PWM) { + if ((r_status_flags & PX4IO_P_STATUS_FLAGS_RAW_PWM) || + !(r_status_flags & PX4IO_P_STATUS_FLAGS_MIXER_OK)) { - /* don't actually mix anything - we already have raw PWM values */ + /* don't actually mix anything - we already have raw PWM values or + not a valid mixer. */ source = MIX_NONE; } else { @@ -239,6 +241,11 @@ static unsigned mixer_text_length = 0; void mixer_handle_text(const void *buffer, size_t length) { + /* do not allow a mixer change while fully armed */ + if (/* FMU is armed */ (r_setup_arming & PX4IO_P_SETUP_ARMING_ARM_OK) && + /* IO is armed */ (r_status_flags & PX4IO_P_STATUS_FLAGS_ARMED)) { + return; + } px4io_mixdata *msg = (px4io_mixdata *)buffer; @@ -252,9 +259,12 @@ mixer_handle_text(const void *buffer, size_t length) switch (msg->action) { case F2I_MIXER_ACTION_RESET: isr_debug(2, "reset"); + + /* FIRST mark the mixer as invalid */ + r_status_flags &= ~PX4IO_P_STATUS_FLAGS_MIXER_OK; + /* THEN actually delete it */ mixer_group.reset(); mixer_text_length = 0; - r_status_flags &= ~PX4IO_P_STATUS_FLAGS_MIXER_OK; /* FALLTHROUGH */ case F2I_MIXER_ACTION_APPEND: diff --git a/apps/px4io/registers.c b/apps/px4io/registers.c index d97fd8d86..511a47f8d 100644 --- a/apps/px4io/registers.c +++ b/apps/px4io/registers.c @@ -361,6 +361,13 @@ registers_set_one(uint8_t page, uint8_t offset, uint16_t value) break; case PX4IO_PAGE_RC_CONFIG: { + + /* do not allow a RC config change while fully armed */ + if (/* FMU is armed */ (r_setup_arming & PX4IO_P_SETUP_ARMING_ARM_OK) && + /* IO is armed */ (r_status_flags & PX4IO_P_STATUS_FLAGS_ARMED)) { + break; + } + unsigned channel = offset / PX4IO_P_RC_CONFIG_STRIDE; unsigned index = offset - channel * PX4IO_P_RC_CONFIG_STRIDE; uint16_t *conf = &r_page_rc_input_config[channel * PX4IO_P_RC_CONFIG_STRIDE]; |