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:
p_leds_on = 0
while True:
time.sleep(0.1)
millis = time.monotonic_ms()
# print("loop", millis)
lt = time.localtime()
dow = lt[6]
......@@ -187,6 +189,7 @@ with display.open() as disp:
disp.backlight(brightness=0)
for led in range(led_count):
leds.prep_hsv(led, [0, 0, 0])
leds.update()
disp.update()
if pressed & buttons.BOTTOM_RIGHT != 0:
......@@ -200,9 +203,7 @@ with display.open() as disp:
# ---------------------------------------- read orientation sensor
samples = sensors[sensor]["sensor"].read()
if len(samples) > 0: # get orientation sensor samples
sample = samples[0]
for sample in samples:
yo = yn # calculate absolute wrist rotation since last check
yn = sample.y + 360
yd = abs(yn - yo)
......@@ -235,10 +236,11 @@ with display.open() as disp:
leds.prep_hsv(10 - led, [hue, 100, ledbri]) # led=0
else:
leds.prep_hsv(10 - led, [0, 0, 0])
leds.update()
# ---------------------------------------- display clock
disp.clear()
if clock_off >= millis:
disp.clear()
# .................................... time
lt = time.localtime()
......@@ -297,8 +299,4 @@ with display.open() as disp:
disp.rect(
8, 60, int(pwrpercent * 1.43 + 8), 63, col=c
) # draw charge bar in battery bar
# ---------------------------------------- do not display clock
leds.update()
disp.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