Esempio n. 1
0
        public async Task Should_get_z_offset()
        {
            var expectedOffset = -0.8d;

            _fakeMigo
            .ReplyMode(FakeMigoMode.Reply)
            .ReplyZOffset(expectedOffset);

            var result = await _migo.GetZOffset()
                         .ConfigureAwait(false);

            result.ZOffset.Should().Be(expectedOffset);
        }
Esempio n. 2
0
        public async IAsyncEnumerable <BedLevelingCalibrationResult> Execute(CancellationToken token)
        {
            var points = GetPoints(_calibrationMode);

            _logger.LogInformation("Home X&Y");

            ZOffsetModel zOffset = await _migo.GetZOffset().ConfigureAwait(false);

            await SetSpeed().ConfigureAwait(false);
            await HomeXY().ConfigureAwait(false);
            await HomeZ().ConfigureAwait(false);

            await MoveTo(0, 0, 10).ConfigureAwait(false);

            foreach (var(x, y) in points)
            {
                if (token.IsCancellationRequested)
                {
                    _logger.LogInformation($"Scenario aborted.");
                    yield break;
                }

                _logger.LogInformation($"Moving to ({x},{y})");
                await MoveTo(x, y, 10).ConfigureAwait(false);

                var z = zOffset.ZOffset;
                _logger.LogInformation($"Moving to zoffset {z}");
                await MoveTo(x, y, z).ConfigureAwait(false);

                yield return(new BedLevelingCalibrationResult
                {
                    Current = new Position(x, y, z)
                });

                await MoveTo(x, y, 10).ConfigureAwait(false);

                _logger.LogInformation($"Step completed.");
            }

            _logger.LogInformation($"Scenario completed.");
        }