コード例 #1
0
    private float StepsApart(float distance1, float distance2)
    {
        float steps1 = TableLookup.lookup(distance1, CalibrationData.distances, CalibrationData.steps);
        float steps2 = TableLookup.lookup(distance2, CalibrationData.distances, CalibrationData.steps);

        return(Math.Abs(steps1 - steps2));
    }
コード例 #2
0
    private void SetMotorStepsForVirtualDistance(float virtualDistance)
    {
        short motorSteps = (short)TableLookup.lookup(virtualDistance, CalibrationData.distances, CalibrationData.steps);

        if (motorSteps < 0)
        {
            motorSteps = 0;
        }
        logger.DebugLog("Stepping motor to " + motorSteps + " for virtual distance " + virtualDistance + " meters");
        motorController.SetMotorSteps(motorSteps, () => {
            lastDistanceMeters = virtualDistance;
        });
    }