micrOSDevToolKit 2.13.1__py3-none-any.whl → 2.17.0__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 +125 -121
- micrOS/source/Common.py +48 -26
- micrOS/source/Config.py +13 -5
- micrOS/source/Espnow.py +100 -58
- micrOS/source/Files.py +77 -41
- micrOS/source/Hooks.py +18 -34
- micrOS/source/Logger.py +2 -7
- micrOS/source/Network.py +36 -16
- micrOS/source/Server.py +22 -8
- micrOS/source/Shell.py +9 -6
- micrOS/source/Tasks.py +34 -13
- micrOS/source/Web.py +69 -31
- micrOS/source/__pycache__/Common.cpython-312.pyc +0 -0
- micrOS/source/__pycache__/Files.cpython-312.pyc +0 -0
- micrOS/source/__pycache__/Logger.cpython-312.pyc +0 -0
- micrOS/source/__pycache__/Server.cpython-312.pyc +0 -0
- micrOS/source/config/_git.keep +0 -0
- micrOS/source/micrOS.py +7 -0
- micrOS/source/micrOSloader.py +2 -10
- micrOS/source/microIO.py +2 -2
- micrOS/source/modules/IO_esp32c6.py +38 -0
- micrOS/source/modules/LM_L298N.py +161 -0
- micrOS/source/modules/LM_cluster.py +250 -0
- {toolkit/workspace/precompiled → micrOS/source/modules}/LM_esp32.py +5 -0
- micrOS/source/modules/LM_espnow.py +36 -0
- micrOS/source/{LM_i2c.py → modules/LM_i2c.py} +1 -1
- micrOS/source/{LM_light_sensor.py → modules/LM_light_sensor.py} +2 -2
- micrOS/source/modules/LM_mqtt_client.py +246 -0
- micrOS/source/{LM_neoeffects.py → modules/LM_neoeffects.py} +14 -4
- micrOS/source/{LM_neomatrix.py → modules/LM_neomatrix.py} +140 -38
- micrOS/source/{LM_oled_ui.py → modules/LM_oled_ui.py} +2 -2
- micrOS/source/{LM_oledui.py → modules/LM_oledui.py} +2 -2
- micrOS/source/{LM_pacman.py → modules/LM_pacman.py} +74 -29
- micrOS/source/{LM_presence.py → modules/LM_presence.py} +2 -2
- micrOS/source/{LM_robustness.py → modules/LM_robustness.py} +49 -2
- micrOS/source/{LM_tcs3472.py → modules/LM_tcs3472.py} +4 -6
- micrOS/source/web/dashboard.html +2 -0
- micrOS/source/web/matrix_draw.html +390 -0
- micrOS/source/web/uapi.js +9 -6
- {microsdevtoolkit-2.13.1.dist-info → microsdevtoolkit-2.17.0.dist-info}/METADATA +30 -37
- {microsdevtoolkit-2.13.1.dist-info → microsdevtoolkit-2.17.0.dist-info}/RECORD +200 -190
- toolkit/DevEnvCompile.py +21 -12
- toolkit/DevEnvOTA.py +27 -16
- toolkit/DevEnvUSB.py +35 -21
- toolkit/LM_to_compile.dat +3 -1
- toolkit/MicrOSDevEnv.py +37 -21
- toolkit/dashboard_apps/QMI8685_GYRO.py +1 -1
- toolkit/dashboard_apps/SystemTest.py +8 -5
- toolkit/{MicrosFiles.py → lib/MicrosFiles.py} +24 -4
- toolkit/micrOSdashboard.py +2 -2
- toolkit/micrOSlint.py +17 -7
- toolkit/simulator_lib/__pycache__/simulator.cpython-312.pyc +0 -0
- toolkit/simulator_lib/__pycache__/uos.cpython-312.pyc +0 -0
- toolkit/simulator_lib/mqtt_as/Note.md +15 -0
- toolkit/simulator_lib/mqtt_as/__init__.py +950 -0
- toolkit/simulator_lib/mqtt_as/__pycache__/__init__.cpython-312.pyc +0 -0
- toolkit/simulator_lib/mqtt_as/clean.py +69 -0
- toolkit/simulator_lib/mqtt_as/mqtt_v5_properties.py +239 -0
- toolkit/simulator_lib/mqtt_as/range.py +90 -0
- toolkit/simulator_lib/mqtt_as/range_ex.py +119 -0
- toolkit/simulator_lib/simulator.py +14 -1
- toolkit/simulator_lib/uos.py +2 -0
- toolkit/workspace/precompiled/Common.mpy +0 -0
- toolkit/workspace/precompiled/Config.mpy +0 -0
- toolkit/workspace/precompiled/Espnow.mpy +0 -0
- toolkit/workspace/precompiled/Files.mpy +0 -0
- toolkit/workspace/precompiled/Hooks.mpy +0 -0
- toolkit/workspace/precompiled/Logger.mpy +0 -0
- toolkit/workspace/precompiled/Network.mpy +0 -0
- toolkit/workspace/precompiled/Server.mpy +0 -0
- toolkit/workspace/precompiled/Shell.mpy +0 -0
- toolkit/workspace/precompiled/Tasks.mpy +0 -0
- toolkit/workspace/precompiled/Web.mpy +0 -0
- toolkit/workspace/precompiled/config/_git.keep +0 -0
- toolkit/workspace/precompiled/micrOS.mpy +0 -0
- toolkit/workspace/precompiled/micrOSloader.mpy +0 -0
- toolkit/workspace/precompiled/microIO.mpy +0 -0
- toolkit/workspace/precompiled/{IO_esp32.mpy → modules/IO_esp32.mpy} +0 -0
- toolkit/workspace/precompiled/{IO_esp32c3.mpy → modules/IO_esp32c3.mpy} +0 -0
- toolkit/workspace/precompiled/modules/IO_esp32c6.mpy +0 -0
- toolkit/workspace/precompiled/{IO_esp32s2.mpy → modules/IO_esp32s2.mpy} +0 -0
- toolkit/workspace/precompiled/{IO_esp32s3.mpy → modules/IO_esp32s3.mpy} +0 -0
- toolkit/workspace/precompiled/{IO_m5stamp.mpy → modules/IO_m5stamp.mpy} +0 -0
- toolkit/workspace/precompiled/{IO_qtpy.mpy → modules/IO_qtpy.mpy} +0 -0
- toolkit/workspace/precompiled/modules/IO_rp2.mpy +0 -0
- toolkit/workspace/precompiled/modules/IO_s3matrix.mpy +0 -0
- toolkit/workspace/precompiled/{IO_tinypico.mpy → modules/IO_tinypico.mpy} +0 -0
- toolkit/workspace/precompiled/modules/LM_L298N.mpy +0 -0
- toolkit/workspace/precompiled/{LM_OV2640.mpy → modules/LM_OV2640.mpy} +0 -0
- toolkit/workspace/precompiled/{LM_aht10.mpy → modules/LM_aht10.mpy} +0 -0
- toolkit/workspace/precompiled/{LM_bme280.mpy → modules/LM_bme280.mpy} +0 -0
- toolkit/workspace/precompiled/{LM_buzzer.mpy → modules/LM_buzzer.mpy} +0 -0
- toolkit/workspace/precompiled/{LM_cct.mpy → modules/LM_cct.mpy} +0 -0
- toolkit/workspace/precompiled/modules/LM_cluster.mpy +0 -0
- toolkit/workspace/precompiled/{LM_co2.mpy → modules/LM_co2.mpy} +0 -0
- toolkit/workspace/precompiled/{LM_dht11.mpy → modules/LM_dht11.mpy} +0 -0
- toolkit/workspace/precompiled/{LM_dht22.mpy → modules/LM_dht22.mpy} +0 -0
- toolkit/workspace/precompiled/{LM_dimmer.mpy → modules/LM_dimmer.mpy} +0 -0
- toolkit/workspace/precompiled/{LM_distance.mpy → modules/LM_distance.mpy} +0 -0
- toolkit/workspace/precompiled/{LM_ds18.mpy → modules/LM_ds18.mpy} +0 -0
- {micrOS/source → toolkit/workspace/precompiled/modules}/LM_esp32.py +5 -0
- toolkit/workspace/precompiled/modules/LM_espnow.py +36 -0
- toolkit/workspace/precompiled/{LM_gameOfLife.mpy → modules/LM_gameOfLife.mpy} +0 -0
- toolkit/workspace/precompiled/{LM_genIO.mpy → modules/LM_genIO.mpy} +0 -0
- toolkit/workspace/precompiled/{LM_haptic.mpy → modules/LM_haptic.mpy} +0 -0
- toolkit/workspace/precompiled/{LM_i2c.py → modules/LM_i2c.py} +1 -1
- toolkit/workspace/precompiled/{LM_i2s_mic.mpy → modules/LM_i2s_mic.mpy} +0 -0
- toolkit/workspace/precompiled/{LM_keychain.mpy → modules/LM_keychain.mpy} +0 -0
- toolkit/workspace/precompiled/{LM_ld2410.mpy → modules/LM_ld2410.mpy} +0 -0
- toolkit/workspace/precompiled/modules/LM_light_sensor.mpy +0 -0
- toolkit/workspace/precompiled/modules/LM_mqtt_client.mpy +0 -0
- toolkit/workspace/precompiled/{LM_neoeffects.mpy → modules/LM_neoeffects.mpy} +0 -0
- toolkit/workspace/precompiled/modules/LM_neomatrix.mpy +0 -0
- toolkit/workspace/precompiled/{LM_neopixel.mpy → modules/LM_neopixel.mpy} +0 -0
- toolkit/workspace/precompiled/{LM_oled.mpy → modules/LM_oled.mpy} +0 -0
- toolkit/workspace/precompiled/{LM_oled_sh1106.mpy → modules/LM_oled_sh1106.mpy} +0 -0
- toolkit/workspace/precompiled/modules/LM_oled_ui.mpy +0 -0
- toolkit/workspace/precompiled/modules/LM_oledui.mpy +0 -0
- toolkit/workspace/precompiled/modules/LM_pacman.mpy +0 -0
- toolkit/workspace/precompiled/modules/LM_presence.mpy +0 -0
- toolkit/workspace/precompiled/{LM_rest.mpy → modules/LM_rest.mpy} +0 -0
- toolkit/workspace/precompiled/{LM_rgb.mpy → modules/LM_rgb.mpy} +0 -0
- toolkit/workspace/precompiled/{LM_rgbcct.mpy → modules/LM_rgbcct.mpy} +0 -0
- toolkit/workspace/precompiled/{LM_roboarm.mpy → modules/LM_roboarm.mpy} +0 -0
- toolkit/workspace/precompiled/{LM_robustness.py → modules/LM_robustness.py} +49 -2
- toolkit/workspace/precompiled/{LM_servo.mpy → modules/LM_servo.mpy} +0 -0
- toolkit/workspace/precompiled/{LM_sound_event.mpy → modules/LM_sound_event.mpy} +0 -0
- toolkit/workspace/precompiled/{LM_stepper.mpy → modules/LM_stepper.mpy} +0 -0
- toolkit/workspace/precompiled/{LM_switch.mpy → modules/LM_switch.mpy} +0 -0
- toolkit/workspace/precompiled/{LM_system.mpy → modules/LM_system.mpy} +0 -0
- toolkit/workspace/precompiled/{LM_tcs3472.py → modules/LM_tcs3472.py} +4 -6
- toolkit/workspace/precompiled/{LM_telegram.mpy → modules/LM_telegram.mpy} +0 -0
- toolkit/workspace/precompiled/{LM_tinyrgb.mpy → modules/LM_tinyrgb.mpy} +0 -0
- toolkit/workspace/precompiled/{LM_trackball.mpy → modules/LM_trackball.mpy} +0 -0
- toolkit/workspace/precompiled/{LM_veml7700.mpy → modules/LM_veml7700.mpy} +0 -0
- toolkit/workspace/precompiled/web/dashboard.html +2 -0
- toolkit/workspace/precompiled/web/matrix_draw.html +390 -0
- toolkit/workspace/precompiled/web/uapi.js +9 -6
- micrOS/source/IO_esp32c6.py +0 -16
- micrOS/source/LM_L298N_DCmotor.py +0 -86
- micrOS/source/LM_espnow.py +0 -57
- micrOS/source/LM_mqtt_pro.py +0 -211
- toolkit/lib/file_extensions.py +0 -22
- toolkit/workspace/precompiled/Common.cpython-312.pyc +0 -0
- toolkit/workspace/precompiled/IO_esp32c6.mpy +0 -0
- toolkit/workspace/precompiled/IO_rp2.mpy +0 -0
- toolkit/workspace/precompiled/IO_s3matrix.mpy +0 -0
- toolkit/workspace/precompiled/LM_L298N_DCmotor.mpy +0 -0
- toolkit/workspace/precompiled/LM_espnow.py +0 -57
- toolkit/workspace/precompiled/LM_light_sensor.mpy +0 -0
- toolkit/workspace/precompiled/LM_mqtt_pro.py +0 -211
- toolkit/workspace/precompiled/LM_neomatrix.mpy +0 -0
- toolkit/workspace/precompiled/LM_oled_ui.mpy +0 -0
- toolkit/workspace/precompiled/LM_oledui.mpy +0 -0
- toolkit/workspace/precompiled/LM_pacman.mpy +0 -0
- toolkit/workspace/precompiled/LM_presence.mpy +0 -0
- toolkit/workspace/precompiled/Logger.cpython-312.pyc +0 -0
- toolkit/workspace/precompiled/Server.cpython-312.pyc +0 -0
- /micrOS/source/{IO_esp32.py → modules/IO_esp32.py} +0 -0
- /micrOS/source/{IO_esp32c3.py → modules/IO_esp32c3.py} +0 -0
- /micrOS/source/{IO_esp32s2.py → modules/IO_esp32s2.py} +0 -0
- /micrOS/source/{IO_esp32s3.py → modules/IO_esp32s3.py} +0 -0
- /micrOS/source/{IO_m5stamp.py → modules/IO_m5stamp.py} +0 -0
- /micrOS/source/{IO_qtpy.py → modules/IO_qtpy.py} +0 -0
- /micrOS/source/{IO_rp2.py → modules/IO_rp2.py} +0 -0
- /micrOS/source/{IO_s3matrix.py → modules/IO_s3matrix.py} +0 -0
- /micrOS/source/{IO_tinypico.py → modules/IO_tinypico.py} +0 -0
- /micrOS/source/{LM_L9110_DCmotor.py → modules/LM_L9110_DCmotor.py} +0 -0
- /micrOS/source/{LM_OV2640.py → modules/LM_OV2640.py} +0 -0
- /micrOS/source/{LM_VL53L0X.py → modules/LM_VL53L0X.py} +0 -0
- /micrOS/source/{LM_aht10.py → modules/LM_aht10.py} +0 -0
- /micrOS/source/{LM_bme280.py → modules/LM_bme280.py} +0 -0
- /micrOS/source/{LM_buzzer.py → modules/LM_buzzer.py} +0 -0
- /micrOS/source/{LM_cct.py → modules/LM_cct.py} +0 -0
- /micrOS/source/{LM_co2.py → modules/LM_co2.py} +0 -0
- /micrOS/source/{LM_dashboard_be.py → modules/LM_dashboard_be.py} +0 -0
- /micrOS/source/{LM_dht11.py → modules/LM_dht11.py} +0 -0
- /micrOS/source/{LM_dht22.py → modules/LM_dht22.py} +0 -0
- /micrOS/source/{LM_dimmer.py → modules/LM_dimmer.py} +0 -0
- /micrOS/source/{LM_distance.py → modules/LM_distance.py} +0 -0
- /micrOS/source/{LM_ds18.py → modules/LM_ds18.py} +0 -0
- /micrOS/source/{LM_gameOfLife.py → modules/LM_gameOfLife.py} +0 -0
- /micrOS/source/{LM_genIO.py → modules/LM_genIO.py} +0 -0
- /micrOS/source/{LM_haptic.py → modules/LM_haptic.py} +0 -0
- /micrOS/source/{LM_i2s_mic.py → modules/LM_i2s_mic.py} +0 -0
- /micrOS/source/{LM_keychain.py → modules/LM_keychain.py} +0 -0
- /micrOS/source/{LM_ld2410.py → modules/LM_ld2410.py} +0 -0
- /micrOS/source/{LM_neopixel.py → modules/LM_neopixel.py} +0 -0
- /micrOS/source/{LM_oled.py → modules/LM_oled.py} +0 -0
- /micrOS/source/{LM_oled_sh1106.py → modules/LM_oled_sh1106.py} +0 -0
- /micrOS/source/{LM_pet_feeder.py → modules/LM_pet_feeder.py} +0 -0
- /micrOS/source/{LM_qmi8658.py → modules/LM_qmi8658.py} +0 -0
- /micrOS/source/{LM_rencoder.py → modules/LM_rencoder.py} +0 -0
- /micrOS/source/{LM_rest.py → modules/LM_rest.py} +0 -0
- /micrOS/source/{LM_rgb.py → modules/LM_rgb.py} +0 -0
- /micrOS/source/{LM_rgbcct.py → modules/LM_rgbcct.py} +0 -0
- /micrOS/source/{LM_roboarm.py → modules/LM_roboarm.py} +0 -0
- /micrOS/source/{LM_rp2w.py → modules/LM_rp2w.py} +0 -0
- /micrOS/source/{LM_sdcard.py → modules/LM_sdcard.py} +0 -0
- /micrOS/source/{LM_servo.py → modules/LM_servo.py} +0 -0
- /micrOS/source/{LM_sound_event.py → modules/LM_sound_event.py} +0 -0
- /micrOS/source/{LM_stepper.py → modules/LM_stepper.py} +0 -0
- /micrOS/source/{LM_switch.py → modules/LM_switch.py} +0 -0
- /micrOS/source/{LM_system.py → modules/LM_system.py} +0 -0
- /micrOS/source/{LM_telegram.py → modules/LM_telegram.py} +0 -0
- /micrOS/source/{LM_tinyrgb.py → modules/LM_tinyrgb.py} +0 -0
- /micrOS/source/{LM_trackball.py → modules/LM_trackball.py} +0 -0
- /micrOS/source/{LM_veml7700.py → modules/LM_veml7700.py} +0 -0
- {microsdevtoolkit-2.13.1.data → microsdevtoolkit-2.17.0.data}/scripts/devToolKit.py +0 -0
- {microsdevtoolkit-2.13.1.dist-info → microsdevtoolkit-2.17.0.dist-info}/WHEEL +0 -0
- {microsdevtoolkit-2.13.1.dist-info → microsdevtoolkit-2.17.0.dist-info}/licenses/LICENSE +0 -0
- {microsdevtoolkit-2.13.1.dist-info → microsdevtoolkit-2.17.0.dist-info}/top_level.txt +0 -0
- /toolkit/workspace/precompiled/{LM_L9110_DCmotor.py → modules/LM_L9110_DCmotor.py} +0 -0
- /toolkit/workspace/precompiled/{LM_VL53L0X.py → modules/LM_VL53L0X.py} +0 -0
- /toolkit/workspace/precompiled/{LM_dashboard_be.py → modules/LM_dashboard_be.py} +0 -0
- /toolkit/workspace/precompiled/{LM_pet_feeder.py → modules/LM_pet_feeder.py} +0 -0
- /toolkit/workspace/precompiled/{LM_qmi8658.py → modules/LM_qmi8658.py} +0 -0
- /toolkit/workspace/precompiled/{LM_rencoder.py → modules/LM_rencoder.py} +0 -0
- /toolkit/workspace/precompiled/{LM_rp2w.py → modules/LM_rp2w.py} +0 -0
- /toolkit/workspace/precompiled/{LM_sdcard.py → modules/LM_sdcard.py} +0 -0
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
from sys import modules
|
|
2
2
|
from Common import socket_stream
|
|
3
|
-
from Files import
|
|
3
|
+
from Files import is_protected, list_fs, ilist_fs, remove_fs, OSPath, path_join
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
#############################################
|
|
7
7
|
# Safe file system handler functions #
|
|
8
8
|
#############################################
|
|
9
9
|
|
|
10
|
-
def ls(path="/", content='*', raw=False, select='*'):
|
|
10
|
+
def ls(path="/", content='*', raw=False, select='*', core=False):
|
|
11
11
|
"""
|
|
12
12
|
Linux like ls command - list app resources and app folders
|
|
13
13
|
:param path: path to list, default: /
|
|
14
14
|
:param content: content type, default all, f-file, d-dir can be selected
|
|
15
15
|
:param raw: keep raw output [(is_app, type), ...]
|
|
16
16
|
:param select: select specific app resource: LM or IO, default: all
|
|
17
|
+
:param core: include core system files
|
|
17
18
|
"""
|
|
18
|
-
items = list_fs(path, content, select=select)
|
|
19
|
+
items = list_fs(path, content, select=select, core=core)
|
|
19
20
|
if raw:
|
|
20
21
|
return items
|
|
21
22
|
|
|
@@ -39,10 +40,10 @@ def rm(path, allow_dir=False):
|
|
|
39
40
|
return remove_fs(path, allow_dir)
|
|
40
41
|
|
|
41
42
|
|
|
42
|
-
def dirtree(path="/", raw=False):
|
|
43
|
+
def dirtree(path="/", raw=False, core=False):
|
|
43
44
|
"""Return only directories from a given path."""
|
|
44
45
|
path = path if path.endswith('/') else f"{path}/"
|
|
45
|
-
folders = [path_join(path, item) for item in ilist_fs(path, type_filter='d')]
|
|
46
|
+
folders = [path_join(path, item) for item in ilist_fs(path, type_filter='d', core=core)]
|
|
46
47
|
folder_contents = {folder:list_fs(folder) for folder in folders}
|
|
47
48
|
if raw:
|
|
48
49
|
return folder_contents
|
|
@@ -54,15 +55,40 @@ def dirtree(path="/", raw=False):
|
|
|
54
55
|
return formatted_output
|
|
55
56
|
|
|
56
57
|
|
|
58
|
+
def cat(path):
|
|
59
|
+
"""
|
|
60
|
+
Dump any file content
|
|
61
|
+
"""
|
|
62
|
+
with open(path, 'r') as f:
|
|
63
|
+
content = f.read()
|
|
64
|
+
return content
|
|
65
|
+
|
|
66
|
+
|
|
57
67
|
def download(url=None, package=None):
|
|
58
68
|
"""
|
|
59
69
|
[BETA] Load Module downloader with mip
|
|
60
70
|
:param url: github url path, ex. BxNxM/micrOS/master/toolkit/workspace/precompiled/LM_robustness.py
|
|
61
71
|
:param package: mip package name or raw url (hack)
|
|
62
72
|
"""
|
|
73
|
+
def _install(target=None):
|
|
74
|
+
nonlocal url, verdict
|
|
75
|
+
try:
|
|
76
|
+
verdict += f"Install {url}\n"
|
|
77
|
+
if target is None:
|
|
78
|
+
install(url) # Default download: /lib
|
|
79
|
+
else:
|
|
80
|
+
install(url, target=target) # Custom target
|
|
81
|
+
verdict += "\n|- Done"
|
|
82
|
+
except Exception as e:
|
|
83
|
+
verdict += f"|- Cannot install: {url}\n{e}"
|
|
84
|
+
return verdict
|
|
85
|
+
|
|
86
|
+
from mip import install
|
|
87
|
+
verdict = ""
|
|
63
88
|
if url is None and package is None:
|
|
64
89
|
return "Nothing to download, url=None package=None"
|
|
65
90
|
if package is None:
|
|
91
|
+
verdict += "Install from GitHub URL"
|
|
66
92
|
base_url = "https://raw.githubusercontent.com/"
|
|
67
93
|
file_name = url.split("/")[-1]
|
|
68
94
|
if not(file_name.endswith("py") and file_name.startswith("LM_")):
|
|
@@ -72,26 +98,19 @@ def download(url=None, package=None):
|
|
|
72
98
|
url = url.replace("https://github.com/", base_url).replace("/blob", "")
|
|
73
99
|
else:
|
|
74
100
|
url = f"{base_url}{url}"
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
verdict = ""
|
|
79
|
-
try:
|
|
80
|
-
verdict += f"Install {url}\n"
|
|
81
|
-
install(url)
|
|
82
|
-
verdict += "\n|- Done"
|
|
83
|
-
except Exception as e:
|
|
84
|
-
verdict += f"|- Cannot install: {url}\n{e}"
|
|
85
|
-
return verdict
|
|
101
|
+
return _install(target=OSPath.MODULES) # Install module from Github URL
|
|
102
|
+
url = package
|
|
103
|
+
return _install() # Install official package
|
|
86
104
|
|
|
87
105
|
|
|
88
|
-
def del_duplicates():
|
|
106
|
+
def del_duplicates(migrate=True):
|
|
89
107
|
"""
|
|
90
108
|
Load module package manager (Not just load modules)
|
|
91
109
|
- delete duplicated .mpy and .py resources, keep .mpy resource!
|
|
92
110
|
"""
|
|
111
|
+
modules_path = OSPath.MODULES
|
|
93
112
|
msg_buf = []
|
|
94
|
-
files = list_fs(type_filter='f', select='LM')
|
|
113
|
+
files = list_fs(path=modules_path, type_filter='f', select='LM')
|
|
95
114
|
py = list((res.split('.')[0] for res in files if res.endswith('.py'))) # Normally smaller list
|
|
96
115
|
mpy = (res.split('.')[0] for res in files if res.endswith('.mpy'))
|
|
97
116
|
for m in mpy:
|
|
@@ -100,11 +119,36 @@ def del_duplicates():
|
|
|
100
119
|
if m in py and m != 'main':
|
|
101
120
|
to_delete = f'{m}.py'
|
|
102
121
|
try:
|
|
103
|
-
verdict = remove_fs(to_delete)
|
|
122
|
+
verdict = remove_fs(path_join(modules_path, to_delete))
|
|
104
123
|
except:
|
|
105
124
|
verdict = "n/a"
|
|
106
125
|
state = False
|
|
107
126
|
msg_buf.append(f' Delete {to_delete} {state} - {verdict}')
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
# MIGRATE /ROOT/LMs & IOs -> /modules
|
|
130
|
+
def _migrate_from_root(_rf):
|
|
131
|
+
nonlocal _deleted, files
|
|
132
|
+
if _rf in files:
|
|
133
|
+
remove_fs(path_join(OSPath._ROOT, _rf))
|
|
134
|
+
if _rf in ("LM_pacman.mpy", "LM_system.mpy"):
|
|
135
|
+
# Delete protected LMs from root
|
|
136
|
+
remove(path_join(OSPath._ROOT, _rf))
|
|
137
|
+
_deleted += 1
|
|
138
|
+
else:
|
|
139
|
+
rename(path_join(OSPath._ROOT, _rf), path_join(modules_path, _rf))
|
|
140
|
+
msg_buf.append(f' Move /{_rf} -> modules/{_rf}')
|
|
141
|
+
if migrate:
|
|
142
|
+
from uos import rename, remove
|
|
143
|
+
_deleted = 0
|
|
144
|
+
files = files + list_fs(path=OSPath._ROOT, type_filter='f', select='IO')
|
|
145
|
+
for rf in ilist_fs(path=OSPath._ROOT, type_filter='f', select='LM'):
|
|
146
|
+
_migrate_from_root(rf)
|
|
147
|
+
for rf in ilist_fs(path=OSPath._ROOT, type_filter='f', select='IO'):
|
|
148
|
+
_migrate_from_root(rf)
|
|
149
|
+
if _deleted > 0:
|
|
150
|
+
msg_buf.append(f' Purged (/): {_deleted}')
|
|
151
|
+
|
|
108
152
|
return '\n'.join(msg_buf) if len(msg_buf) > 0 else 'Nothing to delete.'
|
|
109
153
|
|
|
110
154
|
|
|
@@ -188,7 +232,7 @@ def listmods(msgobj=None):
|
|
|
188
232
|
"""
|
|
189
233
|
# Dump available LMs
|
|
190
234
|
msg_buf = []
|
|
191
|
-
for k in (res.replace('LM_', '') for res in ilist_fs(type_filter='f', select='LM')):
|
|
235
|
+
for k in (res.replace('LM_', '') for res in ilist_fs(path=OSPath.MODULES, type_filter='f', select='LM')):
|
|
192
236
|
if msgobj is None:
|
|
193
237
|
msg_buf.append(f' {k}')
|
|
194
238
|
else:
|
|
@@ -203,13 +247,14 @@ def delmod(mod):
|
|
|
203
247
|
Delete Load Module with full name: module.py or module.mpy
|
|
204
248
|
OR delete any web resource: *.js, *.css, *.html
|
|
205
249
|
"""
|
|
206
|
-
if mod.endswith('py')
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
250
|
+
if mod.endswith('py'):
|
|
251
|
+
to_remove = f'LM_{mod}'
|
|
252
|
+
else:
|
|
253
|
+
return f'Invalid {mod}, must ends with .py or .mpy'
|
|
254
|
+
try:
|
|
255
|
+
return remove_fs(path_join(OSPath.MODULES, to_remove))
|
|
256
|
+
except Exception as e:
|
|
257
|
+
return f'Cannot delete: {mod}: {e}'
|
|
213
258
|
|
|
214
259
|
|
|
215
260
|
@socket_stream
|
|
@@ -218,7 +263,7 @@ def micros_checksum(msgobj=None):
|
|
|
218
263
|
from binascii import hexlify
|
|
219
264
|
from Config import cfgget
|
|
220
265
|
|
|
221
|
-
for f_name in ilist_fs(type_filter='f', select='LM'):
|
|
266
|
+
for f_name in ilist_fs(path=OSPath.MODULES, type_filter='f', select='LM'):
|
|
222
267
|
with open(f_name, 'rb') as f:
|
|
223
268
|
cs = hexlify(sha1(f.read()).digest()).decode('utf-8')
|
|
224
269
|
msgobj(f"{cs} {f_name}")
|
|
@@ -233,7 +278,7 @@ def help(widgets=False):
|
|
|
233
278
|
(widgets=False) list of functions implemented by this application
|
|
234
279
|
(widgets=True) list of widget json for UI generation
|
|
235
280
|
"""
|
|
236
|
-
return ('listmods', 'delmod mod=<module>.py/.mpy
|
|
281
|
+
return ('listmods', 'delmod mod=<module>.py/.mpy', 'del_duplicates',
|
|
237
282
|
'moduls unload="LM_rgb/None"',
|
|
238
283
|
'cachedump delete=None',
|
|
239
284
|
'datdump',
|
|
@@ -67,7 +67,7 @@ def __run_intercon(state):
|
|
|
67
67
|
host = cmd[0]
|
|
68
68
|
cmd = cmd[1:]
|
|
69
69
|
# Send CMD to other device
|
|
70
|
-
state, _ = exec_cmd(cmd + [f">>{host}"], jsonify=True
|
|
70
|
+
state, _ = exec_cmd(cmd + [f">>{host}"], jsonify=True)
|
|
71
71
|
except Exception as e:
|
|
72
72
|
syslog(f"__run_intercon error: {e}")
|
|
73
73
|
if state.lower() == "off":
|
|
@@ -78,7 +78,7 @@ def __run_intercon(state):
|
|
|
78
78
|
host = cmd[0]
|
|
79
79
|
cmd = cmd[1:]
|
|
80
80
|
# Send CMD to other device
|
|
81
|
-
state, _ = exec_cmd(cmd + [f">>{host}"], jsonify=True
|
|
81
|
+
state, _ = exec_cmd(cmd + [f">>{host}"], jsonify=True)
|
|
82
82
|
except Exception as e:
|
|
83
83
|
syslog(f"__run_intercon error: {e}")
|
|
84
84
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
from LM_system import memory_usage
|
|
2
|
-
from Common import socket_stream, syslog
|
|
2
|
+
from Common import socket_stream, syslog, micro_task
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
@socket_stream
|
|
@@ -61,6 +61,52 @@ def _recursion(cnt, msgobj=None):
|
|
|
61
61
|
remain = 0
|
|
62
62
|
return remain
|
|
63
63
|
|
|
64
|
+
################## TEST micro_task UCs ##########################
|
|
65
|
+
|
|
66
|
+
async def __task(tag, period_ms):
|
|
67
|
+
counter = 0
|
|
68
|
+
with micro_task(tag=tag) as my_task:
|
|
69
|
+
while True:
|
|
70
|
+
# DO something here in the async loop...
|
|
71
|
+
counter += 1
|
|
72
|
+
|
|
73
|
+
# Store data in task cache (task show mytask)
|
|
74
|
+
my_task.out = f'MyTask Counter: {counter}'
|
|
75
|
+
|
|
76
|
+
# Async sleep - feed event loop
|
|
77
|
+
await my_task.feed(sleep_ms=period_ms)
|
|
78
|
+
# [i] feed same as "await asyncio.sleep_ms(period_ms)" with micrOS features (WDT)
|
|
79
|
+
|
|
80
|
+
def create_task():
|
|
81
|
+
"""
|
|
82
|
+
Legacy way of task creation (with exact task tagging)
|
|
83
|
+
"""
|
|
84
|
+
# [!] ASYNC TASK CREATION [1*] with async task callback + taskID (TAG) handling
|
|
85
|
+
task_tag = "microtask.run"
|
|
86
|
+
state = micro_task(tag=task_tag, task=__task(tag=task_tag, period_ms=5))
|
|
87
|
+
return "Starting" if state else "Already running"
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
@micro_task("microtask", _wrap=True)
|
|
91
|
+
async def mytask(tag, period_ms=30):
|
|
92
|
+
"""
|
|
93
|
+
New shorter way of task creation
|
|
94
|
+
with decorator function
|
|
95
|
+
"""
|
|
96
|
+
counter = 0
|
|
97
|
+
with micro_task(tag=tag) as my_task:
|
|
98
|
+
while True:
|
|
99
|
+
# DO something here in the async loop...
|
|
100
|
+
counter += 1
|
|
101
|
+
|
|
102
|
+
# Store data in task cache (task show mytask)
|
|
103
|
+
my_task.out = f'MyTask Counter: {counter}'
|
|
104
|
+
|
|
105
|
+
# Async sleep - feed event loop
|
|
106
|
+
await my_task.feed(sleep_ms=period_ms)
|
|
107
|
+
# [i] feed same as "await asyncio.sleep_ms(period_ms)" with micrOS features (WDT)
|
|
108
|
+
|
|
109
|
+
##############################################################################
|
|
64
110
|
|
|
65
111
|
def help(widgets=False):
|
|
66
112
|
"""
|
|
@@ -70,5 +116,6 @@ def help(widgets=False):
|
|
|
70
116
|
(widgets=True) list of widget json for UI generation
|
|
71
117
|
"""
|
|
72
118
|
return 'NOTE: This is a test module to validate system robustness', \
|
|
73
|
-
'raise_error', 'memory_leak cnt=160', 'recursion_limit cnt=14'
|
|
119
|
+
'raise_error', 'memory_leak cnt=160', 'recursion_limit cnt=14', \
|
|
120
|
+
'create_task', 'mytask'
|
|
74
121
|
|
|
@@ -17,20 +17,15 @@ class TCS3472:
|
|
|
17
17
|
def __init__(self, bus, address=0x29):
|
|
18
18
|
self._bus = bus
|
|
19
19
|
self._i2c_address = address
|
|
20
|
-
|
|
21
|
-
self._bus.start()
|
|
22
|
-
|
|
23
20
|
self._bus.writeto(self._i2c_address, b'\x80\x03')
|
|
24
21
|
self._bus.writeto(self._i2c_address, b'\x81\x2b')
|
|
25
|
-
|
|
26
22
|
TCS3472.INSTANCE = self
|
|
27
23
|
|
|
28
24
|
def scaled(self):
|
|
29
25
|
crgb = self.raw()
|
|
30
26
|
if crgb[0] > 0:
|
|
31
27
|
return tuple(float(x) / crgb[0] for x in crgb[1:])
|
|
32
|
-
|
|
33
|
-
return (0, 0, 0)
|
|
28
|
+
return 0, 0, 0
|
|
34
29
|
|
|
35
30
|
def rgb(self):
|
|
36
31
|
return tuple(int(x * 255) for x in self.scaled())
|
|
@@ -72,4 +67,7 @@ def measure():
|
|
|
72
67
|
|
|
73
68
|
|
|
74
69
|
def help(widgest=False):
|
|
70
|
+
"""
|
|
71
|
+
TCS3472 Color sensor
|
|
72
|
+
"""
|
|
75
73
|
return 'load', 'measure'
|
micrOS/source/web/dashboard.html
CHANGED
|
@@ -38,6 +38,7 @@
|
|
|
38
38
|
</head>
|
|
39
39
|
<body>
|
|
40
40
|
<h1> micrOS dashboard </h1>
|
|
41
|
+
<p id="restInfo"></p>
|
|
41
42
|
<!-- Container for the dynamically generated list -->
|
|
42
43
|
<section id="widgets-section"></section>
|
|
43
44
|
<br><br><br>
|
|
@@ -54,6 +55,7 @@
|
|
|
54
55
|
<script>
|
|
55
56
|
document.addEventListener("DOMContentLoaded", function() {
|
|
56
57
|
// Init basic info from board after DOM is fully loaded
|
|
58
|
+
restInfo(showPages=false);
|
|
57
59
|
|
|
58
60
|
// INIT DASHBOARD (load active modules -> build page)
|
|
59
61
|
DynamicWidgetLoad();
|