private void ParseM119() { // Return if The _dataReceived not contains ok\n if (WaitForOkAndNewLineToBeReceived() == false) { return; } // Get all responces var responces = GetAllResponces(); var endstopstatus = new string[6]; foreach (var responce in responces) { if (responce.Contains("x_min")) { endstopstatus[0] = responce; } if (responce.Contains("x_max")) { endstopstatus[1] = responce; } if (responce.Contains("y_min")) { endstopstatus[2] = responce; } if (responce.Contains("y_max")) { endstopstatus[3] = responce; } if (responce.Contains("z_min")) { endstopstatus[4] = responce; } if (responce.Contains("z_max")) { endstopstatus[5] = responce; } } var eventEndstopStatusList = new EndstopStatusList(new List <string>()); eventEndstopStatusList.Data.AddRange(endstopstatus); OnM119EndStopStatus(eventEndstopStatusList); //Delete the responce from the received bytes _dataReceived = DeleteResponceUpToAndInclusiveOk(_dataReceived); OnReadyForNextCommand(EventArgs.Empty); }
/// <summary> /// Report result of M119 EndstopStatus /// </summary> /// <param name="endstopStatusList"></param> private void OnM119EndStopStatus(EndstopStatusList endstopStatusList) { var handler = M119EndStopStatus; handler?.Invoke(this, endstopStatusList); }