Exemple #1
0
class Diagnostics(FloatLayout, MakesmithInitFuncs):
    def about(self):
        popupText = 'Ground Control v' + str(self.data.version) + ' allows you to control the Maslow machine. ' + \
                    'From within Ground Control, you can move the machine to where you want to begin a cut, calibrate the machine, ' + \
                    'open and run a g-code file, or monitor the progress of an ongoing cut. For more details see the Maslow website ' + \
                    'at http://www.maslowcnc.com/. The source code can be downloaded at https://github.com/MaslowCNC. ' + \
                    '\n\n' + \
                    'GroundControl is part of the of the Maslow Control Software Copyright (C) 2014-2017 Bar Smith. ' + \
                    'This program is free software: you can redistribute it and/or modify ' + \
                    'it under the terms of the GNU General Public License as published by ' + \
                    'the Free Software Foundation, either version 3 of the License, or ' + \
                    '(at your option) any later version. ' + \
                    '\n\n' + \
                    'This program is distributed in the hope that it will be useful, ' + \
                    'but WITHOUT ANY WARRANTY; without even the implied warranty of ' + \
                    'MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the ' + \
                    'GNU General Public License for more details. ' + \
                    '\n\n' + \
                    'You should have received a copy of the GNU General Public License ' + \
                    'along with the Maslow Control Software. If not, see <http://www.gnu.org/licenses/>.'

        content = ScrollableTextPopup(cancel=self.dismiss_popup,
                                      text=popupText,
                                      markup=True)
        if sys.platform.startswith('darwin'):
            self._popup = Popup(title="About GroundControl",
                                content=content,
                                size=(520, 400),
                                size_hint=(.6, .6))
        else:
            self._popup = Popup(title="About GroundControl",
                                content=content,
                                size=(520, 400),
                                size_hint=(None, None))
        self._popup.open()

    def dismiss_popup(self):
        '''
        
        Close The Pop-up
        
        '''
        self._popup.dismiss()

    def calibrateChainLengths(self):
        '''
        
        This function is called when the "Calibrate Chain Lengths Automatic" button is pressed under the Actions window
        
        '''

        self.popupContent = CalibrationFrameWidget(
            done=self.dismissCalibrationPopup)
        self.popupContent.setupJustChainsCalibration()
        self.popupContent.on_Enter()

        self._popup = Popup(title="Calibrate Chain Lengths",
                            content=self.popupContent,
                            size_hint=(0.85, 0.95),
                            auto_dismiss=False)
        self._popup.open()

    def runJustTriangularCuts(self):
        '''
        
        This function is called when the "Run Triangular Test Cuts" button under advanced options is pressed
        
        '''

        self.popupContent = CalibrationFrameWidget(
            done=self.dismissCalibrationPopup)
        self.popupContent.setupJustTriangularTestCuts()
        self.popupContent.on_Enter()

        self._popup = Popup(title="Calibrate Chain Lengths",
                            content=self.popupContent,
                            size_hint=(0.85, 0.95),
                            auto_dismiss=False)
        self._popup.open()

    def manualCalibration(self):
        '''
        
        This function is called when the "Run Triangular Test Cuts" button under advanced options is pressed
        
        '''

        self.popupContent = CalibrationFrameWidget(
            done=self.dismissCalibrationPopup)
        self.popupContent.setupManualCalibration()
        self.popupContent.on_Enter()

        self._popup = Popup(title="Calibrate Chain Lengths",
                            content=self.popupContent,
                            size_hint=(0.85, 0.95),
                            auto_dismiss=False)
        self._popup.open()

    def manualCalibrateChainLengths(self):
        self.data.gcode_queue.put("B08 ")
        self.parentWidget.close()

    def testMotors(self):
        self.data.gcode_queue.put("B04 ")
        self.parentWidget.close()

    def wipeEEPROM(self):
        self.data.gcode_queue.put("$RST=* ")
        Clock.schedule_once(self.data.pushSettings, 6)
        self.parentWidget.close()

    def calibrateMachine(self):
        '''
        
        Spawns a walk through that helps the user measure the machine's dimensions
        
        '''
        self.popupContent = CalibrationFrameWidget(
            done=self.dismissCalibrationPopup)
        self.popupContent.setupFullCalibration()
        self.popupContent.on_Enter()
        self._popup = Popup(title="Calibration",
                            content=self.popupContent,
                            size_hint=(0.95, 0.95),
                            auto_dismiss=False)
        self._popup.open()

    def dismissCalibrationPopup(self):
        '''
        
        Close The calibration Pop-up
        
        '''
        self.data.calibrationInProcess = False
        self._popup.dismiss()

    def launchSimulation(self):
        print "launch simulation"
        self.popupContent = SimulationCanvas()
        self.popupContent.data = self.data
        self.popupContent.initialize()
        self._popup = Popup(title="Maslow Calibration Simulation",
                            content=self.popupContent,
                            size_hint=(0.85, 0.95),
                            auto_dismiss=True)
        self._popup.open()
        self.parentWidget.close()

    def loadCalibrationBenchmarkTest(self):
        '''
        
        Loads the Calibration Benchmark Test file
        
        '''
        self.data.gcodeFile = "./gcodeForTesting/Calibration Benchmark Test.nc"
        self.parentWidget.close()

    def resetAllSettings(self):
        '''
        
        Renames the groundcontrol.ini file which resets all the settings to the default values
        
        '''

        currentSettingsFile = App.get_running_app().get_application_config()
        newSettingsFile = currentSettingsFile.replace(
            "groundcontrol",
            "groundcontrolbackup" + time.strftime("%Y%m%d-%H%M%S"))

        os.rename(currentSettingsFile, newSettingsFile)

        #close ground control
        app = App.get_running_app()
        app.stop()

    def advancedOptionsFunctions(self, text):

        if text == "Test Feedback System":
            self.testFeedbackSystem()
        elif text == "Set Chain Length - Manual":
            self.manualCalibrateChainLengths()
        elif text == "Wipe EEPROM":
            self.wipeEEPROM()
        elif text == "Simulation":
            self.launchSimulation()
        elif text == "Load Calibration Benchmark Test":
            self.loadCalibrationBenchmarkTest()
        elif text == "Run Triangular Test Cut Pattern":
            self.runJustTriangularCuts()
        elif text == "Reset settings to defaults":
            self.resetAllSettings()
