Skip to content

setpos to negative number error #62

Description

@brianmichalk1

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions