Skip to content

Commit

Permalink
Merge pull request #103 from kivancsikert/mk5/fix-flow-control
Browse files Browse the repository at this point in the history
Fix flow-control for MK5
  • Loading branch information
lptr authored Feb 22, 2024
2 parents 4b0951d + 0793c0c commit 4d54b03
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion data-templates/flow-control-mk5.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"motor": "a"
},
"flow-meter": {
"pin": 6
"pin": 5
}
}
}
Expand Down
7 changes: 7 additions & 0 deletions src/kernel/drivers/Drv8874Driver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,13 @@ class Drv8874Driver
}

void drive(MotorPhase phase, double duty = 1) override {
if (duty == 0) {
Log.traceln("Stopping motor");
sleep();
return;
}
wakeUp();

int dutyValue = in1Channel.maxValue() / 2 + (int) (in1Channel.maxValue() / 2 * duty);
Log.traceln("Driving motor %s at %d%%",
phase == MotorPhase::FORWARD ? "forward" : "reverse",
Expand Down

0 comments on commit 4d54b03

Please sign in to comment.