-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTODO.txt
118 lines (92 loc) · 3.83 KB
/
TODO.txt
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
=============================================================================
Start/Stop the SPS30 (run for 30 seconds before recording a measurement.)
Start/Stop socket
Start/Stop wifi connection?
unpower D13 led, external i2c power. disable board.NEOPIXEL_POWER
use watchdog to ensure running?
use deep sleep to save power? sleep the SPS30
check on mpl read protocol, to ensure it doesn't block.
TODO what other shutdown tasks?
TODO prepare to sleep
TODO wake up from sleep
TODO periodic fan cleaning
in the header:
board.board_id
CPy version
microcontroller_id
dust version
what's a good way to generate build_timestamp (date, g desc)
=============================================================================
>>> import microcontroller
>>> dir(microcontroller)
['__class__', '__name__', 'Pin', 'Processor', 'ResetReason', 'RunMode', 'cpu', 'delay_us', 'disable_interrupts', 'enable_interrupts', 'nvm', 'on_next_reset', 'pin', 'reset', 'watchdog']
>>> dir(microcontroller.watchdog)
['__class__', 'deinit', 'feed', 'mode', 'timeout']
>>> help(microcontroller.watchdog)
object <WatchDogTimer> is of type WatchDogTimer
feed -- <function>
deinit -- <function>
timeout -- <property>
mode -- <property>
>>> import watchdog
>>> dir(watchdog)
['__class__', '__name__', 'WatchDogMode', 'WatchDogTimeout']
>>> help(watchdog)
object <module 'watchdog'> is of type module
__name__ -- watchdog
WatchDogMode -- <class 'WatchDogMode'>
WatchDogTimeout -- <class 'WatchDogTimeout'>
>>> microcontroller.cpu.uid
bytearray(b'\xc7\xfd\x1aI\xb8g')
>>> microcontroller.cpu.temperature
39.4348
>>> microcontroller.cpu.reset_reason
microcontroller.ResetReason.SOFTWARE
>>> str(microcontroller.cpu.reset_reason)
'microcontroller.ResetReason.SOFTWARE'
=============================================================================
Catch network exceptions. When modem was rebooted...
# TODO handle ECONNECT exception
b'<158>1 2022-07-08T03:31:32Z 192.168.1.65 dust - - - "2022-07-08T03:31:32Z",15.5,68.7,74535,0.464,1.0,1.0,1.0,1.0,7,8,8,8,8'
b'<158>1 2022-07-08T03:36:33Z - dust - - - "2022-07-08T03:36:33Z",15.3,69.3,74547,0.474,0.9,1.0,1.0,1.0,6,7,7,7,7'
Traceback (most recent call last):
File "code.py", line 4, in <module>
File "main.py", line 212, in <module>
File "main.py", line 149, in WriteCsvData
File "main.py", line 134, in WriteToSyslog
OSError: [Errno 113] ECONNABORTED
Code done running.
=============================================================================
code.py output:
connecting to AP e7
Traceback (most recent call last):
File "code.py", line 4, in <module>
File "main.py", line 199, in <module>
File "main.py", line 117, in ConnectToAP
File "/lib/wifi_socket.py", line 27, in ConnectToAP
ConnectionError: No network with that ssid
"wifi.radio.connect('foo', password)"
Code done running.
=============================================================================
Auto-reload is on. Simply save files over USB to run them or enter REPL to disable.
code.py output:
connecting to AP e7
self.ipaddr 192.168.1.65 (ours)
Traceback (most recent call last):
File "code.py", line 4, in <module>
File "main.py", line 201, in <module>
File "main.py", line 121, in SocketToSyslog
File "/lib/wifi_socket.py", line 41, in ConnectToSocket
OSError: [Errno 118] EHOSTUNREACH
"sock.connect(('foo', port))"
Code done running.
=============================================================================
b'<158>1 2022-07-10T22:56:29Z 192.168.1.65 dust - - - "2022-07-10T22:56:28Z",24.9,34.2,74529,0.491,1.1,1.2,1.2,1.2,8,9,9,9,9'
Traceback (most recent call last):
File "code.py", line 4, in <module>
File "main.py", line 219, in <module>
File "main.py", line 126, in SocketToSyslog
OSError: [Errno 118] EHOSTUNREACH
"sock.connect((self.HOST, self.PORT))"
Code done running.
=============================================================================