micrOSDevToolKit 2.9.1__py3-none-any.whl → 2.9.6__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of micrOSDevToolKit might be problematic. Click here for more details.
- micrOS/release_info/micrOS_ReleaseInfo/system_analysis_sum.json +19 -19
- micrOS/source/Common.py +1 -1
- micrOS/source/Config.py +6 -6
- micrOS/source/LM_pacman.py +248 -0
- micrOS/source/LM_rest.py +0 -1
- micrOS/source/LM_robustness.py +2 -2
- micrOS/source/LM_system.py +4 -16
- micrOS/source/LM_telegram.py +95 -61
- micrOS/source/Logger.py +51 -17
- micrOS/source/Notify.py +4 -3
- micrOS/source/Server.py +33 -39
- micrOS/source/Shell.py +72 -74
- micrOS/source/Web.py +22 -23
- micrOS/source/microIO.py +1 -2
- micrOS/source/reset.py +5 -1
- micrOS/source/urequests.py +12 -4
- {micrOSDevToolKit-2.9.1.data → micrOSDevToolKit-2.9.6.data}/scripts/devToolKit.py +3 -2
- {micrOSDevToolKit-2.9.1.dist-info → micrOSDevToolKit-2.9.6.dist-info}/METADATA +1 -1
- {micrOSDevToolKit-2.9.1.dist-info → micrOSDevToolKit-2.9.6.dist-info}/RECORD +57 -54
- toolkit/Gateway.py +2 -2
- toolkit/dashboard_apps/SystemTest.py +14 -12
- toolkit/index.html +4 -4
- toolkit/lib/TerminalColors.py +4 -0
- toolkit/lib/macroScript.py +6 -0
- toolkit/lib/micrOSClient.py +48 -21
- toolkit/lib/micrOSClientHistory.py +122 -0
- toolkit/micrOSlint.py +1 -1
- toolkit/simulator_lib/__pycache__/machine.cpython-312.pyc +0 -0
- toolkit/simulator_lib/__pycache__/uasyncio.cpython-312.pyc +0 -0
- toolkit/simulator_lib/__pycache__/uos.cpython-312.pyc +0 -0
- toolkit/simulator_lib/__pycache__/ussl.cpython-312.pyc +0 -0
- toolkit/simulator_lib/machine.py +4 -0
- toolkit/simulator_lib/node_config.json +1 -1
- toolkit/simulator_lib/uasyncio.py +7 -1
- toolkit/simulator_lib/uos.py +138 -0
- toolkit/socketClient.py +4 -4
- toolkit/workspace/precompiled/Common.mpy +0 -0
- toolkit/workspace/precompiled/Config.mpy +0 -0
- toolkit/workspace/precompiled/Espnow.mpy +0 -0
- toolkit/workspace/precompiled/LM_pacman.py +248 -0
- toolkit/workspace/precompiled/LM_rest.mpy +0 -0
- toolkit/workspace/precompiled/LM_robustness.py +2 -2
- toolkit/workspace/precompiled/LM_system.mpy +0 -0
- toolkit/workspace/precompiled/LM_telegram.mpy +0 -0
- toolkit/workspace/precompiled/Logger.mpy +0 -0
- toolkit/workspace/precompiled/Notify.mpy +0 -0
- toolkit/workspace/precompiled/Server.mpy +0 -0
- toolkit/workspace/precompiled/Shell.mpy +0 -0
- toolkit/workspace/precompiled/Web.mpy +0 -0
- toolkit/workspace/precompiled/_mpy.version +1 -1
- toolkit/workspace/precompiled/microIO.mpy +0 -0
- toolkit/workspace/precompiled/node_config.json +1 -1
- toolkit/workspace/precompiled/reset.mpy +0 -0
- toolkit/workspace/precompiled/urequests.mpy +0 -0
- micrOS/source/LM_lmpacman.py +0 -126
- toolkit/workspace/precompiled/LM_lmpacman.mpy +0 -0
- {micrOSDevToolKit-2.9.1.dist-info → micrOSDevToolKit-2.9.6.dist-info}/LICENSE +0 -0
- {micrOSDevToolKit-2.9.1.dist-info → micrOSDevToolKit-2.9.6.dist-info}/WHEEL +0 -0
- {micrOSDevToolKit-2.9.1.dist-info → micrOSDevToolKit-2.9.6.dist-info}/top_level.txt +0 -0
|
@@ -13,11 +13,11 @@
|
|
|
13
13
|
1
|
|
14
14
|
],
|
|
15
15
|
"Server.py": [
|
|
16
|
-
9.
|
|
16
|
+
9.51,
|
|
17
17
|
3
|
|
18
18
|
],
|
|
19
19
|
"Web.py": [
|
|
20
|
-
9.
|
|
20
|
+
9.26,
|
|
21
21
|
1
|
|
22
22
|
],
|
|
23
23
|
"Tasks.py": [
|
|
@@ -25,11 +25,11 @@
|
|
|
25
25
|
12
|
|
26
26
|
],
|
|
27
27
|
"Config.py": [
|
|
28
|
-
9.
|
|
28
|
+
9.48,
|
|
29
29
|
17
|
|
30
30
|
],
|
|
31
31
|
"reset.py": [
|
|
32
|
-
|
|
32
|
+
10.0,
|
|
33
33
|
0
|
|
34
34
|
],
|
|
35
35
|
"Shell.py": [
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
29
|
|
46
46
|
],
|
|
47
47
|
"Logger.py": [
|
|
48
|
-
8.
|
|
48
|
+
8.85,
|
|
49
49
|
4
|
|
50
50
|
],
|
|
51
51
|
"Common.py": [
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
1
|
|
74
74
|
],
|
|
75
75
|
"microIO.py": [
|
|
76
|
-
9.
|
|
76
|
+
9.38,
|
|
77
77
|
42
|
|
78
78
|
],
|
|
79
79
|
"micrOS.py": [
|
|
@@ -89,7 +89,7 @@
|
|
|
89
89
|
0
|
|
90
90
|
],
|
|
91
91
|
"urequests.py": [
|
|
92
|
-
|
|
92
|
+
9.02,
|
|
93
93
|
5
|
|
94
94
|
],
|
|
95
95
|
"LM_roboarm.py": [
|
|
@@ -100,6 +100,10 @@
|
|
|
100
100
|
8.9,
|
|
101
101
|
1
|
|
102
102
|
],
|
|
103
|
+
"LM_pacman.py": [
|
|
104
|
+
8.94,
|
|
105
|
+
0
|
|
106
|
+
],
|
|
103
107
|
"LM_genIO.py": [
|
|
104
108
|
9.19,
|
|
105
109
|
0
|
|
@@ -109,7 +113,7 @@
|
|
|
109
113
|
0
|
|
110
114
|
],
|
|
111
115
|
"LM_system.py": [
|
|
112
|
-
8.
|
|
116
|
+
8.26,
|
|
113
117
|
5
|
|
114
118
|
],
|
|
115
119
|
"LM_robustness.py": [
|
|
@@ -121,7 +125,7 @@
|
|
|
121
125
|
0
|
|
122
126
|
],
|
|
123
127
|
"LM_rest.py": [
|
|
124
|
-
7.
|
|
128
|
+
7.95,
|
|
125
129
|
0
|
|
126
130
|
],
|
|
127
131
|
"LM_oled.py": [
|
|
@@ -237,7 +241,7 @@
|
|
|
237
241
|
0
|
|
238
242
|
],
|
|
239
243
|
"LM_telegram.py": [
|
|
240
|
-
9.
|
|
244
|
+
9.57,
|
|
241
245
|
0
|
|
242
246
|
],
|
|
243
247
|
"LM_OV2640.py": [
|
|
@@ -284,10 +288,6 @@
|
|
|
284
288
|
8.57,
|
|
285
289
|
0
|
|
286
290
|
],
|
|
287
|
-
"LM_lmpacman.py": [
|
|
288
|
-
8.38,
|
|
289
|
-
0
|
|
290
|
-
],
|
|
291
291
|
"LM_gameOfLife.py": [
|
|
292
292
|
9.29,
|
|
293
293
|
3
|
|
@@ -315,11 +315,11 @@
|
|
|
315
315
|
},
|
|
316
316
|
"summary": {
|
|
317
317
|
"core": [
|
|
318
|
-
|
|
318
|
+
3305,
|
|
319
319
|
23
|
|
320
320
|
],
|
|
321
321
|
"load": [
|
|
322
|
-
|
|
322
|
+
9060,
|
|
323
323
|
55
|
|
324
324
|
],
|
|
325
325
|
"core_dep": [
|
|
@@ -330,8 +330,8 @@
|
|
|
330
330
|
true,
|
|
331
331
|
6
|
|
332
332
|
],
|
|
333
|
-
"core_score": 9.
|
|
334
|
-
"load_score": 8.
|
|
335
|
-
"version": "2.9.
|
|
333
|
+
"core_score": 9.13,
|
|
334
|
+
"load_score": 8.23,
|
|
335
|
+
"version": "2.9.6-0"
|
|
336
336
|
}
|
|
337
337
|
}
|
micrOS/source/Common.py
CHANGED
micrOS/source/Config.py
CHANGED
|
@@ -12,9 +12,9 @@ Designed by Marcell Ban aka BxNxM
|
|
|
12
12
|
#################################################################
|
|
13
13
|
# IMPORTS #
|
|
14
14
|
#################################################################
|
|
15
|
-
from os import remove
|
|
16
15
|
from re import search
|
|
17
16
|
from json import load, dump
|
|
17
|
+
from uos import remove
|
|
18
18
|
from utime import sleep
|
|
19
19
|
from Debug import DebugCfg, console_write, errlog_add
|
|
20
20
|
try:
|
|
@@ -25,7 +25,11 @@ except:
|
|
|
25
25
|
|
|
26
26
|
|
|
27
27
|
class Data:
|
|
28
|
-
|
|
28
|
+
"""
|
|
29
|
+
Data class for managing configuration data.
|
|
30
|
+
"""
|
|
31
|
+
__slots__ = []
|
|
32
|
+
|
|
29
33
|
CONFIG_PATH = "node_config.json"
|
|
30
34
|
CONFIG_CACHE = {"version": "n/a",
|
|
31
35
|
"auth": False,
|
|
@@ -145,20 +149,16 @@ class Data:
|
|
|
145
149
|
value_in_cfg = Data.CONFIG_CACHE[key]
|
|
146
150
|
try:
|
|
147
151
|
if isinstance(value_in_cfg, bool):
|
|
148
|
-
del value_in_cfg
|
|
149
152
|
if str(value).lower() == 'true':
|
|
150
153
|
return True
|
|
151
154
|
if str(value).lower() == 'false':
|
|
152
155
|
return False
|
|
153
156
|
raise Exception("type_handler type handling error")
|
|
154
157
|
if isinstance(value_in_cfg, str):
|
|
155
|
-
del value_in_cfg
|
|
156
158
|
return str(value)
|
|
157
159
|
if isinstance(value_in_cfg, int):
|
|
158
|
-
del value_in_cfg
|
|
159
160
|
return int(value)
|
|
160
161
|
if isinstance(value_in_cfg, float):
|
|
161
|
-
del value_in_cfg
|
|
162
162
|
return float(value)
|
|
163
163
|
except Exception as e:
|
|
164
164
|
console_write(f"Input value type error! {e}")
|
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
from uos import listdir, remove, stat
|
|
2
|
+
from sys import modules
|
|
3
|
+
from Common import socket_stream
|
|
4
|
+
|
|
5
|
+
WEB_EXT = ('html', 'js', 'css')
|
|
6
|
+
DATA_TYPES = ('log', 'pds', 'dat')
|
|
7
|
+
|
|
8
|
+
def _is_app_resource(path='/'):
|
|
9
|
+
if stat(path)[0] & 0x4000: # Dir check
|
|
10
|
+
return True, 'd'
|
|
11
|
+
file_name = path.split("/")[-1]
|
|
12
|
+
if file_name.startswith('LM_') or file_name.split('.')[-1] in WEB_EXT + DATA_TYPES:
|
|
13
|
+
return True, 'f'
|
|
14
|
+
return False, '?'
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
#############################################
|
|
18
|
+
# Safe file system handler functions #
|
|
19
|
+
#############################################
|
|
20
|
+
|
|
21
|
+
def ls(path="/", content='*', raw=False):
|
|
22
|
+
"""
|
|
23
|
+
Linux like ls command - list app resources and app folders
|
|
24
|
+
:param path: path to list, default: /
|
|
25
|
+
:param content: content type, default all, f-file, d-dir can be selected
|
|
26
|
+
:param raw: keep raw output [(is_app, type), ...]
|
|
27
|
+
"""
|
|
28
|
+
path = path if path.endswith('/') else f"{path}/"
|
|
29
|
+
items = []
|
|
30
|
+
for item in listdir(path):
|
|
31
|
+
is_app, item_type = _is_app_resource(path + item)
|
|
32
|
+
if is_app and (content == "*" or item_type == content):
|
|
33
|
+
items.append((item_type, item))
|
|
34
|
+
if raw:
|
|
35
|
+
return items
|
|
36
|
+
formatted_output = ""
|
|
37
|
+
i = 0
|
|
38
|
+
for f in items:
|
|
39
|
+
i += 1
|
|
40
|
+
spacer = " " * (4 - len(str(i)))
|
|
41
|
+
formatted_output += f"{i}{spacer}{f[0]} {f[1]}\n"
|
|
42
|
+
return formatted_output
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def rm(path):
|
|
46
|
+
"""
|
|
47
|
+
Linux like rm command - delete app resources and folders
|
|
48
|
+
:param path: app resource name/path, ex.: LM_robustness.py
|
|
49
|
+
"""
|
|
50
|
+
if 'pacman.' in path or 'system.' in path or "/" == path.strip():
|
|
51
|
+
return f'Load module {path} is protected, skip delete.'
|
|
52
|
+
is_app, item_type = _is_app_resource(path)
|
|
53
|
+
if is_app:
|
|
54
|
+
remove(path)
|
|
55
|
+
return f"Remove: {path} {'dir' if item_type == 'd' else 'file'}"
|
|
56
|
+
return f"Invalid path {path}"
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
def dirtree(path="/", raw=False):
|
|
60
|
+
"""Return only directories from a given path."""
|
|
61
|
+
path = path if path.endswith('/') else f"{path}/"
|
|
62
|
+
folders = [f"{path}/{item}" for item in listdir(path) if _is_app_resource(f"{path}{item}")[1] == 'd']
|
|
63
|
+
folder_contents = {folder:listdir(folder) for folder in folders}
|
|
64
|
+
if raw:
|
|
65
|
+
return folder_contents
|
|
66
|
+
formatted_output = ""
|
|
67
|
+
for k, v in folder_contents.items():
|
|
68
|
+
formatted_output += f"{k}\n"
|
|
69
|
+
for val in v:
|
|
70
|
+
formatted_output += f"\t{val}\n"
|
|
71
|
+
return formatted_output
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
def download(url=None, package=None):
|
|
75
|
+
"""
|
|
76
|
+
[BETA] Load Module downloader with mip
|
|
77
|
+
:param url: github url path, ex. BxNxM/micrOS/master/toolkit/workspace/precompiled/LM_robustness.py
|
|
78
|
+
:param package: mip package name or raw url (hack)
|
|
79
|
+
"""
|
|
80
|
+
if url is None and package is None:
|
|
81
|
+
return "Nothing to download, url=None package=None"
|
|
82
|
+
if package is None:
|
|
83
|
+
base_url = "https://raw.githubusercontent.com/"
|
|
84
|
+
file_name = url.split("/")[-1]
|
|
85
|
+
if not(file_name.endswith("py") and file_name.startswith("LM_")):
|
|
86
|
+
return "Invalid file name in url ending, hint: /LM_*.mpy or /LM_*.py"
|
|
87
|
+
# Convert GitHub URL to raw content URL
|
|
88
|
+
if "github.com" in url and "blob" in url:
|
|
89
|
+
url = url.replace("https://github.com/", base_url).replace("/blob", "")
|
|
90
|
+
else:
|
|
91
|
+
url = f"{base_url}{url}"
|
|
92
|
+
else:
|
|
93
|
+
url = package
|
|
94
|
+
from mip import install
|
|
95
|
+
verdict = ""
|
|
96
|
+
try:
|
|
97
|
+
verdict += f"Install {url}\n"
|
|
98
|
+
install(url)
|
|
99
|
+
verdict += "\n|- Done"
|
|
100
|
+
except Exception as e:
|
|
101
|
+
verdict += f"|- Cannot install: {url}\n{e}"
|
|
102
|
+
return verdict
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
def del_duplicates():
|
|
106
|
+
"""
|
|
107
|
+
Load module package manager (Not just load modules)
|
|
108
|
+
- delete duplicated .mpy and .py resources, keep .mpy resource!
|
|
109
|
+
"""
|
|
110
|
+
msg_buf = []
|
|
111
|
+
py = list((res.split('.')[0] for res in listdir() if res.endswith('.py'))) # Normally smaller list
|
|
112
|
+
mpy = (res.split('.')[0] for res in listdir() if res.endswith('.mpy'))
|
|
113
|
+
for m in mpy:
|
|
114
|
+
# Iterate over mpy resources
|
|
115
|
+
state = True
|
|
116
|
+
if m in py and m != 'main':
|
|
117
|
+
to_delete = f'{m}.py'
|
|
118
|
+
try:
|
|
119
|
+
remove(to_delete)
|
|
120
|
+
except:
|
|
121
|
+
state = False
|
|
122
|
+
msg_buf.append(f' Delete {to_delete} {state}')
|
|
123
|
+
return '\n'.join(msg_buf) if len(msg_buf) > 0 else 'Nothing to delete.'
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
def moduls(unload=None):
|
|
127
|
+
"""
|
|
128
|
+
List / unload loaded upython Load Modules
|
|
129
|
+
:param unload: module name to unload
|
|
130
|
+
:param unload: None - list active modules
|
|
131
|
+
:return str: verdict
|
|
132
|
+
"""
|
|
133
|
+
if unload is None:
|
|
134
|
+
return list(modules.keys())
|
|
135
|
+
if unload in modules.keys():
|
|
136
|
+
del modules[unload]
|
|
137
|
+
return f"Module unload {unload} done."
|
|
138
|
+
return f"Module unload {unload} failed."
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
@socket_stream
|
|
142
|
+
def cachedump(delpds=None, msgobj=None):
|
|
143
|
+
"""
|
|
144
|
+
Cache system persistent data storage files (.pds)
|
|
145
|
+
:param delpds: cache name to delete
|
|
146
|
+
"""
|
|
147
|
+
if delpds is None:
|
|
148
|
+
# List pds files aka application cache
|
|
149
|
+
msg_buf = []
|
|
150
|
+
for pds in (_pds for _pds in listdir() if _pds.endswith('.pds')):
|
|
151
|
+
with open(pds, 'r') as f:
|
|
152
|
+
if msgobj is None:
|
|
153
|
+
msg_buf.append(f'{pds}: {f.read()}')
|
|
154
|
+
else:
|
|
155
|
+
msgobj(f'{pds}: {f.read()}')
|
|
156
|
+
return msg_buf if len(msg_buf) > 0 else ''
|
|
157
|
+
# Remove given pds file
|
|
158
|
+
try:
|
|
159
|
+
remove(f'{delpds}.pds')
|
|
160
|
+
return f'{delpds}.pds delete done.'
|
|
161
|
+
except:
|
|
162
|
+
return f'{delpds}.pds not exists'
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
def dat_dump():
|
|
166
|
+
"""
|
|
167
|
+
Generic .dat file dump
|
|
168
|
+
- logged data from LMs, sensor datat, etc...
|
|
169
|
+
"""
|
|
170
|
+
logs_dir = "/logs/"
|
|
171
|
+
dats = (f for f in listdir(logs_dir) if f.endswith('.dat'))
|
|
172
|
+
out = {}
|
|
173
|
+
for dat in dats:
|
|
174
|
+
with open(f"{logs_dir}{dat}", 'r') as f:
|
|
175
|
+
out[dat] = f.read()
|
|
176
|
+
return out
|
|
177
|
+
|
|
178
|
+
#############################################
|
|
179
|
+
# Legacy features #
|
|
180
|
+
#############################################
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
@socket_stream
|
|
184
|
+
def listmods(msgobj=None):
|
|
185
|
+
"""
|
|
186
|
+
Load module package manager
|
|
187
|
+
- list all load modules
|
|
188
|
+
"""
|
|
189
|
+
# Dump available LMs
|
|
190
|
+
msg_buf = []
|
|
191
|
+
for k in (res.replace('LM_', '') for res in listdir("/")
|
|
192
|
+
if res.startswith('LM_') or res.split('.')[-1] in WEB_EXT):
|
|
193
|
+
if msgobj is None:
|
|
194
|
+
msg_buf.append(f' {k}')
|
|
195
|
+
else:
|
|
196
|
+
msgobj(f' {k}')
|
|
197
|
+
return msg_buf if len(msg_buf) > 0 else ''
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
def delmod(mod=None):
|
|
201
|
+
"""
|
|
202
|
+
Module package manager
|
|
203
|
+
:param mod:
|
|
204
|
+
Delete Load Module with full name: module.py or module.mpy
|
|
205
|
+
OR delete any web resource: *.js, *.css, *.html
|
|
206
|
+
"""
|
|
207
|
+
if mod is not None and (mod.endswith('py') or mod.split('.')[-1] in WEB_EXT):
|
|
208
|
+
# LM exception list - system and pacman cannot be deleted
|
|
209
|
+
if 'pacman.' in mod or 'system.' in mod:
|
|
210
|
+
return f'Load module {mod} is in use, skip delete.'
|
|
211
|
+
try:
|
|
212
|
+
to_remove = mod if mod.split('.')[-1] in WEB_EXT else f'LM_{mod}'
|
|
213
|
+
remove(to_remove)
|
|
214
|
+
return f'Delete module: {mod}'
|
|
215
|
+
except Exception as e:
|
|
216
|
+
return f'Cannot delete: {mod}: {e}'
|
|
217
|
+
return f'Invalid value: {mod}'
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
@socket_stream
|
|
221
|
+
def micros_checksum(msgobj=None):
|
|
222
|
+
from hashlib import sha1
|
|
223
|
+
from binascii import hexlify
|
|
224
|
+
from Config import cfgget
|
|
225
|
+
|
|
226
|
+
for f_name in (_pds for _pds in listdir() if _pds.endswith('py')):
|
|
227
|
+
with open(f_name, 'rb') as f:
|
|
228
|
+
cs = hexlify(sha1(f.read()).digest()).decode('utf-8')
|
|
229
|
+
msgobj(f"{cs} {f_name}")
|
|
230
|
+
# GC collect?
|
|
231
|
+
return f"micrOS version: {cfgget('version')}"
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
def help(widgets=False):
|
|
235
|
+
"""
|
|
236
|
+
[i] micrOS LM naming convention - built-in help message
|
|
237
|
+
:return tuple:
|
|
238
|
+
(widgets=False) list of functions implemented by this application
|
|
239
|
+
(widgets=True) list of widget json for UI generation
|
|
240
|
+
"""
|
|
241
|
+
return ('listmods', 'delmod mod=<module>.py/.mpy or .js/.html/.css', 'del_duplicates',
|
|
242
|
+
'moduls unload="LM_rgb/None"',
|
|
243
|
+
'cachedump delpds="rgb/None"',
|
|
244
|
+
'dat_dump',
|
|
245
|
+
'download url="BxNxM/micrOS/master/toolkit/workspace/precompiled/LM_robustness.py"',
|
|
246
|
+
'micros_checksum',
|
|
247
|
+
'ls path="/" content="*/f/d"',
|
|
248
|
+
'rm <path>', 'dirtree path="/"')
|
micrOS/source/LM_rest.py
CHANGED
micrOS/source/LM_robustness.py
CHANGED
|
@@ -9,8 +9,8 @@ def raise_error(msgobj=None):
|
|
|
9
9
|
"""
|
|
10
10
|
if msgobj is not None:
|
|
11
11
|
msgobj("Raise test exception")
|
|
12
|
-
syslog('Robustness TeSt ErRoR')
|
|
13
|
-
raise Exception("Test exception")
|
|
12
|
+
state = syslog('Robustness TeSt ErRoR')
|
|
13
|
+
raise Exception(f"Test exception: {'OK' if state else 'NOK'}")
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
@socket_stream
|
micrOS/source/LM_system.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from
|
|
1
|
+
from uos import statvfs, getcwd, listdir, uname
|
|
2
2
|
from utime import localtime
|
|
3
3
|
from network import WLAN, STA_IF, AP_IF
|
|
4
4
|
from binascii import hexlify
|
|
@@ -190,6 +190,7 @@ def pinmap(keys='builtin irq1 irq2 irq3 irq4'):
|
|
|
190
190
|
map["search"] = pinmap_search(keys)
|
|
191
191
|
return map
|
|
192
192
|
|
|
193
|
+
|
|
193
194
|
@socket_stream
|
|
194
195
|
def alarms(clean=False, msgobj=None):
|
|
195
196
|
"""
|
|
@@ -204,19 +205,6 @@ def alarms(clean=False, msgobj=None):
|
|
|
204
205
|
return {'NOK alarm': errcnt} if errcnt > 0 else {'OK alarm': errcnt}
|
|
205
206
|
|
|
206
207
|
|
|
207
|
-
def dat_dump():
|
|
208
|
-
"""
|
|
209
|
-
Generic .dat file dump
|
|
210
|
-
- logged data from LMs
|
|
211
|
-
"""
|
|
212
|
-
dats = (f for f in listdir() if f.endswith('.dat'))
|
|
213
|
-
out = {}
|
|
214
|
-
for dat in dats:
|
|
215
|
-
with open(dat, 'r') as f:
|
|
216
|
-
out[dat] = f.read()
|
|
217
|
-
return out
|
|
218
|
-
|
|
219
|
-
|
|
220
208
|
def ifconfig():
|
|
221
209
|
"""
|
|
222
210
|
Show network ifconfig
|
|
@@ -224,7 +212,7 @@ def ifconfig():
|
|
|
224
212
|
return network_config()
|
|
225
213
|
|
|
226
214
|
|
|
227
|
-
def
|
|
215
|
+
def urequest_hosts():
|
|
228
216
|
"""
|
|
229
217
|
Debug function for urequests address caching
|
|
230
218
|
- returns all known http(s) host addresses
|
|
@@ -258,4 +246,4 @@ def help(widgets=False):
|
|
|
258
246
|
'ntp', 'rssi', 'list_stations', 'pinmap key="dhtpin"/None', 'alarms clean=False',
|
|
259
247
|
'notifications enable=<None,True,False>',
|
|
260
248
|
'sun refresh=False', 'ifconfig', 'memory_usage',
|
|
261
|
-
'disk_usage', '
|
|
249
|
+
'disk_usage', 'urequest_hosts'), widgets=widgets)
|