Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Øyvind Kolås
firmware
Commits
14606dab
Commit
14606dab
authored
Sep 06, 2020
by
schneider
Browse files
chore(g-watch): use time instead of utime
parent
2f671ced
Changes
1
Show whitespace changes
Inline
Side-by-side
preload/apps/g_watch/__init__.py
View file @
14606dab
...
...
@@ -4,7 +4,7 @@ import ledfx
import
leds
import
math
import
bhi160
import
u
time
import
time
import
power
import
light_sensor
...
...
@@ -126,7 +126,7 @@ def render_colon():
def
render7segment
():
year
,
month
,
mday
,
hour
,
min
,
sec
,
wday
,
yday
=
u
time
.
localtime
()
year
,
month
,
mday
,
hour
,
min
,
sec
,
wday
,
yday
=
time
.
localtime
()
render_num
(
hour
,
1
)
render_num
(
min
,
13
)
...
...
@@ -146,7 +146,7 @@ with display.open() as disp:
yn
=
0
# new y value
yd
=
0
# y difference
ydl
=
0
# yd lpf
clock_on
=
u
time
.
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
clock_off
=
clock_on
+
timeout
# time in ms when clock is turned off
fade_time
=
0
# fade out counter
...
...
@@ -156,8 +156,8 @@ with display.open() as disp:
p_leds_on
=
0
while
True
:
millis
=
u
time
.
monotonic_ms
()
lt
=
u
time
.
localtime
()
millis
=
time
.
monotonic_ms
()
lt
=
time
.
localtime
()
dow
=
lt
[
6
]
# ---------------------------------------- read brightness sensor
...
...
@@ -183,7 +183,7 @@ with display.open() as disp:
disp
.
print
(
"LEDS OFF"
,
posx
=
40
,
posy
=
30
,
font
=
2
)
disp
.
update
()
disp
.
backlight
(
brightness
=
50
)
u
time
.
sleep_ms
(
500
)
time
.
sleep_ms
(
500
)
disp
.
backlight
(
brightness
=
0
)
for
led
in
range
(
led_count
):
leds
.
prep_hsv
(
led
,
[
0
,
0
,
0
])
...
...
@@ -195,7 +195,7 @@ with display.open() as disp:
disp
.
print
(
"LEDS ON"
,
posx
=
40
,
posy
=
30
,
font
=
2
)
disp
.
update
()
disp
.
backlight
(
brightness
=
50
)
u
time
.
sleep_ms
(
500
)
time
.
sleep_ms
(
500
)
disp
.
backlight
(
brightness
=
0
)
# ---------------------------------------- read orientation sensor
...
...
@@ -241,7 +241,7 @@ with display.open() as disp:
if
clock_off
>=
millis
:
# .................................... time
lt
=
u
time
.
localtime
()
lt
=
time
.
localtime
()
year
=
lt
[
0
]
month
=
lt
[
1
]
day
=
lt
[
2
]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment