def clear_bed(self, callback): pos = pconsole.get_position() while not pos: pos = pconsole.get_position() drop = self.mode['drop_amount'] - float(pos[2]) Logger.info("Dropping to: " + str(drop)) ################################################################################################################# #Get off of the endstop so the Z axis works... #get bed dimensions bed_x = roboprinter.printer_instance._settings.global_get(['printerProfiles','defaultProfile', 'volume','width']) bed_y = roboprinter.printer_instance._settings.global_get(['printerProfiles','defaultProfile', 'volume','depth']) #calculate final positions bed_x = float(bed_x) / 2.0 bed_y = float(bed_y) / 2.0 roboprinter.printer_instance._printer.commands('G1 X' + str(bed_x) + ' Y' + str(bed_y) +' F3000') ################################################################################################################# roboprinter.printer_instance._printer.commands('G1 Z'+ str(drop) + ' F3000') from functools import partial c = partial(callback[0], callback=callback[1]) layout = Button_Screen(roboprinter.lang.pack['FT_ZOffset_Wizard']['Warn_Restart']['Body'] , c) title = roboprinter.lang.pack['FT_ZOffset_Wizard']['Warn_Restart']['Title'] self.bb.make_screen(layout, title, option_function='no_option')
def warn_and_restart(self): Logger.info("Unlocked!") self.line_lock = False pos = pconsole.get_position() while not pos: pos = pconsole.get_position() drop = self.drop_amount - float(pos[2]) Logger.info("Dropping to: " + str(drop)) ################################################################################################################# #Get off of the endstop so the Z axis works... #get bed dimensions bed_x = roboprinter.printer_instance._settings.global_get(['printerProfiles','defaultProfile', 'volume','width']) bed_y = roboprinter.printer_instance._settings.global_get(['printerProfiles','defaultProfile', 'volume','depth']) #calculate final positions bed_x = float(bed_x) / 2.0 bed_y = float(bed_y) / 2.0 roboprinter.printer_instance._printer.commands('G1 X' + str(bed_x) + ' Y' + str(bed_y) +' F3000') ################################################################################################################# roboprinter.printer_instance._printer.commands('G1 Z'+ str(drop) + ' F3000') roboprinter.printer_instance._printer.commands('G1 X'+ str(self.start_pos_x) + ' Y'+ str(self.start_pos_y) + ' F3000') # go to first corner self.warning_screen = Button_Screen(roboprinter.lang.pack['FT_ZOffset_Wizard']['Warn_Restart']['Body'] , self.restart) title = roboprinter.lang.pack['FT_ZOffset_Wizard']['Warn_Restart']['Title'] self.bb.make_screen(self.warning_screen, title, option_function='no_option')
def make_shape(self): #Lock the button self.line_lock = True Logger.info("Locked!") pos = pconsole.get_position() while not pos: pos = pconsole.get_position() Logger.info("self.x_pos is at: " + str(self.x_pos) + " position x is at: " + str(pos[0])) Logger.info("mode is: " + str(self.corner)) if self.corner == "L2R": if float(pos[0]) < self.max_x_travel: self._line() else: self.warn_and_restart() elif self.corner == "R2L": if float(pos[0]) > self.max_x_travel: self._line() else: self.warn_and_restart() elif self.corner == "CIRCLE": if float(pos[0]) > self.max_x_travel: self._circle() else: self.warn_and_restart() else: raise ValueError("self.corner was not set to CIRCLE, R2L, or L2R Current value is: " + str(self.corner))
def _capture_zpos(self): """gets position from pconsole. :returns: integer""" Logger.info("ZCapture: Init") p = pconsole.get_position() while p == False: p = pconsole.get_position() Logger.info("ZCapture: "+ str(p)) return p[2]
def reposition(dt): roboprinter.printer_instance._printer.commands('G1 X'+ str(self.start_pos_x) + ' Y'+ str(self.start_pos_y) + ' F3000') # go to first corner roboprinter.printer_instance._printer.commands('G1 Z5') self.x_pos = self.start_pos_x #update position pconsole.get_position() pconsole.get_position() self.go_back_to_FTZO()
def record_E_position(self): #get the E Position #This sends an M114 command to the printer which will return the position for the currently selected toolhead pos = pconsole.get_position() while not pos: pos = pconsole.get_position() self.E_Position = pos[3] Logger.info("E POS recorded at: " + str(self.E_Position))
def position_callback(self, dt): temps = roboprinter.printer_instance._printer.get_current_temperatures() pos = pconsole.get_position() if pos != False: xpos = int(float(pos[0])) ypos = int(float(pos[1])) zpos = int(float(pos[2])) extruder_one_temp = 105 #find the temperature if 'tool0' in temps.keys(): extruder_one_temp = temps['tool0']['actual'] Logger.info("Counter is at: " + str(self.counter)) #check the extruder physical position if self.counter > 25 and xpos == self.old_xpos and ypos == self.old_ypos and zpos == self.old_zpos: if self.sm.current == 'zoffset[1]': if extruder_one_temp < 100: Logger.info('Succesfully found position') self.offset_adjustment_screen() return False else: self.temperature_wait_screen() return False else: Logger.info('User went to a different screen Unscheduling self.') #turn off fan roboprinter.printer_instance._printer.commands('M106 S0') return False #if finding the position fails it will wait 30 seconds and continue self.counter += 1 if self.counter > 60: if self.sm.current == 'zoffset[1]': Logger.info('could not find position, but continuing anyway') if extruder_one_temp < 100: self.offset_adjustment_screen() return False else: self.temperature_wait_screen() return False else: Logger.info('User went to a different screen Unscheduling self.') #turn off fan roboprinter.printer_instance._printer.commands('M106 S0') return False #position tracking self.old_xpos = xpos self.old_ypos = ypos self.old_zpos = zpos