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,204 @@
|
|
|
1
|
+
"""
|
|
2
|
+
A simple driver for the QMI8658 IMU.
|
|
3
|
+
https://github.com/echo-lalia/qmi8658-micropython/blob/main/qmi8685.py
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
import struct
|
|
7
|
+
import time
|
|
8
|
+
from machine import Pin, I2C
|
|
9
|
+
from micropython import const
|
|
10
|
+
from microIO import bind_pin, pinmap_search
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
# Sensor constants
|
|
14
|
+
_QMI8685_PARTID = const(0x05)
|
|
15
|
+
_REG_PARTID = const(0x00)
|
|
16
|
+
_REG_REVISION = const(0x01)
|
|
17
|
+
|
|
18
|
+
_REG_CTRL1 = const(0x02) # Serial interface and sensor enable
|
|
19
|
+
_REG_CTRL2 = const(0x03) # Accelerometer settings
|
|
20
|
+
_REG_CTRL3 = const(0x04) # Gyroscope settings
|
|
21
|
+
_REG_CTRL4 = const(0x05) # Magnetomer settings (support not implemented in this driver yet)
|
|
22
|
+
_REG_CTRL5 = const(0x06) # Sensor data processing settings
|
|
23
|
+
_REG_CTRL6 = const(0x07) # Attitude Engine ODR and Motion on Demand
|
|
24
|
+
_REG_CTRL7 = const(0x08) # Enable Sensors and Configure Data Reads
|
|
25
|
+
|
|
26
|
+
_REG_TEMP = const(0x33) # Temperature sensor.
|
|
27
|
+
|
|
28
|
+
_REG_AX_L = const(0x35) # Read accelerometer
|
|
29
|
+
_REG_AX_H = const(0x36)
|
|
30
|
+
_REG_AY_L = const(0x37)
|
|
31
|
+
_REG_AY_H = const(0x38)
|
|
32
|
+
_REG_AZ_L = const(0x39)
|
|
33
|
+
_REG_AZ_H = const(0x3A)
|
|
34
|
+
|
|
35
|
+
_REG_GX_L = const(0x3B) # read gyro
|
|
36
|
+
_REG_GX_H = const(0x3C)
|
|
37
|
+
_REG_GY_L = const(0x3D)
|
|
38
|
+
_REG_GY_H = const(0x3E)
|
|
39
|
+
_REG_GZ_L = const(0x3F)
|
|
40
|
+
_REG_GZ_H = const(0x40)
|
|
41
|
+
|
|
42
|
+
_QMI8658_I2CADDR_DEFAULT = const(0X6B)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
_ACCELSCALE_RANGE_2G = const(0b00)
|
|
46
|
+
_ACCELSCALE_RANGE_4G = const(0b01)
|
|
47
|
+
_ACCELSCALE_RANGE_8G = const(0b10)
|
|
48
|
+
_ACCELSCALE_RANGE_16G = const(0b11)
|
|
49
|
+
|
|
50
|
+
_GYROSCALE_RANGE_16DPS = const(0b000)
|
|
51
|
+
_GYROSCALE_RANGE_32DPS = const(0b001)
|
|
52
|
+
_GYROSCALE_RANGE_64DPS = const(0b010)
|
|
53
|
+
_GYROSCALE_RANGE_128DPS = const(0b011)
|
|
54
|
+
_GYROSCALE_RANGE_256DPS = const(0b100)
|
|
55
|
+
_GYROSCALE_RANGE_512DPS = const(0b101)
|
|
56
|
+
_GYROSCALE_RANGE_1024DPS = const(0b110)
|
|
57
|
+
_GYROSCALE_RANGE_2048DPS = const(0b111)
|
|
58
|
+
|
|
59
|
+
_ODR_8000HZ = const(0b0000)
|
|
60
|
+
_ODR_4000HZ = const(0b0001)
|
|
61
|
+
_ODR_2000HZ = const(0b0010)
|
|
62
|
+
_ODR_1000HZ = const(0b0011)
|
|
63
|
+
_ODR_500HZ = const(0b0100)
|
|
64
|
+
_ODR_250HZ = const(0b0101)
|
|
65
|
+
_ODR_125HZ = const(0b0110)
|
|
66
|
+
_ODR_62_5HZ = const(0b0111)
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
class QMI8658:
|
|
70
|
+
"""QMI8658 inertial measurement unit."""
|
|
71
|
+
INSTANCE = None
|
|
72
|
+
|
|
73
|
+
def __init__(
|
|
74
|
+
self,
|
|
75
|
+
i2c_bus: I2C,
|
|
76
|
+
address: int = _QMI8658_I2CADDR_DEFAULT,
|
|
77
|
+
accel_scale: int = _ACCELSCALE_RANGE_8G,
|
|
78
|
+
gyro_scale: int = _GYROSCALE_RANGE_256DPS):
|
|
79
|
+
"""Read from a sensor on the given I2C bus, at the given address."""
|
|
80
|
+
self.i2c = i2c_bus
|
|
81
|
+
self.address = address
|
|
82
|
+
# Cache the sensor instance globally for easy access
|
|
83
|
+
QMI8658.INSTANCE = self
|
|
84
|
+
|
|
85
|
+
# Verify sensor part ID
|
|
86
|
+
if self._read_u8(_REG_PARTID) != _QMI8685_PARTID:
|
|
87
|
+
raise AttributeError("Cannot find a QMI8658")
|
|
88
|
+
|
|
89
|
+
# Setup initial configuration
|
|
90
|
+
self._configure_sensor(accel_scale, gyro_scale)
|
|
91
|
+
|
|
92
|
+
# Configure scales/divisors for the driver
|
|
93
|
+
self.acc_scale_divisor = {
|
|
94
|
+
_ACCELSCALE_RANGE_2G: 1 << 14,
|
|
95
|
+
_ACCELSCALE_RANGE_4G: 1 << 13,
|
|
96
|
+
_ACCELSCALE_RANGE_8G: 1 << 12,
|
|
97
|
+
_ACCELSCALE_RANGE_16G: 1 << 11,
|
|
98
|
+
}[accel_scale]
|
|
99
|
+
|
|
100
|
+
self.gyro_scale_divisor = {
|
|
101
|
+
_GYROSCALE_RANGE_16DPS: 2048,
|
|
102
|
+
_GYROSCALE_RANGE_32DPS: 1024,
|
|
103
|
+
_GYROSCALE_RANGE_64DPS: 512,
|
|
104
|
+
_GYROSCALE_RANGE_128DPS: 256,
|
|
105
|
+
_GYROSCALE_RANGE_256DPS: 128,
|
|
106
|
+
_GYROSCALE_RANGE_512DPS: 64,
|
|
107
|
+
_GYROSCALE_RANGE_1024DPS: 32,
|
|
108
|
+
_GYROSCALE_RANGE_2048DPS: 16,
|
|
109
|
+
}[gyro_scale]
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
def _configure_sensor(self, accel_scale: int, gyro_scale: int):
|
|
113
|
+
# Initialize accelerometer and gyroscope settings
|
|
114
|
+
self._write_u8(_REG_CTRL1, 0x60) # Set SPI auto increment and big endian (Ctrl 1)
|
|
115
|
+
self._write_u8(_REG_CTRL2, (accel_scale << 4) | _ODR_1000HZ) # Accel Config
|
|
116
|
+
self._write_u8(_REG_CTRL3, (gyro_scale << 4) | _ODR_1000HZ) # Gyro Config
|
|
117
|
+
self._write_u8(_REG_CTRL5, 0x01) # Low-pass filter enable
|
|
118
|
+
self._write_u8(_REG_CTRL7, 0x03) # Enable accel and gyro
|
|
119
|
+
time.sleep_ms(100)
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
# Helper functions for register operations
|
|
123
|
+
def _read_u8(self, reg:int) -> int:
|
|
124
|
+
return self.i2c.readfrom_mem(self.address, reg, 1)[0]
|
|
125
|
+
|
|
126
|
+
def _read_xyz(self, reg:int) -> tuple[int, int, int]:
|
|
127
|
+
data = self.i2c.readfrom_mem(self.address, reg, 6)
|
|
128
|
+
return struct.unpack('<hhh', data)
|
|
129
|
+
|
|
130
|
+
def _write_u8(self, reg: int, value: int):
|
|
131
|
+
self.i2c.writeto_mem(self.address, reg, bytes([value]))
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
@property
|
|
135
|
+
def temperature(self) -> float:
|
|
136
|
+
"""Get the device temperature."""
|
|
137
|
+
temp_raw = self._read_u8(_REG_TEMP)
|
|
138
|
+
return temp_raw / 256
|
|
139
|
+
|
|
140
|
+
@property
|
|
141
|
+
def acceleration(self) -> tuple[float, float, float]:
|
|
142
|
+
"""Get current acceleration reading."""
|
|
143
|
+
raw_accel = self._read_xyz(_REG_AX_L)
|
|
144
|
+
return tuple(val / self.acc_scale_divisor for val in raw_accel)
|
|
145
|
+
|
|
146
|
+
@property
|
|
147
|
+
def gyro(self) -> tuple[float, float, float]:
|
|
148
|
+
"""Get current gyroscope reading."""
|
|
149
|
+
raw_gyro = self._read_xyz(_REG_GX_L)
|
|
150
|
+
return tuple(val / self.gyro_scale_divisor for val in raw_gyro)
|
|
151
|
+
|
|
152
|
+
#######################
|
|
153
|
+
# Public functions #
|
|
154
|
+
#######################
|
|
155
|
+
|
|
156
|
+
def load():
|
|
157
|
+
"""
|
|
158
|
+
Load the QMI8658 sensor instance.
|
|
159
|
+
The QMI8658 is a motion sensor that measures acceleration, angular velocity (gyroscope), and temperature
|
|
160
|
+
"""
|
|
161
|
+
if QMI8658.INSTANCE is None:
|
|
162
|
+
QMI8658(I2C(0, sda=Pin(bind_pin('i2c_sda')), scl=Pin(bind_pin('i2c_scl'))))
|
|
163
|
+
return QMI8658.INSTANCE
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
def temperature():
|
|
167
|
+
return load().temperature
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
def acceleration():
|
|
171
|
+
return load().acceleration
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
def gyro():
|
|
175
|
+
return load().gyro
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
def measure():
|
|
179
|
+
inst = load()
|
|
180
|
+
return {"temp": inst.temperature, "accel": inst.acceleration, "gyro": inst.gyro}
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
#######################
|
|
184
|
+
# LM helper functions #
|
|
185
|
+
#######################
|
|
186
|
+
|
|
187
|
+
def pinmap():
|
|
188
|
+
"""
|
|
189
|
+
[i] micrOS LM naming convention
|
|
190
|
+
Shows logical pins - pin number(s) used by this Load module
|
|
191
|
+
- info which pins to use for this application
|
|
192
|
+
:return dict: pin name (str) - pin value (int) pairs
|
|
193
|
+
"""
|
|
194
|
+
return pinmap_search(['i2c_scl', 'i2c_sda'])
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
def help(widgets=False):
|
|
198
|
+
"""
|
|
199
|
+
[i] micrOS LM naming convention - built-in help message
|
|
200
|
+
:return tuple:
|
|
201
|
+
(widgets=False) list of functions implemented by this application
|
|
202
|
+
(widgets=True) list of widget json for UI generation
|
|
203
|
+
"""
|
|
204
|
+
return 'load', 'temperature', 'acceleration', 'gyro', 'measure', 'pinmap'
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
from machine import Pin
|
|
2
2
|
import micropython
|
|
3
3
|
from Common import socket_stream, syslog
|
|
4
|
-
from microIO import
|
|
4
|
+
from microIO import bind_pin, pinmap_search
|
|
5
5
|
from Types import resolve
|
|
6
6
|
|
|
7
7
|
# https://www.coderdojotc.org/micropython/sensors/10-rotary-encoder/
|
|
@@ -76,7 +76,7 @@ def load(min_val=0, max_val=20):
|
|
|
76
76
|
"""
|
|
77
77
|
if Data.ROTARY_OBJ is None:
|
|
78
78
|
# GPIO Pins 33 and 35 are for the encoder pins.
|
|
79
|
-
Data.ROTARY_OBJ = Rotary(
|
|
79
|
+
Data.ROTARY_OBJ = Rotary(bind_pin('rot_dt'), bind_pin('rot_clk'))
|
|
80
80
|
Data.MIN_VAL = min_val
|
|
81
81
|
Data.MAX_VAL = max_val
|
|
82
82
|
Data.VAL = min_val
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import uasyncio as asyncio
|
|
2
1
|
from urequests import get as http_get
|
|
3
2
|
from urequests import aget as http_aget
|
|
4
3
|
from Common import micro_task
|
|
@@ -11,7 +10,7 @@ class Rest:
|
|
|
11
10
|
def load(gateway_url=None):
|
|
12
11
|
"""
|
|
13
12
|
Set gateway url aka main domain
|
|
14
|
-
:param gateway_url: base url of gateway, like: http://gateway.local:
|
|
13
|
+
:param gateway_url: base url of gateway, like: http://gateway.local:5005
|
|
15
14
|
"""
|
|
16
15
|
if gateway_url is None:
|
|
17
16
|
if Rest.GATEWAY_HOST is None:
|
|
@@ -67,8 +66,7 @@ def aurl(subdomain):
|
|
|
67
66
|
tag = "rest." + subdomain.replace("http://", '').replace("https://", '')
|
|
68
67
|
if len(tag) > 50:
|
|
69
68
|
tag = tag[0:50]
|
|
70
|
-
|
|
71
|
-
return f"Starting" if state else f"Already running"
|
|
69
|
+
return micro_task(tag=tag, task=__task(subdomain, tag))
|
|
72
70
|
|
|
73
71
|
|
|
74
72
|
def help(widgets=False):
|
|
@@ -78,6 +76,6 @@ def help(widgets=False):
|
|
|
78
76
|
(widgets=False) list of functions implemented by this application
|
|
79
77
|
(widgets=True) list of widget json for UI generation
|
|
80
78
|
"""
|
|
81
|
-
return ('load gateway_url=<http://gateway.local:
|
|
79
|
+
return ('load gateway_url=<http://gateway.local:5005>',
|
|
82
80
|
'url subdomain=</webhooks/template>',
|
|
83
|
-
'aurl subdomain=</webhooks/template>')
|
|
81
|
+
'aurl subdomain=</webhooks/template>')
|
|
@@ -2,10 +2,9 @@
|
|
|
2
2
|
# ANALOG rgb CONTROLLER PARAMS #
|
|
3
3
|
#########################################
|
|
4
4
|
from machine import Pin, PWM
|
|
5
|
-
from
|
|
6
|
-
from Common import transition_gen, micro_task
|
|
5
|
+
from Common import transition_gen, micro_task, data_dir
|
|
7
6
|
from utime import sleep_ms
|
|
8
|
-
from microIO import
|
|
7
|
+
from microIO import bind_pin, pinmap_search
|
|
9
8
|
from random import randint
|
|
10
9
|
from Types import resolve
|
|
11
10
|
|
|
@@ -20,31 +19,27 @@ class Data:
|
|
|
20
19
|
CH_MAX = 1000 # maximum value per channel
|
|
21
20
|
TASK_STATE = False
|
|
22
21
|
RGB_TASK_TAG = "rgb._tran"
|
|
22
|
+
FILE_CACHE = data_dir('rgb.cache')
|
|
23
23
|
|
|
24
24
|
|
|
25
25
|
#########################################
|
|
26
26
|
# ANALOG rgb WITH 3 channel PWM #
|
|
27
27
|
#########################################
|
|
28
28
|
|
|
29
|
-
def __RGB_init():
|
|
29
|
+
def __RGB_init(red_pin=None, green_pin=None, blue_pin=None):
|
|
30
30
|
if Data.RGB_OBJS[0] is None or Data.RGB_OBJS[1] is None or Data.RGB_OBJS[2] is None:
|
|
31
|
-
red = Pin(
|
|
32
|
-
green = Pin(
|
|
33
|
-
blue = Pin(
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
PWM(blue, freq=1024))
|
|
38
|
-
else:
|
|
39
|
-
Data.RGB_OBJS = (PWM(red, freq=20480),
|
|
40
|
-
PWM(green, freq=20480),
|
|
41
|
-
PWM(blue, freq=20480))
|
|
31
|
+
red = Pin(bind_pin('redgb', red_pin))
|
|
32
|
+
green = Pin(bind_pin('rgreenb', green_pin))
|
|
33
|
+
blue = Pin(bind_pin('rgbue', blue_pin))
|
|
34
|
+
Data.RGB_OBJS = (PWM(red, freq=20480),
|
|
35
|
+
PWM(green, freq=20480),
|
|
36
|
+
PWM(blue, freq=20480))
|
|
42
37
|
return Data.RGB_OBJS
|
|
43
38
|
|
|
44
39
|
|
|
45
40
|
def __persistent_cache_manager(mode):
|
|
46
41
|
"""
|
|
47
|
-
|
|
42
|
+
File state cache
|
|
48
43
|
modes:
|
|
49
44
|
r - recover, s - save
|
|
50
45
|
"""
|
|
@@ -52,12 +47,12 @@ def __persistent_cache_manager(mode):
|
|
|
52
47
|
return
|
|
53
48
|
if mode == 's':
|
|
54
49
|
# SAVE CACHE
|
|
55
|
-
with open(
|
|
50
|
+
with open(Data.FILE_CACHE, 'w') as f:
|
|
56
51
|
f.write(','.join([str(k) for k in Data.RGB_CACHE]))
|
|
57
52
|
return
|
|
58
53
|
try:
|
|
59
54
|
# RESTORE CACHE
|
|
60
|
-
with open(
|
|
55
|
+
with open(Data.FILE_CACHE, 'r') as f:
|
|
61
56
|
Data.RGB_CACHE = [float(data) for data in f.read().strip().split(',')]
|
|
62
57
|
except:
|
|
63
58
|
pass
|
|
@@ -73,20 +68,18 @@ def __state_machine(r, g, b):
|
|
|
73
68
|
__persistent_cache_manager('s')
|
|
74
69
|
|
|
75
70
|
|
|
76
|
-
def load(cache=
|
|
71
|
+
def load(red_pin=None, green_pin=None, blue_pin=None, cache=True):
|
|
77
72
|
"""
|
|
78
73
|
Initiate RGB module
|
|
79
|
-
:param
|
|
80
|
-
|
|
81
|
-
|
|
74
|
+
:param red_pin: optional red color pin to overwrite built-in
|
|
75
|
+
:param green_pin: optional green color pin to overwrite built-in
|
|
76
|
+
:param blue_pin: optional blue color pin to overwrite built-in
|
|
77
|
+
:param cache: file state machine cache: True/False (.cache), default=True
|
|
82
78
|
:return str: Cache state
|
|
83
79
|
"""
|
|
84
|
-
|
|
85
|
-
if cache is None:
|
|
86
|
-
Data.PERSISTENT_CACHE = False if platform == 'esp8266' else True
|
|
87
|
-
else:
|
|
88
|
-
Data.PERSISTENT_CACHE = cache
|
|
80
|
+
Data.PERSISTENT_CACHE = cache
|
|
89
81
|
__persistent_cache_manager('r') # recover data cache if enabled
|
|
82
|
+
__RGB_init(red_pin, green_pin, blue_pin)
|
|
90
83
|
if Data.RGB_CACHE[3] == 1:
|
|
91
84
|
Data.RGB_CACHE[3] = 0 # Force ON at boot
|
|
92
85
|
toggle(True)
|
|
@@ -253,8 +246,7 @@ def transition(r=None, g=None, b=None, sec=1.0, wake=False):
|
|
|
253
246
|
# Create transition generator and calculate step_ms
|
|
254
247
|
rgb_gen, step_ms = transition_gen(r_from, r, g_from, g, b_from, b, interval_sec=sec)
|
|
255
248
|
# [!] ASYNC TASK CREATION [1*] with async task callback + taskID (TAG) handling
|
|
256
|
-
|
|
257
|
-
return "Starting transition" if state else "Transition already running"
|
|
249
|
+
return micro_task(tag=Data.RGB_TASK_TAG, task=_task(ms_period=step_ms, iterable=rgb_gen))
|
|
258
250
|
|
|
259
251
|
|
|
260
252
|
def random(smooth=True, max_val=1000):
|
|
@@ -2,7 +2,7 @@ from utime import sleep_ms
|
|
|
2
2
|
from random import randint
|
|
3
3
|
import LM_servo as servo
|
|
4
4
|
from LM_switch import set_state, pinmap as switch_pinmap
|
|
5
|
-
from Common import transition, micro_task
|
|
5
|
+
from Common import transition, micro_task, data_dir
|
|
6
6
|
from Types import resolve
|
|
7
7
|
|
|
8
8
|
|
|
@@ -13,23 +13,24 @@ class RoboArm:
|
|
|
13
13
|
SPEED_MS = 10 # Set default speed between steps (ms)
|
|
14
14
|
MOVE_RECORD = [] # Buffer for XY move record/replay
|
|
15
15
|
PLAY_TAG = 'roboarm._play'
|
|
16
|
+
FILE_CACHE = data_dir('rarm.cache')
|
|
16
17
|
|
|
17
18
|
|
|
18
19
|
def __persistent_cache_manager(mode):
|
|
19
20
|
"""
|
|
20
|
-
|
|
21
|
+
File state cache
|
|
21
22
|
modes:
|
|
22
23
|
r - recover, s - save
|
|
23
24
|
"""
|
|
24
25
|
|
|
25
26
|
if mode == 's':
|
|
26
27
|
# SAVE CACHE
|
|
27
|
-
with open(
|
|
28
|
+
with open(RoboArm.FILE_CACHE, 'w') as f:
|
|
28
29
|
f.write(','.join([str(k) for k in RoboArm.MOVE_RECORD]))
|
|
29
30
|
return
|
|
30
31
|
try:
|
|
31
32
|
# RESTORE CACHE
|
|
32
|
-
with open(
|
|
33
|
+
with open(RoboArm.FILE_CACHE, 'r') as f:
|
|
33
34
|
RoboArm.MOVE_RECORD = [int(data) for data in f.read().strip().split(',')]
|
|
34
35
|
except:
|
|
35
36
|
pass
|
|
@@ -203,11 +204,10 @@ def play(*args, s=None, delay=None, deinit=True):
|
|
|
203
204
|
|
|
204
205
|
# Start play - servo XY in async task
|
|
205
206
|
# [!] ASYNC TASK CREATION [1*] with async task callback + taskID (TAG) handling
|
|
206
|
-
state = micro_task(tag=RoboArm.PLAY_TAG, task=_play(args, deinit, delay))
|
|
207
|
-
if state:
|
|
208
|
-
return 'Play: {} steps'.format(int(len(args)/2))
|
|
209
|
-
return 'Play - already running'
|
|
210
207
|
|
|
208
|
+
state:dict = micro_task(tag=RoboArm.PLAY_TAG, task=_play(args, deinit, delay))
|
|
209
|
+
state.update({"Play steps": int(len(args)/2)})
|
|
210
|
+
return state
|
|
211
211
|
|
|
212
212
|
def record(clean=False, rec_limit=8):
|
|
213
213
|
"""
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
from LM_system import memory_usage
|
|
2
|
+
from Common import socket_stream, syslog, micro_task
|
|
3
|
+
from Auth import sudo
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
@socket_stream
|
|
7
|
+
def raise_error(msgobj=None):
|
|
8
|
+
"""
|
|
9
|
+
Test function - raise LM exception
|
|
10
|
+
"""
|
|
11
|
+
if msgobj is not None:
|
|
12
|
+
msgobj("Raise test exception")
|
|
13
|
+
state = syslog('Robustness TeSt ErRoR')
|
|
14
|
+
raise Exception(f"Test exception: {'OK' if state else 'NOK'}")
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
@socket_stream
|
|
18
|
+
def memory_leak(cnt=160, msgobj=None):
|
|
19
|
+
"""
|
|
20
|
+
Test function - allocate lot of memory
|
|
21
|
+
:param cnt: data counter, default 160 iteration
|
|
22
|
+
:return: verdict
|
|
23
|
+
"""
|
|
24
|
+
dict_test = {}
|
|
25
|
+
mem_start = memory_usage()['mem_used']
|
|
26
|
+
for k in range(cnt):
|
|
27
|
+
mem = memory_usage()['percent']
|
|
28
|
+
data = "micrOS memory usage: {} %".format(mem)
|
|
29
|
+
if msgobj is not None:
|
|
30
|
+
msgobj("[{}] gen: {}".format(k, data))
|
|
31
|
+
dict_test[k] = data
|
|
32
|
+
mem_end = memory_usage()['mem_used']
|
|
33
|
+
delta = mem_start - mem_end
|
|
34
|
+
return '[{}] RAM Alloc.: {} kB {} byte'.format(len(dict_test), int(delta / 1024), int(delta % 1024))
|
|
35
|
+
|
|
36
|
+
@socket_stream
|
|
37
|
+
def recursion_limit(limit=14, msgobj=None):
|
|
38
|
+
cnt = 0
|
|
39
|
+
for cnt in range(1, limit+1):
|
|
40
|
+
try:
|
|
41
|
+
_recursion(cnt, msgobj=msgobj)
|
|
42
|
+
except Exception as e:
|
|
43
|
+
msgobj(f"ok error: {e}")
|
|
44
|
+
break
|
|
45
|
+
return f"Recursion limit: {cnt}"
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def _recursion(cnt, msgobj=None):
|
|
49
|
+
"""
|
|
50
|
+
Test function - recursion test
|
|
51
|
+
:param cnt: recursion depth
|
|
52
|
+
:return: verdict
|
|
53
|
+
Error example:
|
|
54
|
+
node01 $ robustness recursion_limit 15
|
|
55
|
+
lm_exec LM_robustness->recursion_limit: maximum recursion depth exceeded
|
|
56
|
+
"""
|
|
57
|
+
if cnt > 0:
|
|
58
|
+
remain = _recursion(cnt-1)
|
|
59
|
+
if msgobj is not None:
|
|
60
|
+
msgobj("recalled {}".format(cnt))
|
|
61
|
+
else:
|
|
62
|
+
remain = 0
|
|
63
|
+
return remain
|
|
64
|
+
|
|
65
|
+
################## TEST micro_task UCs ##########################
|
|
66
|
+
|
|
67
|
+
async def __task(tag, period_ms):
|
|
68
|
+
counter = 0
|
|
69
|
+
with micro_task(tag=tag) as my_task:
|
|
70
|
+
while True:
|
|
71
|
+
# DO something here in the async loop...
|
|
72
|
+
counter += 1
|
|
73
|
+
|
|
74
|
+
# Store data in task cache (task show mytask)
|
|
75
|
+
my_task.out = f'MyTask Counter: {counter}'
|
|
76
|
+
|
|
77
|
+
# Async sleep - feed event loop
|
|
78
|
+
await my_task.feed(sleep_ms=period_ms)
|
|
79
|
+
# [i] feed same as "await asyncio.sleep_ms(period_ms)" with micrOS features (WDT)
|
|
80
|
+
|
|
81
|
+
def create_task():
|
|
82
|
+
"""
|
|
83
|
+
Legacy way of task creation (with exact task tagging)
|
|
84
|
+
"""
|
|
85
|
+
# [!] ASYNC TASK CREATION [1*] with async task callback + taskID (TAG) handling
|
|
86
|
+
task_tag = "microtask.run"
|
|
87
|
+
return micro_task(tag=task_tag, task=__task(tag=task_tag, period_ms=5))
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
@micro_task("microtask", _wrap=True)
|
|
91
|
+
async def mytask(tag, period_ms=30):
|
|
92
|
+
"""
|
|
93
|
+
New shorter way of task creation
|
|
94
|
+
with decorator function
|
|
95
|
+
"""
|
|
96
|
+
counter = 0
|
|
97
|
+
with micro_task(tag=tag) as my_task:
|
|
98
|
+
while True:
|
|
99
|
+
# DO something here in the async loop...
|
|
100
|
+
counter += 1
|
|
101
|
+
|
|
102
|
+
# Store data in task cache (task show mytask)
|
|
103
|
+
my_task.out = f'MyTask Counter: {counter}'
|
|
104
|
+
|
|
105
|
+
# Async sleep - feed event loop
|
|
106
|
+
await my_task.feed(sleep_ms=period_ms)
|
|
107
|
+
# [i] feed same as "await asyncio.sleep_ms(period_ms)" with micrOS features (WDT)
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
@sudo
|
|
111
|
+
def func_sudo():
|
|
112
|
+
"""
|
|
113
|
+
Function execution requires pwd=<...>
|
|
114
|
+
"""
|
|
115
|
+
return "Access granted"
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
@sudo(_force_only=(True, 0))
|
|
119
|
+
def func_sudo_force(force=False):
|
|
120
|
+
"""
|
|
121
|
+
Function requires pwd=<...> when force=True
|
|
122
|
+
"""
|
|
123
|
+
return f"Access granted, force flag: {force}"
|
|
124
|
+
|
|
125
|
+
##############################################################################
|
|
126
|
+
|
|
127
|
+
def help(widgets=False):
|
|
128
|
+
"""
|
|
129
|
+
[i] micrOS LM naming convention - built-in help message
|
|
130
|
+
:return tuple:
|
|
131
|
+
(widgets=False) list of functions implemented by this application
|
|
132
|
+
(widgets=True) list of widget json for UI generation
|
|
133
|
+
"""
|
|
134
|
+
return 'NOTE: This is a test module to validate system robustness', \
|
|
135
|
+
'raise_error', 'memory_leak cnt=160', 'recursion_limit cnt=14', \
|
|
136
|
+
'create_task', 'mytask', "func_sudo", "func_sudo_force"
|
|
137
|
+
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
from machine import Pin, PWM
|
|
2
|
-
from microIO import
|
|
2
|
+
from microIO import bind_pin, pinmap_search
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
class Data:
|
|
@@ -16,7 +16,7 @@ class Data:
|
|
|
16
16
|
def __servo_init():
|
|
17
17
|
if Data.S_OBJ is None:
|
|
18
18
|
try:
|
|
19
|
-
pin = Pin(
|
|
19
|
+
pin = Pin(bind_pin('servo_1'))
|
|
20
20
|
Data.S_OBJ = PWM(pin, freq=50)
|
|
21
21
|
del pin
|
|
22
22
|
except Exception as e:
|
|
@@ -64,7 +64,7 @@ def sdemo():
|
|
|
64
64
|
def __servo2_init():
|
|
65
65
|
if Data.S_OBJ2 is None:
|
|
66
66
|
try:
|
|
67
|
-
pin = Pin(
|
|
67
|
+
pin = Pin(bind_pin('servo_2')) # Alternative wiring
|
|
68
68
|
Data.S_OBJ2 = PWM(pin, freq=50)
|
|
69
69
|
del pin
|
|
70
70
|
except Exception as e:
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
from utime import sleep_ms
|
|
4
4
|
from machine import Pin
|
|
5
|
-
from microIO import
|
|
5
|
+
from microIO import bind_pin, pinmap_search
|
|
6
6
|
STEPPER_INST = None
|
|
7
7
|
|
|
8
8
|
|
|
@@ -30,10 +30,10 @@ class StepperULN2003:
|
|
|
30
30
|
[1, 0, 0, 1]]
|
|
31
31
|
self.delay = 2
|
|
32
32
|
# Init stepper pins
|
|
33
|
-
self.pin1 = Pin(
|
|
34
|
-
self.pin2 = Pin(
|
|
35
|
-
self.pin3 = Pin(
|
|
36
|
-
self.pin4 = Pin(
|
|
33
|
+
self.pin1 = Pin(bind_pin('stppr_1'), Pin.OUT)
|
|
34
|
+
self.pin2 = Pin(bind_pin('stppr_2'), Pin.OUT)
|
|
35
|
+
self.pin3 = Pin(bind_pin('stppr_3'), Pin.OUT)
|
|
36
|
+
self.pin4 = Pin(bind_pin('stppr_4'), Pin.OUT)
|
|
37
37
|
# Initialize all value to 0 - "OFF"
|
|
38
38
|
self.reset()
|
|
39
39
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
from machine import Pin
|
|
2
|
-
from microIO import
|
|
2
|
+
from microIO import bind_pin, pinmap_search
|
|
3
|
+
from Common import data_dir
|
|
3
4
|
from Types import resolve
|
|
4
5
|
|
|
5
6
|
#########################################
|
|
@@ -8,6 +9,7 @@ from Types import resolve
|
|
|
8
9
|
__SWITCH_OBJ = [None, None, None, None]
|
|
9
10
|
__PERSISTENT_CACHE = False
|
|
10
11
|
__SWITCH_STATE = [0, 0, 0, 0]
|
|
12
|
+
__FILE_CACHE = data_dir('switch.cache')
|
|
11
13
|
|
|
12
14
|
|
|
13
15
|
#########################################
|
|
@@ -16,7 +18,7 @@ __SWITCH_STATE = [0, 0, 0, 0]
|
|
|
16
18
|
|
|
17
19
|
def __persistent_cache_manager(mode):
|
|
18
20
|
"""
|
|
19
|
-
|
|
21
|
+
File cache
|
|
20
22
|
modes:
|
|
21
23
|
r - recover, s - save
|
|
22
24
|
"""
|
|
@@ -25,12 +27,12 @@ def __persistent_cache_manager(mode):
|
|
|
25
27
|
global __SWITCH_STATE
|
|
26
28
|
if mode == 's':
|
|
27
29
|
# SAVE CACHE
|
|
28
|
-
with open(
|
|
30
|
+
with open(__FILE_CACHE, 'w') as f:
|
|
29
31
|
f.write(','.join([str(k) for k in __SWITCH_STATE]))
|
|
30
32
|
return
|
|
31
33
|
try:
|
|
32
34
|
# RESTORE CACHE
|
|
33
|
-
with open(
|
|
35
|
+
with open(__FILE_CACHE, 'r') as f:
|
|
34
36
|
__SWITCH_STATE = [int(data) for data in f.read().strip().split(',')]
|
|
35
37
|
except:
|
|
36
38
|
pass
|
|
@@ -54,7 +56,7 @@ def load(cache=None, ch_init=None):
|
|
|
54
56
|
"""
|
|
55
57
|
Initiate switch module (4 switch pack)
|
|
56
58
|
:param cache bool: file state machine cache: True/False/None(default: automatic True)
|
|
57
|
-
- Load .
|
|
59
|
+
- Load .cache (state machine cache) for this load module
|
|
58
60
|
- Apply loaded states to gpio pins (boot function)
|
|
59
61
|
:return str: Cache state
|
|
60
62
|
"""
|
|
@@ -82,7 +84,7 @@ def load(cache=None, ch_init=None):
|
|
|
82
84
|
|
|
83
85
|
def __switch_init():
|
|
84
86
|
if __SWITCH_OBJ[0] is None:
|
|
85
|
-
__SWITCH_OBJ[0] = Pin(
|
|
87
|
+
__SWITCH_OBJ[0] = Pin(bind_pin('switch_1'), Pin.OUT)
|
|
86
88
|
return __SWITCH_OBJ[0]
|
|
87
89
|
|
|
88
90
|
|
|
@@ -118,7 +120,7 @@ def toggle():
|
|
|
118
120
|
|
|
119
121
|
def __switch2_init():
|
|
120
122
|
if __SWITCH_OBJ[1] is None:
|
|
121
|
-
__SWITCH_OBJ[1] = Pin(
|
|
123
|
+
__SWITCH_OBJ[1] = Pin(bind_pin('switch_2'), Pin.OUT)
|
|
122
124
|
return __SWITCH_OBJ[1]
|
|
123
125
|
|
|
124
126
|
|
|
@@ -153,7 +155,7 @@ def toggle2():
|
|
|
153
155
|
|
|
154
156
|
def __switch3_init():
|
|
155
157
|
if __SWITCH_OBJ[2] is None:
|
|
156
|
-
__SWITCH_OBJ[2] = Pin(
|
|
158
|
+
__SWITCH_OBJ[2] = Pin(bind_pin('switch_3'), Pin.OUT)
|
|
157
159
|
return __SWITCH_OBJ[2]
|
|
158
160
|
|
|
159
161
|
|
|
@@ -188,7 +190,7 @@ def toggle3():
|
|
|
188
190
|
|
|
189
191
|
def __switch4_init():
|
|
190
192
|
if __SWITCH_OBJ[3] is None:
|
|
191
|
-
__SWITCH_OBJ[3] = Pin(
|
|
193
|
+
__SWITCH_OBJ[3] = Pin(bind_pin('switch_4'), Pin.OUT)
|
|
192
194
|
return __SWITCH_OBJ[3]
|
|
193
195
|
|
|
194
196
|
|