From 7b63ffe1ad79ab457bf1cc7790bcb6a421ad3c6a Mon Sep 17 00:00:00 2001 From: weemantella <161925311+weemantella@users.noreply.github.com> Date: Mon, 7 Oct 2024 20:05:30 -0600 Subject: [PATCH 1/8] Added Hub Move on Load snd Unload --- AFC.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/AFC.py b/AFC.py index e6a5dd55..0c5d0ffe 100644 --- a/AFC.py +++ b/AFC.py @@ -1,4 +1,4 @@ -# 8 Track Automated Filament Changer +.# 8 Track Automated Filament Changer # # Copyright (C) 2024 Armored Turtle # @@ -467,6 +467,9 @@ def TOOL_LOAD(self, CUR_LANE): CUR_LANE.do_enable(True) if CUR_LANE.hub_load == False: CUR_LANE.move(CUR_LANE.dist_hub, self.short_moves_speed, self.short_moves_accel) + if self.hub.filament_present == False: + CUR_LANE.move(self.hub_dis + self.short_move_dis, self.short_moves_speed, self.short_moves_accel) + self.toolhead.wait_moves() hub_attempts = 0 while self.hub.filament_present == False: CUR_LANE.move( self.short_move_dis, self.short_moves_speed, self.short_moves_accel) @@ -609,6 +612,9 @@ def TOOL_UNLOAD(self, CUR_LANE): self.toolhead.wait_moves() CUR_LANE.extruder_stepper.sync_to_extruder(None) CUR_LANE.move( self.afc_bowden_length * -1, self.long_moves_speed, self.long_moves_accel, True) + if self.hub.filament_present == True: + CUR_LANE.move( self.hub_dis * -1, self.short_moves_speed, self.short_moves_accel, True) + self.toolhead.wait_moves() num_tries = 0 while self.hub.filament_present == True: CUR_LANE.move(self.short_move_dis * -1, self.short_moves_speed, self.short_moves_accel, True) From d9e9b93bca1db6d918347f6b1423d289d4b03822 Mon Sep 17 00:00:00 2001 From: weemantella <161925311+weemantella@users.noreply.github.com> Date: Mon, 7 Oct 2024 20:11:44 -0600 Subject: [PATCH 2/8] Update AFC.py fixed syntax --- AFC.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AFC.py b/AFC.py index 0c5d0ffe..0dc13342 100644 --- a/AFC.py +++ b/AFC.py @@ -1,4 +1,4 @@ -.# 8 Track Automated Filament Changer +# 8 Track Automated Filament Changer # # Copyright (C) 2024 Armored Turtle # From 45ca2e86ab8f552e91ec1f674d6f127649c5b4b3 Mon Sep 17 00:00:00 2001 From: weemantella <161925311+weemantella@users.noreply.github.com> Date: Mon, 7 Oct 2024 22:36:23 -0600 Subject: [PATCH 3/8] adapt bowden length based on hub attempts On tool load, if the hub isn't cleared with the hub_dis move. use the hub attempts to adjust the bowden length to avoid moving the filament too far and jamming it into the extruder. --- AFC.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AFC.py b/AFC.py index 0dc13342..4021061c 100644 --- a/AFC.py +++ b/AFC.py @@ -480,7 +480,7 @@ def TOOL_LOAD(self, CUR_LANE): message = (' PAST HUB, CHECK FILAMENT PATH\n||=====||==>--||-----||\nTRG LOAD HUB TOOL') self.handle_lane_failure(CUR_LANE, message) return - CUR_LANE.move( self.afc_bowden_length, self.long_moves_speed, self.long_moves_accel) + CUR_LANE.move(self.afc_bowden_length - (hub_attempts * self.short_move_dis), self.long_moves_speed, self.long_moves_accel) CUR_LANE.extruder_stepper.sync_to_extruder(CUR_LANE.extruder_name) tool_attempts = 0 while self.tool.filament_present == False: From 0c879ac83d9fd1b1067ed7ed969e50f5169dc77c Mon Sep 17 00:00:00 2001 From: weemantella <161925311+weemantella@users.noreply.github.com> Date: Wed, 9 Oct 2024 00:55:39 -0600 Subject: [PATCH 4/8] Add set Bowden length command --- AFC.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/AFC.py b/AFC.py index 4021061c..67edf867 100644 --- a/AFC.py +++ b/AFC.py @@ -106,10 +106,15 @@ def __init__(self, config): self.gcode.register_command('LANE_MOVE', self.cmd_LANE_MOVE, desc=self.cmd_LANE_MOVE_help) self.gcode.register_command('TEST', self.cmd_TEST, desc=self.cmd_TEST_help) self.gcode.register_command('HUB_CUT_TEST', self.cmd_HUB_CUT_TEST, desc=self.cmd_HUB_CUT_TEST_help) + self.gcode.register_mux_command('SET_BOWDEN_LENGTH', self.cmd_SET_BOWDEN_LENGTH, desc=self.cmd_SET_BOWDEN_LENGTH_help) self.VarFile = config.get('VarFile') # Get debug and cast to boolean self.debug = True == config.get('debug', 0) + cmd_SET_BOWDEN_LENGTH_help = "Set length of bowden, hub to toolhead" + def cmd_SET_BOWDEN_LENGTH(self, gcmd): + pass + cmd_LANE_MOVE_help = "Lane Manual Movements" def cmd_LANE_MOVE(self, gcmd): lane = gcmd.get('LANE', None) From 796202c3203d8520498dc8f9f240d14e56b8c4e2 Mon Sep 17 00:00:00 2001 From: weemantella <161925311+weemantella@users.noreply.github.com> Date: Wed, 9 Oct 2024 01:21:46 -0600 Subject: [PATCH 5/8] Set bowden length mux command --- AFC.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/AFC.py b/AFC.py index 67edf867..3818d123 100644 --- a/AFC.py +++ b/AFC.py @@ -106,14 +106,19 @@ def __init__(self, config): self.gcode.register_command('LANE_MOVE', self.cmd_LANE_MOVE, desc=self.cmd_LANE_MOVE_help) self.gcode.register_command('TEST', self.cmd_TEST, desc=self.cmd_TEST_help) self.gcode.register_command('HUB_CUT_TEST', self.cmd_HUB_CUT_TEST, desc=self.cmd_HUB_CUT_TEST_help) - self.gcode.register_mux_command('SET_BOWDEN_LENGTH', self.cmd_SET_BOWDEN_LENGTH, desc=self.cmd_SET_BOWDEN_LENGTH_help) + self.gcode.register_mux_command('SET_BOWDEN_LENGTH', 'LENGTH', self.cmd_SET_BOWDEN_LENGTH, desc=self.cmd_SET_BOWDEN_LENGTH_help) self.VarFile = config.get('VarFile') # Get debug and cast to boolean self.debug = True == config.get('debug', 0) cmd_SET_BOWDEN_LENGTH_help = "Set length of bowden, hub to toolhead" def cmd_SET_BOWDEN_LENGTH(self, gcmd): - pass + config_bowden = self.afc_bowden_length + bowden_length = get_float('LENGTH', self.afc_bowden_length) + self.afc_bowden_length = bowden_length + msg = (f"Config Bowden length: {config_bowden}\n" + f"New Bowden Length: {bowden_length}") + self.respond_info(msg) cmd_LANE_MOVE_help = "Lane Manual Movements" def cmd_LANE_MOVE(self, gcmd): From e37215731931312afbedce7af06261ff33779d71 Mon Sep 17 00:00:00 2001 From: weemantella <161925311+weemantella@users.noreply.github.com> Date: Wed, 9 Oct 2024 01:30:20 -0600 Subject: [PATCH 6/8] return to previous state, more testing needed --- AFC.py | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/AFC.py b/AFC.py index 3818d123..e25487a6 100644 --- a/AFC.py +++ b/AFC.py @@ -106,19 +106,9 @@ def __init__(self, config): self.gcode.register_command('LANE_MOVE', self.cmd_LANE_MOVE, desc=self.cmd_LANE_MOVE_help) self.gcode.register_command('TEST', self.cmd_TEST, desc=self.cmd_TEST_help) self.gcode.register_command('HUB_CUT_TEST', self.cmd_HUB_CUT_TEST, desc=self.cmd_HUB_CUT_TEST_help) - self.gcode.register_mux_command('SET_BOWDEN_LENGTH', 'LENGTH', self.cmd_SET_BOWDEN_LENGTH, desc=self.cmd_SET_BOWDEN_LENGTH_help) self.VarFile = config.get('VarFile') # Get debug and cast to boolean self.debug = True == config.get('debug', 0) - - cmd_SET_BOWDEN_LENGTH_help = "Set length of bowden, hub to toolhead" - def cmd_SET_BOWDEN_LENGTH(self, gcmd): - config_bowden = self.afc_bowden_length - bowden_length = get_float('LENGTH', self.afc_bowden_length) - self.afc_bowden_length = bowden_length - msg = (f"Config Bowden length: {config_bowden}\n" - f"New Bowden Length: {bowden_length}") - self.respond_info(msg) cmd_LANE_MOVE_help = "Lane Manual Movements" def cmd_LANE_MOVE(self, gcmd): From 03ca61bb5b61efb202288676162b885c22fb10b3 Mon Sep 17 00:00:00 2001 From: weemantella <161925311+weemantella@users.noreply.github.com> Date: Sun, 13 Oct 2024 01:11:02 -0600 Subject: [PATCH 7/8] Add Set Bowden length mux, adjust movements --- AFC.py | 38 ++++++++++++++++++++++++++++++++------ 1 file changed, 32 insertions(+), 6 deletions(-) diff --git a/AFC.py b/AFC.py index 083f5b13..6a4bcb4c 100644 --- a/AFC.py +++ b/AFC.py @@ -90,16 +90,39 @@ def __init__(self, config): self.gcode.register_command('LANE_MOVE', self.cmd_LANE_MOVE, desc=self.cmd_LANE_MOVE_help) self.gcode.register_command('TEST', self.cmd_TEST, desc=self.cmd_TEST_help) self.gcode.register_command('HUB_CUT_TEST', self.cmd_HUB_CUT_TEST, desc=self.cmd_HUB_CUT_TEST_help) + self.gcode.register_mux_command('SET_BOWDEN_LENGTH', 'AFC', None, self.cmd_SET_BOWDEN_LENGTH, desc=self.cmd_SET_BOWDEN_LENGTH_help) self.VarFile = config.get('VarFile') # Get debug and cast to boolean self.debug = True == config.get('debug', 0) + + cmd_SET_BOWDEN_LENGTH_help = "Set length of bowden, hub to toolhead" + def cmd_SET_BOWDEN_LENGTH(self, gcmd): + config_bowden = self.afc_bowden_length + length_param = gcmd.get('LENGTH', None) + if length_param is None or length_param.strip() == '': + bowden_length = self.config_bowden_length + else: + if length_param[0] in ('+', '-'): + bowden_value = float(length_param) + bowden_length = config_bowden + bowden_value + else: + bowden_length = float(length_param) + self.afc_bowden_length = bowden_length + msg = (f"Config Bowden Length: {self.config_bowden_length}\n" + f"Previous Bowden Length: {config_bowden}\n" + f"New Bowden Length: {bowden_length}") + self.respond_info(msg) cmd_LANE_MOVE_help = "Lane Manual Movements" def cmd_LANE_MOVE(self, gcmd): lane = gcmd.get('LANE', None) distance = gcmd.get_float('DISTANCE', 0) CUR_LANE = self.printer.lookup_object('AFC_stepper ' + lane) - CUR_LANE.move(distance, self.short_moves_speed, self.short_moves_accel) + if distance < 0: + CUR_LANE.move(distance, self.short_moves_speed, self.short_moves_accel, True) + else: + CUR_LANE.move(distance, self.short_moves_speed, self.short_moves_accel) + def respond_info(self, msg): """ @@ -406,15 +429,18 @@ def cmd_PREP(self, gcmd): def cmd_HUB_LOAD(self, gcmd): lane = gcmd.get('LANE', None) CUR_LANE = self.printer.lookup_object('AFC_stepper ' + lane) + if self.hub.filament_present == True: + self.respond_error(f"HUB TRIGGERED, CAN'T HUB LOAD {CUR_LANE.name.upper()}") + return if CUR_LANE.load_state == False: CUR_LANE.do_enable(True) while CUR_LANE.load_state == False: - CUR_LANE.move( self.hub_move_dis, self.short_moves_speed, self.short_moves_accel) + CUR_LANE.move(self.hub_move_dis, self.short_moves_speed, self.short_moves_accel) CUR_LANE.move(CUR_LANE.dist_hub, self.short_moves_speed, self.short_moves_accel) while self.hub.filament_present == False: CUR_LANE.move(self.hub_move_dis, self.short_moves_speed, self.short_moves_accel) while self.hub.filament_present == True: - CUR_LANE.move(self.hub_move_dis * -1, self.short_moves_speed, self.short_moves_accel) + CUR_LANE.move(self.hub_move_dis * -1, self.short_moves_speed, self.short_moves_accel, True) CUR_LANE.status = 'Hubed' CUR_LANE.do_enable(False) @@ -425,11 +451,11 @@ def cmd_LANE_UNLOAD(self, gcmd): if CUR_LANE.name != self.current: CUR_LANE.do_enable(True) if CUR_LANE.dist_hub: - CUR_LANE.move(CUR_LANE.dist_hub * -1, self.short_moves_speed, self.short_moves_accel) + CUR_LANE.move(CUR_LANE.dist_hub * -1, self.short_moves_speed, self.short_moves_accel, True) CUR_LANE.dist_hub = False while CUR_LANE.load_state == True: - CUR_LANE.move( self.hub_move_dis * -1, self.short_moves_speed, self.short_moves_accel) - CUR_LANE.move( self.hub_move_dis * -5, self.short_moves_speed, self.short_moves_accel) + CUR_LANE.move(self.hub_move_dis * -1, self.short_moves_speed, self.short_moves_accel, True) + CUR_LANE.move(self.hub_move_dis * -5, self.short_moves_speed, self.short_moves_accel, True) CUR_LANE.do_enable(False) CUR_LANE.status = None else: From 88d43892124f513bd64c028d003be7391396ac4a Mon Sep 17 00:00:00 2001 From: weemantella <161925311+weemantella@users.noreply.github.com> Date: Sun, 13 Oct 2024 02:16:50 -0600 Subject: [PATCH 8/8] Update AFC.py Add config_bowden_length to store length for mux command --- AFC.py | 1 + 1 file changed, 1 insertion(+) diff --git a/AFC.py b/AFC.py index 6a4bcb4c..ecdebb9a 100644 --- a/AFC.py +++ b/AFC.py @@ -65,6 +65,7 @@ def __init__(self, config): self.tool_stn = config.getfloat("tool_stn", 120) self.tool_stn_unload = config.getfloat("tool_stn_unload", self.tool_stn) self.afc_bowden_length = config.getfloat("afc_bowden_length", 900) + self.config_bowden_length = self.afc_bowden_length # MOVE SETTINGS self.tool_sensor_after_extruder = config.getfloat("tool_sensor_after_extruder", 0)