Fixed loop issue

This commit is contained in:
Maximilian Giller 2019-05-28 14:38:17 +02:00
parent 2269bcf3fa
commit 464f489ebd

View file

@ -157,9 +157,14 @@ class EpdAdapter (DisplayAdapter):
self.send_command(DEEP_SLEEP) self.send_command(DEEP_SLEEP)
self.send_data(0xa5) self.send_data(0xa5)
def wait_until_idle (self): def wait_until_idle (self, max_wait_seconds = 60):
while(self.digital_read(self.busy_pin) == 0): # 0: busy, 1: idle wait_ms = 100
self.delay_ms(100) count = 0
while(self.digital_read(self.busy_pin) == 0 and wait_ms * count < max_wait_seconds * 1000): # 0: busy, 1: idle
self.delay_ms(wait_ms)
count += 1
if wait_ms * count >= max_wait_seconds * 1000:
print("Skipped idle confirmation")
def reset (self): def reset (self):
self.digital_write(self.reset_pin, GPIO.LOW) # module reset self.digital_write(self.reset_pin, GPIO.LOW) # module reset