From 704d7ceaa1e78839de317708570689792025f277 Mon Sep 17 00:00:00 2001
From: "mohesh.mohan" <moheshmohan@gmail.com>
Date: Thu, 12 Dec 2019 00:46:14 +0400
Subject: [PATCH] waveshare213b and waveshare213c support bug fixes

---
 pwnagotchi/ui/hw/libs/waveshare/v213bc/epd2in13bc.py | 9 +++++++++
 pwnagotchi/ui/hw/waveshare213bc.py                   | 4 +---
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/pwnagotchi/ui/hw/libs/waveshare/v213bc/epd2in13bc.py b/pwnagotchi/ui/hw/libs/waveshare/v213bc/epd2in13bc.py
index 1d321eb..d542dc9 100644
--- a/pwnagotchi/ui/hw/libs/waveshare/v213bc/epd2in13bc.py
+++ b/pwnagotchi/ui/hw/libs/waveshare/v213bc/epd2in13bc.py
@@ -158,6 +158,15 @@ class EPD:
         self.send_command(0x12) # REFRESH
         self.ReadBusy()
 
+    def pwnclear(self):
+        self.send_command(0x10)
+        for i in range(0, int(self.width * self.height / 8)):
+            self.send_data(0xFF)
+        self.send_command(0x92)
+
+        self.send_command(0x12) # REFRESH
+        self.ReadBusy()
+
     def sleep(self):
         self.send_command(0x02) # POWER_OFF
         self.ReadBusy()
diff --git a/pwnagotchi/ui/hw/waveshare213bc.py b/pwnagotchi/ui/hw/waveshare213bc.py
index 81b5770..70309a8 100644
--- a/pwnagotchi/ui/hw/waveshare213bc.py
+++ b/pwnagotchi/ui/hw/waveshare213bc.py
@@ -1,5 +1,4 @@
 import logging
-import time
 
 import pwnagotchi.ui.fonts as fonts
 from pwnagotchi.ui.hw.base import DisplayImpl
@@ -38,7 +37,6 @@ class Waveshare213bc(DisplayImpl):
         self._display = EPD()
         self._display.init()
         self._display.Clear()
-        time.sleep(1)
 
     def render(self, canvas):
         buf = self._display.getbuffer(canvas)
@@ -46,4 +44,4 @@ class Waveshare213bc(DisplayImpl):
 
     def clear(self):
         #pass
-        self._display.Clear()
+        self._display.pwnclear()