Skip to content
Snippets Groups Projects
Commit aaff35fe authored by schneider's avatar schneider
Browse files

fix(g-watch): Don't update display when not needed

This reduces the power consumption when the display is off by
about 3.8 mA.

card10 with BLE off and without this patch: 11.5 mA
card10 with BLE off and with this patch: 7.7 mA
parent 14606dab
No related branches found
No related tags found
1 merge request!396Add G-Watch to preload
Pipeline #4745 passed
...@@ -156,7 +156,9 @@ with display.open() as disp: ...@@ -156,7 +156,9 @@ with display.open() as disp:
p_leds_on = 0 p_leds_on = 0
while True: while True:
time.sleep(0.1)
millis = time.monotonic_ms() millis = time.monotonic_ms()
# print("loop", millis)
lt = time.localtime() lt = time.localtime()
dow = lt[6] dow = lt[6]
...@@ -187,6 +189,7 @@ with display.open() as disp: ...@@ -187,6 +189,7 @@ with display.open() as disp:
disp.backlight(brightness=0) disp.backlight(brightness=0)
for led in range(led_count): for led in range(led_count):
leds.prep_hsv(led, [0, 0, 0]) leds.prep_hsv(led, [0, 0, 0])
leds.update()
disp.update() disp.update()
if pressed & buttons.BOTTOM_RIGHT != 0: if pressed & buttons.BOTTOM_RIGHT != 0:
...@@ -200,9 +203,7 @@ with display.open() as disp: ...@@ -200,9 +203,7 @@ with display.open() as disp:
# ---------------------------------------- read orientation sensor # ---------------------------------------- read orientation sensor
samples = sensors[sensor]["sensor"].read() samples = sensors[sensor]["sensor"].read()
if len(samples) > 0: # get orientation sensor samples for sample in samples:
sample = samples[0]
yo = yn # calculate absolute wrist rotation since last check yo = yn # calculate absolute wrist rotation since last check
yn = sample.y + 360 yn = sample.y + 360
yd = abs(yn - yo) yd = abs(yn - yo)
...@@ -235,10 +236,11 @@ with display.open() as disp: ...@@ -235,10 +236,11 @@ with display.open() as disp:
leds.prep_hsv(10 - led, [hue, 100, ledbri]) # led=0 leds.prep_hsv(10 - led, [hue, 100, ledbri]) # led=0
else: else:
leds.prep_hsv(10 - led, [0, 0, 0]) leds.prep_hsv(10 - led, [0, 0, 0])
leds.update()
# ---------------------------------------- display clock # ---------------------------------------- display clock
disp.clear()
if clock_off >= millis: if clock_off >= millis:
disp.clear()
# .................................... time # .................................... time
lt = time.localtime() lt = time.localtime()
...@@ -297,8 +299,4 @@ with display.open() as disp: ...@@ -297,8 +299,4 @@ with display.open() as disp:
disp.rect( disp.rect(
8, 60, int(pwrpercent * 1.43 + 8), 63, col=c 8, 60, int(pwrpercent * 1.43 + 8), 63, col=c
) # draw charge bar in battery bar ) # draw charge bar in battery bar
disp.update()
# ---------------------------------------- do not display clock
leds.update()
disp.update()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment