def __init__(self, box_IP, box_ID, parent=None):
        QObject.__init__(self, parent)
        OutputDevice.__init__(self, box_IP)
        SignalEmitter.__init__(self)

        self.originalFlavor = self.getGCodeFlavor()
        Application.getInstance().applicationShuttingDown.connect(self.onShutDown)
        ### Interface related ###
        self.setName(catalog.i18nc("@item:inmenu", "Doodle3D printing"))
        self.setShortDescription(catalog.i18nc("@action:button", "Print with Doodle3D"))
        self.setDescription(catalog.i18nc("@info:tooltip", "Print with "+ box_ID))
        self.setIconName("print")
        self._control_view = None     # The print interface window, it gets created later
        self.printButton = True
        #######################################################################

        ### Printer ###
        self._box_IP = box_IP         # IP address of this Doodle3D WiFi box
        self._box_ID = box_ID
        self._is_connecting = False   # Printer is connecting
        self._is_connected = False    # Printer is connected
        self._is_printing = False     # Printer is printing
        self._is_cancelling = False   # Printer is cancelling
        self._progress = 0            # Printer progress (0 to 100%)

        self.printBoolean = False
        
        self._heatedUp = False         # Printer heated up
        self._extTemperature = 0       # Extruder temperature
        self._extTargetTemperature = 0 # Target Extruder Temperature
        self._bedTemperature = 0       # Temperature of the bed
        self._bedTargetTemperature = 0     # Target Temperature of the bed

        self._currentLine = 0         # Current line (in the gcode_list) in printing
        self.currentblock = 0
        self.total = 0         
        self._totalLines = 0          # Total lines that's gonna be printed
        self._progress = 0            # Progress of the print
        self._printPhase = ""         # 3 printer phases: "Heating up... ", "Printing... " and "Print Completed "
        self._printerState = ""
        self._stateLocked = False       

        self._gcode_list = []         # Cura-generated GCode
        #######################################################################

        ### Threading ###
        self._printer_info_thread = threading.Thread(target=self.getPrinterInfo)  # The function that gets threaded
        self._printer_info_thread.daemon = True # Daemon threads are automatically killed automatically upon program quit
        self._printer_info_thread.start()       # Starts thread

        self._connect_thread = threading.Thread(target=self._connect)
        self._connect_thread.daemon = True
Пример #2
0
    def __init__(self, parent = None):
        QObject.__init__(self, parent)
        SignalEmitter.__init__(self)
        OutputDevicePlugin.__init__(self)
        Extension.__init__(self)
        self._serial_port_list = []
        self._printer_connections = {}
        self._printer_connections_model = None
        self._update_thread = threading.Thread(target = self._updateThread)
        self._update_thread.setDaemon(True)

        self._check_updates = True
        self._firmware_view = None

        ## Add menu item to top menu of the application.
        self.setMenuName(i18n_catalog.i18nc("@title:menu","Firmware"))
        self.addMenuItem(i18n_catalog.i18nc("@item:inmenu", "Update Firmware"), self.updateAllFirmware)

        Application.getInstance().applicationShuttingDown.connect(self.stop)
        self.addConnectionSignal.connect(self.addConnection) #Because the model needs to be created in the same thread as the QMLEngine, we use a signal.
Пример #3
0
    def __init__(self, parent=None):
        QObject.__init__(self, parent)
        SignalEmitter.__init__(self)
        OutputDevicePlugin.__init__(self)
        Extension.__init__(self)

        self._serial_port_list = []
        self._printer_connections = {}
        self._printer_connections_model = None
        self._update_thread = threading.Thread(target=self._updateThread)
        self._update_thread.setDaemon(True)

        self._check_updates = True
        self._firmware_view = None
        self.updatetrigger = False

        # Add menu item to top menu of the application.
        self.setMenuName(i18n_catalog.i18nc("@title:menu", "Doodle3D"))
        self.addMenuItem(i18n_catalog.i18nc("@item:inlistbox", "Enable Scan devices..."), self.updateAllFirmware)

        Application.getInstance().applicationShuttingDown.connect(self.stop)
        self.addConnectionSignal.connect(self.addConnection)
