diff options
author | Ingo Donasch <idonasch@users.noreply.github.com> | 2025-05-31 19:06:44 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-05-31 13:06:44 -0400 |
commit | 2dd73d0431a2e6a0a88d5ebd95ffa870b1b45831 (patch) | |
tree | 7678ce57d3e1c2fb68a039f3112aa8e6763cafe9 | |
parent | d25602e88d320d171d68949b4c2e438ccb3c7c65 (diff) | |
download | kutter-2dd73d0431a2e6a0a88d5ebd95ffa870b1b45831.tar.gz kutter-2dd73d0431a2e6a0a88d5ebd95ffa870b1b45831.tar.xz kutter-2dd73d0431a2e6a0a88d5ebd95ffa870b1b45831.zip |
print_stats: Fix for filament statistics bug in print_stats.py for toolchangers (#6946)
added extruder:activate_extruder event hook to print_stats.py to update self.last_epos
Signed-off-by: Ingo Donasch <ingo@donasch.net>
-rw-r--r-- | klippy/extras/print_stats.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/klippy/extras/print_stats.py b/klippy/extras/print_stats.py index 668cd7d0..2eb7a01e 100644 --- a/klippy/extras/print_stats.py +++ b/klippy/extras/print_stats.py @@ -15,6 +15,11 @@ class PrintStats: self.gcode.register_command( "SET_PRINT_STATS_INFO", self.cmd_SET_PRINT_STATS_INFO, desc=self.cmd_SET_PRINT_STATS_INFO_help) + printer.register_event_handler("extruder:activate_extruder", + self._handle_activate_extruder) + def _handle_activate_extruder(self): + gc_status = self.gcode_move.get_status() + self.last_epos = gc_status['position'].e def _update_filament_usage(self, eventtime): gc_status = self.gcode_move.get_status(eventtime) cur_epos = gc_status['position'].e |