private void resetPrinter_Click(object sender, EventArgs e) { if (Connection._serialPort.IsOpen) { GCode.emergencyReset(); } else { UserInterface.logConsole("Not connected"); } }
private void stopBut_Click(object sender, EventArgs e) { try { Connection._serialPort.DiscardOutBuffer(); GCode.emergencyReset(); Connection.disconnect(); Threading.isCalibrating = false; Connection.connect(); } catch { } }
public static void sendEEPROM() { //manually set all eeprom values UserInterface.logConsole("Setting EEPROM."); Thread.Sleep(50); GCode.sendEEPROMVariable(3, 11, EEPROM.stepsPerMM); Thread.Sleep(50); GCode.sendEEPROMVariable(3, 153, EEPROM.zMaxLength); Thread.Sleep(50); GCode.sendEEPROMVariable(3, 808, EEPROM.zProbeHeight); Thread.Sleep(50); GCode.sendEEPROMVariable(3, 812, EEPROM.zProbeSpeed); Thread.Sleep(50); GCode.sendEEPROMVariable(3, 881, EEPROM.diagonalRod); Thread.Sleep(50); GCode.sendEEPROMVariable(3, 885, EEPROM.HRadius); Thread.Sleep(50); GCode.sendEEPROMVariable(1, 893, EEPROM.offsetX); Thread.Sleep(50); GCode.sendEEPROMVariable(1, 895, EEPROM.offsetY); Thread.Sleep(50); GCode.sendEEPROMVariable(1, 897, EEPROM.offsetZ); Thread.Sleep(50); GCode.sendEEPROMVariable(3, 901, EEPROM.A); Thread.Sleep(50); GCode.sendEEPROMVariable(3, 905, EEPROM.B); Thread.Sleep(50); GCode.sendEEPROMVariable(3, 909, EEPROM.C); Thread.Sleep(50); GCode.sendEEPROMVariable(3, 913, EEPROM.DA); Thread.Sleep(50); GCode.sendEEPROMVariable(3, 917, EEPROM.DB); Thread.Sleep(50); GCode.sendEEPROMVariable(3, 921, EEPROM.DC); Thread.Sleep(50); }
public static void handleInput(string message, bool canMove) { Program.mainFormTest.setUserVariables(); if (EEPROMFunctions.tempEEPROMSet == false) { int intParse; float floatParse2; EEPROMFunctions.parseEEPROM(message, out intParse, out floatParse2); EEPROMFunctions.setEEPROM(intParse, floatParse2); } else if (EEPROMFunctions.tempEEPROMSet == true && EEPROMFunctions.EEPROMReadOnly == true && EEPROMFunctions.EEPROMReadCount < 1) { //rm } else if (GCode.checkHeights == true && EEPROMFunctions.tempEEPROMSet == true && Calibration.calibrateInProgress == false && EEPROMFunctions.EEPROMReadOnly == false) { if (UserVariables.probeChoice == "Z-Probe" && GCode.wasZProbeHeightSet == false && GCode.wasSet == true) { if (HeightFunctions.parseZProbe(message) != 1000) { EEPROM.zProbeHeight = Convert.ToSingle(Math.Round(EEPROM.zMaxLength / 6) - HeightFunctions.parseZProbe(message)); GCode.wasZProbeHeightSet = true; Program.mainFormTest.setEEPROMGUIList(); EEPROMFunctions.sendEEPROM(); } } else if (canMove == true) { //UserInterface.logConsole("position flow"); GCode.positionFlow(); } else if (HeightFunctions.parseZProbe(message) != 1000 && HeightFunctions.heightsSet == false) { HeightFunctions.setHeights(HeightFunctions.parseZProbe(message)); } } else if (Calibration.calibrationState == true && Calibration.calibrateInProgress == false && GCode.checkHeights == false && EEPROMFunctions.tempEEPROMSet == true && EEPROMFunctions.EEPROMReadOnly == false && HeightFunctions.heightsSet == true) { Program.mainFormTest.setHeightsInvoke(); if (Calibration.calibrationState == true && HeightFunctions.checkHeightsOnly == false) { Calibration.calibrateInProgress = true; /* * if (EEPROMFunctions.EEPROMRequestSent == false) * { * EEPROMFunctions.readEEPROM(); * EEPROMFunctions.EEPROMRequestSent = true; * } */ if (UserVariables.advancedCalibration == false || GCode.isHeuristicComplete == true) { UserInterface.logConsole("Calibration Iteration Number: " + Calibration.iterationNum); Calibration.calibrate(); Program.mainFormTest.setEEPROMGUIList(); EEPROMFunctions.sendEEPROM(); if (Calibration.calibrationState == false) { GCode.homeAxes(); Calibration.calibrationComplete = true; UserInterface.logConsole("Calibration Complete"); //end calibration } } else { UserInterface.logConsole("Heuristic Step: " + UserVariables.advancedCalCount); GCode.heuristicLearning(); Program.mainFormTest.setEEPROMGUIList(); EEPROMFunctions.sendEEPROM(); } Calibration.calibrateInProgress = false; } else { if (UserVariables.probeChoice == "FSR") { EEPROM.zMaxLength -= UserVariables.FSROffset; UserInterface.logConsole("Setting Z Max Length with adjustment for FSR"); } GCode.homeAxes(); UserInterface.logConsole("Heights checked"); } HeightFunctions.heightsSet = false; } /* * else * { * UserInterface.logConsole("0: " + Calibration.calibrateInProgress + GCode.checkHeights + EEPROMFunctions.tempEEPROMSet + EEPROMFunctions.EEPROMReadOnly); * } */ }
public static void readEEPROM() { GCode.sendReadEEPROMCommand(); }
public static void learnPrinter() { GCode.heuristicLearning(); }
public static void handleInput(string message) { Program.mainFormTest.setUserVariables(); if (EEPROMFunctions.tempEEPROMSet == false) { int intParse; float floatParse2; EEPROMFunctions.parseEEPROM(message, out intParse, out floatParse2); EEPROMFunctions.setEEPROM(intParse, floatParse2); } else if (EEPROMFunctions.tempEEPROMSet == true && EEPROMFunctions.EEPROMReadOnly == true && EEPROMFunctions.EEPROMReadCount < 1) { //rm } else if (GCode.checkHeights == true && EEPROMFunctions.tempEEPROMSet == true && Calibration.calibrateInProgress == false && EEPROMFunctions.EEPROMReadOnly == false) { GCode.positionFlow(); } else if (Calibration.calibrationState == true && Calibration.calibrateInProgress == false && GCode.checkHeights == false && EEPROMFunctions.tempEEPROMSet == true && EEPROMFunctions.EEPROMReadOnly == false) { if (HeightFunctions.parseZProbe(message) != 1000 && HeightFunctions.heightsSet == false) { HeightFunctions.setHeights(HeightFunctions.parseZProbe(message)); } else if (HeightFunctions.heightsSet == true) { Program.mainFormTest.setHeightsInvoke(); if (Calibration.calibrationState == true && HeightFunctions.checkHeightsOnly == false) { Calibration.calibrateInProgress = true; /* * if (EEPROMFunctions.EEPROMRequestSent == false) * { * EEPROMFunctions.readEEPROM(); * EEPROMFunctions.EEPROMRequestSent = true; * } */ if (UserVariables.advancedCalibration == false) { UserInterface.logConsole("Calibration Iteration Number: " + Calibration.iterationNum); Calibration.calibrate(); Program.mainFormTest.setEEPROMGUIList(); EEPROMFunctions.sendEEPROM(); if (Calibration.calibrationState == false) { GCode.homeAxes(); UserInterface.logConsole("Calibration Complete"); //end calibration } } else { UserInterface.logConsole("Heuristic Step: " + UserVariables.advancedCalCount); GCode.heuristicLearning(); Program.mainFormTest.setEEPROMGUIList(); EEPROMFunctions.sendEEPROM(); } Calibration.calibrateInProgress = false; } HeightFunctions.heightsSet = false; } } /* * else * { * UserInterface.logConsole("0: " + Calibration.calibrateInProgress + GCode.checkHeights + EEPROMFunctions.tempEEPROMSet + EEPROMFunctions.EEPROMReadOnly); * } */ }