public void GetHomingMessage_IsEqual() { GRBLProtokoll protokoll = new GRBLProtokoll(); CNCMessage cNCMessage = protokoll.GetHomingMessage(); Assert.Equal("$H", cNCMessage.Message); }
public override CNCMessage GetSpindelSetRPMMessage(double RPM, string Direction) { CNCMessage spindelmessage = new CNCMessage(); string dir = Direction.Trim().ToLower(); if (RPM < 0) { return(spindelmessage); } if (dir != "clockwise" && dir != "counterclockwise") { return(spindelmessage); } if (dir == "clockwise") { spindelmessage.AppendCommand(CommandDict.GetCommand(GRBLCommand.RTC_SetSpindleSpeedClockWise)); spindelmessage.AppendCommand(CommandDict.GetCommand(GRBLCommand.GRBL_WriteValue, "S", RPM.ToString())); } else if (dir == "counterclockwise") { spindelmessage.AppendCommand(CommandDict.GetCommand(GRBLCommand.RTC_SetSpindleSpeedCounterClockWise)); spindelmessage.AppendCommand(CommandDict.GetCommand(GRBLCommand.GRBL_WriteValue, "S", RPM.ToString())); } return(spindelmessage); }
public override CNCMessage GetKillAlarmMessage() { CNCMessage rmessage = new CNCMessage(); rmessage.AppendCommand(CommandDict.GetCommand(GRBLCommand.GRBL_KillAlarmLock)); return(rmessage); }
/// <summary> /// Gets a GRBL Message for Feed. /// This is the message who will returned /// [GC:G0 G54 G17 G21 G90 G94 M5 M9 T0 F0 S0] /// </summary> /// <returns>CNCMessage</returns> public override CNCMessage GetCurrentFeedMessage() { CNCMessage rmessage = new CNCMessage(); rmessage.AppendCommand(CommandDict.GetCommand(GRBLCommand.GRBL_ViewGCODEParserState)); return(rmessage); }
/// <summary> /// Gets a GRBL Message for setting the feed of the CNC Controller /// </summary> /// <returns></returns> public override CNCMessage GetSetFeedMessage(double Feed) { CNCMessage rmessage = new CNCMessage(); rmessage.AppendCommand(CommandDict.GetCommand(GRBLCommand.GRBL_WriteSetting, "F", Feed.ToString())); return(rmessage); }
/// <summary> /// Gets a GRBL Message for Z /// </summary> /// <returns>CNCMessage</returns> public override CNCMessage GetCurrentZMessage() { CNCMessage rmessage = new CNCMessage(); rmessage.AppendCommand(CommandDict.GetCommand(GRBLCommand.RTC_StatusReportQuery)); return(rmessage); }
public void GetSetZeroMessage_IsEqual() { GRBLProtokoll protokoll = new GRBLProtokoll(); CNCMessage output = protokoll.GetSetZeroMessage(); Assert.Equal("G10 P1 L20 X0 Y0 Z0", output.Message); }
public override CNCMessage GetSoftResetMessage() { CNCMessage rmessage = new CNCMessage(); rmessage.AppendCommand(CommandDict.GetCommand(GRBLCommand.RTC_SoftReset)); return(rmessage); }
public void GetKillAlarmMessage_IsEqual() { GRBLProtokoll protokoll = new GRBLProtokoll(); CNCMessage cNCMessage = protokoll.GetKillAlarmMessage(); Assert.Equal("$X", cNCMessage.Message.Trim()); }
public override CNCMessage GetHomingMessage() { CNCMessage homingmessage = new CNCMessage(); homingmessage.AppendCommand(CommandDict.GetCommand(GRBLCommand.GRBL_RunHomincCycle)); return(homingmessage); }
/// <summary> /// Gets a GRBL Message for moving the tool by ... Millimeters in X direction /// </summary> /// <returns></returns> public override CNCMessage GetMoveByXMessage(double XMillimieter, double Feed) { CNCMessage rmessage = new CNCMessage(); rmessage.AppendCommand(CommandDict.GetCommand(GRBLCommand.GRBL_WriteValue, "X", XMillimieter.ToString())); rmessage.AppendCommand(CommandDict.GetCommand(GRBLCommand.GRBL_WriteValue, "F", Feed.ToString())); return(rmessage); }
public override CNCMessage GetJogByZMessage(double ZMillimieter, double Feed) { CNCMessage rmessage = new CNCMessage(); rmessage.AppendCommand(CommandDict.GetCommand(GRBLCommand.GRBL_RunJoggingMogion)); rmessage.AppendCommand(CommandDict.GetCommand(GRBLCommand.GRBL_WriteValue, "Z", ZMillimieter.ToString())); rmessage.AppendCommand(CommandDict.GetCommand(GRBLCommand.GRBL_WriteValue, "F", Feed.ToString())); return(rmessage); }
public void GetRelativeJogByXYZMessage_IsEqual() { // Arrange GRBLProtokoll protokoll = new GRBLProtokoll(); // Act CNCMessage output = protokoll.GetRelativeJogByXYZMessage(12, 12, 12, 100); // Assert Assert.Equal("$J=G21 G91 X12 Y12 Z12 F100", output.Message.Trim()); }
public void GetCurrentXYZMessage_IsEqual() { // Arrange GRBLProtokoll protokoll = new GRBLProtokoll(); // Act CNCMessage output = protokoll.GetCurrentXYZMessage(); // Assert Assert.Equal("?", output.Message); }
public void GetMoveByZMessage_IsEqual() { // Arrange GRBLProtokoll protokoll = new GRBLProtokoll(); // Act CNCMessage output = protokoll.GetMoveByZMessage(12, 100); // Assert Assert.Equal("Z12 F100", output.Message.Trim()); }
public override CNCMessage GetRelativeJogByZMessage(double ZMillimeter, double Feed) { CNCMessage rmessage = new CNCMessage(); rmessage.AppendCommand(CommandDict.GetCommand(GRBLCommand.GRBL_RunJoggingMogion)); rmessage.AppendCommand(CommandDict.GetCommand(GRBLCommand.G_SetUnitToMillimeter_G21)); rmessage.AppendCommand(CommandDict.GetCommand(GRBLCommand.G_RelativeMotion_G91)); rmessage.AppendCommand(CommandDict.GetCommand(GRBLCommand.GRBL_WriteValue, "Z", ZMillimeter.ToString())); rmessage.AppendCommand(CommandDict.GetCommand(GRBLCommand.GRBL_WriteValue, "F", Feed.ToString())); return(rmessage); }
public void GetSpindelSetRPMMessage_IsEqual() { GRBLProtokoll gRBLProtokoll = new GRBLProtokoll(); CNCMessage cNCMessage = gRBLProtokoll.GetSpindelSetRPMMessage(1000, "clockwise"); CNCMessage nNCMessagecounter = gRBLProtokoll.GetSpindelSetRPMMessage(1000, "counterclockwise"); Assert.Equal("M3 S1000", cNCMessage.Message.Trim()); Assert.Equal("M4 S1000", nNCMessagecounter.Message.Trim()); }
public void SendMessage_GotAnythingBack() { // Assamble GRBLProtokoll pr = new GRBLProtokoll(); CNCMessage m = pr.GetCurrentFeedMessage(); // Act GRBLInterface.SendMessage(m); // Assert // No Exception is proof enough }
public override CNCMessage GetSetZeroMessage() { CNCMessage zeromessage = new CNCMessage(); zeromessage.AppendCommand(CommandDict.GetCommand(GRBLCommand.G_SetOffset_G10)); zeromessage.AppendCommand(CommandDict.GetCommand(GRBLCommand.P_Tool1)); zeromessage.AppendCommand(CommandDict.GetCommand(GRBLCommand.L20)); zeromessage.AppendCommand("X0 "); zeromessage.AppendCommand("Y0 "); zeromessage.AppendCommand("Z0"); return(zeromessage); }
public async Task SendCustomMessage() { CNCMessage message = new CNCMessage() { Message = "$X" }; CNCMessage message1 = new CNCMessage() { Message = "FALSCH" }; var tmp = await device.SendCustomMessage(message); Assert.Contains("ok", tmp.Message); tmp = await device.SendCustomMessage(message1); Assert.Contains("error", tmp.Message); }
public void SendMessage_ReceiveMessage() { // Assamble GRBLProtokoll pr = new GRBLProtokoll(); CNCMessage m = pr.GetCurrentFeedMessage(); CNCMessage start = new CNCMessage() { Message = "Grbl 1.1g ['$' for help]" }; var an = GRBLInterface.WaitReceiveMessage(100, start, 2000); // Act GRBLInterface.SendMessage(m); //CNCMessage answer = GRBLInterface.ReceiveMessage(10); CNCMessage tmp = new CNCMessage() { Message = "F" }; CNCMessage answer = GRBLInterface.WaitReceiveMessage(100, tmp, 3000); // Assert Assert.Contains("F", answer.Message); }