From bfe0ea7623f61aec7ec1e59c21ca67759c009057 Mon Sep 17 00:00:00 2001 From: Dispsylala Date: Sun, 27 Oct 2019 19:51:48 +0000 Subject: [PATCH] Makes Inky Fast mode opt-in by selecting 'fastAndFurious' Displays warning if selected. Otherwise uses original InkyPHAT library --- pwnagotchi/ui/hw/inky.py | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/pwnagotchi/ui/hw/inky.py b/pwnagotchi/ui/hw/inky.py index 3917079..7ae3327 100644 --- a/pwnagotchi/ui/hw/inky.py +++ b/pwnagotchi/ui/hw/inky.py @@ -33,15 +33,25 @@ class Inky(DisplayImpl): def initialize(self): logging.info("initializing inky display") - from pwnagotchi.ui.hw.libs.inkyphat.inkyphatfast import InkyPHATFast - self._display = InkyPHATFast(self.config['color']) - self._display.set_border(InkyPHATFast.BLACK) + + if self.config['color'] == 'fastAndFurious': + logging.info("Initializing Inky in 2-color FAST MODE") + logging.info("THIS MAY BE POTENTIALLY DANGEROUS. NO WARRANTY IS PROVIDED") + logging.info("USE THIS DISPLAY IN THIS MODE AT YOUR OWN RISK") + + from pwnagotchi.ui.hw.libs.inkyphat.inkyphatfast import InkyPHATFast + self._display = InkyPHATFast('black') + self._display.set_border(InkyPHATFast.BLACK) + else: + from inky import InkyPHAT + self._display = InkyPHAT(self.config['color']) + self._display.set_border(InkyPHAT.BLACK) def render(self, canvas): - if self.config['color'] != 'mono': - display_colors = 3 - else: + if self.config['color'] == 'black' or self.config['color'] == 'fastAndFurious': display_colors = 2 + else: + display_colors = 3 img_buffer = canvas.convert('RGB').convert('P', palette=1, colors=display_colors) if self.config['color'] == 'red':