コード例 #1
0
ファイル: mainForm.cs プロジェクト: mgozali/OpenDACT
        private void checkHeights_Click(object sender, EventArgs e)
        {
            if (EEPROMFunctions.tempEEPROMSet == false)
            {
                EEPROMFunctions.readEEPROM();
            }

            GCode.checkHeights               = true;
            EEPROMFunctions.EEPROMReadOnly   = false;
            Calibration.calibrationState     = true;
            Calibration.calibrationSelection = 0;
            HeightFunctions.checkHeightsOnly = true;
            HeightFunctions.heightsSet       = false;
        }
コード例 #2
0
ファイル: mainForm.cs プロジェクト: steventrowland/OpenDACT
 private void readEEPROM_Click(object sender, EventArgs e)
 {
     if (Connection._serialPort.IsOpen)
     {
         EEPROMFunctions.tempEEPROMSet = false;
         EEPROMFunctions.readEEPROM();
         EEPROMFunctions.EEPROMReadOnly   = true;
         HeightFunctions.checkHeightsOnly = false;
         EEPROMFunctions.EEPROMReadCount  = 0;
     }
     else
     {
         UserInterface.logConsole("Not Connected");
     }
 }
コード例 #3
0
ファイル: mainForm.cs プロジェクト: mgozali/OpenDACT
 private void calibrateButton_Click(object sender, EventArgs e)
 {
     if (Connection._serialPort.IsOpen)
     {
         GCode.checkHeights = true;
         EEPROMFunctions.readEEPROM();
         EEPROMFunctions.EEPROMReadOnly   = false;
         Calibration.calibrationState     = true;
         Calibration.calibrationSelection = 0;
         HeightFunctions.checkHeightsOnly = false;
     }
     else
     {
         UserInterface.logConsole("Not connected");
     }
 }
コード例 #4
0
ファイル: mainForm.cs プロジェクト: steventrowland/OpenDACT
        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();
        }
コード例 #5
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);
             * }
             */
        }
コード例 #6
0
ファイル: GCode.cs プロジェクト: steventrowland/OpenDACT
        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
        }
コード例 #7
0
ファイル: DecisionHandler.cs プロジェクト: mgozali/OpenDACT
        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);
             * }
             */
        }