public static void M682SetLimitingSpeed(GCode gcode, FirmwareController connection) { EepromAddressInfo eepromInfo1 = connection.MyPrinterProfile.EEPROMConstants.GetEepromInfo("SpeedLimitX"); EepromAddressInfo eepromInfo2 = connection.MyPrinterProfile.EEPROMConstants.GetEepromInfo("SpeedLimitY"); EepromAddressInfo eepromInfo3 = connection.MyPrinterProfile.EEPROMConstants.GetEepromInfo("SpeedLimitZ"); EepromAddressInfo eepromInfo4 = connection.MyPrinterProfile.EEPROMConstants.GetEepromInfo("SpeedLimitEp"); EepromAddressInfo eepromInfo5 = connection.MyPrinterProfile.EEPROMConstants.GetEepromInfo("SpeedLimitEn"); if (gcode.HasX) { var num1 = (int)connection.WriteManualCommands("M618 S" + (int)eepromInfo1.EepromAddr + " P" + EEPROMMapping.FloatToBinaryInt(gcode.X) + " T" + eepromInfo1.Size); } if (gcode.HasY) { var num2 = (int)connection.WriteManualCommands("M618 S" + (int)eepromInfo2.EepromAddr + " P" + EEPROMMapping.FloatToBinaryInt(gcode.Y) + " T" + eepromInfo2.Size); } if (gcode.HasZ) { var num3 = (int)connection.WriteManualCommands("M618 S" + (int)eepromInfo3.EepromAddr + " P" + EEPROMMapping.FloatToBinaryInt(gcode.Z) + " T" + eepromInfo3.Size); } if (gcode.HasE) { var num4 = (int)connection.WriteManualCommands("M618 S" + (int)eepromInfo4.EepromAddr + " P" + EEPROMMapping.FloatToBinaryInt(gcode.E) + " T" + eepromInfo4.Size); } if (gcode.HasR) { var num5 = (int)connection.WriteManualCommands("M618 S" + (int)eepromInfo5.EepromAddr + " P" + EEPROMMapping.FloatToBinaryInt(gcode.R) + " T" + eepromInfo5.Size); } StandardVirtualCodes.SendOK(connection); }
public static void M684PrintAllEepromValues(GCode gcode, FirmwareController connection) { SortedList <int, EepromAddressInfo> allData = connection.MyPrinterProfile.EEPROMConstants.GetAllData(); var text = ">> ok "; foreach (EepromAddressInfo eepromAddressInfo in allData.Values) { if (eepromAddressInfo.EepromAddr <= 512) { text = text + eepromAddressInfo.Name + ": "; if (eepromAddressInfo.Type.Equals(typeof(float))) { text = text + connection.FloatFromEEPROM(eepromAddressInfo.Name).ToString("0.00") + "\n"; } else if (eepromAddressInfo.Type.Equals(typeof(uint)) || eepromAddressInfo.Type.Equals(typeof(int)) || (eepromAddressInfo.Type.Equals(typeof(ushort)) || eepromAddressInfo.Type.Equals(typeof(short))) || eepromAddressInfo.Type.Equals(typeof(byte))) { text = text + connection.eeprom_mapping.GetUInt32(eepromAddressInfo.Name).ToString() + "\n"; } else { if (!eepromAddressInfo.Type.Equals(typeof(char))) { throw new Exception("Unexpected type"); } text = text + connection.eeprom_mapping.GetInt32(eepromAddressInfo.Name).ToString() + "\n"; } } } connection.WriteLog(text, Logger.TextType.Read); }
public static void M583GetNozzleWidth(GCode gcode, FirmwareController connection) { connection.ProcessNozzleSizeExtrusionWidth(); var nozzleSizeMicrons = connection.CurrentPrinterInfo.extruder.iNozzleSizeMicrons; connection.WriteLog(string.Format(">> ok S:{0}", nozzleSizeMicrons), Logger.TextType.Read); }
public static void M570SetFilamentUID(GCode gcode, FirmwareController connection) { EepromAddressInfo eepromInfo = connection.MyPrinterProfile.EEPROMConstants.GetEepromInfo("FilamentUID"); connection.AddManualCommandToFront("M618 S" + eepromInfo.EepromAddr + " P" + gcode.P + " T" + eepromInfo.Size); StandardVirtualCodes.SendOK(connection); }
public static void M576GetFilamentInformation(GCode gcode, FirmwareController connection) { connection.ProcessFilamentDataFromEEPROM(); FilamentSpool currentFilament = connection.GetCurrentFilament(); connection.WriteLog(string.Format(">> ok S:{0} P:{1} T:{2} E:{3} I:{4} UID:{5}", (int)currentFilament.filament_color_code, currentFilament.filament_type, currentFilament.filament_temperature - 100, currentFilament.estimated_filament_length_printed, currentFilament.filament_size, currentFilament.filament_uid), Logger.TextType.Read); }
public static void M572GetBackLash(GCode gcode, FirmwareController connection) { connection.ProcessBacklashEEPROM(); Calibration calibrationDetails = connection.CalibrationDetails; connection.WriteLog(string.Format(">> ok BX:{0} BY:{1}", calibrationDetails.BACKLASH_X, calibrationDetails.BACKLASH_Y), Logger.TextType.Read); }
public static void M573GetBedLevelingValues(GCode gcode, FirmwareController connection) { connection.ProcessBedCompensationDataFromEEPROM(); Calibration calibrationDetails = connection.CalibrationDetails; connection.WriteLog(string.Format(">> ok BR:{0} BL:{1} FR:{2} FL:{3} V:{4}", calibrationDetails.CORNER_HEIGHT_BACK_RIGHT, calibrationDetails.CORNER_HEIGHT_BACK_LEFT, calibrationDetails.CORNER_HEIGHT_FRONT_RIGHT, calibrationDetails.CORNER_HEIGHT_FRONT_LEFT, calibrationDetails.G32_VERSION), Logger.TextType.Read); }
public static void M581GetBackLashSpeed(GCode gcode, FirmwareController connection) { connection.ProcessBacklashSpeedEEPROM(); Calibration calibrationDetails = connection.CalibrationDetails; connection.WriteLog(string.Format(">> ok BS:{0}", calibrationDetails.BACKLASH_SPEED), Logger.TextType.Read); }
public static void M580SetBackLashSpeed(GCode gcode, FirmwareController connection) { connection.SetBacklashSpeed(gcode.X); EepromAddressInfo eepromInfo = connection.MyPrinterProfile.EEPROMConstants.GetEepromInfo("BacklashSpeed"); var num = (int)connection.WriteManualCommands("M618 S" + eepromInfo.EepromAddr + " P" + EEPROMMapping.FloatToBinaryInt(gcode.X) + " T" + eepromInfo.Size); StandardVirtualCodes.SendOK(connection); }
public bool ProcessVirtualCode(GCode gcode, FirmwareController connection) { if (!code_dictionary.ContainsKey(gcode.M)) { return(false); } code_dictionary[gcode.M](gcode, connection); return(true); }
public CommandResult SetNozzleWidth(int iNozzleWidthMicrons) { FirmwareController firmwareController = GetFirmwareController(); if (firmwareController != null) { return(firmwareController.SetNozzleWidth(iNozzleWidthMicrons)); } return(CommandResult.Failed_NotInFirmware); }
public CommandResult SetCalibrationOffset(float offset) { FirmwareController firmwareController = GetFirmwareController(); if (firmwareController == null) { return(CommandResult.Failed_NotInFirmware); } return(firmwareController.SetCalibrationOffset(offset) ? CommandResult.Success : CommandResult.Failed_Argument); }
public CommandResult PausePrint() { FirmwareController firmwareController = GetFirmwareController(); if (firmwareController != null) { return(firmwareController.PausePrint()); } return(CommandResult.Failed_NotInFirmware); }
public CommandResult RegisterExternalPluginGCodes(string ID, string[] gCodeList) { FirmwareController firmwareController = GetFirmwareController(); if (firmwareController != null) { return(firmwareController.RegisterExternalPluginGCodes(ID, gCodeList)); } return(CommandResult.Failed_NotInFirmware); }
static void Main() { IntPtr ptr = GetConsoleWindow(); //MoveWindow(ptr, -1000, 0, 1000, 400, true); // Move console window out from under printer windows // Start the printer - DO NOT CHANGE THESE LINES PrinterThread printer = new PrinterThread(); Thread oThread = new Thread(new ThreadStart(printer.Run)); oThread.Start(); printer.WaitForInit(); // Start the firmware thread - DO NOT CHANGE THESE LINES FirmwareController firmware = new FirmwareController(printer.GetPrinterSim()); oThread = new Thread(new ThreadStart(firmware.Start)); oThread.Start(); firmware.WaitForInit(); Command command = new Command(printer.GetPrinterSim()); Tests testMenu = new Tests(command, printer.GetPrinterSim()); SetForegroundWindow(ptr); bool fDone = false; while (!fDone) { Console.Clear(); Console.WriteLine("3D Printer Simulation - Control Menu\n"); Console.WriteLine("P - Print"); Console.WriteLine("T - Test"); Console.WriteLine("Q - Quit"); char ch = Char.ToUpper(Console.ReadKey().KeyChar); switch (ch) { case 'P': // Print PrintFile("..\\SampleSTLs\\F-35_Corrected.gcode", command, printer.GetPrinterSim()); break; case 'T': // Test menu testMenu.TestMenu(); break; case 'Q': // Quite printer.Stop(); firmware.Stop(); fDone = true; break; } } }
public CommandResult SaveEEPROMDataToXMLFile(string filename) { FirmwareController firmwareController = GetFirmwareController(); if (firmwareController == null) { return(CommandResult.Failed_NotInFirmware); } return(firmwareController.eeprom_mapping.SaveToXMLFile(filename) ? CommandResult.Success : CommandResult.Failed_Argument); }
public static void M571SetBacklashConstants(GCode gcode, FirmwareController connection) { EepromAddressInfo eepromInfo1 = connection.MyPrinterProfile.EEPROMConstants.GetEepromInfo("BacklashX"); EepromAddressInfo eepromInfo2 = connection.MyPrinterProfile.EEPROMConstants.GetEepromInfo("BacklashY"); connection.SetBacklash(gcode.X, gcode.Y); var num1 = (int)connection.WriteManualCommands("M618 S" + eepromInfo1.EepromAddr + " P" + EEPROMMapping.FloatToBinaryInt(gcode.X) + " T" + eepromInfo1.Size); var num2 = (int)connection.WriteManualCommands("M618 S" + eepromInfo2.EepromAddr + " P" + EEPROMMapping.FloatToBinaryInt(gcode.Y) + " T" + eepromInfo2.Size); StandardVirtualCodes.SendOK(connection); }
public CommandResult AbortPrint() { FirmwareController firmwareController = GetFirmwareController(); if (firmwareController == null) { return(CommandResult.Failed_NotInFirmware); } firmwareController.AbortPrint(); return(CommandResult.Success); }
public CommandResult ContinuePrint() { var num = (int)ReleaseLock(lockID); FirmwareController firmwareController = GetFirmwareController(); if (firmwareController != null) { return(firmwareController.ContinuePrint()); } return(CommandResult.Failed_NotInFirmware); }
public CommandResult ClearWarning() { FirmwareController firmwareController = GetFirmwareController(); if (firmwareController == null) { return(CommandResult.Failed_NotInFirmware); } firmwareController.ClearWarning(); return(CommandResult.Success); }
public CommandResult KillJobs() { FirmwareController firmwareController = GetFirmwareController(); if (firmwareController == null) { return(CommandResult.Failed_NotInFirmware); } firmwareController.KillJobs(); return(CommandResult.Success); }
public CommandResult SetOffsetInformation(BedOffsets Off) { FirmwareController firmwareController = GetFirmwareController(); if (firmwareController == null) { return(CommandResult.Failed_NotInFirmware); } firmwareController.SetOffsetInformation(Off); return(CommandResult.Success); }
public CommandResult SetBacklashValues(BacklashSettings backlash) { FirmwareController firmwareController = GetFirmwareController(); if (firmwareController == null) { return(CommandResult.Failed_NotInFirmware); } firmwareController.SetBacklashValues(backlash); return(CommandResult.Success); }
public CommandResult SendEmergencyStop() { FirmwareController firmwareController = GetFirmwareController(); if (firmwareController == null) { return(CommandResult.Failed_NotInFirmware); } firmwareController.SendEmergencyStop(); return(CommandResult.SuccessfullyReceived); }
public CommandResult SetFilamentInformation(FilamentSpool filament) { FirmwareController firmwareController = GetFirmwareController(); if (firmwareController == null) { return(CommandResult.Failed_NotInFirmware); } firmwareController.SetFilamentInformation(filament, true); return(CommandResult.Success); }
public static void M1014StopwatchStop(GCode gcode, FirmwareController connection) { var num = connection.NStopwatchReturnTime(); if (0L <= num) { connection.WriteLog(string.Format(">> ok M:{0}", num), Logger.TextType.Read); } else { connection.WriteLog(">> stopwatch not running", Logger.TextType.Read); } }
public CommandResult GotoBootloader() { var num = (int)ReleaseLock(lockID); FirmwareController firmwareController = GetFirmwareController(); if (firmwareController == null) { return(CommandResult.Failed_NotInFirmware); } firmwareController.GotoBootloader(); return(CommandResult.Success); }
static void Main() { IntPtr ptr = GetConsoleWindow(); MoveWindow(ptr, 0, 0, 1000, 400, true); // Start the printer - DO NOT CHANGE THESE LINES PrinterThread printer = new PrinterThread(); Thread oThread = new Thread(new ThreadStart(printer.Run)); oThread.Start(); printer.WaitForInit(); // Start the firmware thread - DO NOT CHANGE THESE LINES FirmwareController firmware = new FirmwareController(printer.GetPrinterSim()); oThread = new Thread(new ThreadStart(firmware.Start)); oThread.Start(); firmware.WaitForInit(); SetForegroundWindow(ptr); bool fDone = false; while (!fDone) { Console.Clear(); Console.WriteLine("3D Printer Simulation - Control Menu\n"); Console.WriteLine("P - Print"); Console.WriteLine("T - Test"); Console.WriteLine("Q - Quit"); char ch = Char.ToUpper(Console.ReadKey().KeyChar); switch (ch) { case 'P': // Print PrintFile(printer.GetPrinterSim()); firmware.removeModel(); break; case 'T': // Test menu break; case 'Q': // Quite printer.Stop(); firmware.Stop(); fDone = true; break; } } }
public static void M578GetCurrentBedOffsets(GCode gcode, FirmwareController connection) { connection.ProcessBedOffsetDataFromEEPROM(); connection.ProcessCalibrationOffset(); Calibration calibrationDetails = connection.CalibrationDetails; var text = string.Format(">> ok BRO:{0} BLO:{1} FRO:{2} FLO:{3} ZO:{4}", calibrationDetails.CORNER_HEIGHT_BACK_RIGHT_OFFSET, calibrationDetails.CORNER_HEIGHT_BACK_LEFT_OFFSET, calibrationDetails.CORNER_HEIGHT_FRONT_RIGHT_OFFSET, calibrationDetails.CORNER_HEIGHT_FRONT_LEFT_OFFSET, calibrationDetails.ENTIRE_Z_HEIGHT_OFFSET); if (calibrationDetails.UsesCalibrationOffset) { text = string.Format("{0} CO:{1}", text, calibrationDetails.CALIBRATION_OFFSET); } connection.WriteLog(text, Logger.TextType.Read); }
public static void M577SetBedOffsets(GCode gcode, FirmwareController connection) { EepromAddressInfo eepromInfo1 = connection.MyPrinterProfile.EEPROMConstants.GetEepromInfo("ZCalibrationBLO"); EepromAddressInfo eepromInfo2 = connection.MyPrinterProfile.EEPROMConstants.GetEepromInfo("ZCalibrationBRO"); EepromAddressInfo eepromInfo3 = connection.MyPrinterProfile.EEPROMConstants.GetEepromInfo("ZCalibrationFRO"); EepromAddressInfo eepromInfo4 = connection.MyPrinterProfile.EEPROMConstants.GetEepromInfo("ZCalibrationFLO"); EepromAddressInfo eepromInfo5 = connection.MyPrinterProfile.EEPROMConstants.GetEepromInfo("ZCalibrationZO"); var stringList = new List <string>(); if (gcode.HasX && eepromInfo1 != null) { var int32 = BitConverter.ToInt32(BitConverter.GetBytes(gcode.X), 0); stringList.Add("M618 S" + eepromInfo1.EepromAddr + " P" + int32 + " T" + eepromInfo1.Size); } if (gcode.HasY && eepromInfo2 != null) { var int32 = BitConverter.ToInt32(BitConverter.GetBytes(gcode.Y), 0); stringList.Add("M618 S" + eepromInfo2.EepromAddr + " P" + int32 + " T" + eepromInfo2.Size); } if (gcode.HasZ && eepromInfo3 != null) { var int32 = BitConverter.ToInt32(BitConverter.GetBytes(gcode.Z), 0); stringList.Add("M618 S" + eepromInfo3.EepromAddr + " P" + int32 + " T" + eepromInfo3.Size); } if (gcode.HasE && eepromInfo4 != null) { var int32 = BitConverter.ToInt32(BitConverter.GetBytes(gcode.E), 0); stringList.Add("M618 S" + eepromInfo4.EepromAddr + " P" + int32 + " T" + eepromInfo4.Size); } if (gcode.hasF && eepromInfo5 != null) { var int32 = BitConverter.ToInt32(BitConverter.GetBytes(gcode.F), 0); stringList.Add("M618 S" + eepromInfo5.EepromAddr + " P" + int32 + " T" + eepromInfo5.Size); } if (connection.CalibrationDetails.UsesCalibrationOffset) { EepromAddressInfo eepromInfo6 = connection.MyPrinterProfile.EEPROMConstants.GetEepromInfo("CalibrationOffset"); if (gcode.HasI && eepromInfo6 != null) { var int32 = BitConverter.ToInt32(BitConverter.GetBytes(gcode.I), 0); stringList.Add("M618 S" + eepromInfo6.EepromAddr + " P" + int32 + " T" + eepromInfo6.Size); } } if (stringList.Count > 0) { connection.AddManualCommandToFront(stringList.ToArray()); } StandardVirtualCodes.SendOK(connection); }