micrOSDevToolKit 2.9.1__py3-none-any.whl → 2.26.1__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.
- env/driver_cp210x/macOS_VCP_Driver/SiLabsUSBDriverDisk.dmg +0 -0
- env/driver_cp210x/macOS_VCP_Driver/macOS_VCP_Driver_Release_Notes.txt +17 -1
- micrOS/micropython/esp32-20251209-v1.27.0.bin +0 -0
- micrOS/micropython/esp32c3-20251209-v1.27.0.bin +0 -0
- micrOS/micropython/esp32c6-20251209-v1.27.0.bin +0 -0
- micrOS/micropython/esp32s2-20251209-v1.27.0.bin +0 -0
- micrOS/micropython/esp32s2-LOLIN_MINI-20251209-v1.27.0.bin +0 -0
- micrOS/micropython/{esp32s3-20241129-v1.24.1.bin → esp32s3-4MBflash-20241129-v1.24.1.bin} +0 -0
- micrOS/micropython/esp32s3-8MBflash-20251209-v1.27.0.bin +0 -0
- micrOS/micropython/esp32s3_spiram_oct-20251209-v1.27.0.bin +0 -0
- micrOS/micropython/rpi-pico-w-20251209-v1.27.0.uf2 +0 -0
- micrOS/micropython/tinypico-20251209-v1.27.0.bin +0 -0
- micrOS/release_info/micrOS_ReleaseInfo/system_analysis_sum.json +167 -163
- micrOS/source/Auth.py +37 -0
- micrOS/source/Common.py +361 -116
- micrOS/source/Config.py +32 -22
- micrOS/source/Debug.py +50 -94
- micrOS/source/Espnow.py +377 -100
- micrOS/source/Files.py +207 -0
- micrOS/source/Hooks.py +48 -20
- micrOS/source/InterConnect.py +126 -42
- micrOS/source/Interrupts.py +6 -6
- micrOS/source/Logger.py +63 -26
- micrOS/source/Network.py +41 -21
- micrOS/source/Notify.py +48 -22
- micrOS/source/Pacman.py +326 -0
- micrOS/source/Scheduler.py +14 -54
- micrOS/source/Server.py +67 -69
- micrOS/source/Shell.py +99 -91
- micrOS/source/Tasks.py +141 -95
- micrOS/source/Time.py +19 -18
- micrOS/source/Types.py +53 -9
- micrOS/source/Web.py +381 -76
- micrOS/source/__pycache__/Common.cpython-312.pyc +0 -0
- micrOS/source/__pycache__/Debug.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__/Scheduler.cpython-312.pyc +0 -0
- micrOS/source/__pycache__/Server.cpython-312.pyc +0 -0
- micrOS/source/__pycache__/Shell.cpython-312.pyc +0 -0
- micrOS/source/__pycache__/replhelper.cpython-312.pyc +0 -0
- micrOS/source/config/_git.keep +0 -0
- micrOS/source/helpers.py +132 -0
- micrOS/source/micrOS.py +17 -7
- micrOS/source/micrOSloader.py +5 -12
- micrOS/source/microIO.py +44 -20
- micrOS/source/modules/IO_esp32c6.py +38 -0
- micrOS/source/{IO_esp32s3.py → modules/IO_esp32s3.py} +37 -1
- micrOS/source/{IO_m5stamp.py → modules/IO_m5stamp.py} +35 -1
- micrOS/source/{IO_qtpy.py → modules/IO_qtpy.py} +22 -17
- micrOS/source/{IO_tinypico.py → modules/IO_tinypico.py} +38 -0
- micrOS/source/modules/LM_L298N.py +161 -0
- {toolkit/workspace/precompiled → micrOS/source/modules}/LM_L9110_DCmotor.py +3 -3
- micrOS/source/{LM_OV2640.py → modules/LM_OV2640.py} +45 -27
- micrOS/source/{LM_VL53L0X.py → modules/LM_VL53L0X.py} +3 -3
- micrOS/source/{LM_aht10.py → modules/LM_aht10.py} +2 -2
- micrOS/source/{LM_bme280.py → modules/LM_bme280.py} +3 -3
- micrOS/source/{LM_buzzer.py → modules/LM_buzzer.py} +18 -25
- micrOS/source/{LM_cct.py → modules/LM_cct.py} +17 -21
- micrOS/source/modules/LM_cluster.py +255 -0
- micrOS/source/{LM_co2.py → modules/LM_co2.py} +3 -3
- micrOS/source/{LM_dht11.py → modules/LM_dht11.py} +2 -2
- micrOS/source/{LM_dht22.py → modules/LM_dht22.py} +2 -2
- micrOS/source/{LM_dimmer.py → modules/LM_dimmer.py} +9 -9
- micrOS/source/{LM_distance.py → modules/LM_distance.py} +4 -6
- micrOS/source/{LM_ds18.py → modules/LM_ds18.py} +2 -2
- micrOS/source/{LM_esp32.py → modules/LM_esp32.py} +5 -0
- micrOS/source/modules/LM_espnow.py +53 -0
- micrOS/source/modules/LM_fileserver.py +265 -0
- micrOS/source/{LM_genIO.py → modules/LM_genIO.py} +52 -37
- micrOS/source/{LM_haptic.py → modules/LM_haptic.py} +2 -2
- {toolkit/workspace/precompiled → micrOS/source/modules}/LM_i2c.py +5 -4
- micrOS/source/{LM_i2s_mic.py → modules/LM_i2s_mic.py} +6 -7
- micrOS/source/{LM_ld2410.py → modules/LM_ld2410.py} +2 -2
- micrOS/source/{LM_light_sensor.py → modules/LM_light_sensor.py} +10 -21
- micrOS/source/modules/LM_mh_z19c.py +198 -0
- micrOS/source/modules/LM_neoeffects.py +284 -0
- micrOS/source/{LM_neopixel.py → modules/LM_neopixel.py} +19 -23
- micrOS/source/{LM_oled.py → modules/LM_oled.py} +2 -2
- micrOS/source/{LM_oled_sh1106.py → modules/LM_oled_sh1106.py} +3 -3
- micrOS/source/{LM_oled_ui.py → modules/LM_oled_ui.py} +72 -64
- micrOS/source/modules/LM_pacman.py +320 -0
- micrOS/source/{LM_presence.py → modules/LM_presence.py} +11 -15
- micrOS/source/modules/LM_qmi8658.py +204 -0
- micrOS/source/{LM_rencoder.py → modules/LM_rencoder.py} +2 -2
- micrOS/source/{LM_rest.py → modules/LM_rest.py} +4 -6
- micrOS/source/{LM_rgb.py → modules/LM_rgb.py} +21 -29
- micrOS/source/{LM_roboarm.py → modules/LM_roboarm.py} +8 -8
- micrOS/source/modules/LM_robustness.py +137 -0
- micrOS/source/{LM_servo.py → modules/LM_servo.py} +3 -3
- micrOS/source/{LM_stepper.py → modules/LM_stepper.py} +5 -5
- micrOS/source/{LM_switch.py → modules/LM_switch.py} +11 -9
- micrOS/source/{LM_system.py → modules/LM_system.py} +38 -32
- micrOS/source/modules/LM_tcs3472.py +187 -0
- micrOS/source/{LM_telegram.py → modules/LM_telegram.py} +164 -116
- micrOS/source/{LM_trackball.py → modules/LM_trackball.py} +3 -3
- micrOS/source/{LM_veml7700.py → modules/LM_veml7700.py} +2 -2
- micrOS/source/modules/LM_web.py +38 -0
- micrOS/source/urequests.py +39 -15
- {toolkit/workspace/precompiled → micrOS/source/web}/dashboard.html +4 -0
- micrOS/source/web/editor.js +440 -0
- micrOS/source/web/filesui.html +178 -0
- micrOS/source/web/filesui.js +338 -0
- {toolkit/workspace/precompiled → micrOS/source/web}/index.html +44 -2
- micrOS/source/{uapi.js → web/uapi.js} +48 -7
- micrOS/source/{ustyle.css → web/ustyle.css} +6 -3
- micrOS/utests/__init__.py +0 -0
- micrOS/utests/test_scheduler.py +435 -0
- {micrOSDevToolKit-2.9.1.data → microsdevtoolkit-2.26.1.data}/scripts/devToolKit.py +33 -3
- {micrOSDevToolKit-2.9.1.dist-info → microsdevtoolkit-2.26.1.dist-info}/METADATA +327 -268
- microsdevtoolkit-2.26.1.dist-info/RECORD +396 -0
- {micrOSDevToolKit-2.9.1.dist-info → microsdevtoolkit-2.26.1.dist-info}/WHEEL +1 -1
- toolkit/DevEnvCompile.py +63 -33
- toolkit/DevEnvOTA.py +58 -22
- toolkit/DevEnvUSB.py +110 -55
- toolkit/Gateway.py +6 -6
- toolkit/LM_to_compile.dat +6 -4
- toolkit/MicrOSDevEnv.py +127 -57
- toolkit/WebRepl.py +73 -0
- toolkit/dashboard_apps/BackupRestore.py +20 -35
- toolkit/dashboard_apps/CCTDemo.py +12 -17
- toolkit/dashboard_apps/CCTTest.py +20 -24
- toolkit/dashboard_apps/CamStream.py +2 -6
- toolkit/dashboard_apps/CatGame.py +14 -16
- toolkit/dashboard_apps/Dimmer.py +11 -21
- toolkit/dashboard_apps/GetVersion.py +11 -19
- toolkit/dashboard_apps/MicrophoneTest.py +1 -6
- toolkit/dashboard_apps/NeoEffectsDemo.py +22 -35
- toolkit/dashboard_apps/NeopixelTest.py +20 -25
- toolkit/dashboard_apps/PresenceTest.py +2 -8
- toolkit/dashboard_apps/QMI8685_GYRO.py +68 -0
- toolkit/dashboard_apps/RGBTest.py +20 -24
- toolkit/dashboard_apps/RoboArm.py +24 -32
- toolkit/dashboard_apps/SED_test.py +10 -14
- toolkit/dashboard_apps/SensorsTest.py +61 -0
- toolkit/dashboard_apps/SystemTest.py +202 -105
- toolkit/dashboard_apps/Template_app.py +11 -23
- toolkit/dashboard_apps/_app_base.py +34 -0
- toolkit/dashboard_apps/_gyro_visualizer.py +78 -0
- toolkit/dashboard_apps/uLightDemo.py +15 -24
- toolkit/index.html +4 -4
- toolkit/lib/LocalMachine.py +6 -1
- toolkit/lib/MicrosFiles.py +46 -0
- toolkit/lib/Repository.py +64 -0
- toolkit/lib/TerminalColors.py +4 -0
- toolkit/lib/macroScript.py +6 -0
- toolkit/lib/micrOSClient.py +123 -50
- toolkit/lib/micrOSClientHistory.py +156 -0
- toolkit/lib/pip_package_installer.py +5 -2
- toolkit/micrOSdashboard.py +12 -17
- toolkit/micrOSlint.py +20 -8
- toolkit/simulator_lib/__pycache__/IO_darwin.cpython-312.pyc +0 -0
- toolkit/simulator_lib/__pycache__/aioespnow.cpython-312.pyc +0 -0
- toolkit/simulator_lib/__pycache__/framebuf.cpython-312.pyc +0 -0
- toolkit/simulator_lib/__pycache__/machine.cpython-312.pyc +0 -0
- toolkit/simulator_lib/__pycache__/micropython.cpython-312.pyc +0 -0
- toolkit/simulator_lib/__pycache__/mip.cpython-312.pyc +0 -0
- toolkit/simulator_lib/__pycache__/neopixel.cpython-312.pyc +0 -0
- toolkit/simulator_lib/__pycache__/network.cpython-312.pyc +0 -0
- toolkit/simulator_lib/__pycache__/sim_common.cpython-312.pyc +0 -0
- toolkit/simulator_lib/__pycache__/simgc.cpython-312.pyc +0 -0
- toolkit/simulator_lib/__pycache__/simulator.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__/urandom.cpython-312.pyc +0 -0
- toolkit/simulator_lib/__pycache__/usocket.cpython-312.pyc +0 -0
- toolkit/simulator_lib/__pycache__/ussl.cpython-312.pyc +0 -0
- toolkit/simulator_lib/aioespnow.py +28 -0
- toolkit/simulator_lib/dht.py +1 -1
- toolkit/simulator_lib/framebuf.py +49 -1
- toolkit/simulator_lib/machine.py +17 -2
- toolkit/simulator_lib/micropython.py +3 -3
- toolkit/simulator_lib/mip.py +165 -0
- toolkit/simulator_lib/neopixel.py +3 -2
- toolkit/simulator_lib/network.py +2 -1
- toolkit/simulator_lib/node_config.json +2 -3
- toolkit/simulator_lib/ntptime.py +1 -1
- toolkit/simulator_lib/{sim_console.py → sim_common.py} +2 -3
- toolkit/simulator_lib/simgc.py +6 -2
- toolkit/simulator_lib/simulator.py +137 -59
- toolkit/simulator_lib/uasyncio.py +33 -2
- toolkit/simulator_lib/uos.py +147 -0
- toolkit/simulator_lib/urandom.py +4 -0
- toolkit/socketClient.py +43 -23
- toolkit/user_data/webhooks/generic.py +1 -1
- toolkit/user_data/webhooks/macro.py +1 -1
- toolkit/user_data/webhooks/template.py +1 -1
- toolkit/workspace/precompiled/Auth.mpy +0 -0
- toolkit/workspace/precompiled/Common.mpy +0 -0
- toolkit/workspace/precompiled/Config.mpy +0 -0
- toolkit/workspace/precompiled/Debug.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/InterConnect.mpy +0 -0
- toolkit/workspace/precompiled/Interrupts.mpy +0 -0
- toolkit/workspace/precompiled/Logger.mpy +0 -0
- toolkit/workspace/precompiled/Network.mpy +0 -0
- toolkit/workspace/precompiled/Notify.mpy +0 -0
- toolkit/workspace/precompiled/Pacman.mpy +0 -0
- toolkit/workspace/precompiled/Scheduler.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/Time.mpy +0 -0
- toolkit/workspace/precompiled/Types.mpy +0 -0
- toolkit/workspace/precompiled/Web.mpy +0 -0
- toolkit/workspace/precompiled/_mpy.version +1 -1
- toolkit/workspace/precompiled/config/_git.keep +0 -0
- toolkit/workspace/precompiled/helpers.mpy +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/modules/IO_esp32s3.mpy +0 -0
- toolkit/workspace/precompiled/modules/IO_m5stamp.mpy +0 -0
- toolkit/workspace/precompiled/modules/IO_qtpy.mpy +0 -0
- toolkit/workspace/precompiled/modules/IO_rp2.mpy +0 -0
- toolkit/workspace/precompiled/modules/IO_tinypico.mpy +0 -0
- toolkit/workspace/precompiled/modules/LM_L298N.mpy +0 -0
- {micrOS/source → toolkit/workspace/precompiled/modules}/LM_L9110_DCmotor.py +3 -3
- toolkit/workspace/precompiled/modules/LM_OV2640.mpy +0 -0
- toolkit/workspace/precompiled/{LM_VL53L0X.py → modules/LM_VL53L0X.py} +3 -3
- 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/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/modules/LM_dimmer.mpy +0 -0
- toolkit/workspace/precompiled/modules/LM_distance.mpy +0 -0
- toolkit/workspace/precompiled/{LM_ds18.mpy → modules/LM_ds18.mpy} +0 -0
- toolkit/workspace/precompiled/{LM_esp32.py → modules/LM_esp32.py} +5 -0
- toolkit/workspace/precompiled/modules/LM_espnow.py +53 -0
- toolkit/workspace/precompiled/modules/LM_fileserver.mpy +0 -0
- toolkit/workspace/precompiled/{LM_gameOfLife.mpy → modules/LM_gameOfLife.mpy} +0 -0
- toolkit/workspace/precompiled/modules/LM_genIO.mpy +0 -0
- toolkit/workspace/precompiled/{LM_haptic.mpy → modules/LM_haptic.mpy} +0 -0
- {micrOS/source → toolkit/workspace/precompiled/modules}/LM_i2c.py +5 -4
- toolkit/workspace/precompiled/modules/LM_i2s_mic.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_mh_z19c.py +198 -0
- toolkit/workspace/precompiled/modules/LM_neoeffects.mpy +0 -0
- toolkit/workspace/precompiled/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_pacman.mpy +0 -0
- toolkit/workspace/precompiled/modules/LM_presence.mpy +0 -0
- toolkit/workspace/precompiled/modules/LM_qmi8658.py +204 -0
- toolkit/workspace/precompiled/{LM_rencoder.py → modules/LM_rencoder.py} +2 -2
- toolkit/workspace/precompiled/modules/LM_rest.mpy +0 -0
- toolkit/workspace/precompiled/modules/LM_rgb.mpy +0 -0
- toolkit/workspace/precompiled/{LM_rgbcct.mpy → modules/LM_rgbcct.mpy} +0 -0
- toolkit/workspace/precompiled/modules/LM_roboarm.mpy +0 -0
- toolkit/workspace/precompiled/modules/LM_robustness.py +137 -0
- 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/modules/LM_switch.mpy +0 -0
- toolkit/workspace/precompiled/modules/LM_system.mpy +0 -0
- toolkit/workspace/precompiled/modules/LM_tcs3472.py +187 -0
- toolkit/workspace/precompiled/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/modules/LM_web.mpy +0 -0
- toolkit/workspace/precompiled/urequests.mpy +0 -0
- {micrOS/source → toolkit/workspace/precompiled/web}/dashboard.html +4 -0
- toolkit/workspace/precompiled/web/editor.js +440 -0
- toolkit/workspace/precompiled/web/filesui.html +178 -0
- toolkit/workspace/precompiled/web/filesui.js +338 -0
- {micrOS/source → toolkit/workspace/precompiled/web}/index.html +44 -2
- toolkit/workspace/precompiled/{uapi.js → web/uapi.js} +48 -7
- toolkit/workspace/precompiled/{ustyle.css → web/ustyle.css} +6 -3
- micrOS/micropython/esp32-20241129-v1.24.1.bin +0 -0
- micrOS/micropython/esp32c3-20240222-v1.22.2.bin +0 -0
- micrOS/micropython/esp32s2-20240602-v1.23.0.bin +0 -0
- micrOS/micropython/esp32s2-LOLIN_MINI-20220618-v1.19.1.bin +0 -0
- micrOS/micropython/esp32s2-LOLIN_MINI-20240602-v1.23.0.bin +0 -0
- micrOS/micropython/esp32s3-20240105-v1.22.1.bin +0 -0
- micrOS/micropython/esp32s3_spiram_oct-20231005-v1.21.0.bin +0 -0
- micrOS/micropython/esp32s3_spiram_oct-20241129-v1.24.1.bin +0 -0
- micrOS/micropython/rpi-pico-w-20241129-v1.24.1.uf2 +0 -0
- micrOS/micropython/tinypico-20241129-v1.24.1.bin +0 -0
- micrOS/source/LM_L298N_DCmotor.py +0 -86
- micrOS/source/LM_catgame.py +0 -75
- micrOS/source/LM_dashboard_be.py +0 -37
- micrOS/source/LM_demo.py +0 -97
- micrOS/source/LM_espnow.py +0 -23
- micrOS/source/LM_intercon.py +0 -57
- micrOS/source/LM_keychain.py +0 -322
- micrOS/source/LM_lmpacman.py +0 -126
- micrOS/source/LM_neoeffects.py +0 -331
- micrOS/source/LM_oledui.py +0 -972
- micrOS/source/LM_pet_feeder.py +0 -78
- micrOS/source/LM_ph_sensor.py +0 -51
- micrOS/source/LM_robustness.py +0 -74
- micrOS/source/reset.py +0 -11
- micrOSDevToolKit-2.9.1.dist-info/RECORD +0 -365
- toolkit/dashboard_apps/AirQualityBME280.py +0 -36
- toolkit/dashboard_apps/AirQualityDHT22_CO2.py +0 -36
- toolkit/lib/file_extensions.py +0 -16
- toolkit/simulator_lib/__pycache__/sim_console.cpython-312.pyc +0 -0
- toolkit/simulator_lib/__pycache__/sim_console.cpython-38.pyc +0 -0
- toolkit/simulator_lib/__pycache__/sim_console.cpython-39.pyc +0 -0
- toolkit/workspace/precompiled/IO_esp32s3.mpy +0 -0
- toolkit/workspace/precompiled/IO_m5stamp.mpy +0 -0
- toolkit/workspace/precompiled/IO_qtpy.mpy +0 -0
- toolkit/workspace/precompiled/IO_rp2.mpy +0 -0
- toolkit/workspace/precompiled/IO_tinypico.mpy +0 -0
- toolkit/workspace/precompiled/LM_L298N_DCmotor.mpy +0 -0
- toolkit/workspace/precompiled/LM_OV2640.mpy +0 -0
- toolkit/workspace/precompiled/LM_catgame.py +0 -75
- toolkit/workspace/precompiled/LM_cct.mpy +0 -0
- toolkit/workspace/precompiled/LM_dashboard_be.py +0 -37
- toolkit/workspace/precompiled/LM_demo.py +0 -97
- toolkit/workspace/precompiled/LM_dimmer.mpy +0 -0
- toolkit/workspace/precompiled/LM_distance.mpy +0 -0
- toolkit/workspace/precompiled/LM_espnow.py +0 -23
- toolkit/workspace/precompiled/LM_genIO.mpy +0 -0
- toolkit/workspace/precompiled/LM_i2s_mic.mpy +0 -0
- toolkit/workspace/precompiled/LM_intercon.mpy +0 -0
- toolkit/workspace/precompiled/LM_keychain.mpy +0 -0
- toolkit/workspace/precompiled/LM_light_sensor.mpy +0 -0
- toolkit/workspace/precompiled/LM_lmpacman.mpy +0 -0
- toolkit/workspace/precompiled/LM_neoeffects.mpy +0 -0
- toolkit/workspace/precompiled/LM_neopixel.mpy +0 -0
- toolkit/workspace/precompiled/LM_oled_ui.mpy +0 -0
- toolkit/workspace/precompiled/LM_oledui.mpy +0 -0
- toolkit/workspace/precompiled/LM_pet_feeder.py +0 -78
- toolkit/workspace/precompiled/LM_ph_sensor.py +0 -51
- toolkit/workspace/precompiled/LM_presence.mpy +0 -0
- toolkit/workspace/precompiled/LM_rest.mpy +0 -0
- toolkit/workspace/precompiled/LM_rgb.mpy +0 -0
- toolkit/workspace/precompiled/LM_roboarm.mpy +0 -0
- toolkit/workspace/precompiled/LM_robustness.py +0 -74
- toolkit/workspace/precompiled/LM_switch.mpy +0 -0
- toolkit/workspace/precompiled/LM_system.mpy +0 -0
- toolkit/workspace/precompiled/LM_telegram.mpy +0 -0
- toolkit/workspace/precompiled/node_config.json +0 -1
- toolkit/workspace/precompiled/reset.mpy +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_rp2.py → modules/IO_rp2.py} +0 -0
- /micrOS/source/{LM_gameOfLife.py → modules/LM_gameOfLife.py} +0 -0
- /micrOS/source/{LM_rgbcct.py → modules/LM_rgbcct.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_sound_event.py → modules/LM_sound_event.py} +0 -0
- /micrOS/source/{LM_tinyrgb.py → modules/LM_tinyrgb.py} +0 -0
- /micrOS/source/{udashboard.js → web/udashboard.js} +0 -0
- /micrOS/source/{uwidgets.js → web/uwidgets.js} +0 -0
- /micrOS/source/{uwidgets_pro.js → web/uwidgets_pro.js} +0 -0
- {micrOSDevToolKit-2.9.1.dist-info → microsdevtoolkit-2.26.1.dist-info/licenses}/LICENSE +0 -0
- {micrOSDevToolKit-2.9.1.dist-info → microsdevtoolkit-2.26.1.dist-info}/top_level.txt +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/workspace/precompiled/{udashboard.js → web/udashboard.js} +0 -0
- /toolkit/workspace/precompiled/{uwidgets.js → web/uwidgets.js} +0 -0
- /toolkit/workspace/precompiled/{uwidgets_pro.js → web/uwidgets_pro.js} +0 -0
|
@@ -1,24 +1,27 @@
|
|
|
1
|
+
"""
|
|
2
|
+
micrOS simple OLED UI (irq or single task based refresh)
|
|
3
|
+
- with page generation
|
|
4
|
+
Designed by Marcell Ban aka BxNxM
|
|
5
|
+
"""
|
|
6
|
+
|
|
1
7
|
from Config import cfgget
|
|
2
8
|
from utime import localtime
|
|
3
9
|
from network import WLAN, STA_IF
|
|
4
|
-
from microIO import
|
|
10
|
+
from microIO import bind_pin, pinmap_search
|
|
5
11
|
from Network import ifconfig
|
|
6
12
|
from Common import syslog, exec_cmd, manage_task
|
|
7
13
|
from machine import Pin
|
|
8
14
|
from Types import resolve
|
|
9
15
|
try:
|
|
10
|
-
from LM_system import memory_usage
|
|
16
|
+
from LM_system import memory_usage, hosts
|
|
11
17
|
except:
|
|
12
18
|
memory_usage = None # Optional function handling
|
|
13
|
-
try:
|
|
14
|
-
import LM_intercon as InterCon
|
|
15
|
-
except:
|
|
16
|
-
InterCon = None # Optional function handling
|
|
17
19
|
try:
|
|
18
20
|
from LM_gameOfLife import next_gen as gol_nextgen, reset as gol_reset
|
|
19
21
|
except:
|
|
20
22
|
gol_nextgen = None # Optional function handling
|
|
21
23
|
|
|
24
|
+
from utime import ticks_ms, ticks_diff # For IRQ joystick handling
|
|
22
25
|
|
|
23
26
|
#################################
|
|
24
27
|
# PAGE MANAGER CLASS DEFINITION #
|
|
@@ -153,19 +156,31 @@ class PageUI:
|
|
|
153
156
|
def _set(pin_tag, callback):
|
|
154
157
|
pin = None
|
|
155
158
|
try:
|
|
156
|
-
pin =
|
|
159
|
+
pin = bind_pin(pin_tag)
|
|
157
160
|
except Exception as e:
|
|
158
161
|
syslog(f'[ERR] {pin_tag} IRQ: {e}')
|
|
159
162
|
if pin:
|
|
160
163
|
pin_obj = Pin(pin, Pin.IN, Pin.PULL_DOWN)
|
|
161
164
|
# [IRQ] - event type setup
|
|
162
|
-
pin_obj.irq(trigger=Pin.
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
165
|
+
pin_obj.irq(trigger=Pin.IRQ_FALLING, handler=callback)
|
|
166
|
+
|
|
167
|
+
def _event_handler(control_command, prell_ms=150):
|
|
168
|
+
nonlocal _p_last
|
|
169
|
+
_last = _p_last.get(control_command)
|
|
170
|
+
last = 0 if _last is None else _last
|
|
171
|
+
# Calculate time difference between last trigger action and now tick.
|
|
172
|
+
diff = ticks_diff(ticks_ms(), last)
|
|
173
|
+
if abs(diff) > prell_ms:
|
|
174
|
+
# Save now tick - last trigger action
|
|
175
|
+
_p_last[control_command] = ticks_ms()
|
|
176
|
+
self.control(control_command)
|
|
177
|
+
|
|
178
|
+
_p_last = {}
|
|
179
|
+
_set("js_right", lambda pin: _event_handler('next'))
|
|
180
|
+
_set("js_left", lambda pin: _event_handler('prev'))
|
|
181
|
+
_set("js_up", lambda pin: _event_handler('on'))
|
|
182
|
+
_set("js_down", lambda pin: _event_handler('off'))
|
|
183
|
+
_set("js_press", lambda pin: _event_handler('press'))
|
|
169
184
|
self.irq_ok = True
|
|
170
185
|
|
|
171
186
|
def __power_save(self):
|
|
@@ -227,6 +242,7 @@ class PageUI:
|
|
|
227
242
|
else:
|
|
228
243
|
self.page_callback_list[self.active_page]() # <== Execute page functions
|
|
229
244
|
except Exception as e:
|
|
245
|
+
syslog(f"oled_ui render error: {e}")
|
|
230
246
|
PageUI.PAGE_UI_OBJ.show_msg = f"Err: {e}" # Show page error in msgbox
|
|
231
247
|
PageUI.DISPLAY.show()
|
|
232
248
|
self.__power_save()
|
|
@@ -322,39 +338,47 @@ class PageUI:
|
|
|
322
338
|
#####################################
|
|
323
339
|
# PAGE GENERATORS #
|
|
324
340
|
#####################################
|
|
325
|
-
def intercon_page(self,
|
|
341
|
+
def intercon_page(self, cmd:str, run=False):
|
|
326
342
|
"""Generic interconnect page core - create multiple page with it"""
|
|
327
343
|
posx, posy = 5, 12
|
|
328
344
|
|
|
329
345
|
def _button():
|
|
346
|
+
nonlocal host, _cmd
|
|
330
347
|
# BUTTON CALLBACK - INTERCONNECT execution
|
|
331
348
|
self.open_intercons.append(host)
|
|
332
349
|
try:
|
|
333
350
|
# Send CMD to other device & show result
|
|
334
|
-
data_meta =
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
351
|
+
state, data_meta = exec_cmd(_cmd, jsonify=True)
|
|
352
|
+
if state:
|
|
353
|
+
self.cmd_task_tag = list(data_meta.keys())[0]
|
|
354
|
+
verdict = list(data_meta.values())[0]
|
|
355
|
+
if "Already running" in verdict and not run:
|
|
356
|
+
self.cmd_out = verdict # Otherwise the task start output not relevant on UI
|
|
357
|
+
else:
|
|
358
|
+
self.cmd_out = f"Error: {data_meta}"
|
|
338
359
|
except Exception as e:
|
|
339
360
|
self.cmd_out = str(e)
|
|
340
361
|
self.open_intercons.remove(host)
|
|
341
362
|
|
|
342
363
|
# Check open host connection
|
|
343
|
-
|
|
344
|
-
|
|
364
|
+
_cmd = cmd.strip().split()
|
|
365
|
+
host = _cmd[-1].replace(">", "").replace("&", "")
|
|
345
366
|
# Draw host + cmd details
|
|
346
|
-
PageUI.DISPLAY.text(
|
|
347
|
-
PageUI.DISPLAY.text(
|
|
367
|
+
PageUI.DISPLAY.text(' '.join(_cmd[0:-1]), 0, posy)
|
|
368
|
+
PageUI.DISPLAY.text(_cmd[-1], posx, posy+10)
|
|
369
|
+
self._cmd_text(posx, posy + 10)
|
|
370
|
+
|
|
348
371
|
# Update display output with retrieved task result (by TaskID)
|
|
349
372
|
if self.cmd_task_tag is not None:
|
|
350
373
|
task_buffer = manage_task(self.cmd_task_tag, 'show').replace(' ', '')
|
|
351
374
|
if task_buffer is not None and len(task_buffer) > 0:
|
|
352
375
|
# Set display out to task buffered data
|
|
353
376
|
self.cmd_out = task_buffer
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
377
|
+
if not manage_task(self.cmd_task_tag, 'isbusy'):
|
|
378
|
+
# Kill task - clean
|
|
379
|
+
manage_task(self.cmd_task_tag, 'kill')
|
|
380
|
+
# data gathered - remove tag - skip re-read
|
|
381
|
+
self.cmd_task_tag = None
|
|
358
382
|
# Show self.cmd_out value on display
|
|
359
383
|
self._cmd_text(posx, posy+10)
|
|
360
384
|
# Run button event at page init
|
|
@@ -364,7 +388,7 @@ class PageUI:
|
|
|
364
388
|
# Set button press callback (+draw button)
|
|
365
389
|
self.set_press_callback(_button)
|
|
366
390
|
|
|
367
|
-
def cmd_call_page(self, cmd, run=False):
|
|
391
|
+
def cmd_call_page(self, cmd:str, run=False):
|
|
368
392
|
"""Generic LoadModule execution page core - create multiple page with it"""
|
|
369
393
|
posx, posy = 5, 12
|
|
370
394
|
|
|
@@ -409,15 +433,20 @@ def _sys_page():
|
|
|
409
433
|
|
|
410
434
|
|
|
411
435
|
def _intercon_cache(line_limit=3):
|
|
412
|
-
if InterCon is None:
|
|
413
|
-
return False
|
|
414
436
|
line_start = 15
|
|
415
437
|
line_cnt = 1
|
|
416
438
|
PageUI.DISPLAY.text("InterCon cache", 0, line_start)
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
439
|
+
cache = hosts()["intercon"]
|
|
440
|
+
if sum([1 for _ in cache]) > 0:
|
|
441
|
+
for key, val in cache.items():
|
|
442
|
+
if '.' in key:
|
|
443
|
+
# IP splitting
|
|
444
|
+
key = key.split('.')[0]
|
|
445
|
+
val = '.'.join(val.split('.')[-2:])
|
|
446
|
+
else:
|
|
447
|
+
# MAC splitting
|
|
448
|
+
key = key.split(':')[0]
|
|
449
|
+
val = ':'.join(val.split(':')[-2:])
|
|
421
450
|
PageUI.DISPLAY.text(f" {val} {key}", 0, line_start+(line_cnt*10))
|
|
422
451
|
line_cnt += 1
|
|
423
452
|
if line_cnt > line_limit:
|
|
@@ -501,8 +530,7 @@ def msgbox(msg='micrOS msg'):
|
|
|
501
530
|
PageUI.PAGE_UI_OBJ.render_page()
|
|
502
531
|
return 'Show msg'
|
|
503
532
|
|
|
504
|
-
|
|
505
|
-
def intercon_genpage(cmd=None, run=False):
|
|
533
|
+
def genpage(cmd:str=None, run=False):
|
|
506
534
|
"""
|
|
507
535
|
Create intercon pages dynamically :)
|
|
508
536
|
- based on cmd value.
|
|
@@ -510,34 +538,15 @@ def intercon_genpage(cmd=None, run=False):
|
|
|
510
538
|
:param run: run button event at page init: True/False
|
|
511
539
|
:return: page creation verdict
|
|
512
540
|
"""
|
|
513
|
-
raw = cmd.split()
|
|
514
|
-
host = raw[0]
|
|
515
|
-
cmd = ' '.join(raw[1:])
|
|
516
|
-
try:
|
|
517
|
-
# Create page for intercon command
|
|
518
|
-
PageUI.PAGE_UI_OBJ.add_page(lambda: PageUI.PAGE_UI_OBJ.intercon_page(host, cmd, run=run))
|
|
519
|
-
except Exception as e:
|
|
520
|
-
syslog(f'[ERR] intercon_genpage: {e}')
|
|
521
|
-
return str(e)
|
|
522
|
-
return True
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
def cmd_genpage(cmd=None, run=False):
|
|
526
|
-
"""
|
|
527
|
-
Create load module execution pages dynamically :)
|
|
528
|
-
- based on cmd value: load_module function (args)
|
|
529
|
-
:param cmd: 'load_module function (args)' string
|
|
530
|
-
:param run: run button event at page init: True/False
|
|
531
|
-
:return: page creation verdict
|
|
532
|
-
"""
|
|
533
|
-
if not isinstance(cmd, str):
|
|
534
|
-
return False
|
|
535
|
-
|
|
536
541
|
try:
|
|
537
|
-
|
|
538
|
-
|
|
542
|
+
if ">>" in cmd or "&" in cmd:
|
|
543
|
+
# Create page for intercon/task background command
|
|
544
|
+
PageUI.PAGE_UI_OBJ.add_page(lambda: PageUI.PAGE_UI_OBJ.intercon_page(cmd, run=run))
|
|
545
|
+
else:
|
|
546
|
+
# Create page for realtime command
|
|
547
|
+
PageUI.PAGE_UI_OBJ.add_page(lambda: PageUI.PAGE_UI_OBJ.cmd_call_page(cmd, run=run))
|
|
539
548
|
except Exception as e:
|
|
540
|
-
syslog(f'[ERR]
|
|
549
|
+
syslog(f'[ERR] genpage: {e}')
|
|
541
550
|
return str(e)
|
|
542
551
|
return True
|
|
543
552
|
|
|
@@ -588,6 +597,5 @@ def help(widgets=False):
|
|
|
588
597
|
'draw',
|
|
589
598
|
'BUTTON control cmd=<prev,press,next,on,off>',
|
|
590
599
|
'msgbox "msg"',
|
|
591
|
-
'
|
|
592
|
-
'cmd_genpage "cmd" run=False',
|
|
600
|
+
'genpage "cmd" run=False',
|
|
593
601
|
'pinmap'), widgets=widgets)
|
|
@@ -0,0 +1,320 @@
|
|
|
1
|
+
from sys import modules
|
|
2
|
+
from Common import socket_stream
|
|
3
|
+
from Files import list_fs, ilist_fs, remove_file, remove_dir, OSPath, path_join, is_protected
|
|
4
|
+
from Auth import sudo
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
#############################################
|
|
8
|
+
# Safe file system handler functions #
|
|
9
|
+
#############################################
|
|
10
|
+
|
|
11
|
+
def ls(path="/", content='*', raw=False, select='*', core=False):
|
|
12
|
+
"""
|
|
13
|
+
Linux like ls command - list app resources and app folders
|
|
14
|
+
:param path: path to list, default: /
|
|
15
|
+
:param content: content type, default all, f-file, d-dir can be selected
|
|
16
|
+
:param raw: keep raw output [(is_app, type), ...]
|
|
17
|
+
:param select: select specific app resource: LM or IO, default: all
|
|
18
|
+
:param core: include core system files
|
|
19
|
+
"""
|
|
20
|
+
items = list_fs(path, content, select=select, core=core)
|
|
21
|
+
if raw:
|
|
22
|
+
return items
|
|
23
|
+
|
|
24
|
+
# Build a formatted output (just like `ls -l` style index)
|
|
25
|
+
lines = ""
|
|
26
|
+
for i, f in enumerate(items):
|
|
27
|
+
spacer = " " * (4 - len(str(i+1)))
|
|
28
|
+
if content == "*":
|
|
29
|
+
lines += f"{i+1}{spacer}{f[0]} {f[1]}\n"
|
|
30
|
+
else:
|
|
31
|
+
lines += f"{i + 1}{spacer}{f}\n"
|
|
32
|
+
return lines
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
@sudo(_force_only=(True, 1))
|
|
36
|
+
def rm(path, force=False):
|
|
37
|
+
"""
|
|
38
|
+
Linux like rm command - delete app resources and folders
|
|
39
|
+
:param path: app resource name/path, ex.: LM_robustness.py
|
|
40
|
+
:param force: bypasses protection check - sudo mode
|
|
41
|
+
"""
|
|
42
|
+
return remove_file(path, force)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
@sudo(_force_only=(True, 1))
|
|
46
|
+
def rmdir(path, force=False):
|
|
47
|
+
"""
|
|
48
|
+
Linux like rmdir command for directory deletion
|
|
49
|
+
:param path: app resource folder path, ex.: /lib/myapp
|
|
50
|
+
:param force: bypasses protection check - sudo mode
|
|
51
|
+
"""
|
|
52
|
+
return remove_dir(path, force)
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
def dirtree(path="/", raw=False, core=False):
|
|
56
|
+
"""Return only directories from a given path."""
|
|
57
|
+
path = path if path.endswith('/') else f"{path}/"
|
|
58
|
+
folders = [path_join(path, item) for item in ilist_fs(path, type_filter='d', core=core)]
|
|
59
|
+
folder_contents = {folder:list_fs(folder) for folder in folders}
|
|
60
|
+
if raw:
|
|
61
|
+
return folder_contents
|
|
62
|
+
formatted_output = ""
|
|
63
|
+
for k, v in folder_contents.items():
|
|
64
|
+
formatted_output += f"{k}\n"
|
|
65
|
+
for val in v:
|
|
66
|
+
formatted_output += f"\t{val[0]} {val[1]}\n"
|
|
67
|
+
return formatted_output
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
def cat(path):
|
|
71
|
+
"""
|
|
72
|
+
Dump any file content
|
|
73
|
+
"""
|
|
74
|
+
if is_protected(path):
|
|
75
|
+
return f'Read not allowed'
|
|
76
|
+
with open(path, 'r') as f:
|
|
77
|
+
content = f.read()
|
|
78
|
+
return content
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
def install(ref=None):
|
|
82
|
+
"""
|
|
83
|
+
Unified mip-based installer for micrOS.
|
|
84
|
+
Automatically detects:
|
|
85
|
+
1. Official MicroPython packages (from https://micropython.org/pi/v2)
|
|
86
|
+
Example: pacman install "umqtt.simple"
|
|
87
|
+
2. Single-file load modules (LM_/IO_ names or URLs)
|
|
88
|
+
Example: pacman install "https://github.com/BxNxM/micrOS/blob/master/toolkit/workspace/precompiled/modules/LM_rgb.mpy"
|
|
89
|
+
pacman install "github.com/BxNxM/micrOS/blob/master/toolkit/workspace/precompiled/modules/LM_rgb.mpy"
|
|
90
|
+
3. GitHub packages (folders via tree/blob URLs or github: form)
|
|
91
|
+
Example: pacman install "github:peterhinch/micropython-mqtt"
|
|
92
|
+
pacman install "https://github.com/peterhinch/micropython-mqtt/tree/master"
|
|
93
|
+
pacman install "https://github.com/peterhinch/micropython-mqtt/blob/master/package.json"
|
|
94
|
+
pacman install "https://github.com/peterhinch/micropython-mqtt"
|
|
95
|
+
[NOK] pacman install "https://github.com/basanovase/sim7600/tree/main/sim7600" -> Package not found: github:basanovase/sim7600/package.json
|
|
96
|
+
4. Install from local /config/requirements.txt file
|
|
97
|
+
Example: pacman install "requirements.txt"
|
|
98
|
+
"""
|
|
99
|
+
from Pacman import install as pm_install
|
|
100
|
+
return pm_install(ref)
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
@sudo
|
|
104
|
+
def uninstall(name=None):
|
|
105
|
+
"""
|
|
106
|
+
Delete package by name from /lib
|
|
107
|
+
:param name: None (default) show installed package name
|
|
108
|
+
OR package name to delete (str)
|
|
109
|
+
"""
|
|
110
|
+
if name is None:
|
|
111
|
+
return list_fs(path=OSPath.LIB, type_filter='d')
|
|
112
|
+
from Pacman import uninstall as pm_uninstall
|
|
113
|
+
return pm_uninstall(name)
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
def upgrade(name=None, force=False):
|
|
117
|
+
"""
|
|
118
|
+
Upgrade package by name from /lib
|
|
119
|
+
:param name: None (default) show installed package name
|
|
120
|
+
OR package name to upgrade (str)
|
|
121
|
+
:param force: skip version check
|
|
122
|
+
"""
|
|
123
|
+
if name is None:
|
|
124
|
+
return list_fs(path=OSPath.LIB, type_filter='d')
|
|
125
|
+
from Pacman import upgrade as pm_upgrade
|
|
126
|
+
return pm_upgrade(name, force)
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
def del_duplicates(migrate=True):
|
|
130
|
+
"""
|
|
131
|
+
Load module package manager (Not just load modules)
|
|
132
|
+
- delete duplicated .mpy and .py resources, keep .mpy resource!
|
|
133
|
+
"""
|
|
134
|
+
modules_path = OSPath.MODULES
|
|
135
|
+
msg_buf = []
|
|
136
|
+
files = list_fs(path=modules_path, type_filter='f', select='LM')
|
|
137
|
+
py = list((res.split('.')[0] for res in files if res.endswith('.py'))) # Normally smaller list
|
|
138
|
+
mpy = (res.split('.')[0] for res in files if res.endswith('.mpy'))
|
|
139
|
+
for m in mpy:
|
|
140
|
+
# Iterate over mpy resources
|
|
141
|
+
state = True
|
|
142
|
+
if m in py and m != 'main':
|
|
143
|
+
to_delete = f'{m}.py'
|
|
144
|
+
try:
|
|
145
|
+
verdict = remove_file(path_join(modules_path, to_delete))
|
|
146
|
+
except:
|
|
147
|
+
verdict = "n/a"
|
|
148
|
+
state = False
|
|
149
|
+
msg_buf.append(f' Delete {to_delete} {state} - {verdict}')
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
# MIGRATE /ROOT/LMs & IOs -> /modules
|
|
153
|
+
def _migrate_from_root(_rf):
|
|
154
|
+
nonlocal _deleted, files
|
|
155
|
+
if _rf in files:
|
|
156
|
+
remove_file(path_join(OSPath._ROOT, _rf))
|
|
157
|
+
if _rf in ("LM_pacman.mpy", "LM_system.mpy"):
|
|
158
|
+
# Delete protected LMs from root
|
|
159
|
+
remove(path_join(OSPath._ROOT, _rf))
|
|
160
|
+
_deleted += 1
|
|
161
|
+
else:
|
|
162
|
+
rename(path_join(OSPath._ROOT, _rf), path_join(modules_path, _rf))
|
|
163
|
+
msg_buf.append(f' Move /{_rf} -> modules/{_rf}')
|
|
164
|
+
if migrate:
|
|
165
|
+
from uos import rename, remove
|
|
166
|
+
_deleted = 0
|
|
167
|
+
files = files + list_fs(path=OSPath._ROOT, type_filter='f', select='IO')
|
|
168
|
+
for rf in ilist_fs(path=OSPath._ROOT, type_filter='f', select='LM'):
|
|
169
|
+
_migrate_from_root(rf)
|
|
170
|
+
for rf in ilist_fs(path=OSPath._ROOT, type_filter='f', select='IO'):
|
|
171
|
+
_migrate_from_root(rf)
|
|
172
|
+
if _deleted > 0:
|
|
173
|
+
msg_buf.append(f' Purged (/): {_deleted}')
|
|
174
|
+
|
|
175
|
+
return '\n'.join(msg_buf) if len(msg_buf) > 0 else 'Nothing to delete.'
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
def moduls(unload=None):
|
|
179
|
+
"""
|
|
180
|
+
List / unload loaded upython Load Modules
|
|
181
|
+
:param unload: module name to unload
|
|
182
|
+
:param unload: None - list active modules
|
|
183
|
+
:return str: verdict
|
|
184
|
+
"""
|
|
185
|
+
if unload is None:
|
|
186
|
+
return list(modules.keys())
|
|
187
|
+
if unload in modules.keys():
|
|
188
|
+
del modules[unload]
|
|
189
|
+
return f"Module unload {unload} done."
|
|
190
|
+
return f"Module unload {unload} failed."
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
@socket_stream
|
|
194
|
+
def cachedump(delete=None, ext="cache", msgobj=None):
|
|
195
|
+
"""
|
|
196
|
+
Cache system persistent data storage files (.cache)
|
|
197
|
+
:param delete: cache name to delete
|
|
198
|
+
:param ext: cache file extension (default: cache)
|
|
199
|
+
"""
|
|
200
|
+
data_dir = OSPath.DATA
|
|
201
|
+
if delete is None:
|
|
202
|
+
# List cache files aka application cache
|
|
203
|
+
msg_buf = []
|
|
204
|
+
for cache in (c for c in ilist_fs(data_dir, type_filter='f') if c.endswith('.cache')):
|
|
205
|
+
_path = path_join(data_dir, cache)
|
|
206
|
+
with open(_path, 'r') as f:
|
|
207
|
+
if msgobj is None:
|
|
208
|
+
msg_buf.append(f'{_path}: {f.read()}')
|
|
209
|
+
else:
|
|
210
|
+
msgobj(f'{_path}: {f.read()}')
|
|
211
|
+
return msg_buf if len(msg_buf) > 0 else ''
|
|
212
|
+
# Remove given cache file
|
|
213
|
+
try:
|
|
214
|
+
delete_cache = path_join(data_dir, f"{delete}.cache")
|
|
215
|
+
verdict = remove_file(delete_cache)
|
|
216
|
+
return f'{delete_cache} delete done.: {verdict}'
|
|
217
|
+
except:
|
|
218
|
+
return f'{delete}.{ext} not exists'
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
def datdump():
|
|
222
|
+
"""
|
|
223
|
+
Generic .dat file dump
|
|
224
|
+
- logged data from LMs, sensor data, etc...
|
|
225
|
+
"""
|
|
226
|
+
data_dir = OSPath.DATA
|
|
227
|
+
dats = (f for f in ilist_fs(data_dir, type_filter='f') if f.endswith('.dat'))
|
|
228
|
+
out = {}
|
|
229
|
+
for dat in dats:
|
|
230
|
+
with open(path_join(data_dir, dat), 'r') as f:
|
|
231
|
+
out[dat] = f.read()
|
|
232
|
+
return out
|
|
233
|
+
|
|
234
|
+
|
|
235
|
+
def makedir(path):
|
|
236
|
+
"""
|
|
237
|
+
Create directory command
|
|
238
|
+
"""
|
|
239
|
+
from uos import mkdir
|
|
240
|
+
try:
|
|
241
|
+
mkdir(path)
|
|
242
|
+
return f"{path} dir created."
|
|
243
|
+
except Exception as e:
|
|
244
|
+
return f"{path} failed to create: {e}"
|
|
245
|
+
|
|
246
|
+
#############################################
|
|
247
|
+
# Legacy features #
|
|
248
|
+
#############################################
|
|
249
|
+
|
|
250
|
+
|
|
251
|
+
@socket_stream
|
|
252
|
+
def listmods(msgobj=None):
|
|
253
|
+
"""
|
|
254
|
+
Load module package manager
|
|
255
|
+
- list all load modules
|
|
256
|
+
"""
|
|
257
|
+
# Dump available LMs
|
|
258
|
+
msg_buf = []
|
|
259
|
+
for k in (res.replace('LM_', '') for res in ilist_fs(path=OSPath.MODULES, type_filter='f', select='LM')):
|
|
260
|
+
if msgobj is None:
|
|
261
|
+
msg_buf.append(f' {k}')
|
|
262
|
+
else:
|
|
263
|
+
msgobj(f' {k}')
|
|
264
|
+
return msg_buf if len(msg_buf) > 0 else ''
|
|
265
|
+
|
|
266
|
+
|
|
267
|
+
@sudo
|
|
268
|
+
def delmod(mod):
|
|
269
|
+
"""
|
|
270
|
+
Module package manager
|
|
271
|
+
:param mod:
|
|
272
|
+
Delete Load Module with full name: module.py or module.mpy
|
|
273
|
+
OR delete any web resource: *.js, *.css, *.html
|
|
274
|
+
"""
|
|
275
|
+
if mod.endswith('py'):
|
|
276
|
+
to_remove = f'LM_{mod}'
|
|
277
|
+
else:
|
|
278
|
+
return f'Invalid {mod}, must ends with .py or .mpy'
|
|
279
|
+
try:
|
|
280
|
+
return remove_file(path_join(OSPath.MODULES, to_remove))
|
|
281
|
+
except Exception as e:
|
|
282
|
+
return f'Cannot delete: {mod}: {e}'
|
|
283
|
+
|
|
284
|
+
|
|
285
|
+
@socket_stream
|
|
286
|
+
def micros_checksum(msgobj=None):
|
|
287
|
+
from hashlib import sha1
|
|
288
|
+
from binascii import hexlify
|
|
289
|
+
from Config import cfgget
|
|
290
|
+
|
|
291
|
+
for f_name in ilist_fs(path=OSPath.MODULES, type_filter='f', select='LM'):
|
|
292
|
+
with open(f_name, 'rb') as f:
|
|
293
|
+
cs = hexlify(sha1(f.read()).digest()).decode('utf-8')
|
|
294
|
+
msgobj(f"{cs} {f_name}")
|
|
295
|
+
# GC collect?
|
|
296
|
+
return f"micrOS version: {cfgget('version')}"
|
|
297
|
+
|
|
298
|
+
|
|
299
|
+
def help(widgets=False):
|
|
300
|
+
"""
|
|
301
|
+
[i] micrOS LM naming convention - built-in help message
|
|
302
|
+
:return tuple:
|
|
303
|
+
(widgets=False) list of functions implemented by this application
|
|
304
|
+
(widgets=True) list of widget json for UI generation
|
|
305
|
+
"""
|
|
306
|
+
return ('listmods', 'delmod mod=<module>.py/.mpy', 'del_duplicates',
|
|
307
|
+
'moduls unload="LM_rgb/None"',
|
|
308
|
+
'cachedump delete=None',
|
|
309
|
+
'datdump',
|
|
310
|
+
# Package commands
|
|
311
|
+
'install url="BxNxM/micrOS/master/toolkit/workspace/precompiled/LM_robustness.py"',
|
|
312
|
+
'uninstall name=None',
|
|
313
|
+
'upgrade name=None',
|
|
314
|
+
# File system commands
|
|
315
|
+
'micros_checksum',
|
|
316
|
+
'ls path="/" content="*/f/d" select="*/LM/IO"',
|
|
317
|
+
'rm <path>',
|
|
318
|
+
'rmdir <path>',
|
|
319
|
+
'dirtree path="/"',
|
|
320
|
+
'makedir <path>')
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
from microIO import
|
|
2
|
-
from Common import SmartADC, micro_task, notify, syslog
|
|
1
|
+
from microIO import bind_pin, pinmap_search
|
|
2
|
+
from Common import SmartADC, micro_task, notify, syslog, exec_cmd
|
|
3
3
|
from utime import ticks_ms
|
|
4
|
-
|
|
5
|
-
import LM_intercon as InterCon
|
|
6
|
-
except:
|
|
7
|
-
InterCon = None
|
|
4
|
+
|
|
8
5
|
|
|
9
6
|
class Data:
|
|
10
7
|
TASK_TAG = 'presence._capture'
|
|
@@ -68,9 +65,9 @@ def __run_intercon(state):
|
|
|
68
65
|
try:
|
|
69
66
|
cmd = Data.ON_INTERCON_CLBK.split()
|
|
70
67
|
host = cmd[0]
|
|
71
|
-
cmd =
|
|
72
|
-
# Send CMD to other device
|
|
73
|
-
|
|
68
|
+
cmd = cmd[1:]
|
|
69
|
+
# Send CMD to other device
|
|
70
|
+
state, _ = exec_cmd(cmd + [f">>{host}"], jsonify=True)
|
|
74
71
|
except Exception as e:
|
|
75
72
|
syslog(f"__run_intercon error: {e}")
|
|
76
73
|
if state.lower() == "off":
|
|
@@ -79,9 +76,9 @@ def __run_intercon(state):
|
|
|
79
76
|
try:
|
|
80
77
|
cmd = Data.OFF_INTERCON_CLBK.split()
|
|
81
78
|
host = cmd[0]
|
|
82
|
-
cmd =
|
|
83
|
-
# Send CMD to other device
|
|
84
|
-
|
|
79
|
+
cmd = cmd[1:]
|
|
80
|
+
# Send CMD to other device
|
|
81
|
+
state, _ = exec_cmd(cmd + [f">>{host}"], jsonify=True)
|
|
85
82
|
except Exception as e:
|
|
86
83
|
syslog(f"__run_intercon error: {e}")
|
|
87
84
|
|
|
@@ -96,7 +93,7 @@ async def __task(ms_period, buff_size):
|
|
|
96
93
|
|
|
97
94
|
if Data.MIC_TYPE == Data.MIC_TYPES['ADC']:
|
|
98
95
|
# Create ADC object
|
|
99
|
-
Data.MIC_ADC = SmartADC.get_instance(
|
|
96
|
+
Data.MIC_ADC = SmartADC.get_instance(bind_pin('mic'))
|
|
100
97
|
elif Data.MIC_TYPE == Data.MIC_TYPES['I2S']:
|
|
101
98
|
if Data.I2S_MIC is None:
|
|
102
99
|
import LM_i2s_mic
|
|
@@ -216,8 +213,7 @@ def motion_trig(sample_ms=15, buff_size=10):
|
|
|
216
213
|
|
|
217
214
|
# [3] Start mic sampling in async task
|
|
218
215
|
# [!] ASYNC TASK CREATION [1*] with async task callback + taskID (TAG) handling
|
|
219
|
-
|
|
220
|
-
return "Starting" if state else "Already running"
|
|
216
|
+
return micro_task(tag=Data.TASK_TAG, task=__task(ms_period=sample_ms, buff_size=buff_size))
|
|
221
217
|
|
|
222
218
|
|
|
223
219
|
def subscribe_intercon(on, off):
|