1
0
mirror of https://github.com/mbirth/wipy-ussd1306.git synced 2024-09-19 06:03:24 +01:00

Added garbage collection to free up some memory before doing

memory-intensive tasks.
This commit is contained in:
Markus Birth 2016-04-09 16:35:51 +02:00
parent ec958f3808
commit d66498cb88

View File

@ -33,6 +33,7 @@ except:
# WiPy
import machine
import gc
import struct
import time
@ -196,7 +197,9 @@ class SSD1306:
def clear(self):
""" clear screen """
self.position(0, 0)
gc.collect()
self.data([0] * (self.height * self.width // 8))
gc.collect()
self.position(0, 0)
def sleep_ms(self, mseconds):
@ -259,6 +262,5 @@ class SSD1306:
arr = [dc] + arr
#print(repr(arr))
buf = struct.pack('B'*len(arr), *arr)
print(repr(buf))
#print(repr(buf))
self.i2c.writeto(self.devid, buf)