Skip to content

Commit 837a106

Browse files
bkuengdagar
authored andcommitted
px4io, pwm_out: update pwm default checking
The defaults changed in the previous commit for per-channel params, so we make sure that the overall params are still used as long as the per-channel params are default.
1 parent ab1d76a commit 837a106

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/drivers/pwm_out/PWMOut.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -565,7 +565,7 @@ void PWMOut::update_params()
565565
int32_t pwm_min = -1;
566566

567567
if (param_get(param_find(str), &pwm_min) == PX4_OK) {
568-
if (pwm_min >= 0) {
568+
if (pwm_min >= 0 && pwm_min != 1000) {
569569
_mixing_output.minValue(i) = math::constrain(pwm_min, (int32_t) PWM_LOWEST_MIN, (int32_t) PWM_HIGHEST_MIN);
570570

571571
if (pwm_min != _mixing_output.minValue(i)) {
@@ -585,7 +585,7 @@ void PWMOut::update_params()
585585
int32_t pwm_max = -1;
586586

587587
if (param_get(param_find(str), &pwm_max) == PX4_OK) {
588-
if (pwm_max >= 0) {
588+
if (pwm_max >= 0 && pwm_max != 2000) {
589589
_mixing_output.maxValue(i) = math::constrain(pwm_max, (int32_t) PWM_LOWEST_MAX, (int32_t) PWM_HIGHEST_MAX);
590590

591591
if (pwm_max != _mixing_output.maxValue(i)) {
@@ -622,7 +622,7 @@ void PWMOut::update_params()
622622
int32_t pwm_dis = -1;
623623

624624
if (param_get(param_find(str), &pwm_dis) == PX4_OK) {
625-
if (pwm_dis >= 0) {
625+
if (pwm_dis >= 0 && pwm_dis != 900) {
626626
_mixing_output.disarmedValue(i) = math::constrain(pwm_dis, (int32_t) 0, (int32_t) PWM_HIGHEST_MAX);
627627

628628
if (pwm_dis != _mixing_output.disarmedValue(i)) {

src/drivers/px4io/px4io.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -743,7 +743,7 @@ void PX4IO::update_params()
743743
int32_t pwm_min = -1;
744744

745745
if (param_get(param_find(str), &pwm_min) == PX4_OK) {
746-
if (pwm_min >= 0) {
746+
if (pwm_min >= 0 && pwm_min != 1000) {
747747
_mixing_output.minValue(i) = math::constrain(pwm_min, static_cast<int32_t>(PWM_LOWEST_MIN),
748748
static_cast<int32_t>(PWM_HIGHEST_MIN));
749749

@@ -768,7 +768,7 @@ void PX4IO::update_params()
768768
int32_t pwm_max = -1;
769769

770770
if (param_get(param_find(str), &pwm_max) == PX4_OK) {
771-
if (pwm_max >= 0) {
771+
if (pwm_max >= 0 && pwm_max != 2000) {
772772
_mixing_output.maxValue(i) = math::constrain(pwm_max, static_cast<int32_t>(PWM_LOWEST_MAX),
773773
static_cast<int32_t>(PWM_HIGHEST_MAX));
774774

@@ -816,7 +816,7 @@ void PX4IO::update_params()
816816
int32_t pwm_dis = -1;
817817

818818
if (param_get(param_find(str), &pwm_dis) == PX4_OK) {
819-
if (pwm_dis >= 0) {
819+
if (pwm_dis >= 0 && pwm_dis != 900) {
820820
_mixing_output.disarmedValue(i) = math::constrain(pwm_dis, static_cast<int32_t>(0),
821821
static_cast<int32_t>(PWM_HIGHEST_MAX));
822822

0 commit comments

Comments
 (0)