added flags -r, -s to move
This commit is contained in:
1 parent
8071f4c246
commit
e67abc6889
1 file changed
+21
-2
@@ -23,10 +23,10 @@ static L6474_Handle_t stepperHandle = NULL;
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
int state = 0;
|
int state = 0;
|
||||||
float posmax = 29.5;
|
float posmax = 295;
|
||||||
float posmin = 0.0f;
|
float posmin = 0.0f;
|
||||||
float posref = 0.0f;
|
float posref = 0.0f;
|
||||||
|
int mmperturn = 1;
|
||||||
// eingestellter Step Mode: 1, 2, 4, 8 oder 16
|
// eingestellter Step Mode: 1, 2, 4, 8 oder 16
|
||||||
int microsteps = 16;
|
int microsteps = 16;
|
||||||
|
|
||||||
@@ -634,8 +634,27 @@ int StepperConsoleFunction( int argc, char** argv, void* ctx )
|
|||||||
printf("FAIL\r\n");
|
printf("FAIL\r\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
float target_mm = (float)atof(argv[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) {
|
if (target_mm < posmin || target_mm > posmax) {
|
||||||
printf("position out of range\r\n");
|
printf("position out of range\r\n");
|
||||||
printf("FAIL\r\n");
|
printf("FAIL\r\n");
|
||||||
|
|||||||
Reference in new issue
Block a user