You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
CONSOLE_ECHO TITLE="Hotend thermal expansion compensation"TYPE="success"MSG={'"New value is: %.6f_N_The new multiplier value has been saved to the configuration."' % multiplier}
1023
-
{% else %}
1024
-
Z_OFFSET_APPLY_PROBE
1025
-
{% endif %}
1019
+
# Save the result as beacon_saved_runtime_offset via SAVE_VARIABLE
DEBUG_ECHO PREFIX="_BEACON_SET_RUNTIME_OFFSET"MSG="Saved new runtime_offset: {new_runtime_offset}, current z_offset: {printer.gcode_move.homing_origin.z}, applied expansion offset: {applied_expansion_offset}"
1027
1023
1028
-
[gcode_macro _BEACON_APPLY_RUNTIME_MULTIPLIER]
1029
-
variable_runtime_multiplier: -1.0
1024
+
[gcode_macro _BEACON_RESTORE_RUNTIME_OFFSET]
1030
1025
gcode:
1031
-
# config
1032
-
{% set toolhead = 0 %}
1033
-
{% if printer["dual_carriage"] is defined %}
1034
-
{% set idex_mode = printer["dual_carriage"].carriage_1|lower %}
1035
-
{% set toolhead = 1 if idex_mode == 'primary' else 0 %}
1036
-
{% endif %}
1037
-
1038
-
# beacon config
1039
-
{% set beacon_contact_true_zero_temp = printer["gcode_macro RatOS"].beacon_contact_true_zero_temp|default(150)|int %}
1040
-
{% 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 %}
1041
-
{% set beacon_contact_expansion_compensation = true if printer["gcode_macro RatOS"].beacon_contact_expansion_compensation|default(false)|lower == 'true' else false %}
1042
-
1043
-
# get current layer number
1044
-
{% set layer_number = printer["gcode_macro _ON_LAYER_CHANGE"].layer_number|default(0)|int %}
1026
+
# Get the current GCODE_OFFSET, call it NEW_RUNTIME_OFFSET
1027
+
{% set runtime_offset = printer.save_variables.variables.beacon_saved_runtime_offset|default(0) %}
1028
+
{% set offset_before = printer.gcode_move.homing_origin.z %}
1029
+
SET_GCODE_OFFSET Z_ADJUST={runtime_offset}
1045
1030
1046
-
# get is printing gcode state
1047
-
{% set is_printing_gcode = true if printer["gcode_macro START_PRINT"].is_printing_gcode|default(true)|lower == 'true' else false %}
1048
-
1049
-
{% if layer_number == 0 and is_printing_gcode %}
1050
-
{% set link_url = "https://os.ratrig.com/docs/slicers" %}
1051
-
{% set link_text = "RatOS Slicer Documentation" %}
1052
-
{% set line_1 = '"Your slicer is not correctly reporting layer information. See the layer change custom g-code in the <a href="%s" target="_blank" >%s</a>".' % (link_url, link_text) %}
{% if layer_number == 1 and is_printing_gcode and printer.configfile.settings.beacon is defined and beacon_contact_start_print_true_zero and beacon_contact_expansion_compensation %}
1059
-
1060
-
# ratos variables file
1061
-
{% set svv = printer.save_variables.variables %}
1062
-
1063
-
# get coefficient
1064
-
{% set nozzle_expansion_coefficient = svv.nozzle_expansion_coefficient_t0|default(0)|float %}
1065
-
{% if toolhead == 1 %}
1066
-
{% set nozzle_expansion_coefficient = svv.nozzle_expansion_coefficient_t1|default(0)|float %}
1067
-
{% endif %}
1068
-
1069
-
# calculate new multiplier
1070
-
{% set beacon_contact_expansion_multiplier = svv.nozzle_expansion_coefficient_multiplier|default(1.0)|float %}
1071
-
{% set print_temp = printer["gcode_macro _BEACON_SET_NOZZLE_TEMP_OFFSET"].runtime_temp|default(0)|int %}
1072
-
1073
-
{% if print_temp > 0 %}
1074
-
{% set z_offset = printer.gcode_move.homing_origin.z|float %}
1075
-
{% set temp_delta = print_temp - beacon_contact_true_zero_temp %}
1076
-
{% set coefficient_per_degree = nozzle_expansion_coefficient / 100 %}
1077
-
{% set z_offset_per_degree = z_offset / temp_delta %}
1078
-
{% set new_multiplier = z_offset_per_degree / coefficient_per_degree %}
0 commit comments