Exemple #2
0
class Diagnostics(FloatLayout, MakesmithInitFuncs):
    def about(self):
        popupText = 'Ground Control v' + str(self.data.version) + ' allows you to control the Maslow machine. ' + \
                    'From within Ground Control, you can move the machine to where you want to begin a cut, calibrate the machine, ' + \
                    'open and run a g-code file, or monitor the progress of an ongoing cut. For more details see the Maslow website ' + \
                    'at http://www.maslowcnc.com/. The source code can be downloaded at https://github.com/MaslowCNC. ' + \
                    '\n\n' + \
                    'GroundControl is part of the of the Maslow Control Software Copyright (C) 2014-2017 Bar Smith. ' + \
                    'This program is free software: you can redistribute it and/or modify ' + \
                    'it under the terms of the GNU General Public License as published by ' + \
                    'the Free Software Foundation, either version 3 of the License, or ' + \
                    '(at your option) any later version. ' + \
                    '\n\n' + \
                    'This program is distributed in the hope that it will be useful, ' + \
                    'but WITHOUT ANY WARRANTY; without even the implied warranty of ' + \
                    'MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the ' + \
                    'GNU General Public License for more details. ' + \
                    '\n\n' + \
                    'You should have received a copy of the GNU General Public License ' + \
                    'along with the Maslow Control Software. If not, see <http://www.gnu.org/licenses/>.'

        content = ScrollableTextPopup(cancel=self.dismiss_popup,
                                      text=popupText,
                                      markup=True)
        if sys.platform.startswith('darwin'):
            self._popup = Popup(title="About GroundControl",
                                content=content,
                                size=(520, 400),
                                size_hint=(.6, .6))
        else:
            self._popup = Popup(title="About GroundControl",
                                content=content,
                                size=(520, 400),
                                size_hint=(None, None))
        self._popup.open()

    def dismiss_popup(self):
        '''
        
        Close The Pop-up
        
        '''
        self._popup.dismiss()

    def calibrateChainLengths(self):
        #establish known initial conditions
        self.data.gcode_queue.put("B06 L0 R0 ")

        self.popupContent = CalibrateLengthsPopup(
            done=self.dismissMeasureMachinePopup)
        self.popupContent.data = self.data
        self._popup = Popup(title="Calibrate Chain Lengths",
                            content=self.popupContent,
                            size_hint=(0.85, 0.95),
                            auto_dismiss=False)
        self._popup.open()

    def manualCalibrateChainLengths(self):
        self.data.gcode_queue.put("B08 ")
        self.parentWidget.close()

    def testMotors(self):
        self.data.gcode_queue.put("B04 ")
        self.parentWidget.close()

    def testFeedbackSystem(self):
        print "Testing feedback system"
        self.data.gcode = [
            "G20 ", "G1 X-1 Y-1 F25 ", "G1 X1 ", "G3 Y2 J1.5", "G1 X-1 ",
            "G1 Y-1", "G1 X0 Y0"
        ]
        self.data.gcodeIndex = 0
        self.data.uploadFlag = True
        self.data.logger.beginRecordingAvgError()
        self.data.message_queue.put(
            "Message: If you press \"Continue\" Maslow will run a small test shape and report the average positional error when finished. The z-axis will not move during this test."
        )
        self.parentWidget.close()

    def wipeEEPROM(self):
        self.data.gcode_queue.put("B07 ")
        self.parentWidget.close()

    def measureMachine(self):
        '''
        
        Spawns a walk through that helps the user measure the machine's dimensions
        
        '''
        self.popupContent = MeasureMachinePopup(
            done=self.dismissMeasureMachinePopup)
        self.popupContent.data = self.data
        self._popup = Popup(title="Setup Machine Dimensions",
                            content=self.popupContent,
                            size_hint=(0.85, 0.95),
                            auto_dismiss=False)
        self._popup.open()

    def dismissMeasureMachinePopup(self):
        '''
        
        Close The measure machine Pop-up
        
        '''
        self._popup.dismiss()

    def launchSimulation(self):
        print "launch simulation"
        self.popupContent = SimulationCanvas()
        self.popupContent.data = self.data
        self.popupContent.initialize()
        self._popup = Popup(title="Maslow Calibration Simulation",
                            content=self.popupContent,
                            size_hint=(0.85, 0.95),
                            auto_dismiss=True)
        self._popup.open()
        self.parentWidget.close()

    def advancedOptionsFunctions(self, text):

        if text == "Test Feedback System":
            self.testFeedbackSystem()
        elif text == "Calibrate Chain Length - Manual":
            self.manualCalibrateChainLengths()
        elif text == "Wipe EEPROM":
            self.wipeEEPROM()
        elif text == "Simulation":
            self.launchSimulation()