Skip to content

Commit

Permalink
correctly set the PRINT_STATS_INFO and documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
Frix-x authored Dec 13, 2023
1 parent 3388d41 commit b1b611c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
10 changes: 7 additions & 3 deletions docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,16 @@ Before your first print, **carefully check all features to prevent issues on you

Next, ensure the mechanical probe (if used) can be attached/detached, verify that QGL/Z_TILT works, and confirm correct coordinates for all components (purge bucket, physical Z endstop, etc.). Check your first layer calibration (and the `switch_offset` parameter of the automatic Z calibration plugin, if used), etc.

Finally, add custom print start G-code to your slicer. Here's an example for SuperSlicer:
Then, add this custom print start G-code to your slicer (example for SuperSlicer):
```
START_PRINT EXTRUDER_TEMP={first_layer_temperature[initial_extruder] + extruder_temperature_offset[initial_extruder]} BED_TEMP=[first_layer_bed_temperature] MATERIAL=[filament_type] CHAMBER=[chamber_temperature] SIZE={first_layer_print_min[0]}_{first_layer_print_min[1]}_{first_layer_print_max[0]}_{first_layer_print_max[1]} INITIAL_TOOL={initial_extruder}
START_PRINT EXTRUDER_TEMP={first_layer_temperature[initial_extruder] + extruder_temperature_offset[initial_extruder]} BED_TEMP=[first_layer_bed_temperature] MATERIAL=[filament_type] SIZE={first_layer_print_min[0]}_{first_layer_print_min[1]}_{first_layer_print_max[0]}_{first_layer_print_max[1]} INITIAL_TOOL={initial_extruder}
```

Also, add custom print end G-code to your slicer:
There is also a couple of other optionnal parameters that are supported in Klippain (they need to be added on the same one line following the other parameters):
- `CHAMBER=[chamber_temperature]` to be able to specify a target heatsoak temperature for the START_PRINT sequence
- `TOTAL_LAYER=[total_layer_count]` to be able to set the PRINT_STATS_INFOS in Klipper. If using this, you will need to add on your slicer custom layer change gcode the appropriate `SET_PRINT_STATS_INFO CURRENT_LAYER={layer_num}`

Finally, add custom print end G-code to your slicer:
```
END_PRINT
```
Expand Down
7 changes: 5 additions & 2 deletions macros/base/start_print.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ gcode:
{% set MATERIAL = params.MATERIAL|default(printer["gcode_macro _USER_VARIABLES"].print_default_material)|string %} # Material type set in the slicer
{% set FL_SIZE = params.SIZE|default("0_0_0_0")|string %} # Get bounding box of the first layer for the adaptive bed mesh
{% set BED_MESH_PROFILE = params.MESH|default("")|string %} # Bed mesh profile to load
{% set TOTAL_LAYER = params.TOTAL_LAYER|default(0)|int %} # Layers Count provided by slicer

# Set the variables to be used in all the modules based on the slicer parameters
SET_GCODE_VARIABLE MACRO=START_PRINT VARIABLE=bed_temp VALUE={BED_TEMP}
Expand All @@ -35,7 +34,11 @@ gcode:
SET_GCODE_VARIABLE MACRO=START_PRINT VARIABLE=material VALUE='"{MATERIAL}"'
SET_GCODE_VARIABLE MACRO=START_PRINT VARIABLE=fl_size VALUE='"{FL_SIZE}"'
SET_GCODE_VARIABLE MACRO=START_PRINT VARIABLE=bed_mesh_profile VALUE='"{BED_MESH_PROFILE}"'
SET_GCODE_VARIABLE MACRO=START_PRINT VARIABLE=total_layer VALUE={TOTAL_LAYER}

{% if params.TOTAL_LAYER %} # total layers count (if provided by the slicer) %}
SET_PRINT_STATS_INFO TOTAL_LAYER={params.TOTAL_LAYER|int}
SET_GCODE_VARIABLE MACRO=START_PRINT VARIABLE=total_layer VALUE={params.TOTAL_LAYER|int}
{% endif %}

# Get all the config options and configurations for this macro
{% set verbose = printer["gcode_macro _USER_VARIABLES"].verbose %}
Expand Down

0 comments on commit b1b611c

Please sign in to comment.