Welcome! Log In Create A New Profile

Advanced

Bug in Pronterface nozzle graph while USB printing

Posted by 3D-ES 
Bug in Pronterface nozzle graph while USB printing
January 18, 2014 01:43PM
Hi there!

There is a problem with the Pronterface graph.

When I start Pronterface and connect to the printer,
I click "watch" to see the bed and nozzle temperature.

This works perfectly fine, both of the lines are correct.

But when I use the "watch" function while I am USB printing,
the nozzle temperature toggles between 0 and the real value!

Tracing pronterface.py brought me to two points of interest:

1. The function recvcb(self, l)

This function receives the reported temperature and stores it.
It will update all the available temperature values in the graph.

A findall approach is used which works for both "T:" and "T0:".
    def recvcb(self, l):
        if ("T:" in l) or ("T0:" in l) or ("T1:" in l) or ("T2:" in l):
            self.tempreport = l
            wx.CallAfter(self.tempdisp.SetLabel, self.tempreport.strip().replace("ok ", ""))
            temps = re.findall("T[0-9]*:\s*([0-9]+\.[0-9])",self.tempreport.strip())
            try:
                #wx.CallAfter(self.graph.SetExtruder0Temperature, parse_temperature_report(self.tempreport, "T:"))
                #wx.CallAfter(self.graph.SetExtruder0Temperature, parse_temperature_report(self.tempreport, "T0:"))
                wx.CallAfter(self.graph.SetExtruder0Temperature, float(temps[0]))
                #wx.CallAfter(self.graph.SetExtruder1Temperature, parse_temperature_report(self.tempreport, "T1:"))
                if len(temps) > 1:
                    wx.CallAfter(self.graph.SetExtruder1Temperature, float(temps[1]))
                #wx.CallAfter(self.graph.SetExtruder2Temperature, parse_temperature_report(self.tempreport, "T2:"))
                if len(temps) > 2:
                    wx.CallAfter(self.graph.SetExtruder2Temperature, float(temps[2]))
                wx.CallAfter(self.graph.SetBedTemperature, parse_temperature_report(self.tempreport, "B:"))
            except:
                traceback.print_exc()
---8<---
2. The function statuschecker(self)

This function also parses the stored temperature report and also updates the graph...!
---8<---
                #wx.CallAfter(self.graph.SetExtruder0Temperature, parse_temperature_report(self.tempreport, "T:"))
                wx.CallAfter(self.graph.SetExtruder0Temperature, parse_temperature_report(self.tempreport, "T0:"))
                wx.CallAfter(self.graph.SetExtruder1Temperature, parse_temperature_report(self.tempreport, "T1:"))
                wx.CallAfter(self.graph.SetExtruder2Temperature, parse_temperature_report(self.tempreport, "T2:"))
                wx.CallAfter(self.graph.SetBedTemperature, parse_temperature_report(self.tempreport, "B:"))
---8<---
The second parse function looks like this:
def parse_temperature_report(report, key):
    if key in report:
        #print report
        #print report.split()
        return float(filter(lambda x: x.startswith(key), report.split())[0].split(":")[1].split("/")[0])
    else:
        return -1.0
Since the Ormerod temperature report contains: "T:193.2 B:64.7",
it will not be able to find the key "T0:" in the report and returns -1.0

The result: both methods are having a heated temperature argument.

What to do about this situation?

Since the Ormerod will support 3 nozzle temperatures in the future,
we could fast-forward and change the reported nozzle ID to "T0:"...

But that does not improve the current state of Pronterface...

I have noticed that there are a lot of smart people on this forum,
What are your ideas about this bug, and the best way to fix this?

If someone would like to fix this, please go ahead! smiling smiley


RS-Online Ormerod #263, Kossel mini with Minitronics, Prusa i3 MK2
Re: Bug in Pronterface nozzle graph while USB printing
January 18, 2014 01:56PM
Hi 3D-ES

Thanks for spotting this! I think Jean-Marc has been looking for this bug for a while, so he may be able to address this. I'll forward it to him.

Ian
RepRapPro tech support
Re: Bug in Pronterface nozzle graph while USB printing
January 18, 2014 03:36PM
Well spotted! I did wonder why the graph dipped every so often, but I so far hadn't got a chance to look into it.

I'll get it fixed when I next get into the office (Monday).
Sorry, only registered users may post in this forum.

Click here to login