Option dangerous_affirm_black added.

This commit is contained in:
antirez
2024-03-23 23:06:16 +01:00
parent 65823425bf
commit 77e94274ad
2 changed files with 19 additions and 1 deletions

View File

@@ -74,6 +74,16 @@ Update latecy:
Speed 0 and 1 are very slow, most of the times not worth using. However note that speed 0 uses internal LUTs that are temperature adjusted, so if you have an application that will not run at room temperature, you may need to use speed 0.
## Experimental: reaffirming black pixels
When no-flickering is enabled, black pixels tend to lose color and go towards grey. This is normal and is explained in detail in the next sections of this README. Usually we can't do much about it: the driver main goal is to avoid damaging the display by biasing pixels in one direction.
However, if you really want to try your luck (I did and can't see any issue so far), you can use this option during the object initialization:
dangerous_reaffirm_black = True
Doing so, the BB table (black -> black) will very slightly drive black pixels to black for 20 milliseconds in no-flickering modes. Since the pulse is so short, it is very unlikely to damage the display if not used for a very long time with the same image. When this option is enabled, it is possible to go forward without a full update for a very long time, so setting a full update period of zero becomes possible.
## Partial updates
TODO: the display API is trivial, but there is to evaluate how to implement this feature, if to use specialized LUTs and so forth. Currently it is very rarely useful, because this driver has fast LUTs and no flickering modes.

View File

@@ -143,7 +143,7 @@ HZ_100 = const(0b00111010)
HZ_200 = const(0b00111001)
class UC8151:
def __init__(self,spi,*,cs,dc,rst,busy,width=128,height=296,speed=0,mirror_x=False,mirror_y=False,inverted=False,no_flickering=False,debug=False,full_update_period=50):
def __init__(self,spi,*,cs,dc,rst,busy,width=128,height=296,speed=0,mirror_x=False,mirror_y=False,inverted=False,no_flickering=False,debug=False,full_update_period=50,dangerous_reaffirm_black=False):
self.spi = spi
self.cs = Pin(cs,Pin.OUT) if cs != None else None
self.dc = Pin(dc,Pin.OUT) if dc != None else None
@@ -153,6 +153,7 @@ class UC8151:
self.height = height
self.speed = speed
self.no_flickering = no_flickering
self.dangerous_reaffirm_black = dangerous_reaffirm_black
self.inverted = inverted
self.mirror_x = mirror_x
self.mirror_y = mirror_y
@@ -554,6 +555,13 @@ class UC8151:
if no_flickering == True:
self.clear_lut(WW)
self.clear_lut(BB)
# If the user sets the dangerous_reaffirm_black parameter during
# the initialization, we very slightly (just two frames) reaffirm
# the black pixels in the BB table, so that they will go less
# towards greyish color. Potentially this could polarize the
# display.
if self.dangerous_reaffirm_black:
self.set_lut_row(BB,0,pat=0b10_01_10_01,dur=[0,2,0,0],rep=1)
if self.debug:
print(f"LUTs for speed {speed} no_flickering {no_flickering}:")