I'm not sure if I'm misunderstanding this but I assumed that the 'Suppress temperature messages' tick-box would do what it says on the tin, but it doesn't seem to make a difference as the temperature messages just keep coming.
I am using Octoprint 1.4.0 on a Pi4 Model B Rev 1.1 running the OctoPi 0.17.0 image connected to a Creality CR-10s Pro running the Creality firmware 1.70.1
Is this a known issue? I can't find any reference to it in searches so I assume not.
Please enable your serial.log and post it here. The "Suppress temperature messages" works with a standard Marlin temperature report, but unless you show us what your temperature reports look like, we can only guess.
This is what appears in the terminal -
Recv: == T:25.45 /0.00 == B:26.36 /0.00 @:0 B@:0
Recv: == T:25.45 /0.00 == B:26.36 /0.00 @:0 B@:0
Recv: == T:25.45 /0.00 == B:26.36 /0.00 @:0 B@:0
Recv: == T:25.45 /0.00 == B:26.36 /0.00 @:0 B@:0
Recv: == T:25.45 /0.00 == B:26.36 /0.00 @:0 B@:0
Recv: == T:25.45 /0.00 == B:26.36 /0.00 @:0 B@:0
Recv: == T:25.45 /0.00 == B:26.36 /0.00 @:0 B@
I have turned on serial logging, Is there a way to attach the log file or do I post it in here?
This assumes that you have figured out how to SSH into your RPi using PuTTY (on Windows), ssh (on Linux), or something else on macOS.
Note that this is totally untested as I don't have a Creality CR-10s Pro running the Creality firmware 1.70.1. It also assumes that only the temperature report has the extra == characters. If that assumption is false, then I would use a regular expression that matched only the temperature report line.
Connect to octopi via SSH (or login as the effective octoprint user on your machine) copy this snippet and paste it straight into the terminal:
cat > /home/pi/.octoprint/plugins/Fix_Temp_Report.py << EOF
# coding=utf-8
from __future__ import absolute_import
def fix_Temp_Report(comm, line, *args, **kwargs):
while "==" in line:
line = line.replace("==","")
return line
__plugin_name__ = "Fix Temp Report"
__plugin_version__ = "1.0.0"
__plugin_description__ = "Remove extraneous == from temperature report"
__plugin_hooks__ = {
"octoprint.comm.protocol.gcode.received": fix_Temp_Report
}
EOF
sudo service octoprint restart
just tested the fix and it didn't work. It would appear that the plug-in is not being run, or is not doing what it should. To try to debug the code I replaced the line = line.replace("==","") with line = line.replace("==","*****") but the messages still came out with the == in.
Checking in the directory the Fix_Temp_Report.py is now joined by Fix_Temp_Report.pyc and the plug-in is displayed in the Plugin Manager and is enabled.
Is there anything that I could have done wrong? Is there any way to debug the plugin to see if it is getting called ok? Would it be possible to add a print statement to display line before and after the replace?
def fix_Temp_Report(comm, line, *args, **kwargs):
while "==" in line:
line = line.replace("==","")
f = open("/home/pi/test.txt", "a")
f.write( line )
f.close()
return line
and the result in the file was -
If all you added is the open, write, and close then the **** in the output is disturbing. If the serial.log still contains the lines with the == in them, then I suspect that the problem is the wrong hook function or the hook function used is too late in the process. This is the documentation of the hook being used and a quick look at all the hooks didn't find anything more appropriate. Note that the documentation does contain a warning:
Make sure to not perform any computationally expensive or otherwise long running actions within these handlers as you will effectively block the receive loop, causing the communication with the printer to stall.
This includes I/O of any kind.
At this point, we may have to ask @foosel for some guidance. Is this the right approach? What is an appropriate method for debugging? I'm guessing using the logger or logging.
I have changed the suppress Terminal Filter to - (Send: (N\d+\s+)?M105)|(Recv: == T:.*$)
which seems to be doing the job. The problem with the plug-in code is strange in that it seems that the code gets the correct line data and returns the correctly amended data but somehow it is not being used.
further to my last message I have noticed that if you use a terminal filter you get [...] displayed to indicate the suppressed messages. If however you deselect the Suppress Temperature Messages all of the suppressed messages are then displayed. This indicates to me that the messages are being buffered somewhere.. Could this eventually present a problem with a large number of buffered lines?
@ChrisMower, I'm glad you found a way to suppress the messages. Obviously, OctoPrint's Terminal Filters are being run before the plugin hook sees the line. I originally authored this plugin to solve another Creality firmware transgression and it worked there so I thought I'd give it a shot here.
Your question about the buffered lines is beyond my pay grade. @foosel or someone more familiar with the OctoPrint internals would have to answer that one.
OctoPrint has a Discord server (icon at the top of this page) and you could try asking there in support-octoprint or dev-core.
I have changed the suppress Terminal Filter to - (Send: (N\d+\s+)?M105)|(Recv: == T:.*$)
which seems to be doing the job.
I think multiple whitespace characters are trimmed in the forum text editor. Therefore @ChrisMower's filter text was altered.
I needed to put an extra whitespace after "Recv:" for my printer.
Hi there..
I'm having exactly the same issue here, but your solutions are beyond my understanding. I'm an inexperienced old-guy.
I thought I was following along at the beginning of the post, but you lost me with language and code I don't understand (yet).
Would someone please be willing to translate or clarify what the solution was to enabling the "Suppress Temperature Messages", and how I can do the same to mine?
Ender 5 Plus, Marlin firmware, Raspberry Pi4 running OctoPi + Octodash. My temperature report is identical with the "extra =="
My knowledge base takes me as far as accessing the Pi through Putty, but I don't really know what to do from there for this issue.
If the only downside to this temperature report is that the terminal output doesn't suppress these reports when the box is checked, then the solution is to change the regex in OctoPrint settings (the wrench icon), Terminal Filters. You do this through your browser.
The filter text to use is listed in the post just above yours, @frybr. You should be able to cut and paste.
Thanks for very much for your reply. Was tied up at work, and just trying this now.
I tried copy/pasting the text into the Terminal Filter:
"(Send: (N\d+\s+)?M105)|(Recv: == T:.*$)"
and the text in this thread with the extra space:
"(Send: (N\d+\s+)?M105)|(Recv: == T:.*$)"
Neither had the desired affect of suppressing the temperature messages. I understand this certainly isn't critical functionality for the program, but just a little nuisance.
As a beginner, I don't know where to look or ask next.
Any suggestions are greatly appreciated.
The regex had a extra space. There should only be one space on either side of the ==.
This is the corrected regex: (Send: (N\d+\s+)?M105)|(Recv: == T:.*$).
I need a tool to help me figure out regex strings. I found this one which I like because it explains what the regex is supposed to do, has a quick reference, and allows you to select the flavor (use Python) of regex (there's subtle differences between them).
"
(Send: (N\d+\s+)?M105)|(Recv: == T:.*$)
"
gm
1st Alternative (Send: (N\d+\s+)?M105)
1st Capturing Group (Send: (N\d+\s+)?M105)
Send: matches the characters Send: literally (case sensitive)
2nd Capturing Group (N\d+\s+)?
? Quantifier β Matches between zero and one times, as many times as possible, giving back as needed (greedy)
N matches the character N literally (case sensitive)
\d+ matches a digit (equal to [0-9])
+ Quantifier β Matches between one and unlimited times, as many times as possible, giving back as needed (greedy)
\s+ matches any whitespace character (equal to [\r\n\t\f\v ])
+ Quantifier β Matches between one and unlimited times, as many times as possible, giving back as needed (greedy)
M105 matches the characters M105 literally (case sensitive)
2nd Alternative (Recv: == T:.*$)
3rd Capturing Group (Recv: == T:.*$)
Recv: == T: matches the characters Recv: == T: literally (case sensitive)
.* matches any character (except for line terminators)
* Quantifier β Matches between zero and unlimited times, as many times as possible, giving back as needed (greedy)
$ asserts position at the end of a line
Global pattern flags
g modifier: global. All matches (don't return after first match)
m modifier: multi line. Causes ^ and $ to match the begin/end of each line (not only begin/end of string)
Match 1
Full match 0-48 Recv: == T:23.32 /0.00 == B:21.52 /0.00 @:0 B@:0
Group 3. 0-48 Recv: == T:23.32 /0.00 == B:21.52 /0.00 @:0 B@:0
Search reference
(Send: (N\d+\s+)?M105)|(Recv: == T:.*$)
Recv: == T:23.32 /0.00 == B:21.52 /0.00 @:0 B@:0
insert your replacement value here