hs.serial:sendData(value) chokes after some indeterminate amount of time?
gingerbeardman opened this issue · comments
I have created a hammerspoon script to send mouse events (x,y) to a serial connection.
https://gist.github.com/gingerbeardman/2580d878e3279381c7a67bd8d4c70e03
(It also shows a canvas after you invoke it which is the screen size of the device i'm sending to, which makes it easy to keep the mouse "on screen".)
It works a treat! but...
...in certain circumstances (reproducible, but no pattern spotted so far) hammerspoon locks up.
I am guessing that the serial connection, buffer, stack, or something, is becoming overloaded or flooded? just a guess.
My device seems to be able to deal with things as fast as I can send them.
Any thoughts on debugging hs.serial?
Alternatively I'd consider a different approach.
Any help appreciated.
matt
It could be a garbage collection issue? Can you try capturing the hs.serial
object in a global?
That does seem better, thanks.
I'll keep an eye on it and mark this issue as closed.