Hi,
I’m trying to read a chamber temp sensors value during the execution of my print start macro.
My macro looks something like this:
[gcode_macro PRINT_START]
gcode:
{% set TEMP_BED = params.BED|default(100)|int %}
{% set TEMP_EXTRUDER = params.EXTRUDER|default(240)|int %}
{% set TEMP_CHAMBER = params.CHAMBER|default(40)|int %}
{% set TEMP_CHAMBER_CURRENT = ( printer["temperature_sensor chamber"].temperature )|float %}
SET_GCODE_OFFSET Z=0.0 ; reset offset
M117 Homing...
BED_MESH_CLEAR ; clear bed mesh
G28 HIDE=0 ; home all axies and don't hide the probe
G1 X{ MAX_X_POS / 2 } Y{ MAX_Y_POS / 2 } F4800 ; go to the center of the bed
G90 ; absolute positioning
M117 Heatup...
TEMPERATURE_WAIT SENSOR=heater_bed MINIMUM={ ( TEMP_BED - 3 )|int } ; wait for bed temp
SET_HEATER_TEMPERATURE HEATER=extruder TARGET=180 ; set hot end temp and continue
TEMPERATURE_WAIT SENSOR=heater_bed MINIMUM={ ( TEMP_BED )|int } MAXIMUM={ ( TEMP_BED + 5 )|int } ; wait for bed temp
TEMPERATURE_WAIT SENSOR=extruder MINIMUM={ ( 180 - 1 )|int } MAXIMUM={ ( 180 + 3 )|int } ; wait for hot end temp
TEMPERATURE_WAIT SENSOR="temperature_sensor chamber" MINIMUM={ ( TEMP_CHAMBER + 1 )|int } ; wait for chamber temp
M117 Meshing...
PROBE_GET ; pobieramy sonde
BED_MESH_CALIBRATE ; tworzymy siatke stolu
PROBE_HIDE ; chowamy sonde
G0 X{ MIN_X_POS } Y{ MAX_Y_POS - 20 } F3000 ; move the head
G0 Z0.25 F3000 ; move the bed
M117 Heatup...
SET_HEATER_TEMPERATURE HEATER=extruder TARGET={ ( TEMP_EXTRUDER )|int } ; set hot end temp and continue
TEMPERATURE_WAIT SENSOR=extruder MINIMUM={ ( TEMP_EXTRUDER - 1 )|int } MAXIMUM={ ( TEMP_EXTRUDER + 3 )|int } ; wait for hot end temp
M107 ; turn off the print fan after heatup
M117 Nozzle cleaning...
NOZZLE_CLEAN ; clean the nozzle on the silicone brush
M117 Printing...
{% set TEMP_CHAMBER_CURRENT = ( printer["temperature_sensor chamber"].temperature )|float %}
SET_GCODE_OFFSET Z={ ( ( ( TEMP_CHAMBER_CURRENT )|float * 0.01 ) * ( -1 ) )|float } ; set offset based on current chamber temp
and according to this:
Important! Macros are first evaluated in entirety and only then are the resulting commands executed. If a macro issues a command that alters the state of the printer, the results of that state change will not be visible during the evaluation of the macro.
the bit after “M117 Printing…” will not ever work properly.
I would be very greatfull if any one of the macro gurus here would explain to me how can I read that chamber sensor and put it’s value in a variable in any place in the above print start macro.
Thank you in advance for any help.