Пример #4
0
    def __init__(self, serial_port, parent = None):
        QObject.__init__(self, parent)
        OutputDevice.__init__(self, serial_port)
        SignalEmitter.__init__(self)
        #super().__init__(serial_port)
        self.setName(catalog.i18nc("@item:inmenu", "USB printing"))
        self.setShortDescription(catalog.i18nc("@action:button", "Print with USB"))
        self.setDescription(catalog.i18nc("@info:tooltip", "Print with USB"))
        self.setIconName("print")

        self._serial = None
        self._serial_port = serial_port
        self._error_state = None

        self._connect_thread = threading.Thread(target = self._connect)
        self._connect_thread.daemon = True

        self._end_stop_thread = threading.Thread(target = self._pollEndStop)
        self._end_stop_thread.deamon = True
        self._poll_endstop = -1

        # Printer is connected
        self._is_connected = False

        # Printer is in the process of connecting
        self._is_connecting = False

        # The baud checking is done by sending a number of m105 commands to the printer and waiting for a readable
        # response. If the baudrate is correct, this should make sense, else we get giberish.
        self._required_responses_auto_baud = 3

        self._progress = 0

        self._listen_thread = threading.Thread(target=self._listen)
        self._listen_thread.daemon = True

        self._update_firmware_thread = threading.Thread(target= self._updateFirmware)
        self._update_firmware_thread.daemon = True
        
        self._heatup_wait_start_time = time.time()

        ## Queue for commands that need to be send. Used when command is sent when a print is active.
        self._command_queue = queue.Queue()

        self._is_printing = False

        ## Set when print is started in order to check running time.
        self._print_start_time = None
        self._print_start_time_100 = None

        ## Keep track where in the provided g-code the print is
        self._gcode_position = 0

        # List of gcode lines to be printed
        self._gcode = []

        # Number of extruders
        self._extruder_count = 1

        # Temperatures of all extruders
        self._extruder_temperatures = [0] * self._extruder_count

        # Target temperatures of all extruders
        self._target_extruder_temperatures = [0] * self._extruder_count

        #Target temperature of the bed
        self._target_bed_temperature = 0 

        # Temperature of the bed
        self._bed_temperature = 0

        # Current Z stage location 
        self._current_z = 0

        self._x_min_endstop_pressed = False
        self._y_min_endstop_pressed = False
        self._z_min_endstop_pressed = False

        self._x_max_endstop_pressed = False
        self._y_max_endstop_pressed = False
        self._z_max_endstop_pressed = False

        # In order to keep the connection alive we request the temperature every so often from a different extruder.
        # This index is the extruder we requested data from the last time.
        self._temperature_requested_extruder_index = 0 

        self._updating_firmware = False

        self._firmware_file_name = None

        self._control_view = None
Пример #5
0
    def __init__(self, serial_port, parent=None):
        QObject.__init__(self, parent)
        OutputDevice.__init__(self, serial_port)
        SignalEmitter.__init__(self)
        #super().__init__(serial_port)
        self.setName(catalog.i18nc("@item:inmenu", "USB printing"))
        self.setShortDescription(
            catalog.i18nc("@action:button", "Print with USB"))
        self.setDescription(catalog.i18nc("@info:tooltip", "Print with USB"))
        self.setIconName("print")

        self._serial = None
        self._serial_port = serial_port
        self._error_state = None

        self._connect_thread = threading.Thread(target=self._connect)
        self._connect_thread.daemon = True

        self._end_stop_thread = threading.Thread(target=self._pollEndStop)
        self._end_stop_thread.daemon = True
        self._poll_endstop = -1

        # Printer is connected
        self._is_connected = False

        # Printer is in the process of connecting
        self._is_connecting = False

        # The baud checking is done by sending a number of m105 commands to the printer and waiting for a readable
        # response. If the baudrate is correct, this should make sense, else we get giberish.
        self._required_responses_auto_baud = 3

        self._progress = 0

        self._listen_thread = threading.Thread(target=self._listen)
        self._listen_thread.daemon = True

        self._update_firmware_thread = threading.Thread(
            target=self._updateFirmware)
        self._update_firmware_thread.daemon = True
        self.firmwareUpdateComplete.connect(self._onFirmwareUpdateComplete)

        self._heatup_wait_start_time = time.time()

        ## Queue for commands that need to be send. Used when command is sent when a print is active.
        self._command_queue = queue.Queue()

        self._is_printing = False

        ## Set when print is started in order to check running time.
        self._print_start_time = None
        self._print_start_time_100 = None

        ## Keep track where in the provided g-code the print is
        self._gcode_position = 0

        # List of gcode lines to be printed
        self._gcode = []

        # Number of extruders
        self._extruder_count = 1

        # Temperatures of all extruders
        self._extruder_temperatures = [0] * self._extruder_count

        # Target temperatures of all extruders
        self._target_extruder_temperatures = [0] * self._extruder_count

        #Target temperature of the bed
        self._target_bed_temperature = 0

        # Temperature of the bed
        self._bed_temperature = 0

        # Current Z stage location
        self._current_z = 0

        self._x_min_endstop_pressed = False
        self._y_min_endstop_pressed = False
        self._z_min_endstop_pressed = False

        self._x_max_endstop_pressed = False
        self._y_max_endstop_pressed = False
        self._z_max_endstop_pressed = False

        # In order to keep the connection alive we request the temperature every so often from a different extruder.
        # This index is the extruder we requested data from the last time.
        self._temperature_requested_extruder_index = 0

        self._updating_firmware = False

        self._firmware_file_name = None

        self._control_view = None