forked from doniks/pycom-examples
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathfeatures.py
71 lines (67 loc) · 2.06 KB
/
features.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
import time
from machine import RTC
import machine
import binascii
import pycom
def features(on=None):
if on is None:
print("heartbeat ", pycom.heartbeat_on_boot())
print("lte ", pycom.lte_modem_en_on_boot())
try:
print("pybytes ", pycom.pybytes_on_boot())
except:
pass
try:
print("smart_config", pycom.smart_config_on_boot())
except:
pass
print("wdt ", pycom.wdt_on_boot())
print("wifi ", pycom.wifi_on_boot())
else:
print("configure all features as", on)
pycom.heartbeat_on_boot(on)
pycom.lte_modem_en_on_boot(on)
try:
pycom.pybytes_on_boot(on)
except:
pass
try:
pycom.smart_config_on_boot(on)
except:
pass
pycom.wdt_on_boot(on)
pycom.wifi_on_boot(on)
features(None)
if __name__ == '__main__':
import binascii
import machine
uid = binascii.hexlify(machine.unique_id()).decode("utf-8")
name = os.uname().sysname.lower() + '-' + uid[-4:]
print(name, uid)
features()
if False:
features(True) # turn everything on
features(False) # turn everything off
# print
import pycom
print('heartbeat', pycom.heartbeat_on_boot())
print('lte', pycom.lte_modem_en_on_boot())
print('pybytes', pycom.pybytes_on_boot())
print('smart_config', pycom.smart_config_on_boot())
print('wdt', pycom.wdt_on_boot())
print('wifi', pycom.wifi_on_boot())
# off
pycom.heartbeat_on_boot(False)
import pycom
pycom.lte_modem_en_on_boot(False)
pycom.wdt_on_boot(False)
pycom.wifi_on_boot(False)
pycom.smart_config_on_boot(False)
pycom.pybytes_on_boot(False)
# on
pycom.heartbeat_on_boot(True)
pycom.lte_modem_en_on_boot(True)
pycom.pybytes_on_boot(True)
pycom.smart_config_on_boot(True)
pycom.wdt_on_boot(True)
pycom.wifi_on_boot(True)