mirror of https://github.com/FOME-Tech/fome-fw.git
avoid stepper pin double init #265
This commit is contained in:
parent
8949404d54
commit
41ed3bd6ce
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue