diff --git a/stm32-stepper-root/stepper_h7/CM7/Core/Src/Stepper/stepper.c b/stm32-stepper-root/stepper_h7/CM7/Core/Src/Stepper/stepper.c index cc8675e..9aafdc3 100644 --- a/stm32-stepper-root/stepper_h7/CM7/Core/Src/Stepper/stepper.c +++ b/stm32-stepper-root/stepper_h7/CM7/Core/Src/Stepper/stepper.c @@ -23,10 +23,10 @@ static L6474_Handle_t stepperHandle = NULL; */ int state = 0; -float posmax = 29.5; +float posmax = 295; float posmin = 0.0f; float posref = 0.0f; - +int mmperturn = 1; // eingestellter Step Mode: 1, 2, 4, 8 oder 16 int microsteps = 16; @@ -634,8 +634,27 @@ int StepperConsoleFunction( int argc, char** argv, void* ctx ) printf("FAIL\r\n"); return -1; } + float target_mm = (float)atof(argv[1]); + if ( argc > 2) + { + if(strcmp(argv[2], "-s")==0){ + //TODO: Geschwindigkeit verstellen + unsigned int hz = atoi(argv[3]) * 800 / 60; + StepTimerSetSpeed(hz); + } + else if(strcmp(argv[2], "-r")==0){ + int temp = 0; + L6474_GetAbsolutePosition(h, &temp); + target_mm = (float)temp / (50 * microsteps) + (float)atof(argv[1]); + + } + else if(strcmp(argv[2], "-a")==0){ + } + + } + if (target_mm < posmin || target_mm > posmax) { printf("position out of range\r\n"); printf("FAIL\r\n");