Temporarily disable M155?

M155 is the command that tells the printer to periodically output the temperature. It takes an Sn parameter that indicates how many seconds in between reports. The value is determined by the "Autoreport interval to request from firmware" setting in the "Serial Connection" config page.

What I want to do is temporarily disable that setting during bed leveling, so that the message don't interfere with the leveling itself. I can turn the setting off with "M155 S0", but in order to turn it back on again, I need to know the correct value of n. How can I determine that value in a script?

Do you know this site?

https://reprap.org/wiki/G-code

https://reprap.org/wiki/G-code#M155:_Automatically_send_temperatures

Yes, that's how I learned about the M155 command. But that's not my question. My question is, how do I access the "Autoreport interval to request from firmware" setting in the "Serial Connection" config page in my script? That is, how do I determine that "2" in "M155 S2" that Octoprint uses to set M155? Is there an environment variable I can use? Is there a way to push/pop the M155 settings in the firmware?

No. OctoPrint defaults to S2. You can change that to anything in 'Settings->Printer->GCODE Scripts->After serial connection to printer is established' way towards bottom. If your printer can not do autoreports, OctoPrint defaults to polling which is fixed at 2Β± seconds. I do some macros where I turn it off and then restore it at the end.

To properly answer your question, I believe we need to know more about your "script" like where is it running?

From a practical point of view, I've not changed that value in OctoPrint's settings in years so I think M155 S0 and M155 S5 (or whatever your value is) can be hard coded.

1 Like

It's not stored as a variable, and you can't get the value back from the printer's firmware.

You could possibly retrieve the value from OctoPrint's settings depending where and how your "script" is running. If you need access to the settings, then perhaps converting it into being a (very simple) plugin would be more use.

In OctoPrint's built in scripts, you will not be able to access this information. So describe more about your script.

So this is the for the "Bed Visualizer" plugin. It gives me the opportunity to specify the commands needed for generate the bed mesh data. This is what is recommended for the MK3.9 (it seems to work for the 3.5):

Summary

;
; MBL Prep
;
G0 X0 Y-4 Z15 F4800 ; move away from printbed
M140 S60 ; set bed temp
M104 S170 ; set extruder temp for bed leveling
M109 R170 ; wait for temp
M84 E ; turn off E motor
M302 S160 ; lower cold extrusion limit to 160C
G1 E-2 F2400 ; retraction
M84 E ; turn off E motor
G28 ; home all without mesh bed level
M106 S100
G0 Z40 F10000
M190 S60 ; wait for bed temp
M107
;
; MBL
;
M84 E ; turn off E motor
M155 S0
G29 P1 ; invalidate mbl & probe print area
G29 P3.2 ; interpolate mbl probes
G29 P3.13 ; extrapolate mbl outside probe area
;
; MBL Update Mesh
;
@ BEDLEVELVISUALIZER
G29 T ; print bed topography report
;
; Cleanup
;
M104 S0 ; turn off temperature
M140 S0 ; turn off heatbed
M107 ; turn off fan
G0 X0 Y-4 Z15 F4800 ; move away from printbed
M155 S2

For now, I've hard-coded the "M155 S2" at the end. What I was hoping to be able to do is something like "M155 S%%autoreport_temperature_interval%%" and then Octoprint will, upon sending this command to the printer, replace the %%autoreport_temperature_interval%%" with 2.

Sorry. What is the purpose of using a variable? If OctoPrint will ALWAYS replace that variable with a 2? What other operation, other than a script, would ever change that value? If you absolutely have to have this, you should use Charlie's GCode Macros plugin and rewrite every script you use to a macro that includes a reference to a data file that you then have to maintain.
Or, you could just use "M155 S2"...

My point is that if I go to the "Intervals & timeouts" page and change the "Temperature interval (autoreport)" setting to 5 (for example), I want this G-code to automatically send "M155 S5" at the end.

I was hoping that there would be an environment variable for every Octoprint configuration option that can be used in any G-code.

Really sorry! I was SO far off on that one! So what you want is a Request Issue up on the OctoPrint Github page to add that to OctoPrint. You could write a plugin for it but I don't think you can then tie it into the GCODE Scripts under the Printer. I have been wrong before. LOL.

1 Like

as I understand (and that is a big 'caveat' in this case, I'm not expert at all for this), the temperature reporting that the M155 is about is "for information only", and that is "information intended for the 'meatspace' (human) user", not for any "IT part" of Octoprint or other printer control.
So, unless I'm wrong about this, as the human in control of this/these printer(s), you can decide what you want and set that value.

That is not correct:

as some of them.

DUH me!!
What I should have put instead was a weaker statement that (as I understand) the timing is not desperately critical, and suggest use something between 2 and 10