wasp: clock: Reduce battery meter redraws
The ADC on nRF doesn't run precisely stable which means the battery meter can flicker if updated too often. This will eventually be fixed by the framework but, for now, let's just force the update rate to be fairly slow.
This commit is contained in:
parent
5489437f78
commit
be6c6b02b0
1 changed files with 5 additions and 2 deletions
|
@ -25,14 +25,16 @@ class ClockApp(object):
|
|||
|
||||
display.fill(0)
|
||||
display.rleblit(fonts.clock_colon, pos=(2*48, 80), fg=0xb5b6)
|
||||
self.on_screen = ( -1, -1 )
|
||||
self.update(watch)
|
||||
self.meter.draw()
|
||||
|
||||
|
||||
def update(self, watch):
|
||||
now = watch.rtc.get_time()
|
||||
if now[0] == self.on_screen[0] and now[1] == self.on_screen[1]:
|
||||
self.meter.update()
|
||||
if now[1] % 2 == 0:
|
||||
self.meter.update()
|
||||
return False
|
||||
|
||||
display = watch.display
|
||||
display.rleblit(DIGITS[now[1] % 10], pos=(4*48, 80))
|
||||
|
@ -42,3 +44,4 @@ class ClockApp(object):
|
|||
self.on_screen = now
|
||||
|
||||
self.meter.update()
|
||||
return True
|
||||
|
|
Loading…
Reference in a new issue