Author Topic: Slow display - Is this a kown issue ?!  (Read 986 times)

jkrafft

  • Newbie
  • *
  • Posts: 32
    • View Profile
Slow display - Is this a kown issue ?!
« on: August 07, 2021, 05:27:08 PM »
Hi
On my pistompcore, the display is very slow.
Apparently, the encoder command are not taken until display is ready, making navigation very slow.
Is this a known issue ?
Could it be hardware related (mistakes during build) ?
Is it sofware issue ?
Is it hardware/software limitations ?

Thx

Randall (Admin)

  • Administrator
  • Full Member
  • *****
  • Posts: 222
    • View Profile
Re: Slow display - Is this a kown issue ?!
« Reply #1 on: August 07, 2021, 06:49:26 PM »
Yeah, it's a known issue, and one high on my ToDo list.  It's mainly noticeable when scrolling the System Menu or Plugin deep edit screens, right? 

It has more to do with the LCD display than the encoder.  And more software than hardware.  Hardware-wise, the display and ADC share a SPI bus.  The baud rate for the bus is set lower than ideal for the sake of the ADC.  We could explore increasing that, but as it is, that will affect the ADC resolution and doesn't seem to improve the latency much.

From a software perspective, it could probably be made to be more responsive by improving code inefficiencies.
The display area is broken in to 7 horizontal "zones" so only a zone with changed data is refreshed.  That does make it a bit more responsive that it was when refreshing the whole screen.  It's likely possible to further target display refreshes.

There is also a sort operation which happens every time you twist the encoder on the System Menu or plugin deep edit screens.  That sort list could be cached.  There are similar other calculations which could probably be done once and cached.

Another improvement could be made to the encoder handler.  Currently, with each detent (30 degree rotation), a handler is called and must complete before the next is called.  For large/quicker rotations, what you'd like it to do, is skip ahead without handling each in-between selection.  That would make it feel much more responsive.

Randall (Admin)

  • Administrator
  • Full Member
  • *****
  • Posts: 222
    • View Profile
Re: Slow display - Is this a kown issue ?!
« Reply #2 on: August 07, 2021, 08:42:52 PM »
HA!  I found an even better solution!

In trying to find which code was being so slow, I dug into the the adafruit_rgb_display library used as a display driver.  I noticed many comments in the code suggesting that it would be more performant if numpy (a math lib) was installed.  After installing it, wow, what a difference!

Here's how to install it:
$ sudo apt install python3-numpy

Then restart pi-Stomp:
$ ps-restart

Enjoy your new rather responsive LCD!

I will now add numpy to the setup script so others never have to deal with that latency.

jkrafft

  • Newbie
  • *
  • Posts: 32
    • View Profile
Re: Slow display - Is this a kown issue ?!
« Reply #3 on: August 08, 2021, 03:02:10 PM »
Man! that's great, it works way better now.
Even without the possibility to fast skip, it now feels more responsive.

Thx
Keep up the fantastic work!

benh

  • Newbie
  • *
  • Posts: 37
    • View Profile
Re: Slow display - Is this a kown issue ?!
« Reply #4 on: October 16, 2021, 05:35:18 PM »
They share an SPI bus but they surely have different chip selects no ? Would it be possible to switch the speed dynamically then when accessing them ? The ADC should ignore the clock when it's CS isn't asserted... or it doesn't ?

Randall (Admin)

  • Administrator
  • Full Member
  • *****
  • Posts: 222
    • View Profile
Re: Slow display - Is this a kown issue ?!
« Reply #5 on: October 16, 2021, 06:29:55 PM »
Yes, different chip selects.  Don't know if the speed can change dynamically.  A few weeks I added some additional conflict prevention by having ADC polling skipped while the LCD is being written to.