pimoroni / breakout-garden

Documentation, software, and examples for the Breakout Garden ecosystem.
https://shop.pimoroni.com/products/breakout-garden-hat
MIT License
70 stars 13 forks source link

seismograph.py Thread #22

Closed jorgevinagre closed 5 years ago

jorgevinagre commented 5 years ago

Hi I´ve tried to adapt the seismograph.py example but with bmp280 sensor to draw the graphic.

On the first iteration of the main loop the code throws an exception in this line draw.line([(128, 64), (96, 64 + points[-1])], fill="white") The array is empty so the call to the last element fails. Is there something missing in the code sample?

I´m using a raspberry pi zero.

Thanks

Gadgetoid commented 5 years ago

Yikes, good spot. It looks like in some - but not all - cases the threaded data sampling would add something into that array before this line was reached. Presumably where the Image.open operation was slow enough to cause a measureable delay.

Gadgetoid commented 5 years ago

Should be suitably fixed, albeit the Pi I tested on wasn't fast enough to run into this error. (My Pi 4 was tied up doing something plainly ridiculous for uuh engineering reasons)

Thank you!