-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathboot.py
51 lines (31 loc) · 1.06 KB
/
boot.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
# https://github.com/lepczynski/badge-miropython-wemosD1Mini-OledSSD1306
# Made in 2019 on Earth by Lepi
# boot.py file is executed on every boot (including wake-boot from deepsleep)
# for production:
#import uos
#uos.dupterm(None, 1) # disable REPL on UART(0)
import gc
import time, machine
def do_connect():
import network
sta_if = network.WLAN(network.STA_IF)
if not sta_if.isconnected():
print('connecting to WiFi network...')
sta_if.active(True)
print('loading wifi config file [properties.wifi.txt]...')
# chenge broadcast name to "lepi-badge" or from properties actually
config_wifi_carrets = open('properties.wifi.txt', 'r').readlines()
config_wifi = [ x.rstrip() for x in config_wifi_carrets ]
sta_if.connect(config_wifi[0], config_wifi[1])
while not sta_if.isconnected():
pass
print('WiFi network config:', sta_if.ifconfig())
try:
do_connect()
except:
time.sleep(60)
machine.reset()
import webrepl
print('Loading SHODAN...')
webrepl.start()
gc.collect()