diff --git a/extras/AFC.py b/extras/AFC.py index 9070235..366cce0 100644 --- a/extras/AFC.py +++ b/extras/AFC.py @@ -6,7 +6,6 @@ import json - from configparser import Error as error class afc: @@ -16,7 +15,9 @@ def __init__(self, config): self.printer.register_event_handler("klippy:connect",self.handle_connect) self.SPOOL = self.printer.load_object(config,'AFC_spool') self.ERROR = self.printer.load_object(config,'AFC_error') + self.IDLE = self.printer.load_object(config,'idle_timeout') self.gcode = self.printer.lookup_object('gcode') + self.STATUS= self.IDLE.state self.gcode_move = self.printer.load_object(config, 'gcode_move') self.VarFile = config.get('VarFile') diff --git a/extras/AFC_prep.py b/extras/AFC_prep.py index b69ab6d..01c7581 100644 --- a/extras/AFC_prep.py +++ b/extras/AFC_prep.py @@ -19,6 +19,7 @@ def __init__(self, config): self.delay = config.getfloat('delay_time', 0.1, minval=0.0) self.enable = config.getboolean("enable", False) + # Flag to set once resume rename as occured for the first time self.rename_occured = False @@ -30,6 +31,7 @@ def handle_connect(self): """ self.AFC = self.printer.lookup_object('AFC') self.AFC.gcode.register_command('PREP', self.PREP, desc=None) + def _rename_resume(self): """ @@ -69,6 +71,7 @@ def PREP(self, gcmd): self.AFC.extruders={} temp=[] + self.AFC.tool_cmds={} for PO in self.printer.objects: if 'AFC_stepper' in PO and 'tmc' not in PO: diff --git a/extras/AFC_stepper.py b/extras/AFC_stepper.py index df7078c..f2d7f7f 100644 --- a/extras/AFC_stepper.py +++ b/extras/AFC_stepper.py @@ -238,10 +238,18 @@ def prep_callback(self, eventtime, state): if self.load_state == True and self.prep_state == True: self.status = 'Loaded' self.AFC.afc_led(self.AFC.led_ready, led) + elif self.name == self.AFC.current and self.IDLE.state == 'Printing' and self.AFC.lanes[self.unit][self.name]['runout_lane'] != 'NONE': + self.status = None + self.AFC.afc_led(self.AFC.led_not_ready, led) + self.AFC.gcode.respond_info("Infinete Spool triggered") + empty_LANE = self.printer.lookup_object('AFC_stepper ' + self.AFC.current) + change_LANE = self.printer.lookup_object('AFC_stepper ' + self.AFC.lanes[self.unit][self.name]['runout_lane']) + self.gcode.run_script_from_command(change_LANE.map) + self.gcode.run_script_from_command('SET_MAP LANE=' + change_LANE.name + ' MAP=' + empty_LANE.map) else: self.status = None self.AFC.afc_led(self.AFC.led_not_ready, led) - + def do_enable(self, enable): self.sync_print_time() stepper_enable = self.printer.lookup_object('stepper_enable')