Retaining a GCode Response

My printer (an Ultibots D300VS) runs through a leveling and calibration sequence before each print with a G32 command; the response to that command has information about how well that calibration went. Right now, in order to see that response, I need to be in the terminal tab in Octoprint with Autoscroll turned off at the right time, otherwise there' no way for me to catch that information.

I've dug through settings and the plugin repository, but I haven't found any way to have Octoprint retain and display a certain GCode response.

I'm wondering if someone with more Octoprint plugin programming experience than me (who has none) can give me a sense of whether this is a reasonable challenge to start with for a first Octoprint plugin.

You can’t just scroll back to see it?
Or am I missing what your trying to do.

That's pretty much the problem. I can scroll back a maximum of 300 lines in my octopi installation; as you might imagine, you can blow through 300 lines of GCode extremely quickly during the beginning of a print. Frequently by the time I'm down in front of my printer scrutinizing the first few layers of my print, it's too late to scroll back up and check what my calibration results were.

And just from a personal user experience standpoint, I'rd rather be putting this output in one place, rather than having to dive and search for it.

So are you wanting to tell it what your watching for and have it capture x number of lines before and after the watch string? Or perhaps have it pause scrolling at the watch string and then allow it to scroll to the next instance of the watch string once you've examined it? Something like that? Perhaps you could explain how you would like it to act.

Totally understand what you mean- no need to be ready to grab it from the terminal, you might not look at it until hundreds of lines scroll past. I don't think it's possible to get out of the current API- seems like a great use case for a push.

Another option is to turn on serial logging. OctoPrint / OctoPi will save those for quite a while.

@cscheuer Show me an example output that you are trying to capture and I can tell you if that would be a reasonable first plugin project. It sadly depends heavily on how the output is structured.

Hi Gina,
I'm not in front of my printer, so I can't directly copy and paste from the Ocotprint terminal right now, but copying and pasting from someone on the Ultibots forums, the response from a G32 command is a like this (with varying numbers, naturally):

Calibrated 6 factors using 13 points, deviation before 0.023 after 0.023

If it's only this one line you wouldn't even need a plugin to have this captured and displayed somewhere. You could just use a custom control with the template and regex properties set.

But doing it via a plugin would also be fairly straight forward.

edit Forgot the link to the custom controls that I wanted to include: http://docs.octoprint.org/en/master/features/custom_controls.html

1 Like

I'm attempting to do what you're suggesting, but I'm running into my own inexperience here. I attempted to set this up manually in config.yaml, and just ended up putting Octoprint into situations where it wouldn't boot until I reverted my changes. Having done that, I tried using the Custom Control Editor plugin to get some help. Using that tool and then looking at the config.yaml, the relevant lines look like this:

- children:
  - command: G32
    default: Waiting to Calibrate
    name: Calibrate
    regex: Calibrated ([0-9]+) factors using ([0-9]+) points, deviation before ([0-9.]+)
      after ([0-9.]+)
    template: 'Factors: {0}, Points: {1}, Before: {2}, After: {3}'
  layout: vertical
  name: Calibration

This works perfectly until I refresh my browser, at which point it the calibration info disappears and it goes back to its default value. If I remove the default: Waiting to Calibrate line, the data still disappears.

Is there any way to have this retained (at least until octoprint is restarted)? Am I missing something obvious?

No, not with feedback controls, at least not at the moment. Forgot about this being only temporary.

So you'll have to go the plugin route instead. I'd implement a simple octoprint.comm.protocol.gcode.received handler, store the parsed values inside the plugin and make them retrievable through a SimpleApiPlugin mixin implementation and display all that somewhere in the frontend, e.g. as a sidebar or navbar TemplatePlugin.

Is broadcasting to another machine with rsyslog an option in octo?

I realize this is an old thread -- did anything come of this? I'm having pretty much the same issue with the 300 line history limit when autoscroll is enabled running pid auto-tuning with a large number of cycles.