From 806b850b39690dac64b8321ef760e97eb500e95b Mon Sep 17 00:00:00 2001 From: Mikkel Schmidt Date: Tue, 17 Dec 2024 15:25:27 +0100 Subject: [PATCH] PostProcessing: enable more opt-out features and print more warnings --- configuration/klippy/ratos.py | 16 ++++++++++++---- configuration/macros.cfg | 19 ++++--------------- 2 files changed, 16 insertions(+), 19 deletions(-) diff --git a/configuration/klippy/ratos.py b/configuration/klippy/ratos.py index 6475cd2b5..2a5b880ba 100644 --- a/configuration/klippy/ratos.py +++ b/configuration/klippy/ratos.py @@ -144,12 +144,20 @@ def cmd_RATOS_LOG(self, gcmd): desc_PROCESS_GCODE_FILE = "G-code post-processor for IDEX and RMMU" def cmd_PROCESS_GCODE_FILE(self, gcmd): filename = gcmd.get('FILENAME', "") + isIdex = self.config.has_section("dual_carriage") if filename[0] == '/': filename = filename[1:] self.gcode.run_script_from_command("SET_GCODE_VARIABLE MACRO=START_PRINT VARIABLE=first_x VALUE=-1") self.gcode.run_script_from_command("SET_GCODE_VARIABLE MACRO=START_PRINT VARIABLE=first_y VALUE=-1") if self.bypass_post_processing: self.console_echo('Bypassing post-processing', 'info', 'Configuration option `bypass_post_processing` is set to true. Bypassing post-processing...') + if isIdex: + self.console_echo('Bypassing post-processing on IDEX machines is not recommended', 'warning', + 'RatOS IDEX features require gcode processing and transformation to be enabled._N_' + + 'You can enable it by adding the following to printer.cfg._N__N_' + + '[ratos]_N_' + + 'bypass_post_processing: False_N_' + + 'enable_gcode_transform: True_N_') self.v_sd.cmd_SDCARD_PRINT_FILE(gcmd) return @@ -214,11 +222,11 @@ def process_gcode_file(self, filename, enable_gcode_transform): args.append('--allow-unsupported-slicer-versions') args.append(path) if not enable_gcode_transform and isIdex: - self.console_echo('RatOS ToolShift requires gcode transformation to be enabled', 'warning', - 'Post-processing on IDEX machines without gcode transformation is not recommended._N_' + + self.console_echo('Post-processing on IDEX machines without gcode transformation is not recommended', 'warning', + 'RatOS IDEX features require gcode transformation to be enabled._N_' + 'You can enable it by adding the following to printer.cfg._N__N_' + - '[ratos]' + - 'enable_gcode_transform: True') + '[ratos]_N_' + + 'enable_gcode_transform: True_N_') logging.info('Post-processing started via RatOS CLI: ' + str(args)) self.console_echo('Post-processing started', 'info', 'Processing %s (%.2f mb)...' % (filename, size / 1024 / 1024)); process = subprocess.Popen( diff --git a/configuration/macros.cfg b/configuration/macros.cfg index 7637d4038..2baa37595 100644 --- a/configuration/macros.cfg +++ b/configuration/macros.cfg @@ -331,7 +331,6 @@ gcode: {% set total_layer_count = params.TOTAL_LAYER_COUNT|default(0)|int %} {% set extruder_first_layer_temp = (params.EXTRUDER_TEMP|default("")).split(",") %} - {% set client_post_processor_version = params.POST_PROCESSOR_VERSION|default(0)|int %} # echo first print coordinates RATOS_ECHO MSG="First print coordinates X:{first_x} Y:{first_y}" @@ -344,13 +343,6 @@ gcode: CONSOLE_ECHO TITLE="Incomplete Slicer Configuration detected" TYPE="warning" MSG={line_1} {% endif %} - # check client post processor version if needed - {% if client_post_processor_version > 0 %} - {% if client_post_processor_version < post_processor_version %} - { action_raise_error("Client post processor outdated. Please download the new version from the scripts folder.")} - {% endif %} - {% endif %} - # update printer stats SET_PRINT_STATS_INFO CURRENT_LAYER=1 SET_GCODE_VARIABLE MACRO=_ON_LAYER_CHANGE VARIABLE=layer_number VALUE=1 @@ -431,16 +423,13 @@ gcode: {% endif %} {% endif %} - # IDEX post processor sanity check - {% if printer["dual_carriage"] is defined %} - {% if params.MIN_X is not defined or params.MAX_X is not defined or params.FIRST_X is not defined or params.FIRST_Y is not defined %} + # IDEX copy and mirror mode sanity check + {% if (idex_mode == "copy" or idex_mode == "mirror") and printer.configfile.settings.ratos.enable_gcode_transform %} + + {% if params.MIN_X is not defined or params.MAX_X is not defined %} _LED_START_PRINTING_ERROR { action_raise_error("Something went wrong! Missing important post processor start print parameter!") } {% endif %} - {% endif %} - - # IDEX copy and mirror mode sanity check - {% if idex_mode == "copy" or idex_mode == "mirror" %} # reset object xoffset SET_GCODE_VARIABLE MACRO=START_PRINT VARIABLE=object_xoffset VALUE=0