Skip to content

Commit 964a835

Browse files
authored
Merge pull request #187 from MarkAYoder/prufix
Fixed off by one for motor==0
2 parents 23773c8 + 6d03fe3 commit 964a835

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

library/src/motor.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ int rc_motor_set(int motor, double duty)
254254
else if (duty <-1.0) duty =-1.0;
255255

256256
if(motor==0){
257-
for(i=1;i<channels;i++){
257+
for(i=1;i<=channels;i++){
258258
if(rc_motor_set(i,duty)==-1) return -1;
259259
}
260260
return 0;
@@ -298,7 +298,7 @@ int rc_motor_free_spin(int motor)
298298

299299
// case for all channels
300300
if(motor==0){
301-
for(i=1;i<channels;i++){
301+
for(i=1;i<=channels;i++){
302302
if(rc_motor_free_spin(i)==-1) return -1;
303303
}
304304
return 0;
@@ -337,7 +337,7 @@ int rc_motor_brake(int motor)
337337

338338
// case for all channels
339339
if(motor==0){
340-
for(i=1;i<channels;i++){
340+
for(i=1;i<=channels;i++){
341341
if(rc_motor_brake(i)==-1) return -1;
342342
}
343343
return 0;

0 commit comments

Comments
 (0)