nano_stepper
nano_stepper copied to clipboard
setpos to negative number error
If a setpos command is issued with a negative value, a resulting readpos value will be the abs() of the negative.
move -124.00 400
:>
deg
:>
readpos
encoder -124.10
:>
setpos -10
:>
readpos
encoder 10.08
The current implementation:
static int setpos_cmd(sCmdUart *ptrUart,int argc, char * argv[])
{
if (argc>=1)
{
int64_t a;
float x;
x=fabs(atof(argv[0]));
a=ANGLE_FROM_DEGREES(x);
stepperCtrl.setAngle(a);
return 0;
}
return 1;
}
Is there a reason why the fabs() is used?