Example #1
0
        private async Task GetFullStatus()
        {
            var data = await dev.ReadBufferDataAsync((byte)Command.GetFullStatus1, 9).ConfigureAwait(false);

            var irun = (data[1] >> 4) & 0x0f;

            runningCurrent = (RunningCurrent)irun;

            var ihold = data[1] & 0x0f;

            holdingCurrent = (HoldingCurrent)irun;

            var vmax = (data[2] >> 4) & 0x0f;

            maxVelocity = (MaxVelocityType)vmax;

            var vmin = data[2] & 0x0f;

            minVelocityFactorThirtySeconds = vmin == 0 ? 32 : vmin;

            var acc = data[3] & 0x0f;

            acceleration = (Accel)acc;

            accelShape = (data[3] & 0x80) > 0;

            var _stepMode = (data[3] >> 5) & 0x03;

            stepMode = (StepModeType)_stepMode;

            shaftDirection = (data[3] & 0x10) > 0;

            await GetPositionStatus().ConfigureAwait(false);
        }