avoid stepper pin double init #265

This commit is contained in:
Matthew Kennedy 2023-10-13 02:44:14 -07:00
parent 8949404d54
commit 41ed3bd6ce
1 changed files with 5 additions and 0 deletions

View File

@ -213,6 +213,11 @@ void StepperMotor::initialize(StepperHw *hardware, int totalSteps) {
}
void StepDirectionStepper::initialize(brain_pin_e stepPin, brain_pin_e directionPin, pin_output_mode_e directionPinMode, float reactionTime, brain_pin_e enablePin, pin_output_mode_e enablePinMode) {
// avoid double-init
this->directionPin.deInit();
this->stepPin.deInit();
this->enablePin.deInit();
if (!isBrainPinValid(stepPin) || !isBrainPinValid(directionPin)) {
return;
}