Idea: include "special" comments that make it into queue


#1

It seems that comments have the potential to be very powerful in providing real-time feedback to plugins to do a variety of things. However, all traditional comments starting with ; currently get stripped in the comm layer. To overcome this with the CancelObject plugin I was parsing file on upload to replace needed comments with another tag that the plugin could catch, do something, and then remove from the queue. This is non-ideal because now that gcode file is "tainted" with a non-standard tag. If this gcode is moved to another printer/octoprint instance there maybe issues if that tag gets passed to the printer. These tags could all be reverted on finish/fail/etc., (something I'm planning on doing), but that doesn't seem to be a particularly robust way of doing things.

My proposal would be to include a functional comment that would be allowed to pass through comm, something like ;; or ;# that would still always be interpreted as a comment by printer firmwares, but could provide useful information for plugins.

Thoughts?


#2

In a way we already have this: @ commands. OctoPrint will never send an @ command to the printer, but allow to trigger various stuff through it while it makes it way through queuing and sending phases.

I'd rather not start using actual comments for this (even if limited to a subset) since that would add a significant amount of parsing to something that has to go fast - right now OctoPrint simply strips anything after an ; and if that means the line is empty it continues to the next line.

ETA And thinking about it some more I also wouldn't be surprised if the amount of comment variants out there generated by various slicers would lead to false positives regardless of what special prefix is chosen.


#3

Ahh, OK. I had the wrong impression of @ commands when I first read about them. Thank you for the clarification. This will simplify things.


#4

What impression if I may ask? Just so I can look into possibly rewording things so that doesn't happen to others :wink:


#5

I read about them months ago, and for some reason I was confusing them with action commands. Probably just trying to take in too much too quickly on my end.