forked from geekscape/aiko_engine_mp
-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.py
43 lines (33 loc) · 1.03 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
# main.py: version: 2018-04-30 00:00
#
# To Do
# ~~~~~
# - None, yet !
import aiko.event as event
import configuration.main
configuration.globals = globals() # used by aiko.mqtt.on_exec_message()
parameter = configuration.main.parameter
try:
file = open("repl")
file.close()
raise Exception("Exit to repl")
except OSError:
pass
import gc
def gc_event():
gc.collect()
print(" ###### GC:", gc.mem_free(), gc.mem_alloc())
if parameter("gc_enabled"): # GC: 86368 9632
event.add_timer_handler(gc_event, 60000)
import aiko.led as led # GC: 79696 16304
led.initialise()
if parameter("oled_enabled"): # GC: 73088 22912
import aiko.oled as oled
oled.initialise()
import aiko.net as net # GC: 54304 41696
net.initialise()
if parameter("application"):
application_name = parameter("application")
application = __import__(application_name)
application.initialise()
event.loop()