On-device start gcode handling
-
Hi all,
I am trying to handle all of the pre-printing gcode checks as well as starting sequences on-device.
To achieve this, I want to use the parameters sent with M98 which I set in the slicer.
Currently I have;
;Prusaslicer section; ; Define prusaslicer variables { local xmin = (max(print_bed_min[0], first_layer_print_min[0] - 20)); local xmax = (min(print_bed_max[0], first_layer_print_max[0] + 20)); local ymin = (max(print_bed_min[1], first_layer_print_min[1] - 20)); local ymax = (min(print_bed_max[1], first_layer_print_max[1] + 20)); } ; called with M98 P"0:/macros/print-start" M98 P"0:/macros/print-start"A{first_layer_temperature[0]} B{first_layer_temperature[1]} C{first_layer_bed_temperature[0]} D{xmin[0]} E{xmax[0]} F{ymin[0]} H{ymax[0]} I{initial_tool} J"{is_extruder_used[0]}" K"{is_extruder_used[1]}" L"{filament_type[0]}" O"{filament_type[1]}" P{nozzle_diameter[0]} Q{nozzle_diameter[1]}
And the duet macro will start with;
;Duet section ; Retrieve and define variables ; Temperature variables set var.lefttemp = param.A ; Extruder temperature set var.righttemp = param.B ; Extruder temperature set var.bed = param.C ; Bed temperature ; Print variables set var.printxmin = param.D ; Left boundry set var.printxmax = param.E ; Right boundry set var.printymin = param.F ; Front boundry set var.printymax = param.H ; Back boundry set var.purgelength = 15 ; Machine variables set var.initialtool = param.I ; initial tool set var.leftused = param.J ; is right tool used yes/no set var.rightused = param.K ; is right tool used yes/no set var.leftfilament = param.L ; loaded filament type left set var.rightfilament = param.O ; loaded filament type right set var.leftnozzlesize = param.P ; nozzle diameter left set var.rightnozzlesize = param.Q ; nozzle diameter right
After this I can use the variables to move and check the machine
However, if I test the macro by sending;
M98 P"0:/macros/variable-test-printstart" A215 B215 C0 D254.127 E333.118 F221.901 H278.099 I0 J"true" K"false" L"PLA" O"PLA" P0.4 Q0.4
I get the error
Error: in file variable-test-printstart line 34: in file macro line 0: unknown parameter 'P'
While the P parameter is clearly defined in the code.
Can anybody tell me why this is happening?
Testing macro is;
var lefttemp = 0 var righttemp = 0 var bed = 0 var printxmin = 0 var printxmax = 600 var printymin = 0 var printymax = 500 var purgelength = 0 var initialtool = 0 var leftused = "false" var rightused = "false" var leftfilament = "none" var rightfilament = "none" var leftnozzlesize = 0 var rightnozzlesize = 0 ; Temperature variables set var.lefttemp = param.A ; Extruder temperature set var.righttemp = param.B ; Extruder temperature set var.bed = param.C ; Bed temperature ; Print variables set var.printxmin = param.D ; Left boundry set var.printxmax = param.E ; Right boundry set var.printymin = param.F ; Front boundry set var.printymax = param.H ; Back boundry set var.purgelength = 15 ; Machine variables set var.initialtool = param.I ; initial tool set var.leftused = param.J ; is right tool used yes/no set var.rightused = param.K ; is right tool used yes/no set var.leftfilament = param.L ; loaded filament type left set var.rightfilament = param.O ; loaded filament type right set var.leftnozzlesize = param.P ; nozzle diameter left set var.rightnozzlesize = param.Q ; nozzle diameter right echo var.lefttemp echo var.righttemp echo var.bed echo var.printxmin echo var.printxmax echo var.printymin echo var.printymax echo var.purgelength echo var.initialtool echo var.leftused echo var.rightused echo var.leftfilament echo var.rightfilament echo var.leftnozzlesize echo var.rightnozzlesize
-
@SanderLPFRG see here https://docs.duet3d.com/en/User_manual/Reference/Gcode_meta_commands#macro-parameters
You cannot use P as a parameter (as P is already used to reference the gcode file that is being called by M98) When using a macro as custom gcode, do not use G, M, N, or T as parameters in a custom 'G' gcode file. Do not use G, M, or N as parameter in a custom 'M' gcode file. There are no standard G or M commands that use these parameters and RRF will treat the parameter as being the start of the next command.
-
@jay_s_uk I have, but I do not see any issues. I have not used G, M, N, or T and I do not see a max specified
what do you mean exactly?
-
@SanderLPFRG you can't use P and that'll probably be throwing the command out
-
@SanderLPFRG said in On-device start gcode handling:
@jay_s_uk I have, but I do not see any issues. I have not used G, M, N, or T and I do not see a max specified
what do you mean exactly?
The section he quoted below regarding not using āPā
-
@jay_s_uk Wow I seriously have read over that 10 times I think. sorry for the unnessecary question
Thanks all! -