implemented reference (untested)

This commit is contained in:
fewikay committed 2026-10-26 16:18:12 +01:00
1 parent 13eac4fd0c
commit 26b117b63f
1 file changed
+25 -2
@@ -129,10 +129,10 @@ L6474_Handle_t init_stepper(void* pIO, void* pGPO, void* pPWM){
void reset_stepper(L6474_Handle_t s){
L6474_BaseParameter_t b;
L6474_SetBaseParameter(&b); // sinnvolle Standardwerte
L6474_SetBaseParameter(&b);
b.stepMode = smMICRO4;
b.OcdTh = ocdth1125mA;
L6474_EncodePhaseCurrentParameter(&b, 700.0f); // 700 mA richtig umrechnen
L6474_EncodePhaseCurrentParameter(&b, 700.0f);
int result = 0;
@@ -142,3 +142,26 @@ void reset_stepper(L6474_Handle_t s){
result |= L6474_SetPowerOutputs(s, 1);
}
void stepper_reference(L6474_Handle_t s, int flag){
//flag: 0 keiner, 1 -t, 2 -e, 3 -s
if(flag == 3){
L6474_SetAbsolutePosition(s, 0);
return;
}
int button_pressed = 0;
while(!button_pressed){
L6474_StepIncremental(s, -1);
if(HAL_GPIO_ReadPin(USR_BUTTON_GPIO_Port, USR_BUTTON_Pin) == GPIO_PIN_RESET){
button_pressed=1;
}
}
L6474_SetAbsolutePosition(s, 0);
}
void stepper_softstart(L6474_Handle_t s, unsigned int duration){
}