speedyg0nz / MagInkDash

E-Ink Magic Dashboard that runs off a battery powered Inkplate 10; displaying content from Google Calendar, OpenWeatherMap and OpenAI that are retrieved and rendered by a Raspberry Pi.
Apache License 2.0
115 stars 14 forks source link

Experiencing random `display.drawImage` failures #1

Closed smoores-dev closed 1 year ago

smoores-dev commented 1 year ago

Hello! I wanted to firstly thank you for making and open-sourcing this project; I have my own dashboard that is based heavily on this one (https://gitlab.com/smoores/friedman-dash).

Have you ever had issues with the display.drawImage function failing, even when the server is up and seems to be returning a valid image file?

Oddly, this seems to have started only in the past few days, but I've now experienced several times where I look up to see that the display is blank, and remains so across several refreshes, all while I have no issues whatsoever downloading the image from the server with a web browser.

I managed to reproduce it a few times while I had the display hooked up to Arduino IDE's Serial Monitor, and I could see that display.drawImage was returning 0 rather than 1, indicating failure of some kind, but I haven't been able to get much more information than that since (and of course the problem is inconsistent, and seems to magically resolve every time I plug the display back into my computer to try to learn more).

Anyway, no worries at all if this you haven't experienced this; I'll keep poking around on my own. Just figured I would ask, in case!

speedyg0nz commented 1 year ago

Hi, thanks for highlighting this. Currently I have 2 sets of the Inkplate 10 running the same MagInkDash script. Weirdly, I'm noticing similar issues on the newer one (purchased this year), but not the older one that I purchased last year. It's too early to say that there's an issue with the newer board without further investigation though. Another possibility is the battery installed. I'm noticing that the 3000mAh battery that I installed in the newer board is depleting at a faster rate than the 1500mAh battery I installed in the older board. So it's entirely possible that I received a poorer quality battery that is not delivering sufficient voltage to drive the refresh of the display, and hence resulting in a blank screen. This could also explain why this issue does not appear when the Inkplate is plugged in. I'll need to swap the batteries to confirm this hypothesis, and see if the issue persists when I do so.

smoores-dev commented 1 year ago

I'm not 100% certain, but I think this was actually due to this: https://github.com/SolderedElectronics/Inkplate-Arduino-library/issues/208. For whatever reason, NetworkClient::downloadFile overrides the configured timeout and sets one for 1 second, which I was most likely occasionally surpassing. This explains why I only saw the issue intermittently, and only on the Inkplate (since the web browser had no such timeout).

I ended up re-writing the drawPngFromWeb function locally with a more reasonable timeout of 10 seconds, and so far everything seems to be working. Fingers crosseed!

smoores-dev commented 1 year ago

I'll close this. Thanks for your time @speedyg0nz!

speedyg0nz commented 1 year ago

Looks like Inkplate replied to the issue you raised. Great job investigating the issue!