sendEEPROM() public static method

public static sendEEPROM ( ) : void
return void
Exemplo n.º 1
0
        private void sendEEPROMButton_Click(object sender, EventArgs e)
        {
            EEPROM.stepsPerMM   = Convert.ToInt32(this.Invoke((Func <double>) delegate { double value; Double.TryParse(this.stepsPerMMText.Text, out value); return(value); }));
            EEPROM.zMaxLength   = Convert.ToSingle(this.Invoke((Func <double>) delegate { double value; Double.TryParse(this.zMaxLengthText.Text, out value); return(value); }));
            EEPROM.zProbeHeight = Convert.ToSingle(this.Invoke((Func <double>) delegate { double value; Double.TryParse(this.zProbeText.Text, out value); return(value); }));
            EEPROM.zProbeSpeed  = Convert.ToSingle(this.Invoke((Func <double>) delegate { double value; Double.TryParse(this.zProbeSpeedText.Text, out value); return(value); }));
            EEPROM.diagonalRod  = Convert.ToSingle(this.Invoke((Func <double>) delegate { double value; Double.TryParse(this.diagonalRod.Text, out value); return(value); }));
            EEPROM.HRadius      = Convert.ToSingle(this.Invoke((Func <double>) delegate { double value; Double.TryParse(this.HRadiusText.Text, out value); return(value); }));
            EEPROM.offsetX      = Convert.ToSingle(this.Invoke((Func <double>) delegate { double value; Double.TryParse(this.offsetXText.Text, out value); return(value); }));
            EEPROM.offsetY      = Convert.ToSingle(this.Invoke((Func <double>) delegate { double value; Double.TryParse(this.offsetYText.Text, out value); return(value); }));
            EEPROM.offsetZ      = Convert.ToSingle(this.Invoke((Func <double>) delegate { double value; Double.TryParse(this.offsetZText.Text, out value); return(value); }));
            EEPROM.A            = Convert.ToSingle(this.Invoke((Func <double>) delegate { double value; Double.TryParse(this.AText.Text, out value); return(value); }));
            EEPROM.B            = Convert.ToSingle(this.Invoke((Func <double>) delegate { double value; Double.TryParse(this.BText.Text, out value); return(value); }));
            EEPROM.C            = Convert.ToSingle(this.Invoke((Func <double>) delegate { double value; Double.TryParse(this.CText.Text, out value); return(value); }));
            EEPROM.DA           = Convert.ToSingle(this.Invoke((Func <double>) delegate { double value; Double.TryParse(this.DAText.Text, out value); return(value); }));
            EEPROM.DB           = Convert.ToSingle(this.Invoke((Func <double>) delegate { double value; Double.TryParse(this.DBText.Text, out value); return(value); }));
            EEPROM.DC           = Convert.ToSingle(this.Invoke((Func <double>) delegate { double value; Double.TryParse(this.DCText.Text, out value); return(value); }));

            EEPROMFunctions.sendEEPROM();
        }
Exemplo n.º 2
0
        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);
             * }
             */
        }
