diff options
| author | Daniel Thompson <daniel@redfelineninja.org.uk> | 2020-03-09 00:00:13 (GMT) |
|---|---|---|
| committer | Daniel Thompson <daniel@redfelineninja.org.uk> | 2020-03-09 00:00:13 (GMT) |
| commit | 031d139b7c31f83791c8c35cc78624aa1eda6da2 (patch) | |
| tree | 0322cf93239101571d3e8b1c29a9e0980313abe0 /wasp/apps | |
| parent | 5413d826d7ffe825b759cd013f9f68e9311aee01 (diff) | |
wasp: draw565: Refactor to allow apps to focus on the drawable.
Diffstat (limited to 'wasp/apps')
| -rw-r--r-- | wasp/apps/clock.py | 17 | ||||
| -rw-r--r-- | wasp/apps/testapp.py | 4 |
2 files changed, 10 insertions, 11 deletions
diff --git a/wasp/apps/clock.py b/wasp/apps/clock.py index cde39a2..f99091a 100644 --- a/wasp/apps/clock.py +++ b/wasp/apps/clock.py @@ -56,10 +56,10 @@ class ClockApp(object): def draw(self, effect=None): """Redraw the display from scratch.""" - display = watch.display + draw = watch.drawable - display.fill(0) - display.rleblit(digits.clock_colon, pos=(2*48, 80), fg=0xb5b6) + draw.fill() + draw.rleblit(digits.clock_colon, pos=(2*48, 80), fg=0xb5b6) self.on_screen = ( -1, -1, -1, -1, -1, -1 ) self.update() self.meter.draw() @@ -77,14 +77,13 @@ class ClockApp(object): self.on_screen = now return False - display = watch.display - display.rleblit(DIGITS[now[4] % 10], pos=(4*48, 80)) - display.rleblit(DIGITS[now[4] // 10], pos=(3*48, 80), fg=0xbdb6) - display.rleblit(DIGITS[now[3] % 10], pos=(1*48, 80)) - display.rleblit(DIGITS[now[3] // 10], pos=(0*48, 80), fg=0xbdb6) + draw = watch.drawable + draw.rleblit(DIGITS[now[4] % 10], pos=(4*48, 80)) + draw.rleblit(DIGITS[now[4] // 10], pos=(3*48, 80), fg=0xbdb6) + draw.rleblit(DIGITS[now[3] % 10], pos=(1*48, 80)) + draw.rleblit(DIGITS[now[3] // 10], pos=(0*48, 80), fg=0xbdb6) self.on_screen = now - draw = watch.drawable month = now[1] - 1 month = MONTH[month*3:(month+1)*3] draw.string('{} {} {}'.format(now[2], month, now[0]), diff --git a/wasp/apps/testapp.py b/wasp/apps/testapp.py index 56a3853..9f512f1 100644 --- a/wasp/apps/testapp.py +++ b/wasp/apps/testapp.py @@ -38,7 +38,7 @@ class TestApp(): draw.string('({}, {})'.format(event[1], event[2]), 0, 108, width=240) elif self.test == 'String': - watch.display.fill(0, 0, 30, 240, 240-30) + draw.fill(0, 0, 30, 240, 240-30) t = machine.Timer(id=1, period=8000000) t.start() draw.string("The quick brown", 12, 24+24) @@ -56,7 +56,7 @@ class TestApp(): def draw(self, effect=None): """Redraw the display from scratch.""" watch.display.mute(True) - watch.display.fill(0) + watch.drawable.fill() watch.drawable.string('{} test'.format(self.test), 0, 6, width=240) watch.display.mute(False) |
