mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-05-17 10:37:36 +08:00
fix argument order in pwm_limit_calc call, clean up
note that FMU does not update AUX pwm outputs if no RC signal
This commit is contained in:
committed by
Lorenz Meier
parent
f3c3d1f7f9
commit
009a413438
@@ -119,7 +119,13 @@ MixerGroup::set_trims(uint16_t *values, unsigned n)
|
||||
unsigned index = 0;
|
||||
|
||||
while ((mixer != nullptr) && (index < n)) {
|
||||
/* hardwired assumption that PWM output range is [1000, 2000] usec */
|
||||
/*
|
||||
* hardwired assumption that PWM output range is [1000, 2000] usec
|
||||
*
|
||||
* This only works with SimpleMixer::set_trim(float) which always returns the value one,
|
||||
* but the only other existing implementation is MultirotorMixer, which ignores
|
||||
* the trim value.
|
||||
*/
|
||||
float offset = ((float)values[index] - 1500) / 500;
|
||||
|
||||
/* to be safe, clamp offset to range of [-100, 100] usec */
|
||||
@@ -127,6 +133,7 @@ MixerGroup::set_trims(uint16_t *values, unsigned n)
|
||||
|
||||
if (offset > 0.2f) { offset = 0.2f; }
|
||||
|
||||
debug("set trim: %d, offset: %5.3f", values[index], (double)offset);
|
||||
index += mixer->set_trim(offset);
|
||||
mixer = mixer->_next;
|
||||
}
|
||||
|
||||
@@ -192,6 +192,7 @@ void pwm_limit_calc(const bool armed, const bool pre_armed, const unsigned num_c
|
||||
break;
|
||||
|
||||
case PWM_LIMIT_STATE_ON:
|
||||
|
||||
for (unsigned i = 0; i < num_channels; i++) {
|
||||
|
||||
float control_value = output[i];
|
||||
@@ -223,6 +224,7 @@ void pwm_limit_calc(const bool armed, const bool pre_armed, const unsigned num_c
|
||||
} else if (effective_pwm[i] > max_pwm[i]) {
|
||||
effective_pwm[i] = max_pwm[i];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user