diff options
author | px4dev <px4@purgatory.org> | 2012-08-11 10:34:02 -0700 |
---|---|---|
committer | px4dev <px4@purgatory.org> | 2012-08-11 10:34:54 -0700 |
commit | 42ace38e3199670c05e5888933aaedfc25b03265 (patch) | |
tree | 7efee9f3fc31b2c007d154f27107b37439ea5f69 | |
parent | 4eef4e186437c6b923df7b9dcffdc3723c411560 (diff) | |
download | px4-firmware-42ace38e3199670c05e5888933aaedfc25b03265.tar.gz px4-firmware-42ace38e3199670c05e5888933aaedfc25b03265.tar.bz2 px4-firmware-42ace38e3199670c05e5888933aaedfc25b03265.zip |
Don't try to mix if we have no mixer installed.
-rw-r--r-- | apps/px4/fmu/fmu.cpp | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/apps/px4/fmu/fmu.cpp b/apps/px4/fmu/fmu.cpp index 779df4ba1..bac9431eb 100644 --- a/apps/px4/fmu/fmu.cpp +++ b/apps/px4/fmu/fmu.cpp @@ -226,7 +226,7 @@ FMUServo::task_main() while (!_task_should_exit) { /* sleep waiting for data, but no more than 100ms */ - int ret = ::poll(&fds[0], 2, 100); + int ret = ::poll(&fds[0], 2, 1000); /* this would be bad... */ if (ret < 0) { @@ -239,17 +239,21 @@ FMUServo::task_main() if (fds[0].revents & POLLIN) { float outputs[num_outputs]; - /* get controls */ + /* get controls - must always do this to avoid spinning */ orb_copy(ORB_ID_VEHICLE_ATTITUDE_CONTROLS, _t_actuators, &_controls); - /* do mixing */ - _mixers->mix(&outputs[0], num_outputs); + /* can we mix? */ + if (_mixers != nullptr) { - /* iterate actuators */ - for (unsigned i = 0; i < num_outputs; i++) { + /* do mixing */ + _mixers->mix(&outputs[0], num_outputs); - /* scale for PWM output 900 - 2100us */ - up_pwm_servo_set(i, 1500 + (600 * outputs[i])); + /* iterate actuators */ + for (unsigned i = 0; i < num_outputs; i++) { + + /* scale for PWM output 900 - 2100us */ + up_pwm_servo_set(i, 1500 + (600 * outputs[i])); + } } } |