-
Notifications
You must be signed in to change notification settings - Fork 0
/
boot.py
50 lines (36 loc) · 1.18 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
WIFI_NAME = 'Pieceowater'
WIFI_PASS = 'Idontwanttosettheworldonfire'
DEVICE_KEY = 'HelloWorld123'
BACKEND_HOST = 'api.grands-pay.com'
def wifi_connect():
import network
wlan = network.WLAN(network.STA_IF)
wlan.active(True)
# print(wlan.scan())
if not wlan.isconnected():
print('connecting to network...')
wlan.connect(WIFI_NAME, WIFI_PASS)
while not wlan.isconnected():
pass
print('network config:', wlan.ifconfig())
def get_storage_info():
import os
statvfs = os.statvfs('/')
total_storage = statvfs[0] * statvfs[2] / (1024 * 1024)
free_storage = statvfs[0] * statvfs[3] / (1024 * 1024)
return total_storage, free_storage
def get_ram_info():
import gc
ram_size = gc.mem_free() / (1024 * 1024)
return ram_size
def init():
total_storage, free_storage = get_storage_info()
ram_size = get_ram_info()
print(">>>>>>>>>>>>>>>>>>>>>>")
print("RAM Size: {:.2f} MB\n".format(ram_size))
print("Total Storage: {:.2f} MB".format(total_storage))
print("Free Storage: {:.2f} MB".format(free_storage))
print(">>>>>>>>>>>>>>>>>>>>>>")
wifi_connect()
print("BOOTED UP!")
init()