arachnidlabs / minishift-python

Python library for interfacing with the minishift.
BSD 3-Clause "New" or "Revised" License
3 stars 4 forks source link

Runs for a day(?) and then hangs #5

Open ComputerSmiths opened 9 years ago

ComputerSmiths commented 9 years ago

So I've got some test code running on a Raspberry Pi2:


import minishift import time import sys

vid, pid = 0x04d8, 0xf517 width = 72 ms = minishift.Minishift(minishift.MCP2210Interface(vid, pid), width) canvas = minishift.Canvas(width) while True: timestring = time.strftime(str(sys.argv[1])) print '\r'+timestring, sys.stdout.flush() canvas.write_text(0, timestring) ms.update(canvas) for y in range (0,8): for x in range (0,width): canvas[x,y]=0 time.sleep(1)


And when I run it (either foreground or background): python time.py "%a %T" &

It runs fine for maybe a day and then stops updating the display. If I run it again in the foreground, with the background process 'stuck', I get this in the foreground:

Traceback (most recent call last): File "time.py", line 14, in ms.update(canvas) File "/usr/local/lib/python2.7/dist-packages/minishift/draw.py", line 192, in update self.interface.send(canvas.to_bytes()) File "/usr/local/lib/python2.7/dist-packages/minishift/draw.py", line 25, in send self.device.transfer(data) File "/usr/local/lib/python2.7/dist-packages/mcp2210/device.py", line 210, in transfer Tue 06:11:23 self.transfer_settings = settings File "/usr/local/lib/python2.7/dist-packages/mcp2210/device.py", line 63, in setter self.sendCommand(set_command(value)) File "/usr/local/lib/python2.7/dist-packages/mcp2210/device.py", line 137, in sendCommand response = command.RESPONSE.from_buffer_copy(response_data) ValueError: Buffer size too small (0 instead of at least 4 bytes)

And then the background process starts running again!

Any idea what's up? This ran for weeks with a 5-unit display using %X for the format string...

Thanks!

ComputerSmiths commented 9 years ago

Correction, it's the background process that gives the above error message, and then the 'new' process starts running.

But it still hangs after a while, which it didn't do with just five segments, is there a way to do some kind of debugging?