Custom GCode help
Part of my Printer custom GCode is
M104 S{first_layer_temperature[0]*0.9} ; set extruder temp to 90%\n
M140 S[first_layer_bed_temperature] ; set bed temp\n
M190 S[first_layer_bed_temperature] ; wait for bed temp\n
M104 S[first_layer_temperature] ; set real extruder temp\n
M109 S[first_layer_temperature] ; wait for extruder temp\n
I did this because I didn't want the nozzle sitting a high temp waiting for bed.
Which works quite well except where I immediately restart. Then the nozzle temp is set to the 90% value even thought it's already above that and thus cools while bed heats. I'd like to add a condition to the effect that if nozzle temp greater than "{first_layer_temperature[0]*0.9}" then nozzle temp = "[first_layer_temperature]" else nozzle temp = "{first_layer_temperature[0]*0.9}". Any help appreciated.
BTW why the syntax is different is because it's cobbled together from posted scripts.
RE: Custom GCode help
You can use the max function to choose the larger of two values.
M140 S{max(first_layer__temperature[0],160)}
Unfortunately, that won't work. All conditional code is evaluated in the slicer, not the printer. On the Mk3, you can not evaluate conditions in gcode.
There is the R option to M140 that should continue if the temp is higher, but I recall it doesn't work. It always waits for the nozzle to hit the specified temperature.
and miscellaneous other tech projects
He is intelligent, but not experienced. His pattern indicates two dimensional thinking. -- Spock in Star Trek: The Wrath of Khan
RE: Custom GCode help
As Bob says the correct Gcode command is the M140 R{first_layer_temperature[0]*0.9} but R was not implemented on the Prusa MK3.
If however you have a different printer then it may be implemented in its firmware. Wont hurt to try it and see.
RE: Custom GCode help
Ah, good point. I forgot @towlerg has a Sovol. If you've loaded Marlin 2, there's a very good chance the expanded command options work.
and miscellaneous other tech projects
He is intelligent, but not experienced. His pattern indicates two dimensional thinking. -- Spock in Star Trek: The Wrath of Khan
RE: Custom GCode help
Thanks guys I'll give it a go.
Of course I should have realized, the slicer can't possible know about realtime data. I think I'm going to have to migrate this code to OctoPrint.