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
toolkit/DevEnvOTA.py
CHANGED
|
@@ -13,18 +13,16 @@ try:
|
|
|
13
13
|
from .lib import LocalMachine
|
|
14
14
|
from .lib.TerminalColors import Colors
|
|
15
15
|
from .lib.SafeInput import input_with_timeout
|
|
16
|
-
from .lib.
|
|
16
|
+
from .lib.MicrosFiles import check_all_extensions, check_web_extensions, check_python_extensions, micros_resource_list
|
|
17
17
|
from .lib.Repository import git_clone_archive, git_clone
|
|
18
|
-
from .MicrosFiles import micros_resource_list
|
|
19
18
|
except Exception as e:
|
|
20
19
|
print("Import warning __name__:{}: {}".format(__name__, e))
|
|
21
20
|
from DevEnvCompile import Compile
|
|
22
21
|
from lib import LocalMachine
|
|
23
22
|
from lib.TerminalColors import Colors
|
|
24
23
|
from lib.SafeInput import input_with_timeout
|
|
25
|
-
from lib.
|
|
24
|
+
from lib.MicrosFiles import check_all_extensions, check_web_extensions, check_python_extensions, micros_resource_list
|
|
26
25
|
from lib.Repository import git_clone_archive, git_clone
|
|
27
|
-
from MicrosFiles import micros_resource_list
|
|
28
26
|
|
|
29
27
|
sys.path.append(MYPATH)
|
|
30
28
|
import socketClient
|
|
@@ -406,6 +404,30 @@ class OTA(Compile):
|
|
|
406
404
|
print(f"[SIM] 'OTA' COPY FILES... {source} -> {target}")
|
|
407
405
|
LocalMachine.FileHandler().copy(source, target)
|
|
408
406
|
|
|
407
|
+
@staticmethod
|
|
408
|
+
def _dynamic_file_target(source_name, force_lm):
|
|
409
|
+
"""
|
|
410
|
+
Dynamic file target path based on file extension.
|
|
411
|
+
-> web
|
|
412
|
+
-> modules
|
|
413
|
+
-> config
|
|
414
|
+
-> data
|
|
415
|
+
"""
|
|
416
|
+
# Force LM update - user load modules - drag n drop files
|
|
417
|
+
if force_lm and not source_name.startswith('LM_') and source_name.endswith('py'):
|
|
418
|
+
source_name = 'LM_{}'.format(source_name)
|
|
419
|
+
# Drag-n-Drop file upload file type check and folder adjustment
|
|
420
|
+
if check_web_extensions(source_name):
|
|
421
|
+
source_name_target = os.path.join('web', source_name)
|
|
422
|
+
elif check_python_extensions(source_name):
|
|
423
|
+
source_name_target = os.path.join('modules', source_name)
|
|
424
|
+
elif source_name.endswith("node_config.json"):
|
|
425
|
+
source_name_target = os.path.join('config', source_name)
|
|
426
|
+
else:
|
|
427
|
+
# Copy file to micrOS data folder (not web, not module, not config)
|
|
428
|
+
source_name_target = os.path.join('data', source_name)
|
|
429
|
+
return source_name_target
|
|
430
|
+
|
|
409
431
|
def ota_webrepl_update_core(self, device=None, upload_path_list=None, ota_password='ADmin123',
|
|
410
432
|
force_lm=False, upload_root_dir=None):
|
|
411
433
|
"""
|
|
@@ -468,22 +490,11 @@ class OTA(Compile):
|
|
|
468
490
|
exitcode = -1
|
|
469
491
|
source_name = os.path.basename(source)
|
|
470
492
|
if upload_root_dir is None:
|
|
471
|
-
|
|
472
|
-
if check_web_extensions(source_name):
|
|
473
|
-
source_name_target = os.path.join('web', source_name)
|
|
474
|
-
elif not check_python_extensions(source_name) and not source_name.endswith("node_config.json"):
|
|
475
|
-
source_name_target = os.path.join('data', source_name)
|
|
476
|
-
else:
|
|
477
|
-
# Copy file to micrOS root folder (.mpy and .py or node_config.json)
|
|
478
|
-
source_name_target = source_name
|
|
493
|
+
source_name_target = self._dynamic_file_target(source_name, force_lm)
|
|
479
494
|
else:
|
|
480
495
|
# MAIN USE-CASE
|
|
481
496
|
source_name_target = source.replace(upload_root_dir, '')
|
|
482
497
|
|
|
483
|
-
# Force LM update - user load modules - drag n drop files
|
|
484
|
-
if force_lm and not source_name.startswith('LM_') and source_name.endswith('.py'):
|
|
485
|
-
source_name_target = 'LM_{}'.format(source_name)
|
|
486
|
-
|
|
487
498
|
command = '{python} {api} -p {pwd} {input_file} {host}:{target_path}'.format(
|
|
488
499
|
python=self.python_interpreter,
|
|
489
500
|
api=self.webreplcli_repo_path.replace(" ", "\ "),
|
toolkit/DevEnvUSB.py
CHANGED
|
@@ -13,14 +13,14 @@ try:
|
|
|
13
13
|
from .lib import LocalMachine
|
|
14
14
|
from .lib.TerminalColors import Colors
|
|
15
15
|
from .lib.SerialDriverHandler import install_usb_serial_driver
|
|
16
|
-
from .MicrosFiles import micros_resource_list
|
|
16
|
+
from .lib.MicrosFiles import micros_resource_list
|
|
17
17
|
except Exception as e:
|
|
18
18
|
print("Import warning __name__:{}: {}".format(__name__, e))
|
|
19
19
|
from DevEnvCompile import Compile
|
|
20
20
|
from lib import LocalMachine
|
|
21
21
|
from lib.TerminalColors import Colors
|
|
22
22
|
from lib.SerialDriverHandler import install_usb_serial_driver
|
|
23
|
-
from MicrosFiles import micros_resource_list
|
|
23
|
+
from lib.MicrosFiles import micros_resource_list
|
|
24
24
|
|
|
25
25
|
|
|
26
26
|
class USB(Compile):
|
|
@@ -35,6 +35,7 @@ class USB(Compile):
|
|
|
35
35
|
self.micrOS_node_config_archive = os.path.join(MYPATH, "user_data/node_config_archive")
|
|
36
36
|
self.node_config_profiles_path = os.path.join(MYPATH, "../micrOS/release_info/node_config_profiles/")
|
|
37
37
|
self.esptool_interface = self.get_valid_esptool_cmd()
|
|
38
|
+
self.micrOS_node_config_path = "/config/node_config.json"
|
|
38
39
|
self.dev_types_and_cmds = \
|
|
39
40
|
{'esp32':
|
|
40
41
|
{'erase': '{esptool_interface} --port {dev} erase_flash',
|
|
@@ -436,10 +437,14 @@ class USB(Compile):
|
|
|
436
437
|
selected_index = int(input("Select index: "))
|
|
437
438
|
# Use (already existing) selected config to restore
|
|
438
439
|
selected_config = conf_list[selected_index]
|
|
439
|
-
if
|
|
440
|
+
if selected_config.endswith(".json"):
|
|
440
441
|
# Restore saved config
|
|
441
|
-
|
|
442
|
+
selected_config_target = selected_config
|
|
443
|
+
if '-' in selected_config:
|
|
444
|
+
# Remove prefix (device name / profile name)
|
|
445
|
+
selected_config_target = selected_config.split('-')[-1]
|
|
442
446
|
source_path = os.path.join(self.micrOS_node_config_archive, selected_config)
|
|
447
|
+
target_path = os.path.join(self.precompiled_micrOS_dir_path, selected_config_target)
|
|
443
448
|
elif selected_index == len(conf_list) - 1:
|
|
444
449
|
# SKIP restore config - use the local version in mpy-micrOS folder
|
|
445
450
|
target_path = os.path.join(self.precompiled_micrOS_dir_path, 'node_config.json')
|
|
@@ -448,7 +453,7 @@ class USB(Compile):
|
|
|
448
453
|
# Create new config - from micrOS folder path -> mpy-micrOS folder
|
|
449
454
|
target_path = os.path.join(self.precompiled_micrOS_dir_path, selected_config)
|
|
450
455
|
source_path = os.path.join(self.micrOS_dir_path, selected_config)
|
|
451
|
-
self.console("Restore config: {} -> {}"
|
|
456
|
+
self.console(f"Restore config: {source_path} -> {target_path}")
|
|
452
457
|
if source_path is not None:
|
|
453
458
|
LocalMachine.FileHandler.copy(source_path, target_path)
|
|
454
459
|
|
|
@@ -485,9 +490,11 @@ class USB(Compile):
|
|
|
485
490
|
else:
|
|
486
491
|
self.console("Profile was selected: {}{}{}".format(Colors.OK, profile_list[int(profile)], Colors.NC))
|
|
487
492
|
# Read default conf
|
|
488
|
-
default_conf_path = os.path.join(self.
|
|
493
|
+
default_conf_path = os.path.join(self.micrOS_dir_path, 'node_config.json')
|
|
489
494
|
if not os.path.isfile(default_conf_path):
|
|
490
|
-
self.
|
|
495
|
+
if not self.__generate_default_config():
|
|
496
|
+
self.console(f"Missing default config: {default_conf_path}", state="warn")
|
|
497
|
+
return None
|
|
491
498
|
with open(default_conf_path, 'r') as f:
|
|
492
499
|
default_conf_dict = json.load(f)
|
|
493
500
|
# Read profile
|
|
@@ -650,21 +657,28 @@ class USB(Compile):
|
|
|
650
657
|
return processid
|
|
651
658
|
|
|
652
659
|
def __get_node_config(self):
|
|
660
|
+
|
|
661
|
+
def _get_config(path):
|
|
662
|
+
mpremote_cmd = self.dev_types_and_cmds[self.selected_device_type]['mpremote_cmd']
|
|
663
|
+
if mpremote_cmd is None:
|
|
664
|
+
# Legacy ampy command (esp32 auto reboot tolerance...)
|
|
665
|
+
_command = (self.dev_types_and_cmds[self.selected_device_type]['ampy_cmd']
|
|
666
|
+
.format(dev=device, args=f'get {path}'))
|
|
667
|
+
else:
|
|
668
|
+
_command = f'{mpremote_cmd} fs cat {path}' # new mpremote <1.24.1
|
|
669
|
+
_exitcode, _stdout, _stderr = LocalMachine.CommandHandler.run_command(_command, shell=True)
|
|
670
|
+
return _exitcode, _stdout, _stderr
|
|
671
|
+
|
|
653
672
|
device = self.get_devices()[0]
|
|
654
673
|
self.console(f"Get node config over USB: {device}")
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
# Legacy ampy command (esp32 auto reboot tolerance...)
|
|
658
|
-
command = self.dev_types_and_cmds[self.selected_device_type]['ampy_cmd'].format(dev=device, args='get node_config.json')
|
|
674
|
+
if self.dry_run:
|
|
675
|
+
exitcode, stdout, stderr = 0, '{"key": "Dummy stdout"}', ''
|
|
659
676
|
else:
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
677
|
+
exitcode, stdout, stderr = _get_config("node_config.json") # Legacy
|
|
678
|
+
if exitcode != 0:
|
|
679
|
+
exitcode, stdout, stderr = _get_config(self.micrOS_node_config_path) # New
|
|
663
680
|
self._archive_node_config()
|
|
664
|
-
|
|
665
|
-
exitcode = 0
|
|
666
|
-
stdout = '{"key": "Dummy stdout"}'
|
|
667
|
-
stderr = ''
|
|
681
|
+
|
|
668
682
|
if '\n' in stdout:
|
|
669
683
|
stdout = stdout.strip().splitlines()
|
|
670
684
|
stdout = str([line for line in stdout if '{' in line and '}' in line][0])
|
|
@@ -687,7 +701,7 @@ class USB(Compile):
|
|
|
687
701
|
|
|
688
702
|
def _archive_node_config(self):
|
|
689
703
|
self.console("ARCHIVE NODE_CONFIG.JSON")
|
|
690
|
-
local_node_config =
|
|
704
|
+
local_node_config = self.precompiled_micrOS_dir_path + self.micrOS_node_config_path
|
|
691
705
|
if os.path.isfile(local_node_config):
|
|
692
706
|
with open(local_node_config, 'r') as f:
|
|
693
707
|
node_devfid = json.load(f)['devfid']
|
|
@@ -699,8 +713,8 @@ class USB(Compile):
|
|
|
699
713
|
LocalMachine.FileHandler.copy(local_node_config, archive_node_config)
|
|
700
714
|
|
|
701
715
|
def __override_local_config_from_node(self, node_config=None):
|
|
702
|
-
node_config_path =
|
|
703
|
-
self.console("Overwrite node_config.json with connected node config: {}"
|
|
716
|
+
node_config_path = self.precompiled_micrOS_dir_path + self.micrOS_node_config_path
|
|
717
|
+
self.console(f"Overwrite node_config.json with connected node config: {node_config_path}", state='ok')
|
|
704
718
|
if not self.dry_run and node_config is not None:
|
|
705
719
|
with open(node_config_path, 'w') as f:
|
|
706
720
|
f.write(node_config)
|
toolkit/LM_to_compile.dat
CHANGED
|
@@ -11,7 +11,6 @@ LM_bme280.py
|
|
|
11
11
|
LM_co2.py
|
|
12
12
|
LM_dht11.py
|
|
13
13
|
LM_light_sensor.py
|
|
14
|
-
LM_L298N_DCmotor.py
|
|
15
14
|
LM_intercon.py
|
|
16
15
|
LM_tinyrgb.py
|
|
17
16
|
LM_repair.py
|
|
@@ -41,3 +40,6 @@ LM_haptic.py
|
|
|
41
40
|
LM_distance.py
|
|
42
41
|
LM_veml7700.py
|
|
43
42
|
LM_neomatrix.py
|
|
43
|
+
LM_L298N.py
|
|
44
|
+
LM_mqtt_client.py
|
|
45
|
+
LM_cluster.py
|
toolkit/MicrOSDevEnv.py
CHANGED
|
@@ -142,6 +142,20 @@ class MicrOSDevTool(OTA, USB):
|
|
|
142
142
|
[!] name dependency with micrOS internal manual provider
|
|
143
143
|
"""
|
|
144
144
|
|
|
145
|
+
def _is_private_func(_line):
|
|
146
|
+
nonlocal decorator, line
|
|
147
|
+
if 'def ' in line and 'def _' not in line:
|
|
148
|
+
if "async" in line and decorator is not None and "@micro_task" in decorator:
|
|
149
|
+
# Enable (adjust) async task method with publish_micro_task decorator
|
|
150
|
+
line = line.replace("async", "").strip()
|
|
151
|
+
return False
|
|
152
|
+
if '(self' in line or '(cls' in _line or (decorator is not None and "staticmethod" in decorator):
|
|
153
|
+
# Ignore class methods
|
|
154
|
+
return True
|
|
155
|
+
return False
|
|
156
|
+
# Ignore non functions, and hidden functions (starts with _)
|
|
157
|
+
return True
|
|
158
|
+
|
|
145
159
|
if not os.path.isdir(self.sfuncman_output_path):
|
|
146
160
|
self.console('DOC GEN DISABLED', state="WARN")
|
|
147
161
|
return
|
|
@@ -151,11 +165,12 @@ class MicrOSDevTool(OTA, USB):
|
|
|
151
165
|
static_help_html_path = os.path.join(self.sfuncman_output_path, 'sfuncman.html')
|
|
152
166
|
|
|
153
167
|
# [PARSING] Collect Load Module function structure buffer
|
|
154
|
-
|
|
168
|
+
modules_path = os.path.join(self.micrOS_dir_path, "modules")
|
|
169
|
+
modules_to_doc = (i.split('.')[0] for i in LocalMachine.FileHandler.list_dir(modules_path) if
|
|
155
170
|
i.startswith('LM_') and (i.endswith('.py')))
|
|
156
171
|
module_function_dict = {}
|
|
157
172
|
for LM in modules_to_doc:
|
|
158
|
-
LMpath = '{}/{}.py'.format(
|
|
173
|
+
LMpath = '{}/{}.py'.format(modules_path, LM)
|
|
159
174
|
try:
|
|
160
175
|
module_name = LM.replace('LM_', '')
|
|
161
176
|
module_function_dict[module_name] = {}
|
|
@@ -165,25 +180,26 @@ class MicrOSDevTool(OTA, USB):
|
|
|
165
180
|
line = f.readline()
|
|
166
181
|
if not line:
|
|
167
182
|
break
|
|
168
|
-
if
|
|
169
|
-
if
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
183
|
+
if _is_private_func(line):
|
|
184
|
+
if line.strip().startswith("@"):
|
|
185
|
+
decorator = line.strip()
|
|
186
|
+
else:
|
|
187
|
+
decorator = None
|
|
188
|
+
continue
|
|
189
|
+
|
|
190
|
+
# Gen proper func name
|
|
191
|
+
command = '{}'.format(line.split(')')[0]).replace("def", '').strip()
|
|
192
|
+
command = command.replace('(', ' ') \
|
|
193
|
+
.replace(',', '') \
|
|
194
|
+
.replace('msgobj=None', '') \
|
|
195
|
+
.replace('force=True', '')
|
|
196
|
+
func = command.strip().split()[0]
|
|
197
|
+
param = ' '.join(command.strip().split()[1:])
|
|
198
|
+
# Save record
|
|
199
|
+
if module_function_dict[module_name].get(func, None) is None:
|
|
200
|
+
module_function_dict[module_name][func] = {}
|
|
201
|
+
module_function_dict[module_name][func]['param(s)'] = param if len(param) > 0 else ""
|
|
202
|
+
|
|
187
203
|
# Create / update module data fields
|
|
188
204
|
module_function_dict[module_name]['img'] = f"https://github.com/BxNxM/micrOS/blob/master/media/lms/{module_name}.png?raw=true"
|
|
189
205
|
except Exception as e:
|
|
@@ -26,7 +26,7 @@ def print_table(data):
|
|
|
26
26
|
|
|
27
27
|
def app(devfid=None, pwd=None):
|
|
28
28
|
CLIENT = AppBase(device=devfid, password=pwd)
|
|
29
|
-
measure_cmd = '
|
|
29
|
+
measure_cmd = 'qmi8658 measure >json'
|
|
30
30
|
|
|
31
31
|
mp.set_start_method('spawn', force=True)
|
|
32
32
|
queue = mp.Queue()
|
|
@@ -551,8 +551,8 @@ def webcli_test():
|
|
|
551
551
|
out = CLIENT.execute(['conf', 'devip'], tout=TIMEOUT_SEC)
|
|
552
552
|
if out[0] and out[1] is not None:
|
|
553
553
|
devip = out[1]
|
|
554
|
-
endpoints.append(f'http://{devip}')
|
|
555
554
|
endpoints.append(f'http://{devip}/rest')
|
|
555
|
+
endpoints.append(f'http://{devip}')
|
|
556
556
|
|
|
557
557
|
for endpoint in endpoints:
|
|
558
558
|
_start_t = time.time()
|
|
@@ -562,12 +562,15 @@ def webcli_test():
|
|
|
562
562
|
delta_t = round(time.time() - _start_t, 2)
|
|
563
563
|
# Check if the request was successful
|
|
564
564
|
if not (response.status_code == 200 and ('<!DOCTYPE html>' in str(response.content) or '"micrOS"' in str(response.content))):
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
565
|
+
if response.status_code == 400 and "Low memory" in str(response.content):
|
|
566
|
+
verdict += f" Endpoint: {endpoint} - Low memory mode [{Colors.WARN}OK{Colors.NC}]({delta_t}s)"
|
|
567
|
+
print(response.content)
|
|
568
|
+
else:
|
|
569
|
+
verdict += f" Endpoint: {endpoint} [{Colors.ERR}NOK{Colors.NC}]({delta_t}s)"
|
|
570
|
+
print(response.content)
|
|
571
|
+
state = False
|
|
568
572
|
else:
|
|
569
573
|
verdict += f" Endpoint: {endpoint} [{Colors.OK}OK{Colors.NC}]({delta_t}s)"
|
|
570
|
-
|
|
571
574
|
metrics_name = 'landingpage' if "." in endpoint.split('/')[-1] else endpoint.split('/')[-1]
|
|
572
575
|
_add_metrics(f"web_{metrics_name}_response_ms", int(delta_t*1000))
|
|
573
576
|
except Exception as e:
|
|
@@ -1,12 +1,32 @@
|
|
|
1
1
|
import os
|
|
2
2
|
|
|
3
3
|
try:
|
|
4
|
-
from .
|
|
5
|
-
from .lib.file_extensions import check_all_extensions, check_web_extensions
|
|
4
|
+
from . import LocalMachine
|
|
6
5
|
except Exception as e:
|
|
7
6
|
print("Import warning __name__:{}: {}".format(__name__, e))
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
import LocalMachine
|
|
8
|
+
|
|
9
|
+
PYTHON_EXTENSIONS = ('py', 'mpy')
|
|
10
|
+
WEB_ONLY = ('js', 'html', 'css', 'json', 'ico', 'jpeg', 'png')
|
|
11
|
+
ENABLED_EXTENSIONS = PYTHON_EXTENSIONS + WEB_ONLY
|
|
12
|
+
|
|
13
|
+
def check_all_extensions(path):
|
|
14
|
+
extension = path.split('.')[-1]
|
|
15
|
+
if extension in ENABLED_EXTENSIONS:
|
|
16
|
+
return True
|
|
17
|
+
return False
|
|
18
|
+
|
|
19
|
+
def check_web_extensions(path):
|
|
20
|
+
extension = path.split('.')[-1]
|
|
21
|
+
if extension in WEB_ONLY:
|
|
22
|
+
return True
|
|
23
|
+
return False
|
|
24
|
+
|
|
25
|
+
def check_python_extensions(path):
|
|
26
|
+
extension = path.split('.')[-1]
|
|
27
|
+
if extension in PYTHON_EXTENSIONS:
|
|
28
|
+
return True
|
|
29
|
+
return False
|
|
10
30
|
|
|
11
31
|
def micros_resource_list(root_folder):
|
|
12
32
|
resources_path = []
|
toolkit/micrOSdashboard.py
CHANGED
|
@@ -29,14 +29,14 @@ try:
|
|
|
29
29
|
from . import socketClient
|
|
30
30
|
from . import dashboard_apps
|
|
31
31
|
from .lib import LocalMachine
|
|
32
|
-
from .lib.
|
|
32
|
+
from .lib.MicrosFiles import check_all_extensions
|
|
33
33
|
except Exception as e:
|
|
34
34
|
print("Import warning: {}".format(e))
|
|
35
35
|
import MicrOSDevEnv
|
|
36
36
|
import socketClient
|
|
37
37
|
import dashboard_apps
|
|
38
38
|
from lib import LocalMachine
|
|
39
|
-
from lib.
|
|
39
|
+
from lib.MicrosFiles import check_all_extensions
|
|
40
40
|
|
|
41
41
|
APP_DIR = os.path.join(MYPATH, 'dashboard_apps')
|
|
42
42
|
|
toolkit/micrOSlint.py
CHANGED
|
@@ -18,7 +18,7 @@ MICROS_SOURCE_DIR = os.path.join(MYPATH, '../micrOS/source')
|
|
|
18
18
|
RELEASE_INFO_PATH = os.path.join(MYPATH, '../micrOS/release_info/micrOS_ReleaseInfo')
|
|
19
19
|
|
|
20
20
|
# MICROS LINTER CONFIG
|
|
21
|
-
ALLOWED_LM_DEP_WARNS =
|
|
21
|
+
ALLOWED_LM_DEP_WARNS = 4 # ALLOWED NUMBER OF LM CORE DEPENDENCY (less is better)
|
|
22
22
|
|
|
23
23
|
def parse_micros_file_categories(verbose=True):
|
|
24
24
|
"""
|
|
@@ -27,11 +27,17 @@ def parse_micros_file_categories(verbose=True):
|
|
|
27
27
|
file_ignore_list = ['.DS_Store']
|
|
28
28
|
# micrOS file categories
|
|
29
29
|
categories = {'core': [], 'load_module': [], 'pin_maps': [], 'other': []}
|
|
30
|
-
|
|
30
|
+
modules_path = os.path.join(MICROS_SOURCE_DIR, "modules")
|
|
31
|
+
web_path = os.path.join(MICROS_SOURCE_DIR, "web")
|
|
32
|
+
check_file = lambda _b, _f: os.path.isfile(os.path.join(_b, _f)) and _f not in file_ignore_list
|
|
33
|
+
root_files = [f for f in LocalMachine.FileHandler.list_dir(MICROS_SOURCE_DIR) if check_file(MICROS_SOURCE_DIR, f)]
|
|
34
|
+
module_files = [f"modules/{f}" for f in LocalMachine.FileHandler.list_dir(modules_path) if check_file(modules_path, f)]
|
|
35
|
+
web_files = [f"web/{f}" for f in LocalMachine.FileHandler.list_dir(web_path) if check_file(web_path, f)]
|
|
36
|
+
files = root_files + module_files + web_files
|
|
31
37
|
for f in files:
|
|
32
|
-
if f.
|
|
38
|
+
if f.endswith('.py') and "LM_" in f:
|
|
33
39
|
categories['load_module'].append(f)
|
|
34
|
-
elif f.
|
|
40
|
+
elif f.endswith('.py') and "IO_" in f:
|
|
35
41
|
categories['pin_maps'].append(f)
|
|
36
42
|
elif f.endswith('.py'):
|
|
37
43
|
categories['core'].append(f)
|
|
@@ -179,7 +185,8 @@ def load_module_checker(categories, verbose=True):
|
|
|
179
185
|
_allowed.append(_allow)
|
|
180
186
|
return _relation, _allowed
|
|
181
187
|
|
|
182
|
-
lm_god_mode = ['LM_system.py', 'LM_pacman.py',
|
|
188
|
+
lm_god_mode = ['modules/LM_system.py', 'modules/LM_pacman.py',
|
|
189
|
+
'modules/LM_espnow.py', 'modules/LM_cluster.py']
|
|
183
190
|
state_lm_dep = True
|
|
184
191
|
verdict = []
|
|
185
192
|
lm_resources = categories['load_module']
|
|
@@ -224,7 +231,10 @@ def _run_pylint(file_name):
|
|
|
224
231
|
'--disable=too-many-return-statements', # :D I don't think so :D
|
|
225
232
|
'--disable=too-many-branches', # :D I don't think so :D
|
|
226
233
|
'--disable=too-many-positional-arguments', # :D I don't think so :D
|
|
227
|
-
'--disable=too-many-instance-attributes'
|
|
234
|
+
'--disable=too-many-instance-attributes', # :D I don't think so :D
|
|
235
|
+
'--disable=wrong-import-position', # :D I don't think so :D !!! It is needed due to optimizations
|
|
236
|
+
'--disable=too-many-arguments', # :D I know what I am doing...
|
|
237
|
+
'--disable=multiple-statements', # :D I line oneliners
|
|
228
238
|
]
|
|
229
239
|
if file_name in ['Tasks.py', 'microIO.py', 'Types.py']:
|
|
230
240
|
pylint_opts.append('--disable=exec-used') # Disable micrOS execution core exec/eval warning
|
|
@@ -469,7 +479,7 @@ def short_report(categories, states, verbose=True):
|
|
|
469
479
|
print(f"load_module_checker: load module dependency check (no core): {c_OK if lm_dep[0] else c_NOK} {'' if lm_dep[1] == 0 else f'{lm_dep[1]}{_vis(lm_dep_diff)} warning(s)'}")
|
|
470
480
|
print(f" core pylint score: {core_pylint}{_pyl_vis(core_score_diff)}")
|
|
471
481
|
print(f"load module pylint score: {lm_pylint}{_pyl_vis(load_score_diff)}")
|
|
472
|
-
print(f"pylint resource check (syntax
|
|
482
|
+
print(f"pylint resource check (syntax): {c_OK if pylint_check[0] else f'{c_NOK}: {pylint_check[1]}' }")
|
|
473
483
|
|
|
474
484
|
exitcode = sum([1 for k, v in states.items() if not v[0]])
|
|
475
485
|
print(f"micrOSlint verdict: {c_OK if exitcode == 0 else c_NOK}")
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Test LM_mqtt_client.py in simulator
|
|
2
|
+
|
|
3
|
+
## mqtt_as dependency
|
|
4
|
+
|
|
5
|
+
```
|
|
6
|
+
https://github.com/peterhinch/micropython-mqtt/tree/master/mqtt_as
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
## TODO
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
Optimize module dependency for micrOS usage
|
|
13
|
+
- remove ssid and password usage -> micrOS handles that
|
|
14
|
+
- remove nework conenction check -> micrOS makes that
|
|
15
|
+
```
|