Skip to content

Commit 044001d

Browse files
committed
Macros: use zero_reference_position when using beacon true zero
1 parent dbed201 commit 044001d

4 files changed

Lines changed: 46 additions & 0 deletions

File tree

macros.cfg

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,7 @@ gcode:
306306

307307
# beacon contact config
308308
{% 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 %}
309+
{% 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 %}
309310

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

612+
613+
# Calibrate a new beacon model on print if enabled
614+
{% if printer.configfile.settings.beacon is defined and beacon_contact_calibrate_model_on_print %}
615+
_MOVE_TO_SAFE_Z_HOME
616+
BEACON_AUTO_CALIBRATE
617+
{% endif %}
618+
611619
# Run the user created "AFTER_HEATING_BED" macro
612620
_USER_START_PRINT_AFTER_HEATING_BED { rawparams }
613621

macros/mesh.cfg

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,27 @@
1010
variable_calibrate_bed_mesh: True # True|False = enable bed meshing
1111
variable_adaptive_mesh: True # True|False = enable adaptive bed meshing
1212

13+
[gcode_macro _BED_MESH_SANITY_CHECK]
14+
gcode:
15+
{% set printable_x_max = printer["gcode_macro RatOS"].printable_x_max|float %}
16+
{% set printable_y_max = printer["gcode_macro RatOS"].printable_y_max|float %}
17+
{% set safe_home_x = printer["gcode_macro RatOS"].safe_home_x %}
18+
{% if safe_home_x is not defined or safe_home_x|lower == 'middle' %}
19+
{% set safe_home_x = printable_x_max / 2 %}
20+
{% endif %}
21+
{% set safe_home_y = printer["gcode_macro RatOS"].safe_home_y %}
22+
{% if safe_home_y is not defined or safe_home_y|lower == 'middle' %}
23+
{% set safe_home_y = printable_y_max / 2 %}
24+
{% endif %}
25+
{% 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 %}
26+
27+
{% if printer.configfile.settings.beacon is defined and beacon_contact_start_print_true_zero %}
28+
{% set zero_ref_pos = printer.configfile.settings.bed_mesh.zero_reference_position %}
29+
{% if zero_ref_pos is not defined or zero_ref_pos[0] != safe_home_x or zero_ref_pos[1] != safe_home_y %}
30+
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}"
31+
_STOP_AND_RAISE_ERROR MSG="Zero reference position does not match safe home position"
32+
{% endif %}
33+
{% endif %}
1334

1435
[gcode_macro _START_PRINT_BED_MESH]
1536
gcode:

macros/util.cfg

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ gcode:
5353
CALCULATE_PRINTABLE_AREA
5454
INITIAL_FRONTEND_UPDATE
5555
_CHAMBER_FILTER_SANITY_CHECK
56+
_BED_MESH_SANITY_CHECK
5657

5758

5859
[delayed_gcode RATOS_LOGO]
@@ -394,3 +395,14 @@ gcode:
394395
SET_SKEW CLEAR=1
395396
{% endif %}
396397
{% endif %}
398+
399+
400+
[gcode_macro _RAISE_ERROR]
401+
gcode:
402+
{ action_raise_error(params.MSG) }
403+
404+
405+
[gcode_macro _STOP_AND_RAISE_ERROR]
406+
gcode:
407+
M84
408+
_RAISE_ERROR MSG="{params.MSG}"

z-probe/beacon.cfg

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@ variable_beacon_contact_wipe_before_true_zero: True # enables a nozzle wipe
3636
variable_beacon_contact_true_zero_temp: 150 # nozzle temperature for true zeroing
3737
# WARNING: if you're using a smooth PEI sheet, be careful with the temperature
3838

39+
variable_beacon_contact_calibrate_model_on_print: False # Calibrate a new beacon model every print, it's recommended to enable this if
40+
# if you're often swapping build plates with different surface types.
41+
# NOTE: this effectively disables z_offset on the beacon model, since a new one
42+
# will be calibrated every print (however a model offset should never be needed with contact probing)
43+
3944
variable_beacon_contact_prime_probing: True # probe for priming with contact method
4045
variable_beacon_contact_expansion_compensation: True # enables the nozzle thermal expansion compensation
4146

0 commit comments

Comments
 (0)