domneedham / pico-clock-green-python

A MicroPython implementation of the Waveshare Pico-Clock-Green.
Apache License 2.0
10 stars 7 forks source link

Flickering display #19

Open KaeroDot opened 1 year ago

KaeroDot commented 1 year ago

I have found the display is flickering, it seems like to slow redraw of the display. It is especially noticeable for lower values of brightness. Maybe I am too sensitive, my wife does not see it, but it is disturbing enough to me.

After some testing (I had to remove MQTT that is not functioning and prevents running the code), it seems to me the coroutines are interfering with the function display.enable_leds() running in the second thread. When I just run display.enable_leds() in second thread, the display is perfectly stable, and stable even if I set 'switched on time' of an actually drawn row for a single microsecond. The display is very dim (as I need it), but not flickering.

However when I start loop.run_forever(), the display starts flickering. So it seems to me the corutines affects the enable_leds() in the second core, but I was not able to find enough micropython documentation how one thread can affect other thread on two core pico processor.

Originally I have started to document the code and learn it to add alarm (and other things needed by myself), but flickering display is a stop for me.

Is there at least some idea how this could be traced and solved? I am not a professional programmer, so my abilities are limited.

domneedham commented 1 year ago

Hi there, thanks for taking a look and raising this.

I notice it too, especially on lower brightness though I can live with it. I am (at some point) aiming to improve the scheduling for this, as you said the app is redrawing all the time.

I had hoped the 2nd core would fix it, but it seems not.

I am aiming to come back to this project soon, I have just been super busy recently and never found the right time to sit down and work on it.