void cncDevice_ReportReceived(HidReport report) { var sc = new BaseCommand(report.Data); switch (sc.CommandCode) { case 65280: var state = new StatusReport(report.Data); state.Act(this); if (Gs.IsRunning && Gs.IsConnected && Gs.DeviceQueueLength < Gs.DefaultQueueSize) { if (PostedGCode.Count > Progress) { cncDevice.SendReport(PostedGCode[(int)Progress]); Gs.DeviceQueueLength += PostedGCode[(int)Progress].Length; //var code = GParser.Parse(PostedGCode[(int)Progress], LastPreprocessedGCode ?? new G00()); //LastPreprocessedGCode = code; Progress++; } else { Gs.IsRunning = false; Gs.Progress = 0; } } if (!Gs.IsRunning && ProcessingGCodeList.Any()) { var str = ProcessingGCodeList.Dequeue(); cncDevice.SendReport(str); Gs.DeviceQueueLength += str.Length; } return; case 65282: var posstate = new PositionsReport(report.Data); posstate.Act(this); return; } }
private void ManualHomeGCode(object obj) { ProcessingGCodeList.Clear(); ProcessingGCodeList.Enqueue(string.Format(((string)obj), 0, 0, 0, Speed)); }
private void ManualGCodeMinusPlus(object obj) { ProcessingGCodeList.Clear(); ProcessingGCodeList.Enqueue(string.Format(((string)obj), XPosition - Distance, YPosition + Distance, 0, Speed)); }