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>
This commit is contained in:
@@ -15,6 +15,11 @@ class PrintStats:
|
|||||||
self.gcode.register_command(
|
self.gcode.register_command(
|
||||||
"SET_PRINT_STATS_INFO", self.cmd_SET_PRINT_STATS_INFO,
|
"SET_PRINT_STATS_INFO", self.cmd_SET_PRINT_STATS_INFO,
|
||||||
desc=self.cmd_SET_PRINT_STATS_INFO_help)
|
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):
|
def _update_filament_usage(self, eventtime):
|
||||||
gc_status = self.gcode_move.get_status(eventtime)
|
gc_status = self.gcode_move.get_status(eventtime)
|
||||||
cur_epos = gc_status['position'].e
|
cur_epos = gc_status['position'].e
|
||||||
|
|||||||
Reference in New Issue
Block a user