Skip to content

Commit

Permalink
Macros: use zero_reference_position when using beacon true zero
Browse files Browse the repository at this point in the history
  • Loading branch information
miklschmidt committed Nov 10, 2024
1 parent dbed201 commit 044001d
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 0 deletions.
8 changes: 8 additions & 0 deletions macros.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,7 @@ gcode:

# beacon contact config
{% set beacon_contact_start_print_true_zero = true if printer["gcode_macro RatOS"].beacon_contact_start_print_true_zero|default(false)|lower == 'true' else false %}
{% set beacon_contact_calibrate_model_on_print = true if printer["gcode_macro RatOS"].beacon_contact_calibrate_model_on_print|default(false)|lower == 'true' else false %}

# get macro parameters
{% set X0 = params.X0|default(-1)|float %}
Expand Down Expand Up @@ -608,6 +609,13 @@ gcode:
G4 P{(bed_heat_soak_time * 1000)}
{% endif %}


# Calibrate a new beacon model on print if enabled
{% if printer.configfile.settings.beacon is defined and beacon_contact_calibrate_model_on_print %}
_MOVE_TO_SAFE_Z_HOME
BEACON_AUTO_CALIBRATE
{% endif %}

# Run the user created "AFTER_HEATING_BED" macro
_USER_START_PRINT_AFTER_HEATING_BED { rawparams }

Expand Down
21 changes: 21 additions & 0 deletions macros/mesh.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,27 @@
variable_calibrate_bed_mesh: True # True|False = enable bed meshing
variable_adaptive_mesh: True # True|False = enable adaptive bed meshing

[gcode_macro _BED_MESH_SANITY_CHECK]
gcode:
{% set printable_x_max = printer["gcode_macro RatOS"].printable_x_max|float %}
{% set printable_y_max = printer["gcode_macro RatOS"].printable_y_max|float %}
{% set safe_home_x = printer["gcode_macro RatOS"].safe_home_x %}
{% if safe_home_x is not defined or safe_home_x|lower == 'middle' %}
{% set safe_home_x = printable_x_max / 2 %}
{% endif %}
{% set safe_home_y = printer["gcode_macro RatOS"].safe_home_y %}
{% if safe_home_y is not defined or safe_home_y|lower == 'middle' %}
{% set safe_home_y = printable_y_max / 2 %}
{% endif %}
{% set beacon_contact_start_print_true_zero = true if printer["gcode_macro RatOS"].beacon_contact_start_print_true_zero|default(false)|lower == 'true' else false %}

{% if printer.configfile.settings.beacon is defined and beacon_contact_start_print_true_zero %}
{% set zero_ref_pos = printer.configfile.settings.bed_mesh.zero_reference_position %}
{% if zero_ref_pos is not defined or zero_ref_pos[0] != safe_home_x or zero_ref_pos[1] != safe_home_y %}
CONSOLE_ECHO TYPE="error" TITLE="Zero reference position does not match safe home position" MSG="Please update your bed mesh zero reference position in printer.cfg, like so:_N_[bed_mesh]_N_zero_reference_position: {safe_home_x},{safe_home_y}"
_STOP_AND_RAISE_ERROR MSG="Zero reference position does not match safe home position"
{% endif %}
{% endif %}

[gcode_macro _START_PRINT_BED_MESH]
gcode:
Expand Down
12 changes: 12 additions & 0 deletions macros/util.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ gcode:
CALCULATE_PRINTABLE_AREA
INITIAL_FRONTEND_UPDATE
_CHAMBER_FILTER_SANITY_CHECK
_BED_MESH_SANITY_CHECK


[delayed_gcode RATOS_LOGO]
Expand Down Expand Up @@ -394,3 +395,14 @@ gcode:
SET_SKEW CLEAR=1
{% endif %}
{% endif %}


[gcode_macro _RAISE_ERROR]
gcode:
{ action_raise_error(params.MSG) }


[gcode_macro _STOP_AND_RAISE_ERROR]
gcode:
M84
_RAISE_ERROR MSG="{params.MSG}"
5 changes: 5 additions & 0 deletions z-probe/beacon.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ variable_beacon_contact_wipe_before_true_zero: True # enables a nozzle wipe
variable_beacon_contact_true_zero_temp: 150 # nozzle temperature for true zeroing
# WARNING: if you're using a smooth PEI sheet, be careful with the temperature

variable_beacon_contact_calibrate_model_on_print: False # Calibrate a new beacon model every print, it's recommended to enable this if
# if you're often swapping build plates with different surface types.
# NOTE: this effectively disables z_offset on the beacon model, since a new one
# will be calibrated every print (however a model offset should never be needed with contact probing)

variable_beacon_contact_prime_probing: True # probe for priming with contact method
variable_beacon_contact_expansion_compensation: True # enables the nozzle thermal expansion compensation

Expand Down

0 comments on commit 044001d

Please sign in to comment.