console fix + stepper step läuft

This commit is contained in:
fewikay committed 2026-10-23 17:02:17 +02:00
1 parent d076d981ac
commit 13eac4fd0c
3 files changed
+13 -25

No files matched your search

@@ -33,7 +33,7 @@ int StepperConsoleFunction( int argc, char** argv, void* ctx )
}
else if ( strcmp(argv[0], "reset") == 0 )
{
init_stepper(NULL, NULL, NULL);
reset_stepper(h);
}
else
{
@@ -76,7 +76,7 @@ void StepDriverReset(void* pGPO, const int ena){
}
void StepLibraryDelay(unsigned int ms){
HAL_Delay(ms);
vTaskDelay(pdMS_TO_TICKS(ms));
}
// 1) Funktion schreiben (oben in stepper.c, vor init_stepper)
@@ -91,9 +91,9 @@ static int StepLibraryStep( void* pPWM, int dir, unsigned int numPulses ){
for(unsigned int i = 0; i < numPulses; i++){
HAL_GPIO_WritePin(STEP_PULSE_GPIO_Port, STEP_PULSE_Pin, GPIO_PIN_SET);
HAL_Delay(1);
vTaskDelay(pdMS_TO_TICKS(1));
HAL_GPIO_WritePin(STEP_PULSE_GPIO_Port, STEP_PULSE_Pin, GPIO_PIN_RESET);
HAL_Delay(1);
vTaskDelay(pdMS_TO_TICKS(1));
}
return 0;
}
@@ -123,6 +123,11 @@ L6474_Handle_t init_stepper(void* pIO, void* pGPO, void* pPWM){
//p.cancelStep = StepTimerCancelAsync;
L6474_Handle_t s = L6474_CreateInstance(&p, pIO, pGPO, pPWM);
return s;
}
void reset_stepper(L6474_Handle_t s){
L6474_BaseParameter_t b;
L6474_SetBaseParameter(&b); // sinnvolle Standardwerte
b.stepMode = smMICRO4;
@@ -136,22 +141,4 @@ L6474_Handle_t init_stepper(void* pIO, void* pGPO, void* pPWM){
result |= L6474_Initialize(s, &b);
result |= L6474_SetPowerOutputs(s, 1);
// in case we have no error, we can enable the drivers
// and then we step a bit
if ( result == 0 )
{
result |= L6474_StepIncremental(s, 10000 );
}
else
{
// error handling
}
return s;
}
void reset_stepper(){
}
@@ -307,6 +307,7 @@ int main(void)
//Konsole
ConsoleHandle_t c = CONSOLE_CreateInstance( 4*configMINIMAL_STACK_SIZE, configMAX_PRIORITIES - 5 );
L6474_Handle_t stepper1 = init_stepper(NULL, NULL, NULL);
CONSOLE_RegisterCommand(c, "capability", "prints a specified string of capability bits",
CapabilityFunc, NULL);
@@ -315,7 +316,7 @@ int main(void)
fabi, NULL);
CONSOLE_RegisterCommand(c, "stepper", "stepper command",
StepperConsoleFunction, NULL);
StepperConsoleFunction, stepper1);
//Spindle
init_spindle(c, 9000, -9000, 1600);