private void manualCalibrateBut_Click(object sender, EventArgs e) { try { Calibration.calibrationState = true; Program.mainFormTest.setUserVariables(); Heights.X = Convert.ToSingle(xManual.Text); Heights.XOpp = Convert.ToSingle(xOppManual.Text); Heights.Y = Convert.ToSingle(yManual.Text); Heights.YOpp = Convert.ToSingle(yOppManual.Text); Heights.Z = Convert.ToSingle(zManual.Text); Heights.ZOpp = Convert.ToSingle(zOppManual.Text); EEPROM.stepsPerMM = Convert.ToSingle(spmMan.Text); EEPROM.tempSPM = Convert.ToSingle(spmMan.Text); EEPROM.zMaxLength = Convert.ToSingle(zMaxMan.Text); EEPROM.zProbeHeight = Convert.ToSingle(zProHeiMan.Text); EEPROM.zProbeSpeed = Convert.ToSingle(zProSpeMan.Text); EEPROM.HRadius = Convert.ToSingle(horRadMan.Text); EEPROM.diagonalRod = Convert.ToSingle(diaRodMan.Text); EEPROM.offsetX = Convert.ToSingle(towOffXMan.Text); EEPROM.offsetY = Convert.ToSingle(towOffYMan.Text); EEPROM.offsetZ = Convert.ToSingle(towOffZMan.Text); EEPROM.A = Convert.ToSingle(alpRotAMan.Text); EEPROM.B = Convert.ToSingle(alpRotBMan.Text); EEPROM.C = Convert.ToSingle(alpRotCMan.Text); EEPROM.DA = Convert.ToSingle(delRadAMan.Text); EEPROM.DB = Convert.ToSingle(delRadBMan.Text); EEPROM.DC = Convert.ToSingle(delRadCMan.Text); Calibration.basicCalibration(); //set eeprom vals in manual calibration this.spmMan.Text = EEPROM.stepsPerMM.ToString(); this.zMaxMan.Text = EEPROM.zMaxLength.ToString(); this.zProHeiMan.Text = EEPROM.zProbeHeight.ToString(); this.zProSpeMan.Text = EEPROM.zProbeSpeed.ToString(); this.diaRodMan.Text = EEPROM.diagonalRod.ToString(); this.horRadMan.Text = EEPROM.HRadius.ToString(); this.towOffXMan.Text = EEPROM.offsetX.ToString(); this.towOffYMan.Text = EEPROM.offsetY.ToString(); this.towOffZMan.Text = EEPROM.offsetZ.ToString(); this.alpRotAMan.Text = EEPROM.A.ToString(); this.alpRotBMan.Text = EEPROM.B.ToString(); this.alpRotCMan.Text = EEPROM.C.ToString(); this.delRadAMan.Text = EEPROM.DA.ToString(); this.delRadBMan.Text = EEPROM.DB.ToString(); this.delRadCMan.Text = EEPROM.DC.ToString(); //set expected height map this.xExp.Text = Heights.X.ToString(); this.xOppExp.Text = Heights.XOpp.ToString(); this.yExp.Text = Heights.Y.ToString(); this.yOppExp.Text = Heights.YOpp.ToString(); this.zExp.Text = Heights.Z.ToString(); this.zOppExp.Text = Heights.ZOpp.ToString(); Calibration.calibrationState = false; } catch (Exception ex) { UserInterface.logConsole(ex.ToString()); } }
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 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); * } */ }