Skip to content

Commit 07ff136

Browse files
authored
Merge pull request #535 from ArmoredTurtle/DEV
DEV to Main 2025-09-06
2 parents 13c011e + 9266b73 commit 07ff136

4 files changed

Lines changed: 48 additions & 14 deletions

File tree

CHANGELOG.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,13 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8-
## [2025-09-09]
8+
## [2025-09-05]
9+
### Added
10+
- Check to verify that pin_tool_start/end is not set to `Unknown`, throws error if pins are set to `Unknown`.
11+
### Fixes
12+
- Compatibility issue with klipper after version v0.13.0-190-g5eb07966
13+
14+
## [2025-09-01]
915
### Fixes
1016
- Issue with older klipper version before debounce button was added
1117

extras/AFC.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
try: from extras.AFC_stats import AFCStats
2828
except: raise error(ERROR_STR.format(import_lib="AFC_stats", trace=traceback.format_exc()))
2929

30-
AFC_VERSION="1.0.30"
30+
AFC_VERSION="1.0.31"
3131

3232
# Class for holding different states so its clear what all valid states are
3333
class State:

extras/AFC_extruder.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ def __init__(self, config):
4242

4343
self.tool_start_state = False
4444
if self.tool_start is not None:
45+
if "unknown" == self.tool_start.lower():
46+
raise error(f"Unknown is not valid for pin_tool_start in [{self.fullname}] config.")
47+
4548
if self.tool_start == "buffer":
4649
self.logger.info("Setting up as buffer")
4750
else:
@@ -52,6 +55,9 @@ def __init__(self, config):
5255

5356
self.tool_end_state = False
5457
if self.tool_end is not None:
58+
if "unknown" == self.tool_end.lower():
59+
raise error(f"Unknown is not valid for pin_tool_end in [{self.fullname}] config.")
60+
5561
buttons.register_buttons([self.tool_end], self.tool_end_callback)
5662
self.fila_tool_end, self.debounce_button_end = add_filament_switch("tool_end", self.tool_end, self.printer,
5763
self.enable_sensors_in_gui, self.handle_end_runout, self.enable_runout,

extras/AFC_stepper.py

Lines changed: 34 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,34 @@
1717
try: from extras.AFC_lane import AFCLane
1818
except: raise error(ERROR_STR.format(import_lib="AFC_lane", trace=traceback.format_exc()))
1919

20+
LARGE_TIME_OFFSET = 99999.9
21+
2022
class AFCExtruderStepper(AFCLane):
2123
def __init__(self, config):
2224
super().__init__(config)
2325

2426
self.extruder_stepper = extruder.ExtruderStepper(config)
2527

26-
self.motion_queue = None
28+
# Check for Klipper new motion queuing update
29+
try:
30+
self.motion_queuing = self.printer.load_object(config, "motion_queuing")
31+
except Exception:
32+
self.motion_queuing = None
33+
2734
self.next_cmd_time = 0.
35+
2836
ffi_main, ffi_lib = chelper.get_ffi()
29-
self.trapq = ffi_main.gc(ffi_lib.trapq_alloc(), ffi_lib.trapq_free)
30-
self.trapq_append = ffi_lib.trapq_append
31-
self.trapq_finalize_moves = ffi_lib.trapq_finalize_moves
3237
self.stepper_kinematics = ffi_main.gc(
3338
ffi_lib.cartesian_stepper_alloc(b'x'), ffi_lib.free)
39+
40+
if self.motion_queuing is not None:
41+
self.trapq = self.motion_queuing.allocate_trapq()
42+
self.trapq_append = self.motion_queuing.lookup_trapq_append()
43+
else:
44+
self.trapq = ffi_main.gc(ffi_lib.trapq_alloc(), ffi_lib.trapq_free)
45+
self.trapq_append = ffi_lib.trapq_append
46+
self.trapq_finalize_moves = ffi_lib.trapq_finalize_moves
47+
3448
self.assist_activate=False
3549

3650
# Current to use while printing, set to a lower current to reduce stepper heat when printing.
@@ -69,24 +83,32 @@ def _move(self, distance, speed, accel, assist_active=False):
6983

7084

7185
with self.assist_move(speed, distance < 0, assist_active):
86+
# Code based off force_move.py manual_move function
7287
toolhead = self.printer.lookup_object('toolhead')
7388
toolhead.flush_step_generation()
74-
prev_sk = self.extruder_stepper.stepper.set_stepper_kinematics(self.stepper_kinematics)
75-
prev_trapq = self.extruder_stepper.stepper.set_trapq(self.trapq)
89+
prev_sk = self.extruder_stepper.stepper.set_stepper_kinematics(self.stepper_kinematics)
90+
prev_trapq = self.extruder_stepper.stepper.set_trapq(self.trapq)
7691
self.extruder_stepper.stepper.set_position((0., 0., 0.))
7792
axis_r, accel_t, cruise_t, cruise_v = calc_move_time(distance, speed, accel)
7893
print_time = toolhead.get_last_move_time()
7994
self.trapq_append(self.trapq, print_time, accel_t, cruise_t, accel_t,
8095
0., 0., 0., axis_r, 0., 0., 0., cruise_v, accel)
8196
print_time = print_time + accel_t + cruise_t + accel_t
82-
self.extruder_stepper.stepper.generate_steps(print_time)
83-
self.trapq_finalize_moves(self.trapq, print_time + 99999.9,
84-
print_time + 99999.9)
85-
self.extruder_stepper.stepper.set_trapq(prev_trapq)
86-
self.extruder_stepper.stepper.set_stepper_kinematics(prev_sk)
87-
toolhead.note_mcu_movequeue_activity(print_time)
97+
98+
if self.motion_queuing is None:
99+
self.extruder_stepper.stepper.generate_steps(print_time)
100+
self.trapq_finalize_moves(self.trapq, print_time + LARGE_TIME_OFFSET,
101+
print_time + LARGE_TIME_OFFSET)
102+
toolhead.note_mcu_movequeue_activity(print_time)
103+
else:
104+
self.motion_queuing.note_mcu_movequeue_activity(print_time)
105+
88106
toolhead.dwell(accel_t + cruise_t + accel_t)
89107
toolhead.flush_step_generation()
108+
self.extruder_stepper.stepper.set_trapq(prev_trapq)
109+
self.extruder_stepper.stepper.set_stepper_kinematics(prev_sk)
110+
if self.motion_queuing is not None:
111+
self.motion_queuing.wipe_trapq(self.trapq)
90112
toolhead.wait_moves()
91113

92114
def move(self, distance, speed, accel, assist_active=False):

0 commit comments

Comments
 (0)