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
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
class AIOESPNow:
|
|
4
|
+
|
|
5
|
+
def __init__(self):
|
|
6
|
+
self._active = False
|
|
7
|
+
self.peers_table = None
|
|
8
|
+
|
|
9
|
+
def active(self, state=None):
|
|
10
|
+
if state is not None:
|
|
11
|
+
self._active = state
|
|
12
|
+
return self._active
|
|
13
|
+
|
|
14
|
+
def stats(self):
|
|
15
|
+
pass
|
|
16
|
+
|
|
17
|
+
def add_peer(self, mac):
|
|
18
|
+
pass
|
|
19
|
+
|
|
20
|
+
async def asend(self, mac, full_msg):
|
|
21
|
+
pass
|
|
22
|
+
|
|
23
|
+
def send(self, mac, full_msg):
|
|
24
|
+
pass
|
|
25
|
+
|
|
26
|
+
def __iter__(self):
|
|
27
|
+
return (i for i in range(0, 3))
|
|
28
|
+
|
toolkit/simulator_lib/dht.py
CHANGED
|
@@ -1,6 +1,54 @@
|
|
|
1
1
|
|
|
2
2
|
MONO_VLSB = None
|
|
3
|
+
MONO_HMSB = None
|
|
3
4
|
|
|
4
5
|
|
|
5
6
|
class FrameBuffer:
|
|
6
|
-
|
|
7
|
+
|
|
8
|
+
def __init__(self, *args, **kwargs):
|
|
9
|
+
pass
|
|
10
|
+
|
|
11
|
+
def fill(self, color=0):
|
|
12
|
+
pass
|
|
13
|
+
|
|
14
|
+
def show(self):
|
|
15
|
+
pass
|
|
16
|
+
|
|
17
|
+
def write_cmd(self, cmd):
|
|
18
|
+
pass
|
|
19
|
+
|
|
20
|
+
def reset(self):
|
|
21
|
+
pass
|
|
22
|
+
|
|
23
|
+
def poweron(self):
|
|
24
|
+
pass
|
|
25
|
+
|
|
26
|
+
def poweroff(self):
|
|
27
|
+
pass
|
|
28
|
+
|
|
29
|
+
def flip(self, *args, **kwargs):
|
|
30
|
+
pass
|
|
31
|
+
|
|
32
|
+
def rotate(self, *args, **kwargs):
|
|
33
|
+
pass
|
|
34
|
+
|
|
35
|
+
def text(self, string, x, y, color=0):
|
|
36
|
+
pass
|
|
37
|
+
|
|
38
|
+
def pixel(self, x, y, color=0):
|
|
39
|
+
pass
|
|
40
|
+
|
|
41
|
+
def line(self, x0, y0, x1, y1, color=0):
|
|
42
|
+
pass
|
|
43
|
+
|
|
44
|
+
def rect(self, x0, y0, x1, y1, color=0):
|
|
45
|
+
pass
|
|
46
|
+
|
|
47
|
+
def fill_rect(self, x, y, w, h, color=0):
|
|
48
|
+
pass
|
|
49
|
+
|
|
50
|
+
def blit(self, fbuf, x, y, key, palette):
|
|
51
|
+
pass
|
|
52
|
+
|
|
53
|
+
def scroll(self, dx, dy):
|
|
54
|
+
pass
|
toolkit/simulator_lib/machine.py
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
from threading import Thread
|
|
2
2
|
import time
|
|
3
3
|
import micropython
|
|
4
|
-
from
|
|
5
|
-
import sys
|
|
4
|
+
from sim_common import console
|
|
6
5
|
|
|
7
6
|
|
|
8
7
|
def machine(*args, **kwargs):
|
|
@@ -173,6 +172,9 @@ class SoftI2C(I2C):
|
|
|
173
172
|
def __init__(self, scl, sda, freq=None):
|
|
174
173
|
super().__init__(scl, sda, freq)
|
|
175
174
|
|
|
175
|
+
def writevto(self, *args, **kwargs):
|
|
176
|
+
pass
|
|
177
|
+
|
|
176
178
|
|
|
177
179
|
class SoftSPI:
|
|
178
180
|
def __init__(self, sck, mosi, miso):
|
|
@@ -184,12 +186,21 @@ class UART:
|
|
|
184
186
|
def __init__(self, pin, baudrate, tx, rx, timeout=1):
|
|
185
187
|
pass
|
|
186
188
|
|
|
189
|
+
def init(self, *args, **kwargs):
|
|
190
|
+
pass
|
|
191
|
+
|
|
192
|
+
def deinit(self):
|
|
193
|
+
pass
|
|
194
|
+
|
|
187
195
|
def write(self, frame):
|
|
188
196
|
pass
|
|
189
197
|
|
|
190
198
|
def read(self, *args, **kwargs):
|
|
191
199
|
pass
|
|
192
200
|
|
|
201
|
+
def any(self):
|
|
202
|
+
return False
|
|
203
|
+
|
|
193
204
|
def freq(*args, **kwargs):
|
|
194
205
|
return 1
|
|
195
206
|
|
|
@@ -214,3 +225,7 @@ def unique_id():
|
|
|
214
225
|
|
|
215
226
|
def time_pulse_us():
|
|
216
227
|
return time.time_ns()*1000
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
def SDCard():
|
|
231
|
+
pass
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from
|
|
1
|
+
from sim_common import console
|
|
2
2
|
try:
|
|
3
3
|
import resource
|
|
4
4
|
except Exception as e:
|
|
@@ -25,8 +25,8 @@ def mem_info(*args, **kwargs):
|
|
|
25
25
|
return total_heap, used_heap, free_heap
|
|
26
26
|
|
|
27
27
|
|
|
28
|
-
def const(
|
|
29
|
-
return
|
|
28
|
+
def const(arg):
|
|
29
|
+
return arg
|
|
30
30
|
|
|
31
31
|
|
|
32
32
|
def schedule(callback, arg):
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
|
|
3
|
+
try:
|
|
4
|
+
from sim_common import console
|
|
5
|
+
except:
|
|
6
|
+
console = print
|
|
7
|
+
from pathlib import Path
|
|
8
|
+
from urllib.parse import urlparse
|
|
9
|
+
from urllib.request import urlopen, Request
|
|
10
|
+
import json
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def _guess_url_is_file(url):
|
|
14
|
+
|
|
15
|
+
# 1. URL path contains a filename-like pattern
|
|
16
|
+
url_content = Path(urlparse(url).path).name
|
|
17
|
+
if "." in url_content:
|
|
18
|
+
return True
|
|
19
|
+
|
|
20
|
+
# 2. HEAD request content-type
|
|
21
|
+
try:
|
|
22
|
+
with urlopen(Request(url, method="HEAD")) as resp:
|
|
23
|
+
ctype = resp.headers.get("Content-Type", "")
|
|
24
|
+
if not ctype.startswith("text/html"):
|
|
25
|
+
return True
|
|
26
|
+
except Exception as e:
|
|
27
|
+
if "404" in str(e) or "400" in str(e):
|
|
28
|
+
return False
|
|
29
|
+
|
|
30
|
+
# 4. GET small chunk and detect HTML
|
|
31
|
+
try:
|
|
32
|
+
with urlopen(url) as resp:
|
|
33
|
+
chunk = resp.read(256).lower()
|
|
34
|
+
if b"<html" in chunk:
|
|
35
|
+
return False
|
|
36
|
+
except:
|
|
37
|
+
pass
|
|
38
|
+
|
|
39
|
+
# last fallback: treat as file if unsure
|
|
40
|
+
return True
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def _url_file_content(url):
|
|
44
|
+
data = ""
|
|
45
|
+
try:
|
|
46
|
+
with urlopen(url) as resp:
|
|
47
|
+
data = resp.read()
|
|
48
|
+
except Exception as e:
|
|
49
|
+
print()
|
|
50
|
+
console(f"❌ Failed to read {url}: {e}")
|
|
51
|
+
return data
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
def _save_file(path, data):
|
|
55
|
+
try:
|
|
56
|
+
# Write as binary
|
|
57
|
+
with open(path, "wb") as f:
|
|
58
|
+
f.write(data)
|
|
59
|
+
print(f"✅ Saved {path.parent.name}/{path.name}")
|
|
60
|
+
return True
|
|
61
|
+
except Exception as e:
|
|
62
|
+
console(f"Failed to save {path}: {e}")
|
|
63
|
+
return False
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
def _github_to_url(ref, branch="master"):
|
|
67
|
+
if ref.startswith("github"):
|
|
68
|
+
"""
|
|
69
|
+
Convert: github:peterhinch/micropython-mqtt
|
|
70
|
+
https://raw.githubusercontent.com/peterhinch/micropython-mqtt/refs/heads/master/mqtt_as/clean.py
|
|
71
|
+
To: https://raw.githubusercontent.com/peterhinch/micropython-mqtt/refs/heads/master/XXX
|
|
72
|
+
"""
|
|
73
|
+
base_github_url = "https://raw.githubusercontent.com"
|
|
74
|
+
_parts = ref.split("/")
|
|
75
|
+
user = _parts[0].split(":")[-1]
|
|
76
|
+
repo = _parts[1]
|
|
77
|
+
file_path = "/".join(_parts[2:])
|
|
78
|
+
branch = f"refs/heads/{branch}"
|
|
79
|
+
if "." in file_path:
|
|
80
|
+
# File mode - Build raw URL
|
|
81
|
+
ref = f"{base_github_url}/{user}/{repo}/{branch}/{file_path}"
|
|
82
|
+
else:
|
|
83
|
+
# Folder mode - Build raw URL
|
|
84
|
+
ref = f"{base_github_url}/{user}/{repo}/{branch}/{file_path}"
|
|
85
|
+
return ref
|
|
86
|
+
return None
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
def _mip_emu(ref, target:Path=Path("lib"), version:str="master"):
|
|
90
|
+
"""
|
|
91
|
+
Tiny simulation of MicroPython's mip.install for normal Python.
|
|
92
|
+
"""
|
|
93
|
+
installed = []
|
|
94
|
+
|
|
95
|
+
if isinstance(ref, str) and (ref.startswith("http") or ref.startswith("github")):
|
|
96
|
+
|
|
97
|
+
if ref.startswith("github"):
|
|
98
|
+
url = _github_to_url(ref, branch=version)
|
|
99
|
+
if url is None:
|
|
100
|
+
console(f"Invalid GitHub URL: {ref}")
|
|
101
|
+
return []
|
|
102
|
+
else:
|
|
103
|
+
url = ref
|
|
104
|
+
dest = target / Path(urlparse(url).path).name
|
|
105
|
+
|
|
106
|
+
if not _guess_url_is_file(url):
|
|
107
|
+
# Folder mode, redirect to package.json
|
|
108
|
+
url = f"{url.rstrip('/')}/package.json"
|
|
109
|
+
dest = target / Path(urlparse(url).path).name
|
|
110
|
+
console(f"Patch url (dir) to point to package.json: {url}")
|
|
111
|
+
try:
|
|
112
|
+
# File mode
|
|
113
|
+
print(f"🔻 Downloading {url} to {dest}", end="")
|
|
114
|
+
data = _url_file_content(url)
|
|
115
|
+
print(f" ({len(data)} bytes)")
|
|
116
|
+
except Exception as e:
|
|
117
|
+
console(f"❌ Failed to read {url}: {e}")
|
|
118
|
+
return []
|
|
119
|
+
|
|
120
|
+
if url.endswith("package.json"):
|
|
121
|
+
# Install based on package.json content
|
|
122
|
+
package_json_data = json.loads(data)
|
|
123
|
+
package_urls = package_json_data.get("urls", [])
|
|
124
|
+
for file_url in package_urls:
|
|
125
|
+
pack_source_file = file_url[1]
|
|
126
|
+
if pack_source_file.startswith("github"):
|
|
127
|
+
pack_source_file = _github_to_url(pack_source_file, branch=version)
|
|
128
|
+
pack_dest_file = Path(file_url[0])
|
|
129
|
+
pack_dest_dir = target / pack_dest_file.parent
|
|
130
|
+
pack_dest_dir.mkdir(parents=True, exist_ok=True)
|
|
131
|
+
pack_dest_file = pack_dest_dir / pack_dest_file.name
|
|
132
|
+
print(f"File download: {pack_source_file} -> {pack_dest_file}")
|
|
133
|
+
data = _url_file_content(pack_source_file)
|
|
134
|
+
if data:
|
|
135
|
+
if _save_file(pack_dest_file, data):
|
|
136
|
+
installed.append(pack_dest_dir.name)
|
|
137
|
+
else:
|
|
138
|
+
if data:
|
|
139
|
+
# Install based on file content - save url body to file
|
|
140
|
+
if _save_file(dest, data):
|
|
141
|
+
installed.append(dest.name)
|
|
142
|
+
return installed
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
def _dump_dir_content(target):
|
|
146
|
+
# Dump content
|
|
147
|
+
base_path = str(target.parent)
|
|
148
|
+
for item in target.iterdir():
|
|
149
|
+
print(f" 🗂️ {str(item).replace(base_path, '')}")
|
|
150
|
+
if item.is_dir():
|
|
151
|
+
for subitem in item.iterdir():
|
|
152
|
+
print(f" {str(subitem).replace(base_path, '')}")
|
|
153
|
+
print("")
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
def install(ref, **kwargs):
|
|
157
|
+
target = kwargs.get("target", Path.cwd() / "lib")
|
|
158
|
+
version = kwargs.get("version", "master")
|
|
159
|
+
console(f">>> mip install: {ref} {kwargs}")
|
|
160
|
+
if isinstance(target, str):
|
|
161
|
+
target = Path(target)
|
|
162
|
+
# Run mip emulation
|
|
163
|
+
_mip_emu(ref, target=target, version=version)
|
|
164
|
+
# Dump content
|
|
165
|
+
_dump_dir_content(target)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
from sim_common import console
|
|
2
2
|
|
|
3
3
|
class NeoPixel:
|
|
4
4
|
__instance = None
|
|
@@ -17,9 +17,10 @@ class NeoPixel:
|
|
|
17
17
|
return cls.__pix_list[key]
|
|
18
18
|
|
|
19
19
|
def __setitem__(cls, key, value):
|
|
20
|
+
console(f"Update NeoPixel at index {key} to {value}")
|
|
20
21
|
cls.__pix_list[key] = value
|
|
21
22
|
|
|
22
23
|
def write(cls):
|
|
23
|
-
|
|
24
|
+
console(f"Neopixel write: {cls.__pix_list}")
|
|
24
25
|
|
|
25
26
|
|
toolkit/simulator_lib/network.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from
|
|
1
|
+
from sim_common import console
|
|
2
2
|
import socket
|
|
3
3
|
|
|
4
4
|
AP_IF = "DUMMY_AP_IF"
|
|
@@ -45,6 +45,7 @@ class WLAN:
|
|
|
45
45
|
self.__config_dict[key] = value
|
|
46
46
|
for key in args:
|
|
47
47
|
return self.__config_dict.get(key, None)
|
|
48
|
+
return None
|
|
48
49
|
|
|
49
50
|
def ifconfig(self, addr_tuple=None):
|
|
50
51
|
console("Local server IP: {}".format(self.__get_machine_ip()))
|
|
@@ -2,6 +2,5 @@
|
|
|
2
2
|
"devfid": "simulator",
|
|
3
3
|
"appwd": "ADmin123",
|
|
4
4
|
"webui": true,
|
|
5
|
-
"boothook": "
|
|
6
|
-
"aioqueue": 4
|
|
7
|
-
"telegram": "6185435843:AAH71wEyoOil8bRKecQHp4zazTQ_MmE7bvE"}
|
|
5
|
+
"boothook": "web load dashboard=True fileserver=True fs_explore=True; fileserver mounts_write_access modules=True logs=True pwd=$pwd; neopixel load; #telegram load '6185435843:AAH71wEyoOil8bRKecQHp4zazTQ_MmE7bvE' &; #telegram receiver_loop &2000",
|
|
6
|
+
"aioqueue": 4}
|
toolkit/simulator_lib/ntptime.py
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import sys
|
|
2
2
|
import os
|
|
3
|
-
|
|
4
|
-
#DEV_ENV_DIR = os.path.dirname(MYPATH)
|
|
5
|
-
#sys.path.append(DEV_ENV_DIR)
|
|
3
|
+
import time
|
|
6
4
|
|
|
7
5
|
print("Module [sim_console] path: {} __package__: {} __name__: {}".format(sys.path[0], __package__, __name__))
|
|
8
6
|
|
|
@@ -16,6 +14,7 @@ except Exception as e:
|
|
|
16
14
|
print("TerminalColors import error: {}".format(e))
|
|
17
15
|
Colors = None
|
|
18
16
|
|
|
17
|
+
|
|
19
18
|
def console(msg, end='\n', skip_tmp_msgs=True):
|
|
20
19
|
if end == '\r' and skip_tmp_msgs:
|
|
21
20
|
return
|
toolkit/simulator_lib/simgc.py
CHANGED
|
@@ -6,6 +6,10 @@ except Exception as e:
|
|
|
6
6
|
|
|
7
7
|
MEM_BASELOAD = None
|
|
8
8
|
|
|
9
|
+
class MockMemory:
|
|
10
|
+
USED = 200_000 # 200 kb default memory usage
|
|
11
|
+
FREE = 1000_000 # 1 Mb default free memory
|
|
12
|
+
|
|
9
13
|
def _get_memory_usage():
|
|
10
14
|
global MEM_BASELOAD
|
|
11
15
|
if psutil:
|
|
@@ -16,7 +20,7 @@ def _get_memory_usage():
|
|
|
16
20
|
if MEM_BASELOAD is None:
|
|
17
21
|
MEM_BASELOAD = 0
|
|
18
22
|
return memory_usage_bytes - MEM_BASELOAD
|
|
19
|
-
return
|
|
23
|
+
return MockMemory.USED
|
|
20
24
|
|
|
21
25
|
|
|
22
26
|
MEM_BASELOAD = _get_memory_usage() # HACK: GET MEM BASELOAD - CLOSEST TO REALITY - GET REAL MICROS MEM USAGE
|
|
@@ -28,7 +32,7 @@ def _get_free_memory():
|
|
|
28
32
|
# Free memory in bytes
|
|
29
33
|
free_memory_bytes = virtual_memory.available
|
|
30
34
|
return free_memory_bytes
|
|
31
|
-
return
|
|
35
|
+
return MockMemory.FREE
|
|
32
36
|
|
|
33
37
|
|
|
34
38
|
def mem_free(*args, **kwargs):
|
|
@@ -4,24 +4,58 @@ import multiprocessing
|
|
|
4
4
|
import time
|
|
5
5
|
import copy
|
|
6
6
|
import json
|
|
7
|
+
from pathlib import Path
|
|
7
8
|
|
|
8
9
|
MYPATH = os.path.dirname(__file__)
|
|
9
10
|
SIM_PATH = os.path.join(MYPATH, '../workspace/simulator')
|
|
10
|
-
|
|
11
|
-
sys.path.insert(0,
|
|
12
|
-
|
|
11
|
+
PACKAGES_PATH = os.path.join(MYPATH, '../../micrOS/packages/')
|
|
12
|
+
sys.path.insert(0, SIM_PATH) # Add Sim to path
|
|
13
|
+
sys.path.append(os.path.join(MYPATH, '../lib')) # Add devtoolkit/lib to path
|
|
14
|
+
from sim_common import console
|
|
13
15
|
import micrOSloader
|
|
14
16
|
import LocalMachine
|
|
17
|
+
if os.path.exists(PACKAGES_PATH):
|
|
18
|
+
sys.path.append(PACKAGES_PATH)
|
|
19
|
+
try:
|
|
20
|
+
import _tools.unpack as package_unpack
|
|
21
|
+
except ImportError:
|
|
22
|
+
print(f"[WARNING] Import error Packages._tools: {PACKAGES_PATH}")
|
|
23
|
+
package_unpack = None
|
|
24
|
+
else:
|
|
25
|
+
print(f"[WARNING] No Packages._tools available: {PACKAGES_PATH}")
|
|
26
|
+
package_unpack = None
|
|
15
27
|
|
|
28
|
+
# Enable/Disable Simulator Config and Packages import
|
|
16
29
|
ENABLE_SIM_CONFIG = True
|
|
30
|
+
ENABLE_SIM_PACKAGES = True
|
|
31
|
+
EXTERNAL_LOAD_MODULES_FROM_PACKAGES = []
|
|
17
32
|
|
|
18
33
|
|
|
19
|
-
def
|
|
34
|
+
def apply_sim_patch():
|
|
35
|
+
"""
|
|
36
|
+
Apply Config and more
|
|
37
|
+
"""
|
|
38
|
+
global EXTERNAL_LOAD_MODULES_FROM_PACKAGES
|
|
39
|
+
|
|
40
|
+
# APPLY SIM CONFIG - for testing: enable webui, etc...
|
|
20
41
|
if ENABLE_SIM_CONFIG:
|
|
21
42
|
print("Copy SIM config - for testing: enable webui, etc.")
|
|
22
43
|
sim_config = os.path.join(MYPATH, 'node_config.json')
|
|
23
44
|
LocalMachine.FileHandler().copy(sim_config, os.path.join(SIM_PATH))
|
|
24
45
|
|
|
46
|
+
if ENABLE_SIM_PACKAGES and package_unpack is not None:
|
|
47
|
+
overwritten_files, ext_load_module = package_unpack.unpack_all(Path(SIM_PATH))
|
|
48
|
+
for mod in overwritten_files:
|
|
49
|
+
print(f"\t⚠️ [SIM][UNPACK] Overwritten file from packages submodule: {mod}")
|
|
50
|
+
EXTERNAL_LOAD_MODULES_FROM_PACKAGES = [elm.lstrip("LM_").split(".")[0] for elm in ext_load_module if elm.startswith("LM_")]
|
|
51
|
+
# Time module patch - extend with basic micropython utime features for micrOS Simulator
|
|
52
|
+
import utime
|
|
53
|
+
time.ticks_ms = utime.ticks_ms
|
|
54
|
+
time.ticks_diff = utime.ticks_diff
|
|
55
|
+
#sys.modules['time'] = time
|
|
56
|
+
else:
|
|
57
|
+
print("⚠️ [SIM][UNPACK] Package unpacking disabled or package_unpack module not available.")
|
|
58
|
+
|
|
25
59
|
|
|
26
60
|
class micrOSIM():
|
|
27
61
|
SIM_PROCESS_LIST = []
|
|
@@ -29,6 +63,7 @@ class micrOSIM():
|
|
|
29
63
|
def __init__(self, doc_resolve=False):
|
|
30
64
|
if doc_resolve:
|
|
31
65
|
console("[micrOSIM] Create micrOS LM doc (env proc)")
|
|
66
|
+
self._init_sim_doc_resolve()
|
|
32
67
|
# json_structure, html_structure
|
|
33
68
|
self.doc_output = (None, None)
|
|
34
69
|
else:
|
|
@@ -38,7 +73,20 @@ class micrOSIM():
|
|
|
38
73
|
self.pid = None
|
|
39
74
|
micrOSIM.SIM_PROCESS_LIST.append(self.process)
|
|
40
75
|
|
|
76
|
+
def _init_sim_doc_resolve(self):
|
|
77
|
+
"""
|
|
78
|
+
Init micrOS in simulator - folder structure creation
|
|
79
|
+
"""
|
|
80
|
+
apply_sim_patch()
|
|
81
|
+
sim_path = LocalMachine.SimplePopPushd()
|
|
82
|
+
sim_path.pushd(SIM_PATH)
|
|
83
|
+
import micrOS # Init micrOS - DO NOT REMOVE
|
|
84
|
+
sim_path.popd()
|
|
85
|
+
|
|
41
86
|
def micrOS_sim_worker(self, trace=False):
|
|
87
|
+
"""
|
|
88
|
+
Start micrOS in python simulator
|
|
89
|
+
"""
|
|
42
90
|
sim_path = LocalMachine.SimplePopPushd()
|
|
43
91
|
sim_path.pushd(SIM_PATH)
|
|
44
92
|
console("[micrOSIM] Start micrOS loader in: {}".format(SIM_PATH))
|
|
@@ -58,7 +106,7 @@ class micrOSIM():
|
|
|
58
106
|
# Trace handling - DEBUG
|
|
59
107
|
sys.settrace(trace_func)
|
|
60
108
|
|
|
61
|
-
|
|
109
|
+
apply_sim_patch()
|
|
62
110
|
micrOSloader.main()
|
|
63
111
|
|
|
64
112
|
console("[micrOSIM] Stop micrOS ({})".format(SIM_PATH))
|
|
@@ -102,14 +150,77 @@ class micrOSIM():
|
|
|
102
150
|
console("[micrOSIM] Proc was finished: {}/{}".format(i+1, proc_len))
|
|
103
151
|
micrOSIM.SIM_PROCESS_LIST = []
|
|
104
152
|
|
|
153
|
+
@staticmethod
|
|
154
|
+
def _lm_doc_builder(mod, func_dict, structure, structure_to_html):
|
|
155
|
+
# Embed img url to table - module level
|
|
156
|
+
img_url = structure[mod]['img']
|
|
157
|
+
structure_to_html[mod]['img'] = f'<img src="{img_url}" alt="{mod}" height=150>'
|
|
158
|
+
# Parse function doc strings
|
|
159
|
+
for func in func_dict:
|
|
160
|
+
# -- Skip functions --
|
|
161
|
+
if not isinstance(structure[mod][func], dict):
|
|
162
|
+
continue
|
|
163
|
+
# -- Skip functions --
|
|
164
|
+
|
|
165
|
+
console(f"[micrOSIM][Extract doc-str] LM_{mod}.{func}.__doc__")
|
|
166
|
+
try:
|
|
167
|
+
# Get function doc string
|
|
168
|
+
exec(f"from modules import LM_{mod}")
|
|
169
|
+
doc_str = eval(f"LM_{mod}.{func}.__doc__")
|
|
170
|
+
# Get function pin map
|
|
171
|
+
if func == 'pinmap':
|
|
172
|
+
# Get module pin map - module level
|
|
173
|
+
console(f"[micrOSIM][Extract pin map tokens] LM_{mod}.pinmap()")
|
|
174
|
+
try:
|
|
175
|
+
mod_pinmap = eval(f"LM_{mod}.pinmap()")
|
|
176
|
+
if mod_pinmap is not None:
|
|
177
|
+
mod_pinmap = ', '.join(dict(mod_pinmap).keys())
|
|
178
|
+
mod_pinmap = f"\npin map: {mod_pinmap}"
|
|
179
|
+
except:
|
|
180
|
+
mod_pinmap = ''
|
|
181
|
+
# Add pinmap to doc string of pinmap() function
|
|
182
|
+
doc_str = "" if doc_str is None else doc_str
|
|
183
|
+
doc_str += mod_pinmap
|
|
184
|
+
if func == 'help':
|
|
185
|
+
console(f"[micrOSIM][Render widgets from help] LM_{mod}.help(True)")
|
|
186
|
+
if f"{mod}" in EXTERNAL_LOAD_MODULES_FROM_PACKAGES:
|
|
187
|
+
mod_help = f"\n\tEXTERNAL PACKAGE: https://github.com/BxNxM/micrOSPackages"
|
|
188
|
+
else:
|
|
189
|
+
mod_help = ""
|
|
190
|
+
mod_help += f"\n[i] micrOS Widget Types:"
|
|
191
|
+
try:
|
|
192
|
+
widgets_help = eval(f"LM_{mod}.help(True)")
|
|
193
|
+
if widgets_help is not None and isinstance(widgets_help, tuple):
|
|
194
|
+
for widget in widgets_help:
|
|
195
|
+
widget = json.loads(widget)
|
|
196
|
+
mod_help += f"\n\t{widget}"
|
|
197
|
+
except:
|
|
198
|
+
mod_help += '\n\tN/A'
|
|
199
|
+
# Add help renderes widgets to doc string
|
|
200
|
+
doc_str = "" if doc_str is None else doc_str
|
|
201
|
+
doc_str += mod_help
|
|
202
|
+
except Exception as e:
|
|
203
|
+
doc_str = str(e)
|
|
204
|
+
# Update structure with doc-str
|
|
205
|
+
structure[mod][func]['doc'] = doc_str
|
|
206
|
+
structure_to_html[mod][func]['doc'] = 'No doc string available' if doc_str is None else doc_str.strip() \
|
|
207
|
+
.replace('\n', '<br>\n').replace(' ', ' ')
|
|
208
|
+
# Remove empty param(s) cells
|
|
209
|
+
param_cell = structure_to_html[mod][func].get('param(s)', None)
|
|
210
|
+
if param_cell is not None and len(param_cell.strip()) == 0:
|
|
211
|
+
structure_to_html[mod][func].pop('param(s)')
|
|
212
|
+
|
|
213
|
+
|
|
105
214
|
def _lm_doc_strings(self, structure):
|
|
106
215
|
"""
|
|
107
216
|
Collect function doc strings and module logical pins (pin map)
|
|
108
|
-
Create
|
|
109
|
-
- html
|
|
110
|
-
- json raw
|
|
217
|
+
Create 4 dict structures adding docstring
|
|
218
|
+
- html json + raw json for built-in modules
|
|
219
|
+
- html json + raw json for external (installable packages) modules
|
|
111
220
|
"""
|
|
112
221
|
structure_to_html = copy.deepcopy(structure)
|
|
222
|
+
structure_ext_to_html = copy.deepcopy(structure)
|
|
223
|
+
structure_external = copy.deepcopy(structure)
|
|
113
224
|
|
|
114
225
|
# Step into workspace path
|
|
115
226
|
popd = LocalMachine.SimplePopPushd()
|
|
@@ -118,60 +229,27 @@ class micrOSIM():
|
|
|
118
229
|
# Based on created module-function structure collect doc strings
|
|
119
230
|
for mod, func_dict in structure.items():
|
|
120
231
|
# Embed img url to table - module level
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
#
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
console(f"[micrOSIM][Extract pin map tokens] LM_{mod}.pinmap()")
|
|
139
|
-
try:
|
|
140
|
-
mod_pinmap = eval(f"LM_{mod}.pinmap()")
|
|
141
|
-
if mod_pinmap is not None:
|
|
142
|
-
mod_pinmap = ', '.join(dict(mod_pinmap).keys())
|
|
143
|
-
mod_pinmap = f"\npin map: {mod_pinmap}"
|
|
144
|
-
except:
|
|
145
|
-
mod_pinmap = ''
|
|
146
|
-
# Add pinmap to doc string of pinmap() function
|
|
147
|
-
doc_str += mod_pinmap
|
|
148
|
-
if func == 'help':
|
|
149
|
-
console(f"[micrOSIM][Render widgets from help] LM_{mod}.help(True)")
|
|
150
|
-
mod_help = f"\n[i] micrOS Widget Types:"
|
|
151
|
-
try:
|
|
152
|
-
widgets_help = eval(f"LM_{mod}.help(True)")
|
|
153
|
-
if widgets_help is not None and isinstance(widgets_help, tuple):
|
|
154
|
-
for widget in widgets_help:
|
|
155
|
-
widget = json.loads(widget)
|
|
156
|
-
mod_help += f"\n\t{widget}"
|
|
157
|
-
except:
|
|
158
|
-
mod_help += '\n\tN/A'
|
|
159
|
-
# Add help renderes widgets to doc string
|
|
160
|
-
doc_str += mod_help
|
|
161
|
-
except Exception as e:
|
|
162
|
-
doc_str = str(e)
|
|
163
|
-
# Update structure with doc-str
|
|
164
|
-
structure[mod][func]['doc'] = doc_str
|
|
165
|
-
structure_to_html[mod][func]['doc'] = 'No doc string available' if doc_str is None else doc_str.strip()\
|
|
166
|
-
.replace('\n', '<br>\n').replace(' ', ' ')
|
|
167
|
-
# Remove empty param(s) cells
|
|
168
|
-
param_cell = structure_to_html[mod][func].get('param(s)', None)
|
|
169
|
-
if param_cell is not None and len(param_cell.strip()) == 0:
|
|
170
|
-
structure_to_html[mod][func].pop('param(s)')
|
|
232
|
+
if mod in EXTERNAL_LOAD_MODULES_FROM_PACKAGES:
|
|
233
|
+
# EXTERNAL MODULE STRUCTURE
|
|
234
|
+
self._lm_doc_builder(mod, func_dict, structure_external, structure_ext_to_html)
|
|
235
|
+
else:
|
|
236
|
+
# BUILT-IN MODULE STRUCTURE
|
|
237
|
+
self._lm_doc_builder(mod, func_dict, structure, structure_to_html)
|
|
238
|
+
# CLEANUP DUPLICATES:
|
|
239
|
+
for mod, func_dict in structure_external.items():
|
|
240
|
+
if mod in EXTERNAL_LOAD_MODULES_FROM_PACKAGES:
|
|
241
|
+
# Remove mod from built-ins
|
|
242
|
+
del structure[mod]
|
|
243
|
+
del structure_to_html[mod]
|
|
244
|
+
for mod, func_dict in structure.items():
|
|
245
|
+
if mod not in EXTERNAL_LOAD_MODULES_FROM_PACKAGES:
|
|
246
|
+
# Remove mod from external packages
|
|
247
|
+
del structure_external[mod]
|
|
248
|
+
del structure_ext_to_html[mod]
|
|
171
249
|
|
|
172
250
|
# restore path
|
|
173
251
|
popd.popd()
|
|
174
|
-
self.doc_output = (structure, structure_to_html)
|
|
252
|
+
self.doc_output = (structure, structure_to_html, structure_external, structure_ext_to_html)
|
|
175
253
|
|
|
176
254
|
def gen_lm_doc_json_html(self, structure):
|
|
177
255
|
try:
|