Commit 14606dab authored by schneider's avatar schneider
Browse files

chore(g-watch): use time instead of utime

parent 2f671ced
...@@ -4,7 +4,7 @@ import ledfx ...@@ -4,7 +4,7 @@ import ledfx
import leds import leds
import math import math
import bhi160 import bhi160
import utime import time
import power import power
import light_sensor import light_sensor
...@@ -126,7 +126,7 @@ def render_colon(): ...@@ -126,7 +126,7 @@ def render_colon():
def render7segment(): def render7segment():
year, month, mday, hour, min, sec, wday, yday = utime.localtime() year, month, mday, hour, min, sec, wday, yday = time.localtime()
render_num(hour, 1) render_num(hour, 1)
render_num(min, 13) render_num(min, 13)
...@@ -146,7 +146,7 @@ with display.open() as disp: ...@@ -146,7 +146,7 @@ with display.open() as disp:
yn = 0 # new y value yn = 0 # new y value
yd = 0 # y difference yd = 0 # y difference
ydl = 0 # yd lpf ydl = 0 # yd lpf
clock_on = utime.monotonic_ms() # time in ms when clock is turned on clock_on = time.monotonic_ms() # time in ms when clock is turned on
timeout = 7000 # time in ms how long clock will be displayed timeout = 7000 # time in ms how long clock will be displayed
clock_off = clock_on + timeout # time in ms when clock is turned off clock_off = clock_on + timeout # time in ms when clock is turned off
fade_time = 0 # fade out counter fade_time = 0 # fade out counter
...@@ -156,8 +156,8 @@ with display.open() as disp: ...@@ -156,8 +156,8 @@ with display.open() as disp:
p_leds_on = 0 p_leds_on = 0
while True: while True:
millis = utime.monotonic_ms() millis = time.monotonic_ms()
lt = utime.localtime() lt = time.localtime()
dow = lt[6] dow = lt[6]
# ---------------------------------------- read brightness sensor # ---------------------------------------- read brightness sensor
...@@ -183,7 +183,7 @@ with display.open() as disp: ...@@ -183,7 +183,7 @@ with display.open() as disp:
disp.print("LEDS OFF", posx=40, posy=30, font=2) disp.print("LEDS OFF", posx=40, posy=30, font=2)
disp.update() disp.update()
disp.backlight(brightness=50) disp.backlight(brightness=50)
utime.sleep_ms(500) time.sleep_ms(500)
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])
...@@ -195,7 +195,7 @@ with display.open() as disp: ...@@ -195,7 +195,7 @@ with display.open() as disp:
disp.print("LEDS ON", posx=40, posy=30, font=2) disp.print("LEDS ON", posx=40, posy=30, font=2)
disp.update() disp.update()
disp.backlight(brightness=50) disp.backlight(brightness=50)
utime.sleep_ms(500) time.sleep_ms(500)
disp.backlight(brightness=0) disp.backlight(brightness=0)
# ---------------------------------------- read orientation sensor # ---------------------------------------- read orientation sensor
...@@ -241,7 +241,7 @@ with display.open() as disp: ...@@ -241,7 +241,7 @@ with display.open() as disp:
if clock_off >= millis: if clock_off >= millis:
# .................................... time # .................................... time
lt = utime.localtime() lt = time.localtime()
year = lt[0] year = lt[0]
month = lt[1] month = lt[1]
day = lt[2] day = lt[2]
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment