aboutsummaryrefslogtreecommitdiff
path: root/apps/px4io/mixer.cpp
diff options
context:
space:
mode:
authorpx4dev <px4@purgatory.org>2012-12-29 16:01:24 -0800
committerpx4dev <px4@purgatory.org>2012-12-29 16:01:24 -0800
commitd81edb09cf29dd36d50ce7a7bcf55631fecc470f (patch)
tree63cb30938794a69981782ff666b9e181c2b286da /apps/px4io/mixer.cpp
parentf9520ee39d0e14bc67cce809375fb69de9a7f977 (diff)
downloadpx4-firmware-d81edb09cf29dd36d50ce7a7bcf55631fecc470f.tar.gz
px4-firmware-d81edb09cf29dd36d50ce7a7bcf55631fecc470f.tar.bz2
px4-firmware-d81edb09cf29dd36d50ce7a7bcf55631fecc470f.zip
whitespace/formatting
Diffstat (limited to 'apps/px4io/mixer.cpp')
-rw-r--r--apps/px4io/mixer.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/apps/px4io/mixer.cpp b/apps/px4io/mixer.cpp
index 9b3d65dba..0fd4ac717 100644
--- a/apps/px4io/mixer.cpp
+++ b/apps/px4io/mixer.cpp
@@ -69,9 +69,9 @@ static uint16_t *control_values;
static int control_count;
static int mixer_callback(uintptr_t handle,
- uint8_t control_group,
- uint8_t control_index,
- float &control);
+ uint8_t control_group,
+ uint8_t control_index,
+ float &control);
static MixerGroup mixer_group(mixer_callback, 0);
@@ -96,6 +96,7 @@ mixer_tick(void)
if (fmu_input_drops >= FMU_INPUT_DROP_LIMIT) {
system_state.mixer_use_fmu = false;
}
+
} else {
fmu_input_drops = 0;
system_state.fmu_data_received = false;
@@ -127,6 +128,7 @@ mixer_tick(void)
if (i < mixed) {
/* scale to servo output */
system_state.servos[i] = (outputs[i] * 500.0f) + 1500;
+
} else {
/* set to zero to inhibit PWM pulse output */
system_state.servos[i] = 0;
@@ -144,6 +146,7 @@ mixer_tick(void)
* Decide whether the servos should be armed right now.
*/
should_arm = system_state.armed && system_state.arm_ok && (control_count > 0);
+
if (should_arm && !mixer_servos_armed) {
/* need to arm, but not armed */
up_pwm_servo_arm(true);
@@ -180,6 +183,7 @@ mixer_handle_text(const void *buffer, size_t length)
static unsigned mixer_text_length = 0;
px4io_mixdata *msg = (px4io_mixdata *)buffer;
+
if (length < sizeof(px4io_mixdata))
return;
@@ -189,8 +193,10 @@ mixer_handle_text(const void *buffer, size_t length)
case F2I_MIXER_ACTION_RESET:
mixer_group.reset();
mixer_text_length = 0;
+
/* FALLTHROUGH */
case F2I_MIXER_ACTION_APPEND:
+
/* check for overflow - this is really fatal */
if ((mixer_text_length + text_length + 1) > sizeof(mixer_text))
return;
@@ -207,6 +213,7 @@ mixer_handle_text(const void *buffer, size_t length)
/* copy any leftover text to the base of the buffer for re-use */
if (mixer_text_length > 0)
memcpy(&mixer_text[0], end - mixer_text_length, mixer_text_length);
+
break;
}
} \ No newline at end of file