OpenDACT.Class_Files.DecisionHandler.handleInput C# (CSharp) Метод

handleInput() публичный статический Метод

public static handleInput ( string message, bool canMove ) : void
message string
canMove bool
Результат void
        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);
            }
            */
        }

Usage Example

Пример #1
0
        public static void Read()
        {
            while (_continue)
            {
                try
                {
                    UserVariables.isInitiated = true;

                    string message = Connection._serialPort.ReadLine();

                    UserInterface.logPrinter(message);

                    DecisionHandler.handleInput(message);
                }
                catch (TimeoutException) { }
            } //end while
        }     //end void
All Usage Examples Of OpenDACT.Class_Files.DecisionHandler::handleInput
DecisionHandler