Changes in SerialThread.py

Do you have questions about writing plugins or scripts in Python? Meet the coders here.
Post Reply
m3flyin2lo
Plugin Developer
Posts: 22
Joined: Sun Nov 23, 2008 3:22 am

Changes in SerialThread.py

Post by m3flyin2lo » Wed Oct 07, 2009 2:25 am

I wrote a couple of plugins a few months ago, all using the serial port. They were written against the 0.3.6.1487 version.
I've recently upgraded to the latest version of EG (0.3.7.1194) and ran into some problems with my plugins.

I've tracked the issue down to one change in the SerialThread.py source: in the HandleReceive method, the "self.readCondition.notifyAll()" call was replaced with "self.readCondition.notify()". Because of this change, some of my Read calls do not return any data and time out.

I was wondering if there was a reason for that change. I am not sure if I am doing something wrong that would cause this change to break things. The sequence in my plugins where this is an issue is the following:

Code: Select all

        
while r != result and tries<10:
            self.plugin.serialThread.Write(buffer)
            r = self.plugin.serialThread.Read(1, 5)
            tries = tries + 1
I am basically writing a command (buffer) and trying to read back the expected response (result). After the change in SerialThread.py, the response (r) is always empty. Before the change, the response was coming in fine.

Thanks.

Post Reply