adafruit / Adafruit_ILI9341

Library for Adafruit ILI9341 displays
406 stars 281 forks source link

Optimized setAddrWindow() to only set the axis which changes #64

Closed bitbank2 closed 2 years ago

bitbank2 commented 4 years ago

This is a simple, yet effective change for accelerating almost every operation of the GFX library. Switching between command and data modes on SPI LCDs is costly in terms of time. This change checks to see if either of the X and Y pixel window axes have actually changed with the new request and only sets them if they have. It adds 8 bytes of static variables to the size of the library, but delivers a consistent 10+ % increase in speed to every operation.

bitbank2 commented 4 years ago

The failing test is on a Leonardo with a bunch of other libraries loaded. My new code is only a few bytes, yet it pushed it over the size limit. Sounds like that test case needs to change, not this library.

ladyada commented 4 years ago

@bitbank2 thanks for the PR :)

@makermelissa will review shortly and can adjust the test skips