-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
79 lines (56 loc) · 1.24 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# import ftp
import gc
import wifi
import gfx
import utime
import _thread
N = 200_000
M = 9999
C = 0
T = 0
gfx.fill(gfx.BLUE)
gc.enable()
wifi.kill_all(False)
wifi.access_point('ttgo', 'password')
# ftp.FtpTiny().start()
utime.sleep_ms(1000)
gfx.fill(gfx.BLACK)
def test(n):
sum1 = 0
for i in range(n):
sum1 += i
return sum1
# debug.time_it(test, N)
def counter():
global C
count = 0
while True:
count = count + 1
C = f"{count} "
utime.sleep_ms(50)
def show_mem():
while True:
global M
mem = gc.mem_free()
M = f"{mem} "
utime.sleep_ms(2000)
def text_roll():
global T
while True:
if T >= 256:
T = 0
else:
T = T + 1
utime.sleep_ms(1000)
def screen_update():
while True:
gfx.text(C, 0, 0, gfx.WHITE, gfx.BLACK)
gfx.text(T, 0, 18, gfx.WHITE, gfx.BLACK)
gfx.text(M, 0, 114, gfx.YELLOW, gfx.BLACK)
gfx.backlight(64)
_thread.stack_size(16) # noqa
_thread.start_new_thread(counter, ()) # noqa
_thread.start_new_thread(show_mem, ()) # noqa
_thread.start_new_thread(text_roll, ()) # noqa
_thread.stack_size(64) # noqa
_thread.start_new_thread(screen_update, ()) # noqa