Overrides default inky library to change timings on black rendering

This commit is contained in:
Dispsylala 2019-10-13 17:18:27 +01:00
parent 77c16c38f4
commit f0c5ad4b74
4 changed files with 53 additions and 3 deletions

@ -136,9 +136,9 @@ class Display(View):
def _init_display(self):
if self.is_inky():
logging.info("initializing inky display")
from inky import InkyPHAT
self._display = InkyPHAT(self._display_color)
self._display.set_border(InkyPHAT.BLACK)
from pwnagotchi.ui.inkyphat.inkyphatfast import InkyPHATFast
self._display = InkyPHATFast(self._display_color)
self._display.set_border(InkyPHATFast.BLACK)
self._render_cb = self._inky_render
elif self.is_papirus():

@ -0,0 +1,23 @@
from inky.inky import Inky, CS0_PIN, DC_PIN, RESET_PIN, BUSY_PIN
class InkyFast(Inky):
def __init__(self, resolution=(400, 300), colour='black', cs_pin=CS0_PIN, dc_pin=DC_PIN, reset_pin=RESET_PIN,
busy_pin=BUSY_PIN, h_flip=False, v_flip=False):
super(InkyFast, self).__init__(resolution, colour, cs_pin, dc_pin, reset_pin, busy_pin, h_flip, v_flip)
self._luts['black'] = [
0b01001000, 0b10100000, 0b00010000, 0b00010000, 0b00010011, 0b00000000, 0b00000000,
0b01001000, 0b10100000, 0b10000000, 0b00000000, 0b00000011, 0b00000000, 0b00000000,
0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000,
0b01001000, 0b10100101, 0b00000000, 0b10111011, 0b00000000, 0b00000000, 0b00000000,
0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000,
0x04, 0x04, 0x04, 0x04, 0x04,
0x10, 0x04, 0x04, 0x04, 0x04,
0x04, 0x08, 0x08, 0x10, 0x10,
0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00,
]

@ -0,0 +1,27 @@
"""Inky pHAT e-Ink Display Driver."""
from . import inkyfast
class InkyPHATFast(inkyfast.InkyFast):
"""Inky wHAT e-Ink Display Driver."""
WIDTH = 212
HEIGHT = 104
WHITE = 0
BLACK = 1
RED = 2
YELLOW = 2
def __init__(self, colour):
"""Initialise an Inky pHAT Display.
:param colour: one of red, black or yellow, default: black
"""
inkyfast.InkyFast.__init__(
self,
resolution=(self.WIDTH, self.HEIGHT),
colour=colour,
h_flip=False,
v_flip=False)