Printer ignores Gcode pre-print
-
Hi there!
I created a system file that can be executed as print from different macros (i.e. printer calibration macro or first layer calibration macro), called first-layer.g. This system file contains instructions to print a square that will allow to use babystepping for first layer calibration and then stores the resulting value in config-override.g. The gcode itself has been generated via Prusaslicer and I added the start and end bits.
I'm using a Duet Mini and I'm currently on RRF 3.4.0 and DWC 3.4.0
This is how first-layer.g is being called via the macro "First Layer Calibration":
;------------------------------------------------------------------------------------------------------------------------------ ; First Layer Calibration ; ; Description: ; - macro file ; - calibrates the first layer distance between nozzle and bed ; - stores result in config-override.g after print completes ;------------------------------------------------------------------------------------------------------------------------------ M291 P"Do you want to start calibrating the FIRST LAYER?" S3 R"FIRST LAYER CALIBRATION" ; requires user input M32 "0:/sys/first-layer.g" ; executes "first-layer.g" from SD card This is first-layer.g (removed most of the Prusaslicer generated gcode as I do not think it is relevant for my problem):
;---------------------------------------------------------------------------------------------- ; First Layer Calibration ; ; Description: ; - gcode file ; - print to calibrate the distance between nozzle and bed for the first layer ; - required user input to dial in first layer ; - called via the first layer calibration macro ; - needs to be stored in the gcodes folder ;---------------------------------------------------------------------------------------------- ;---------------------------------------------------------------------------------------------- ; Preparation ;---------------------------------------------------------------------------------------------- M98 P"0:/sys/bed-temperature.g" ; calls bed-temperature.g to set bed temperature M568 S160 ; set hotend temperature to 160°C M561 ; clear any bed transform M290 R0 S0 ; clear babystepping G31 P1000 Z0 ; set Z probe offset to 0 ;---------------------------------------------------------------------------------------------- ; First Layer Calibration ;---------------------------------------------------------------------------------------------- M116 ; wait for bed and hotend temperature G32 ; true bed leveling with mesh bed leveling M98 P"0:/sys/hotend-temperature.g" ; calls hotend-temperature.g to set hotend temperature M116 ; wait for bed and hotend temperature G92 E0.0 ; reset extruder position to 0 G1 X60.0 E9.0 F1000.0 ; intro line thin part G1 X100.0 E12.5 F1000.0 ; intro line thick part G92 E0.0 ; reset extruder position to 0 M564 S0 ; allow movement beyond axis limits defined in config.g G21 ; set units to millimeters G90 ; use absolute coordinates M83 ; use relative distances for extrusion ;LAYER_CHANGE ;Z:0.2 ;HEIGHT:0.2 G92 E0.0 ; reset extruder position to 0 ;0.2 G1 E-1 F3000 G1 Z.4 F7200 G1 X61.617 Y47.564 G1 Z.2 G1 E1 F3000 M204 P1000 ;TYPE:Skirt/Brim ;WIDTH:0.42 G1 F1200 G1 X64.531 Y44.274 E.13705 G1 X67.556 Y41.623 E.12546 G1 X70.821 Y39.39 E.12338 G1 X74.068 Y37.676 E.11451 .... .... .... ;WIPE_START G1 F5760;_WIPE G1 X87.249 Y143.176 E-.41629 G1 F5760;_WIPE G1 X87.784 Y143.176 E-.26456 G1 F5760;_WIPE G1 X87.467 Y142.859 E-.22165 ;WIPE_END G1 E-.0475 F3000 G1 Z.6 F7200 ;---------------------------------------------------------------------------------------------- ; Saving First Layer Height ;---------------------------------------------------------------------------------------------- M98 P"layer-change.g" ; execute layer-change.g to save adjusted babysteps to config-override.g M564 S1 ; forbid movement beyond axis limits defined in config.g M291 P"First Layer Calibration completed! Z Offset saved!" S1 R"FIRST LAYER CALIBRATION" M0 ; calls stop.g Here are bed-temperature.g and hotend-temperature.g:
;----------------------------------------------------------------------------------------------------- ; bed-temperature.g ; ; Description: ; - system file ; - called to auto-select the bed temperature according to the loaded filament ;----------------------------------------------------------------------------------------------------- if move.extruders[state.currentTool].filament == "ABS" ; if ABS is loaded M140 S{global.abs_bed_temp} ; set bed to ABS temperature if move.extruders[state.currentTool].filament == "GreenTec Pro" ; if GreenTec Pro is loaded M140 S{global.greentecpro_bed_temp} ; set bed to GreenTec Pro temperature if move.extruders[state.currentTool].filament == "PC" ; if PC is loaded M140 S{global.pc_bed_temp} ; set bed to PC temperature if move.extruders[state.currentTool].filament == "PTEG" ; if PETG is loaded M140 S{global.petg_bed_temp} ; set bed to PETG temperature if move.extruders[state.currentTool].filament == "PLA" ; if PLA is loaded M140 S{global.pla_bed_temp} ; set bed to PLA temperature if move.extruders[state.currentTool].filament == "TPU" ; if TPU is loaded M140 S{global.tpu_bed_temp} ; set bed to TPU temperature ;-------------------------------------------------------------------------------------------------------- ; hotend-temperature.g ; ; Description: ; - system file ; - called to auto-select the hotend temperature according to the loaded filament ;-------------------------------------------------------------------------------------------------------- if move.extruders[state.currentTool].filament == "ABS" ; if ABS is loaded M568 S{global.abs_hotend_temp} ; set hotend to ABS temperature if move.extruders[state.currentTool].filament == "GreenTec Pro" ; if GreenTec Pro is loaded M568 S{global.greentecpro_hotend_temp} ; set hotend to GreenTec Pro temperature if move.extruders[state.currentTool].filament == "PC" ; if PC is loaded M568 S{global.pc_hotend_temp} ; set hotend to PC temperature if move.extruders[state.currentTool].filament == "PTEG" ; if PETG is loaded M568 S{global.petg_hotend_temp} ; set hotend to PETG temperature if move.extruders[state.currentTool].filament == "PLA" ; if PLA is loaded M568 S{global.pla_hotend_temp} ; set hotend to PLA temperature if move.extruders[state.currentTool].filament == "TPU" ; if TPU is loaded M568 S{global.tpu_hotend_temp} ; set hotend to TPU temperature This is how the variables are defined in config.g:
;---------------------------------------------------------------------------------------------------------------------------------------------- ; Global Variables ;---------------------------------------------------------------------------------------------------------------------------------------------- ; Filament Temperatures global abs_hotend_temp = 240 ; global ABS hotend temperature variable global abs_bed_temp = 110 ; global ABS bed temperature variable global greentecpro_hotend_temp = 230 ; global GreenTec Pro hotend temperature variable global greentecpro_bed_temp = 60 ; GreenTec Pro bed temperature global pc_hotend_temp = 270 ; global GreenTec Pro hotend temperature variable global pc_bed_temp = 110 ; global GreenTec Pro bed temperature variable global petg_hotend_temp = 235 ; global PETG hotend temperature variable global petg_bed_temp = 80 ; global PETG bed temperature variable global pla_hotend_temp = 210 ; global PLA hotend temperature variable global pla_bed_temp = 60 ; global PLA bed temperature variable global tpu_hotend_temp = 230 ; global TPU hotend temperature variable global tpu_bed_temp = 60 ; global TPU bed temperature variable The problem I am currently facing is that both M98 commands who are supposed to call bed-temperature.g and hotend-temperature.g before the print are being ignored and the printer tries to start printing without the hotend or bed being heated, resulting in an error.
Can someone help me understand what I am doing wrong?
Thanks a lot!
-
@flobler OK, I figured it out already
This was a stupid typo that I then carried from bed-temperature.g to hotend-temperature.g via copy paste. I tried all these files with PLA previously which worked fine. This time I had PETG loaded but unfortunately looked for PTEG in the object model and not PETG.
Therefore the loaded filament and my bed-temperature.g and hotend-temperature.g system files did not match and therefore not use PETG temperatures before trying to start the print.
Sorry for the noise