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
PetePriority
firmware
Commits
051036fe
Verified
Commit
051036fe
authored
Aug 23, 2019
by
Rahix
Browse files
chore(preload): Remove windows line-endings
Signed-off-by:
Rahix
<
rahix@rahix.de
>
parent
ca40b2db
Changes
2
Hide whitespace changes
Inline
Side-by-side
preload/apps/lsd_nickname/__init__.py
View file @
051036fe
import
display
import
leds
import
utime
_rand
=
123456789
def
rand
():
global
_rand
_rand
=
(
1103515245
*
_rand
+
12345
)
&
0xFFFFFF
return
_rand
gs
=
160
colors
=
[((
i
>>
2
)
*
gs
,
(
i
>>
1
&
1
)
*
gs
,
(
i
&
1
)
*
gs
)
for
i
in
range
(
1
,
8
)]
nick
=
"sample text"
try
:
with
open
(
"/nickname.txt"
)
as
f
:
nick
=
f
.
read
()
except
:
pass
while
True
:
with
display
.
open
()
as
d
:
for
k
in
range
(
4
):
(
x1
,
y1
)
=
(
rand
()
%
159
,
rand
()
%
79
)
(
x2
,
y2
)
=
(
min
(
x1
+
rand
()
%
40
,
159
),
min
(
y1
+
rand
()
%
40
,
79
))
try
:
d
.
rect
(
x1
,
y1
,
x2
,
y2
,
col
=
colors
[
rand
()
%
len
(
colors
)],
filled
=
True
)
except
:
pass
fg
=
colors
[
rand
()
%
len
(
colors
)]
nx
=
80
-
round
(
len
(
nick
)
/
2
*
14
)
d
.
print
(
nick
,
fg
=
fg
,
bg
=
[
0xFF
-
c
for
c
in
fg
],
posx
=
(
nx
-
8
)
+
rand
()
%
16
,
posy
=
22
+
rand
()
%
16
,
)
d
.
update
()
d
.
close
()
leds
.
set
(
rand
()
%
11
,
colors
[
rand
()
%
len
(
colors
)])
leds
.
set_rocket
(
rand
()
%
3
,
rand
()
%
32
)
utime
.
sleep_us
(
1
)
# Feed watch doge
import
display
import
leds
import
utime
_rand
=
123456789
def
rand
():
global
_rand
_rand
=
(
1103515245
*
_rand
+
12345
)
&
0xFFFFFF
return
_rand
gs
=
160
colors
=
[((
i
>>
2
)
*
gs
,
(
i
>>
1
&
1
)
*
gs
,
(
i
&
1
)
*
gs
)
for
i
in
range
(
1
,
8
)]
nick
=
"sample text"
try
:
with
open
(
"/nickname.txt"
)
as
f
:
nick
=
f
.
read
()
except
:
pass
while
True
:
with
display
.
open
()
as
d
:
for
k
in
range
(
4
):
(
x1
,
y1
)
=
(
rand
()
%
159
,
rand
()
%
79
)
(
x2
,
y2
)
=
(
min
(
x1
+
rand
()
%
40
,
159
),
min
(
y1
+
rand
()
%
40
,
79
))
try
:
d
.
rect
(
x1
,
y1
,
x2
,
y2
,
col
=
colors
[
rand
()
%
len
(
colors
)],
filled
=
True
)
except
:
pass
fg
=
colors
[
rand
()
%
len
(
colors
)]
nx
=
80
-
round
(
len
(
nick
)
/
2
*
14
)
d
.
print
(
nick
,
fg
=
fg
,
bg
=
[
0xFF
-
c
for
c
in
fg
],
posx
=
(
nx
-
8
)
+
rand
()
%
16
,
posy
=
22
+
rand
()
%
16
,
)
d
.
update
()
d
.
close
()
leds
.
set
(
rand
()
%
11
,
colors
[
rand
()
%
len
(
colors
)])
leds
.
set_rocket
(
rand
()
%
3
,
rand
()
%
32
)
utime
.
sleep_us
(
1
)
# Feed watch doge
preload/apps/scope/__init__.py
View file @
051036fe
import
os
import
display
import
utime
import
buttons
import
light_sensor
import
math
WIDTH
=
160
HEIGHT
=
80
disp
=
display
.
open
()
light_sensor
.
start
()
history
=
[]
while
True
:
disp
.
clear
()
value
=
light_sensor
.
get_reading
()
history
.
insert
(
0
,
value
)
if
len
(
history
)
>
WIDTH
:
history
.
pop
()
disp
.
print
(
"%i"
%
value
)
for
i
in
range
(
0
,
len
(
history
)):
# Rescale to range 0 <= value < HEIGHT-1
y
=
math
.
floor
(
history
[
i
]
*
(
HEIGHT
-
2
)
/
max
(
history
))
disp
.
pixel
(
WIDTH
-
i
,
HEIGHT
-
y
-
1
)
disp
.
update
()
utime
.
sleep
(
0.1
)
import
os
import
display
import
utime
import
buttons
import
light_sensor
import
math
WIDTH
=
160
HEIGHT
=
80
disp
=
display
.
open
()
light_sensor
.
start
()
history
=
[]
while
True
:
disp
.
clear
()
value
=
light_sensor
.
get_reading
()
history
.
insert
(
0
,
value
)
if
len
(
history
)
>
WIDTH
:
history
.
pop
()
disp
.
print
(
"%i"
%
value
)
for
i
in
range
(
0
,
len
(
history
)):
# Rescale to range 0 <= value < HEIGHT-1
y
=
math
.
floor
(
history
[
i
]
*
(
HEIGHT
-
2
)
/
max
(
history
))
disp
.
pixel
(
WIDTH
-
i
,
HEIGHT
-
y
-
1
)
disp
.
update
()
utime
.
sleep
(
0.1
)
Write
Preview
Supports
Markdown
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