Skip to content

Commit

Permalink
PostProcessing: enable more opt-out features and print more warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
miklschmidt committed Dec 17, 2024
1 parent 5beec80 commit 806b850
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 19 deletions.
16 changes: 12 additions & 4 deletions configuration/klippy/ratos.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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(
Expand Down
19 changes: 4 additions & 15 deletions configuration/macros.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 806b850

Please sign in to comment.