Macros not allowed in M117 custom gcode?
 
Notifications
Clear all

Macros not allowed in M117 custom gcode?  

  RSS
Easy Target
(@easy-target)
Member
Macros not allowed in M117 custom gcode?

I have the following custom start gcode defined. (PrusaSlicer 2.7.1 on linux x64)

G28 ; home
G21 ; metric values
G90 ; absolute positioning
M82 ; set extruder to absolute mode
M107 ; start with the fan off
M117 "Job [input_filename_base] starting"
G1 X0 Y100 Z20 F6000 ; move to heatup (ooze control) position
M190 S{first_layer_bed_temperature[0] - 5} ; wait for bed temperature - 5
M117 "reached {[first_layer_bed_temperature[0]] - 5} bed"
M190 [first_layer_bed_temperature] ; wait for bed temp
M109 S[first_layer_temperature] ; wait for extruder temp

It fails to slice at the second M117 command; saying:

G-code export to /tmp/.27470.gcode failed due to invalid custom G-code sections:
start_gcode
Parsing error at line 9. Unknown syntax error
M117 "reached {[first_layer_bed_temperature[0]] - 5} bed"

I assume that macros are not allowed in `M117` statements? I see no other reason why this would fail in line 9 when it worked in line 8 immediately before that. Is there is reason for this regression?

ps: I'm actually trying to run `M117 "{Layer [layer_num] + 1} of [total_layer_count]"` in the layer change code to give  (non zero-indexed) user feedback. The above example is a demo that the issue is not the macro, but it's context (M190 vs M117).

pps: I can work around, but I lost time trying to debug this; a nice clear statement in the macro documentation listing where macros can and cannot be used would have neen helpful.

This topic was modified 6 months ago by Easy Target
Posted : 14/02/2024 4:58 pm
Neophyl
(@neophyl)
Illustrious Member
RE: Macros not allowed in M117 custom gcode?

Might want to post this on the PS github.  This is a user to user forum mainly and the Devs wont generally see anything posted here.

Posted : 15/02/2024 8:12 am
Easy Target
(@easy-target)
Member
Topic starter answered:
RE: Macros not allowed in M117 custom gcode?

@Neophyl ; thank you, that's a better idea.

I spent a bit more time looking into what I want to do, and realising I could have given a better example etc. last night. So I can do a better job of this on Github. As I say above this is very low-pri, nice-to-have for me. But still, it would be nice to be able to do some math on the values you want to display via M117.

Posted : 15/02/2024 4:54 pm
Share: