New enable input. Add dc ability. Set only SM2 synchronization. Various to make lathe work

This commit is contained in:
Hakan Bastedt
2024-01-18 14:26:51 +01:00
parent 38825bbaf3
commit 9ab4afabe4
8 changed files with 161 additions and 16 deletions

View File

@@ -12,6 +12,7 @@ StepGen::StepGen(TIM_TypeDef *Timer, uint32_t _timerChannel, PinName _stepPin, u
actualPosition = 0;
requestedPosition = 0;
stepsPerMM = 0;
enabled = 0;
dirPin = _dirPin;
stepPin = _stepPin;
@@ -37,8 +38,16 @@ double StepGen::actPos()
return actualPosition;
}
void StepGen::enable(uint8_t yes)
{
enabled = yes;
}
void StepGen::handleStepper(void)
{
if (!enabled)
return;
actPos(timerStepPosition / double(stepsPerMM));
double diffPosition = reqPos() - actPos();