Add sending the motor name in config information to the fake motor
This commit is contained in:
@ -1270,9 +1270,30 @@ static int cmdVars(pDMC2280Driv self) {
|
||||
return DMC_SendReq(self, cmd);
|
||||
}
|
||||
|
||||
/*
|
||||
* Send configuration information to a simulated (fake) motor
|
||||
*/
|
||||
static void cmdConfig(pDMC2280Driv self) {
|
||||
char cmd[CMDLEN];
|
||||
snprintf(cmd, CMDLEN, "MG \"CONFIG%c=SPX=%g,CPX=%g,RL=%g,FL=%g,UH=%g,%s=%d\"",
|
||||
char name[21];
|
||||
int i, j;
|
||||
j = 0;
|
||||
/* copy selected/restricted characters in name */
|
||||
for (i = 0; i < 20; ++i) {
|
||||
if (self->name[i] == '\0')
|
||||
break;
|
||||
if (self->name[i] >= 'a' && self->name[i] <= 'z')
|
||||
name[j++] = self->name[i];
|
||||
else if (self->name[i] >= 'A' && self->name[i] <= 'Z')
|
||||
name[j++] = self->name[i];
|
||||
else if (self->name[i] >= '0' && self->name[i] <= '9')
|
||||
name[j++] = self->name[i];
|
||||
else if (self->name[i] == '-' || self->name[i] == '_')
|
||||
name[j++] = self->name[i];
|
||||
}
|
||||
name[j] = '\0';
|
||||
|
||||
snprintf(cmd, CMDLEN, "MG \"CONFIG%c=SPX=%g,CPX=%g,RL=%g,FL=%g,UH=%g,%s=%d,NAM='%s'\"",
|
||||
self->axisLabel,
|
||||
self->stepsPerX,
|
||||
self->cntsPerX,
|
||||
@ -1280,7 +1301,8 @@ static void cmdConfig(pDMC2280Driv self) {
|
||||
self->fUpper,
|
||||
self->fHome,
|
||||
self->abs_encoder ? "EH" : "MH",
|
||||
self->abs_encoder ? self->absEncHome : self->motorHome);
|
||||
self->abs_encoder ? self->absEncHome : self->motorHome,
|
||||
name);
|
||||
DMC_Send(self, cmd);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user