Exemplo n.º 3
0
        public static void positionFlow()
        {
            float probingHeight = UserVariables.probingHeight;
            float plateDiameter = UserVariables.plateDiameter;
            int   pauseTimeSet  = UserVariables.pauseTimeSet;
            float valueZ        = 0.482F * plateDiameter;
            float valueXYLarge  = 0.417F * plateDiameter;
            float valueXYSmall  = 0.241F * plateDiameter;

            if (UserVariables.probeChoice == "Z-Probe" && wasSet == false)
            {
                switch (iteration)
                {
                case 0:
                    EEPROM.zProbeHeight = 0;
                    homeAxes();
                    iteration++;
                    break;

                case 1:
                    Connection._serialPort.WriteLine("G1 Z" + Math.Round(EEPROM.zMaxLength / 6).ToString() + " X0 Y0");
                    iteration++;
                    break;

                case 2:
                    probe();

                    wasSet = true;
                    Program.mainFormTest.setEEPROMGUIList();
                    EEPROMFunctions.sendEEPROM();
                    iteration = 0;
                    break;
                }

                /*
                 * pauseTimeZMax();
                 * pauseTimeZMax();
                 * pauseTimeProbe();
                 */
            }
            else
            {
                Connection._serialPort.WriteLine("G0 F" + UserVariables.xySpeed * 60);//converts mm/s to mm/min

                switch (currentPosition)
                {
                case 0:
                    switch (iteration)
                    {
                    case 0:
                        homeAxes();
                        iteration++;
                        break;

                    case 1:
                        Connection._serialPort.WriteLine("G1 Z" + probingHeight.ToString() + " X0 Y0");
                        iteration++;
                        break;

                    case 2:
                        probe();
                        iteration++;
                        break;

                    case 3:
                        Connection._serialPort.WriteLine("G1 Z" + probingHeight.ToString() + " X-" + valueXYLarge.ToString() + " Y-" + valueXYSmall.ToString());
                        currentPosition++;
                        iteration = 0;
                        break;
                    }

                    /*
                     * pauseTimeZMaxThird();
                     * pauseTimeZMaxThird();
                     * pauseTimeZMax();
                     * pauseTimeProbe();
                     * pauseTimeRadius();
                     */
                    break;

                case 1:
                    switch (iteration)
                    {
                    case 0:
                        probe();
                        iteration++;
                        break;

                    case 1:
                        Connection._serialPort.WriteLine("G1 Z" + probingHeight.ToString() + " X-" + valueXYLarge.ToString() + " Y-" + valueXYSmall.ToString());
                        iteration++;
                        break;

                    case 2:
                        Connection._serialPort.WriteLine("G1 Z" + probingHeight.ToString() + " X0 Y0");
                        iteration++;
                        break;

                    case 3:
                        Connection._serialPort.WriteLine("G1 Z" + probingHeight.ToString() + " X" + valueXYLarge.ToString() + " Y" + valueXYSmall.ToString());
                        currentPosition++;
                        iteration = 0;
                        break;
                    }

                    /*
                     * pauseTimeProbe();
                     * pauseTimeRadius();
                     * pauseTimeRadius();
                     * pauseTimeRadius();
                     * currentPosition++;
                     */
                    break;

                case 2:
                    switch (iteration)
                    {
                    case 0:
                        probe();
                        iteration++;
                        break;

                    case 1:
                        Connection._serialPort.WriteLine("G1 Z" + probingHeight.ToString() + " X" + valueXYLarge.ToString() + " Y" + valueXYSmall.ToString());
                        iteration++;
                        break;

                    case 2:
                        Connection._serialPort.WriteLine("G1 Z" + probingHeight.ToString() + " X0 Y0");
                        iteration++;
                        break;

                    case 3:
                        Connection._serialPort.WriteLine("G1 Z" + probingHeight.ToString() + " X" + valueXYLarge.ToString() + " Y-" + valueXYSmall.ToString());
                        currentPosition++;
                        iteration = 0;
                        break;
                    }

                    /*
                     * pauseTimeProbe();
                     * pauseTimeRadius();
                     * pauseTimeRadius();
                     * pauseTimeRadius();
                     * currentPosition++;
                     */
                    break;

                case 3:
                    switch (iteration)
                    {
                    case 0:
                        probe();
                        iteration++;
                        break;

                    case 1:
                        Connection._serialPort.WriteLine("G1 Z" + probingHeight.ToString() + " X" + valueXYLarge.ToString() + " Y-" + valueXYSmall.ToString());
                        iteration++;
                        break;

                    case 2:
                        Connection._serialPort.WriteLine("G1 Z" + probingHeight.ToString() + " X0 Y0");
                        iteration++;
                        break;

                    case 3:
                        Connection._serialPort.WriteLine("G1 Z" + probingHeight.ToString() + " X-" + valueXYLarge.ToString() + " Y" + valueXYSmall.ToString());
                        currentPosition++;
                        iteration = 0;
                        break;
                    }

                    /*
                     * pauseTimeProbe();
                     * pauseTimeRadius();
                     * pauseTimeRadius();
                     * pauseTimeRadius();
                     * currentPosition++;
                     */
                    break;

                case 4:
                    switch (iteration)
                    {
                    case 0:
                        probe();
                        iteration++;
                        break;

                    case 1:
                        Connection._serialPort.WriteLine("G1 Z" + probingHeight.ToString() + " X-" + valueXYLarge.ToString() + " Y" + valueXYSmall.ToString());
                        iteration++;
                        break;

                    case 2:
                        Connection._serialPort.WriteLine("G1 Z" + probingHeight.ToString() + " X0 Y0");
                        iteration++;
                        break;

                    case 3:
                        Connection._serialPort.WriteLine("G1 Z" + probingHeight.ToString() + " X0 Y" + valueZ.ToString());
                        currentPosition++;
                        iteration = 0;
                        break;
                    }

                    /*
                     * pauseTimeProbe();
                     * pauseTimeRadius();
                     * pauseTimeRadius();
                     * pauseTimeRadius();
                     * currentPosition++;
                     */
                    break;

                case 5:
                    switch (iteration)
                    {
                    case 0:
                        probe();
                        iteration++;
                        break;

                    case 1:
                        Connection._serialPort.WriteLine("G1 Z" + probingHeight.ToString() + " X0 Y" + valueZ.ToString());
                        iteration++;
                        break;

                    case 2:
                        Connection._serialPort.WriteLine("G1 Z" + probingHeight.ToString() + " X0 Y-" + valueZ.ToString());
                        currentPosition++;
                        iteration = 0;
                        break;
                    }

                    /*
                     * pauseTimeProbe();
                     * pauseTimeRadius();
                     * pauseTimeRadius();
                     * currentPosition++;
                     */
                    break;

                case 6:
                    switch (iteration)
                    {
                    case 0:
                        probe();
                        iteration++;
                        break;

                    case 1:
                        Connection._serialPort.WriteLine("G1 Z" + probingHeight.ToString() + " X0 Y-" + valueZ.ToString());
                        iteration++;
                        break;

                    case 2:
                        Connection._serialPort.WriteLine("G1 Z" + probingHeight.ToString() + " X0 Y0");
                        iteration++;
                        if (Calibration.calibrateInProgress == false)
                        {
                            iteration++;
                        }
                        break;

                    case 3:
                        Connection._serialPort.WriteLine("G1 Z" + Convert.ToInt32(EEPROM.zMaxLength / 3) + " X0 Y0");
                        iteration++;
                        break;

                    case 4:
                        currentPosition = 0;
                        checkHeights    = false;
                        iteration       = 0;
                        break;
                    }

                    /*
                     * pauseTimeProbe();
                     * pauseTimeRadius();
                     * pauseTimeRadius();
                     * pauseTimeZMaxThird();
                     */
                    break;
                } //end switch
            }     //end else
        }
Exemplo n.º 4
0
        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);
             * }
             */
        }