diff --git a/data-templates/flow-control-mk5.json b/data-templates/flow-control-mk5.json index 3e0408e1..f17e84b0 100644 --- a/data-templates/flow-control-mk5.json +++ b/data-templates/flow-control-mk5.json @@ -9,7 +9,7 @@ "motor": "a" }, "flow-meter": { - "pin": 6 + "pin": 5 } } } diff --git a/src/kernel/drivers/Drv8874Driver.hpp b/src/kernel/drivers/Drv8874Driver.hpp index 1c9dec82..70995503 100644 --- a/src/kernel/drivers/Drv8874Driver.hpp +++ b/src/kernel/drivers/Drv8874Driver.hpp @@ -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",