Skip to content

Commit

Permalink
Merge pull request #187 from MarkAYoder/prufix
Browse files Browse the repository at this point in the history
Fixed off by one for motor==0
  • Loading branch information
jadonk authored Jun 22, 2020
2 parents 23773c8 + 6d03fe3 commit 964a835
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions library/src/motor.c
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ int rc_motor_set(int motor, double duty)
else if (duty <-1.0) duty =-1.0;

if(motor==0){
for(i=1;i<channels;i++){
for(i=1;i<=channels;i++){
if(rc_motor_set(i,duty)==-1) return -1;
}
return 0;
Expand Down Expand Up @@ -298,7 +298,7 @@ int rc_motor_free_spin(int motor)

// case for all channels
if(motor==0){
for(i=1;i<channels;i++){
for(i=1;i<=channels;i++){
if(rc_motor_free_spin(i)==-1) return -1;
}
return 0;
Expand Down Expand Up @@ -337,7 +337,7 @@ int rc_motor_brake(int motor)

// case for all channels
if(motor==0){
for(i=1;i<channels;i++){
for(i=1;i<=channels;i++){
if(rc_motor_brake(i)==-1) return -1;
}
return 0;
Expand Down

0 comments on commit 964a835

Please sign in to comment.