diff options
author | Lorenz Meier <lm@inf.ethz.ch> | 2013-12-27 21:33:19 +0100 |
---|---|---|
committer | Lorenz Meier <lm@inf.ethz.ch> | 2013-12-27 21:33:19 +0100 |
commit | 965a7a4f0313ccfe67e6c0f84d76ff3350602fb0 (patch) | |
tree | 139156533f10b4a33819a2d0db4acb795083301d /src/modules | |
parent | a9ea39054dbd6eb62fb3185465848a485c32a046 (diff) | |
download | px4-firmware-965a7a4f0313ccfe67e6c0f84d76ff3350602fb0.tar.gz px4-firmware-965a7a4f0313ccfe67e6c0f84d76ff3350602fb0.tar.bz2 px4-firmware-965a7a4f0313ccfe67e6c0f84d76ff3350602fb0.zip |
Allow to disable a channel
Diffstat (limited to 'src/modules')
-rw-r--r-- | src/modules/px4iofirmware/registers.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/modules/px4iofirmware/registers.c b/src/modules/px4iofirmware/registers.c index b0922f4d6..0358725db 100644 --- a/src/modules/px4iofirmware/registers.c +++ b/src/modules/px4iofirmware/registers.c @@ -584,6 +584,7 @@ registers_set_one(uint8_t page, uint8_t offset, uint16_t value) /* this option is normally set last */ if (value & PX4IO_P_RC_CONFIG_OPTIONS_ENABLED) { uint8_t count = 0; + bool disabled = false; /* assert min..center..max ordering */ if (conf[PX4IO_P_RC_CONFIG_MIN] < 500) { @@ -602,7 +603,10 @@ registers_set_one(uint8_t page, uint8_t offset, uint16_t value) if (conf[PX4IO_P_RC_CONFIG_DEADZONE] > 500) { count++; } - if ((int)(conf[PX4IO_P_RC_CONFIG_ASSIGNMENT]) < 0 || conf[PX4IO_P_RC_CONFIG_ASSIGNMENT] >= PX4IO_RC_MAPPED_CONTROL_CHANNELS) { + + if (conf[PX4IO_P_RC_CONFIG_ASSIGNMENT] == UINT8_MAX) { + disabled = true; + } else if ((int)(conf[PX4IO_P_RC_CONFIG_ASSIGNMENT]) < 0 || conf[PX4IO_P_RC_CONFIG_ASSIGNMENT] >= PX4IO_RC_MAPPED_CONTROL_CHANNELS) { count++; } @@ -610,7 +614,7 @@ registers_set_one(uint8_t page, uint8_t offset, uint16_t value) if (count) { isr_debug(0, "ERROR: %d config error(s) for RC%d.\n", count, (channel + 1)); r_status_flags &= ~PX4IO_P_STATUS_FLAGS_INIT_OK; - } else { + } else if (!disabled) { conf[index] |= PX4IO_P_RC_CONFIG_OPTIONS_ENABLED; } } |