Skip to content

Commit 9a07788

Browse files
committed
Hotfix: Off-by-one fix in overflow check
1 parent ff518e7 commit 9a07788

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/drivers/ardrone_interface/ardrone_motor_control.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -482,10 +482,10 @@ void ardrone_mixing_and_output(int ardrone_write, const struct actuator_controls
482482
motor_pwm[3] = (motor_pwm[3] > 0) ? motor_pwm[3] : 10;
483483

484484
/* Failsafe logic - should never be necessary */
485-
motor_pwm[0] = (motor_pwm[0] <= 512) ? motor_pwm[0] : 512;
486-
motor_pwm[1] = (motor_pwm[1] <= 512) ? motor_pwm[1] : 512;
487-
motor_pwm[2] = (motor_pwm[2] <= 512) ? motor_pwm[2] : 512;
488-
motor_pwm[3] = (motor_pwm[3] <= 512) ? motor_pwm[3] : 512;
485+
motor_pwm[0] = (motor_pwm[0] <= 511) ? motor_pwm[0] : 511;
486+
motor_pwm[1] = (motor_pwm[1] <= 511) ? motor_pwm[1] : 511;
487+
motor_pwm[2] = (motor_pwm[2] <= 511) ? motor_pwm[2] : 511;
488+
motor_pwm[3] = (motor_pwm[3] <= 511) ? motor_pwm[3] : 511;
489489

490490
/* send motors via UART */
491491
ardrone_write_motor_commands(ardrone_write, motor_pwm[0], motor_pwm[1], motor_pwm[2], motor_pwm[3]);

0 commit comments

Comments
 (0)