Ejemplo n.º 1
0
        public static async Task <bool> SendProbeCommandAsync(this ISerial serial, Machine machine, int axisIndex)
        {
            string  axisName  = machine.GetAxisName(axisIndex);
            decimal probeSize = machine.GetProbeSize(axisIndex);

            string probDist   = machine.ProbeDist.ToString(CultureInfo.InvariantCulture);
            string probDistUp = machine.ProbeDistUp.ToString(CultureInfo.InvariantCulture);
            string probFeed   = machine.ProbeFeed.ToString(CultureInfo.InvariantCulture);

            var result = await serial.SendCommandAsync("g91 g31 " + axisName + "-" + probDist + " F" + probFeed + " g90", DefaultProbeTimeout);

            if (result?.LastOrDefault()?.ReplyType.HasFlag(EReplyType.ReplyError) == false)
            {
                serial.QueueCommand("g92 " + axisName + (-probeSize).ToString(CultureInfo.InvariantCulture));
                serial.QueueCommand("g91 g0" + axisName + probDistUp + " g90");
                return(true);
            }

            return(false);
        }
Ejemplo n.º 2
0
 public static async Task <bool> SendProbeCommandAsync(this ISerial serial, Machine machine, int axisIndex)
 {
     return(await serial.SendProbeCommandAsync(machine.GetAxisName(axisIndex), machine.GetProbeSize(axisIndex), machine.ProbeDist, machine.ProbeDistUp, machine.ProbeFeed));
 }