clssn / numato-gpio

Python API for Numato GPIO Expanders
MIT License
4 stars 6 forks source link

Notification callback breaks on timeout #27

Closed will-riley closed 1 year ago

will-riley commented 1 year ago

USB 16ch GPIO version A0M10.01 numato-gpio 0.11.0.dev0 gentoo linux

Set threading.Thread() to daemon=False in init to keep the process open. Example callback only works as expected if GPIO input value changes 2+ times within the timeout period (first signal gets ignored).

For example, if the timeout happens, then ch8 changes, this won't trigger a notification. The timeout flushed the "\n\r", so when "#" comes around to deliver a new notice, the key "\n\r#" doesn't exist.

If timeout is scaled to 10 sec, everything within the 10 sec window works as advertised. Each new notice triggers the callback (except the first one).

Not sure how to fix it yet. Clues appreciated.

will-riley commented 1 year ago

Added "self._ser.timeout = None" as first line of _poll. Seems to work. Still misses the first trigger, but close enough.