micrOSDevToolKit 2.1.5__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/.DS_Store +0 -0
- 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-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 +191 -151
- micrOS/source/Auth.py +37 -0
- micrOS/source/Common.py +376 -102
- micrOS/source/Config.py +55 -25
- micrOS/source/Debug.py +54 -193
- micrOS/source/Espnow.py +404 -0
- micrOS/source/Files.py +207 -0
- micrOS/source/Hooks.py +88 -16
- micrOS/source/InterConnect.py +130 -46
- micrOS/source/Interrupts.py +8 -8
- micrOS/source/Logger.py +131 -0
- micrOS/source/Network.py +41 -21
- micrOS/source/Notify.py +74 -198
- micrOS/source/Pacman.py +326 -0
- micrOS/source/Scheduler.py +18 -55
- micrOS/source/Server.py +84 -217
- micrOS/source/Shell.py +103 -93
- micrOS/source/Tasks.py +239 -173
- micrOS/source/Time.py +21 -22
- micrOS/source/Types.py +89 -54
- micrOS/source/Web.py +485 -0
- 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/helpers.py +132 -0
- micrOS/source/micrOS.py +25 -21
- micrOS/source/micrOSloader.py +14 -23
- micrOS/source/microIO.py +94 -57
- toolkit/simulator_lib/LP_darwin.py → micrOS/source/modules/IO_esp32.py +22 -11
- micrOS/source/{IO_esp32c3.py → modules/IO_esp32c3.py} +6 -1
- micrOS/source/modules/IO_esp32c6.py +38 -0
- micrOS/source/{IO_esp32s2.py → modules/IO_esp32s2.py} +6 -1
- micrOS/source/{IO_esp32s3.py → modules/IO_esp32s3.py} +43 -2
- micrOS/source/modules/IO_m5stamp.py +86 -0
- micrOS/source/{IO_qtpy.py → modules/IO_qtpy.py} +28 -18
- micrOS/source/{IO_tinypico.py → modules/IO_tinypico.py} +48 -3
- micrOS/source/modules/LM_L298N.py +161 -0
- {toolkit/workspace/precompiled → micrOS/source/modules}/LM_L9110_DCmotor.py +4 -4
- micrOS/source/{LM_OV2640.py → modules/LM_OV2640.py} +53 -42
- micrOS/source/{LM_VL53L0X.py → modules/LM_VL53L0X.py} +5 -5
- micrOS/source/{LM_aht10.py → modules/LM_aht10.py} +12 -4
- micrOS/source/{LM_bme280.py → modules/LM_bme280.py} +13 -25
- micrOS/source/{LM_buzzer.py → modules/LM_buzzer.py} +42 -40
- micrOS/source/{LM_cct.py → modules/LM_cct.py} +22 -27
- micrOS/source/modules/LM_cluster.py +255 -0
- micrOS/source/{LM_co2.py → modules/LM_co2.py} +13 -6
- micrOS/source/{LM_dht11.py → modules/LM_dht11.py} +13 -29
- micrOS/source/{LM_dht22.py → modules/LM_dht22.py} +13 -28
- micrOS/source/{LM_dimmer.py → modules/LM_dimmer.py} +19 -16
- micrOS/source/modules/LM_distance.py +135 -0
- micrOS/source/{LM_ds18.py → modules/LM_ds18.py} +12 -4
- micrOS/source/{LM_esp32.py → modules/LM_esp32.py} +16 -4
- micrOS/source/modules/LM_espnow.py +53 -0
- micrOS/source/modules/LM_fileserver.py +265 -0
- micrOS/source/{LM_gameOfLife.py → modules/LM_gameOfLife.py} +5 -5
- micrOS/source/{LM_genIO.py → modules/LM_genIO.py} +49 -35
- micrOS/source/modules/LM_haptic.py +111 -0
- micrOS/source/modules/LM_i2c.py +61 -0
- micrOS/source/{LM_i2s_mic.py → modules/LM_i2s_mic.py} +20 -23
- micrOS/source/{LM_ld2410.py → modules/LM_ld2410.py} +3 -3
- micrOS/source/{LM_light_sensor.py → modules/LM_light_sensor.py} +22 -26
- 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} +26 -31
- micrOS/source/{LM_oled.py → modules/LM_oled.py} +28 -20
- micrOS/source/{LM_oled_sh1106.py → modules/LM_oled_sh1106.py} +28 -24
- micrOS/source/{LM_oled_ui.py → modules/LM_oled_ui.py} +132 -174
- micrOS/source/modules/LM_pacman.py +320 -0
- micrOS/source/{LM_presence.py → modules/LM_presence.py} +24 -36
- micrOS/source/modules/LM_qmi8658.py +204 -0
- micrOS/source/{LM_rencoder.py → modules/LM_rencoder.py} +40 -11
- micrOS/source/modules/LM_rest.py +81 -0
- micrOS/source/{LM_rgb.py → modules/LM_rgb.py} +25 -34
- micrOS/source/{LM_rgbcct.py → modules/LM_rgbcct.py} +5 -5
- micrOS/source/{LM_roboarm.py → modules/LM_roboarm.py} +37 -45
- micrOS/source/modules/LM_robustness.py +137 -0
- micrOS/source/{LM_rp2w.py → modules/LM_rp2w.py} +3 -0
- micrOS/source/{LM_sdcard.py → modules/LM_sdcard.py} +3 -0
- micrOS/source/{LM_servo.py → modules/LM_servo.py} +4 -4
- micrOS/source/modules/LM_sound_event.py +751 -0
- micrOS/source/{LM_stepper.py → modules/LM_stepper.py} +8 -8
- micrOS/source/{LM_switch.py → modules/LM_switch.py} +21 -18
- micrOS/source/{LM_system.py → modules/LM_system.py} +96 -59
- micrOS/source/modules/LM_tcs3472.py +187 -0
- micrOS/source/modules/LM_telegram.py +388 -0
- micrOS/source/modules/LM_trackball.py +287 -0
- micrOS/source/modules/LM_veml7700.py +159 -0
- micrOS/source/modules/LM_web.py +38 -0
- micrOS/source/urequests.py +204 -91
- {toolkit/workspace/precompiled → micrOS/source/web}/dashboard.html +9 -4
- micrOS/source/web/editor.js +440 -0
- micrOS/source/web/filesui.html +178 -0
- micrOS/source/web/filesui.js +338 -0
- micrOS/source/{index.html → web/index.html} +44 -2
- micrOS/source/web/uapi.js +103 -0
- micrOS/source/web/udashboard.js +129 -0
- micrOS/source/web/ustyle.css +55 -0
- micrOS/source/web/uwidgets.js +172 -0
- micrOS/source/web/uwidgets_pro.js +99 -0
- micrOS/utests/__init__.py +0 -0
- micrOS/utests/test_scheduler.py +435 -0
- {micrOSDevToolKit-2.1.5.data → microsdevtoolkit-2.26.1.data}/scripts/devToolKit.py +47 -4
- {micrOSDevToolKit-2.1.5.dist-info → microsdevtoolkit-2.26.1.dist-info}/METADATA +392 -279
- microsdevtoolkit-2.26.1.dist-info/RECORD +396 -0
- {micrOSDevToolKit-2.1.5.dist-info → microsdevtoolkit-2.26.1.dist-info}/WHEEL +1 -1
- toolkit/DevEnvCompile.py +63 -33
- toolkit/DevEnvOTA.py +72 -22
- toolkit/DevEnvUSB.py +147 -77
- toolkit/Gateway.py +9 -9
- toolkit/LM_to_compile.dat +12 -4
- toolkit/MicrOSDevEnv.py +129 -51
- toolkit/WebRepl.py +73 -0
- toolkit/dashboard_apps/BackupRestore.py +171 -0
- 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 +2 -7
- 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 +219 -117
- toolkit/dashboard_apps/Template_app.py +12 -19
- 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 +6 -5
- 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 +371 -0
- toolkit/lib/micrOSClient.py +124 -51
- toolkit/lib/micrOSClientHistory.py +156 -0
- toolkit/lib/pip_package_installer.py +31 -4
- toolkit/micrOSdashboard.py +16 -21
- toolkit/micrOSlint.py +28 -10
- toolkit/simulator_lib/.DS_Store +0 -0
- micrOS/source/IO_esp32.py → toolkit/simulator_lib/IO_darwin.py +3 -0
- 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__/camera.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/camera.py +84 -0
- toolkit/simulator_lib/dht.py +1 -1
- toolkit/simulator_lib/framebuf.py +49 -1
- toolkit/simulator_lib/machine.py +32 -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 +138 -46
- toolkit/simulator_lib/uasyncio.py +34 -3
- toolkit/simulator_lib/uos.py +147 -0
- toolkit/simulator_lib/urandom.py +4 -0
- toolkit/simulator_lib/usocket.py +5 -1
- toolkit/simulator_lib/view01.jpg +0 -0
- toolkit/simulator_lib/view02.jpg +0 -0
- toolkit/socketClient.py +43 -23
- toolkit/user_data/webhooks/generic.py +1 -1
- toolkit/user_data/webhooks/macro.py +44 -0
- toolkit/user_data/webhooks/template.macro +20 -0
- 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/modules/IO_esp32.mpy +0 -0
- toolkit/workspace/precompiled/modules/IO_esp32c3.mpy +0 -0
- toolkit/workspace/precompiled/modules/IO_esp32c6.mpy +0 -0
- toolkit/workspace/precompiled/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 +4 -4
- toolkit/workspace/precompiled/modules/LM_OV2640.mpy +0 -0
- toolkit/workspace/precompiled/{LM_VL53L0X.py → modules/LM_VL53L0X.py} +5 -5
- toolkit/workspace/precompiled/modules/LM_aht10.mpy +0 -0
- toolkit/workspace/precompiled/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/modules/LM_co2.mpy +0 -0
- toolkit/workspace/precompiled/modules/LM_dht11.mpy +0 -0
- toolkit/workspace/precompiled/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/modules/LM_ds18.mpy +0 -0
- toolkit/workspace/precompiled/{LM_esp32.py → modules/LM_esp32.py} +16 -4
- 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/modules/LM_haptic.mpy +0 -0
- toolkit/workspace/precompiled/modules/LM_i2c.py +61 -0
- 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/modules/LM_oled.mpy +0 -0
- toolkit/workspace/precompiled/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} +40 -11
- 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_rp2w.py → modules/LM_rp2w.py} +3 -0
- toolkit/workspace/precompiled/{LM_sdcard.py → modules/LM_sdcard.py} +3 -0
- toolkit/workspace/precompiled/{LM_servo.mpy → modules/LM_servo.mpy} +0 -0
- toolkit/workspace/precompiled/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/modules/LM_trackball.mpy +0 -0
- toolkit/workspace/precompiled/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 +9 -4
- toolkit/workspace/precompiled/web/editor.js +440 -0
- toolkit/workspace/precompiled/web/filesui.html +178 -0
- toolkit/workspace/precompiled/web/filesui.js +338 -0
- toolkit/workspace/precompiled/{index.html → web/index.html} +44 -2
- toolkit/workspace/precompiled/web/uapi.js +103 -0
- toolkit/workspace/precompiled/web/udashboard.js +129 -0
- toolkit/workspace/precompiled/web/ustyle.css +55 -0
- toolkit/workspace/precompiled/web/uwidgets.js +172 -0
- toolkit/workspace/precompiled/web/uwidgets_pro.js +99 -0
- env/driver_cp210x/CH34XSER_MAC/CH34X_DRV_INSTALL_INSTRUCTIONS.pdf +0 -0
- env/driver_cp210x/CH34XSER_MAC/CH34xVCPDriver.pkg +0 -0
- micrOS/micropython/esp32-20231005-v1.21.0.bin +0 -0
- micrOS/micropython/esp32c3-GENERIC-20240105-v1.22.1.bin +0 -0
- micrOS/micropython/esp32c3-GENERIC-20240222-v1.22.2.bin +0 -0
- micrOS/micropython/esp32s2-GENERIC-20240105-v1.22.1.bin +0 -0
- micrOS/micropython/esp32s2-LOLIN_MINI-20220618-v1.19.1.bin +0 -0
- micrOS/micropython/esp32s3-GENERIC-20240105-v1.22.1.bin +0 -0
- micrOS/micropython/esp32s3_spiram_oct-20231005-v1.21.0.bin +0 -0
- micrOS/micropython/rpi-pico-w-20231005-v1.21.0.uf2 +0 -0
- micrOS/micropython/tinypico-20231005-v1.21.0.bin +0 -0
- micrOS/micropython/tinypico-usbc-UM-20240105-v1.22.1.bin +0 -0
- micrOS/source/LM_L298N_DCmotor.py +0 -86
- micrOS/source/LM_catgame.py +0 -74
- micrOS/source/LM_dashboard_be.py +0 -37
- micrOS/source/LM_demo.py +0 -85
- micrOS/source/LM_distance.py +0 -88
- micrOS/source/LM_i2c.py +0 -44
- micrOS/source/LM_intercon.py +0 -57
- micrOS/source/LM_keychain.py +0 -318
- micrOS/source/LM_lmpacman.py +0 -126
- micrOS/source/LM_neoeffects.py +0 -327
- micrOS/source/LM_pet_feeder.py +0 -76
- micrOS/source/LM_ph_sensor.py +0 -51
- micrOS/source/LM_rest.py +0 -40
- micrOS/source/LM_robustness.py +0 -73
- micrOS/source/LM_telegram.py +0 -96
- micrOS/source/reset.py +0 -11
- micrOS/source/uapi.js +0 -76
- micrOS/source/udashboard.js +0 -137
- micrOS/source/ustyle.css +0 -28
- micrOS/source/uwidgets.js +0 -179
- micrOSDevToolKit-2.1.5.dist-info/RECORD +0 -337
- 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__/LP_darwin.cpython-312.pyc +0 -0
- toolkit/simulator_lib/__pycache__/LP_darwin.cpython-38.pyc +0 -0
- toolkit/simulator_lib/__pycache__/LP_darwin.cpython-39.pyc +0 -0
- 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_esp32.mpy +0 -0
- toolkit/workspace/precompiled/IO_esp32c3.mpy +0 -0
- toolkit/workspace/precompiled/IO_esp32s2.mpy +0 -0
- toolkit/workspace/precompiled/IO_esp32s3.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_aht10.mpy +0 -0
- toolkit/workspace/precompiled/LM_bme280.mpy +0 -0
- toolkit/workspace/precompiled/LM_catgame.py +0 -74
- toolkit/workspace/precompiled/LM_cct.mpy +0 -0
- toolkit/workspace/precompiled/LM_co2.mpy +0 -0
- toolkit/workspace/precompiled/LM_dashboard_be.py +0 -37
- toolkit/workspace/precompiled/LM_demo.py +0 -85
- toolkit/workspace/precompiled/LM_dht11.mpy +0 -0
- toolkit/workspace/precompiled/LM_dht22.mpy +0 -0
- toolkit/workspace/precompiled/LM_dimmer.mpy +0 -0
- toolkit/workspace/precompiled/LM_distance.py +0 -88
- toolkit/workspace/precompiled/LM_ds18.mpy +0 -0
- toolkit/workspace/precompiled/LM_genIO.mpy +0 -0
- toolkit/workspace/precompiled/LM_i2c.py +0 -44
- 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.mpy +0 -0
- toolkit/workspace/precompiled/LM_oled_sh1106.mpy +0 -0
- toolkit/workspace/precompiled/LM_oled_ui.mpy +0 -0
- toolkit/workspace/precompiled/LM_pet_feeder.py +0 -76
- 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 -73
- 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/reset.mpy +0 -0
- toolkit/workspace/precompiled/uapi.js +0 -76
- toolkit/workspace/precompiled/udashboard.js +0 -137
- toolkit/workspace/precompiled/ustyle.css +0 -28
- toolkit/workspace/precompiled/uwidgets.js +0 -179
- /toolkit/user_data/node_config_archive/.include → /micrOS/source/config/_git.keep +0 -0
- /micrOS/source/{IO_rp2.py → modules/IO_rp2.py} +0 -0
- /micrOS/source/{LM_tinyrgb.py → modules/LM_tinyrgb.py} +0 -0
- {micrOSDevToolKit-2.1.5.dist-info → microsdevtoolkit-2.26.1.dist-info/licenses}/LICENSE +0 -0
- {micrOSDevToolKit-2.1.5.dist-info → microsdevtoolkit-2.26.1.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
from Espnow import ESPNowSS
|
|
2
|
+
ESPNOW = ESPNowSS()
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
def send(peer:bytes|str, cmd:str='modules'):
|
|
6
|
+
"""
|
|
7
|
+
Send message to peer (by mac address)
|
|
8
|
+
:param peer: mac address of espnow device
|
|
9
|
+
:param cmd: message string/load module call
|
|
10
|
+
"""
|
|
11
|
+
return ESPNOW.send(peer, cmd)
|
|
12
|
+
|
|
13
|
+
def stats():
|
|
14
|
+
"""
|
|
15
|
+
Get ESPNOW stats
|
|
16
|
+
"""
|
|
17
|
+
return ESPNOW.stats()
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def members():
|
|
21
|
+
"""
|
|
22
|
+
Get ESPNow devices
|
|
23
|
+
"""
|
|
24
|
+
return ESPNOW.members()
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def handshake(peer:bytes|str):
|
|
28
|
+
"""
|
|
29
|
+
Handshake with ESPNow Peer
|
|
30
|
+
:param peer: mac address of espnow device
|
|
31
|
+
- device name detection
|
|
32
|
+
- address:name caching
|
|
33
|
+
"""
|
|
34
|
+
return ESPNOW.handshake(peer)
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def remove(peer:bytes):
|
|
38
|
+
"""
|
|
39
|
+
Remove peer by binary mac address
|
|
40
|
+
:param peer: binary mac address of espnow device
|
|
41
|
+
"""
|
|
42
|
+
return ESPNOW.remove_peer(peer)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def help():
|
|
46
|
+
"""
|
|
47
|
+
ESPNOW sender/receiver with LM execution
|
|
48
|
+
"""
|
|
49
|
+
return ('handshake peer=<mac-address>',
|
|
50
|
+
'send peer=<peer-name> cmd="hello"',
|
|
51
|
+
'remove peer=<binary-mac-address>',
|
|
52
|
+
'stats',
|
|
53
|
+
'members')
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
from microIO import bind_pin, pinmap_search
|
|
2
|
+
|
|
3
|
+
__I2C = None
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def __init():
|
|
7
|
+
global __I2C
|
|
8
|
+
if __I2C is None:
|
|
9
|
+
from machine import Pin, I2C
|
|
10
|
+
__I2C = I2C(-1, Pin(bind_pin('i2c_scl')), Pin(bind_pin('i2c_sda')))
|
|
11
|
+
return __I2C
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def scan():
|
|
15
|
+
"""
|
|
16
|
+
I2C scan function - experimental
|
|
17
|
+
:return list: list of devices
|
|
18
|
+
"""
|
|
19
|
+
devices = [ hex(device) for device in __init().scan() ]
|
|
20
|
+
return devices
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def discover():
|
|
24
|
+
"""
|
|
25
|
+
Discover devices
|
|
26
|
+
"""
|
|
27
|
+
known_addresses = {hex(0x0A): "TRACKBALL", hex(0x3c): "OLED",
|
|
28
|
+
hex(0x76): "BME280", hex(0x10): 'VEML7700',
|
|
29
|
+
hex(0x6b): "QMI8658", hex(0x29): 'TCS3472'}
|
|
30
|
+
devices = scan()
|
|
31
|
+
output = {"unknown": []}
|
|
32
|
+
for k in devices:
|
|
33
|
+
if k in known_addresses:
|
|
34
|
+
device_name = known_addresses[k]
|
|
35
|
+
output[device_name] = k
|
|
36
|
+
else:
|
|
37
|
+
output["unknown"].append(k)
|
|
38
|
+
return output
|
|
39
|
+
|
|
40
|
+
#######################
|
|
41
|
+
# LM helper functions #
|
|
42
|
+
#######################
|
|
43
|
+
|
|
44
|
+
def pinmap():
|
|
45
|
+
"""
|
|
46
|
+
[i] micrOS LM naming convention
|
|
47
|
+
Shows logical pins - pin number(s) used by this Load module
|
|
48
|
+
- info which pins to use for this application
|
|
49
|
+
:return dict: pin name (str) - pin value (int) pairs
|
|
50
|
+
"""
|
|
51
|
+
return pinmap_search(['i2c_scl', 'i2c_sda'])
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
def help(widgets=False):
|
|
55
|
+
"""
|
|
56
|
+
[BETA][i] micrOS LM naming convention - built-in help message
|
|
57
|
+
:return tuple:
|
|
58
|
+
(widgets=False) list of functions implemented by this application
|
|
59
|
+
(widgets=True) list of widget json for UI generation
|
|
60
|
+
"""
|
|
61
|
+
return 'scan', 'discover', 'pinmap'
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
"""
|
|
2
|
+
MH-Z19 Co2 sensor driver for MicroPython (supports MH-Z19B and MH-Z19C)
|
|
3
|
+
|
|
4
|
+
Provides a simple interface to read:
|
|
5
|
+
- Co2 concentration (PPM)
|
|
6
|
+
- Temperature
|
|
7
|
+
- Status
|
|
8
|
+
|
|
9
|
+
Calibration (MH-Z19C)
|
|
10
|
+
---------------------
|
|
11
|
+
There are two ways to calibrate the zero point on MH-Z19C:
|
|
12
|
+
|
|
13
|
+
1) Apply a low-level signal for more than 7 seconds.
|
|
14
|
+
|
|
15
|
+
2) Send the calibration command:
|
|
16
|
+
FF 01 87 00 00 00 00 00 78
|
|
17
|
+
On success the sensor returns:
|
|
18
|
+
FF 87 01 00 00 00 00 00 78
|
|
19
|
+
|
|
20
|
+
Auto-calibration (ABC) period
|
|
21
|
+
-----------------------------
|
|
22
|
+
Set 7-day automatic calibration period:
|
|
23
|
+
Command: FF 01 AF 01 07 00 00 00 48
|
|
24
|
+
Confirmation: FF AF 01 07 00 00 00 00 49
|
|
25
|
+
|
|
26
|
+
Set 1-day automatic calibration period:
|
|
27
|
+
Command: FF 01 AF 01 01 00 00 00 4E
|
|
28
|
+
Confirmation: FF AF 01 01 00 00 00 00 4F
|
|
29
|
+
|
|
30
|
+
Notes
|
|
31
|
+
-----
|
|
32
|
+
- Use a well-ventilated environment (around 400 ppm) for command-based zero calibration
|
|
33
|
+
|
|
34
|
+
:author: Florian Mandl
|
|
35
|
+
:version: 1.0
|
|
36
|
+
:date: 2025-12-06
|
|
37
|
+
"""
|
|
38
|
+
|
|
39
|
+
import time
|
|
40
|
+
import json
|
|
41
|
+
from machine import Pin, UART
|
|
42
|
+
from microIO import bind_pin, pinmap_search
|
|
43
|
+
from Common import micro_task, manage_task, console, notify
|
|
44
|
+
from Types import resolve
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
class MHZ19:
|
|
48
|
+
INSTANCE = None
|
|
49
|
+
|
|
50
|
+
SENSOR_TASK = 'mh_z19c.sensor'
|
|
51
|
+
CALIBRATE_TASK = 'mh_z19c.calibrate'
|
|
52
|
+
|
|
53
|
+
def __init__(self):
|
|
54
|
+
self.uart_no = 1
|
|
55
|
+
self.ppm = 0
|
|
56
|
+
self.temp = 0
|
|
57
|
+
self.co2status = 0
|
|
58
|
+
self.tx_pin = Pin(bind_pin('mh_z19c_tx',16))
|
|
59
|
+
self.rx_pin = Pin(bind_pin('mh_z19c_rx',17))
|
|
60
|
+
self.hd_pin = Pin(bind_pin('mh_z19c_hd',19), Pin.OUT, Pin.PULL_UP)
|
|
61
|
+
self.start()
|
|
62
|
+
|
|
63
|
+
def start(self):
|
|
64
|
+
self.uart = UART(self.uart_no, baudrate=9600, tx=self.tx_pin, rx=self.rx_pin)
|
|
65
|
+
self.uart.init(9600, bits=8, parity=None, stop=1, timeout=10)
|
|
66
|
+
|
|
67
|
+
def stop(self):
|
|
68
|
+
while self.uart.any():
|
|
69
|
+
self.uart.read()
|
|
70
|
+
self.uart.deinit()
|
|
71
|
+
|
|
72
|
+
def get_data(self):
|
|
73
|
+
# Clear buffer
|
|
74
|
+
while self.uart.any():
|
|
75
|
+
self.uart.read()
|
|
76
|
+
|
|
77
|
+
self.uart.write(b"\xff\x01\x86\x00\x00\x00\x00\x00\x79")
|
|
78
|
+
time.sleep(0.1)
|
|
79
|
+
s = self.uart.read(9)
|
|
80
|
+
if not s or len(s) < 9:
|
|
81
|
+
return False
|
|
82
|
+
if self._crc8(s) != s[8]:
|
|
83
|
+
self.stop()
|
|
84
|
+
time.sleep(0.1)
|
|
85
|
+
self.start()
|
|
86
|
+
return False
|
|
87
|
+
self.ppm = s[2] * 256 + s[3]
|
|
88
|
+
self.temp = s[4] - 40
|
|
89
|
+
self.co2status = s[5]
|
|
90
|
+
return True
|
|
91
|
+
|
|
92
|
+
async def calibrate(self):
|
|
93
|
+
with micro_task(tag=self.CALIBRATE_TASK) as my_task:
|
|
94
|
+
try:
|
|
95
|
+
self.stop()
|
|
96
|
+
self.hd_pin.value(0)
|
|
97
|
+
await my_task.feed(sleep_ms=8000)
|
|
98
|
+
self.hd_pin.value(1)
|
|
99
|
+
self.start()
|
|
100
|
+
console("Calibration finished")
|
|
101
|
+
except Exception as e:
|
|
102
|
+
console(f"Calibration error: {e}")
|
|
103
|
+
|
|
104
|
+
@staticmethod
|
|
105
|
+
def _crc8(a):
|
|
106
|
+
crc = sum(bytearray(a)[1:8]) % 256
|
|
107
|
+
crc = (~crc & 0xFF) + 1
|
|
108
|
+
return crc
|
|
109
|
+
|
|
110
|
+
#########################
|
|
111
|
+
# Application functions #
|
|
112
|
+
#########################
|
|
113
|
+
|
|
114
|
+
def load():
|
|
115
|
+
"""
|
|
116
|
+
Create MH-Z19 CO2 sensor (over UART)
|
|
117
|
+
"""
|
|
118
|
+
|
|
119
|
+
if MHZ19.INSTANCE is None:
|
|
120
|
+
MHZ19.INSTANCE = MHZ19()
|
|
121
|
+
return MHZ19.INSTANCE
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
def measure():
|
|
125
|
+
"""
|
|
126
|
+
Measure with MH-Z19 CO2 sensor
|
|
127
|
+
"""
|
|
128
|
+
mhz19 = load()
|
|
129
|
+
mhz19.get_data()
|
|
130
|
+
return {"ppm": mhz19.ppm,
|
|
131
|
+
"temp": mhz19.temp,
|
|
132
|
+
"status": mhz19.co2status}
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
def calibrate():
|
|
136
|
+
"""
|
|
137
|
+
Calibrate MH-Z19 sensor
|
|
138
|
+
"""
|
|
139
|
+
mhz19 = load()
|
|
140
|
+
return micro_task(tag=MHZ19.CALIBRATE_TASK, task=mhz19.calibrate())
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
async def _run_sensor_loop(interval, topic, channels):
|
|
144
|
+
channels = [] if channels is None else channels
|
|
145
|
+
with micro_task(tag=MHZ19.SENSOR_TASK) as my_task:
|
|
146
|
+
while True:
|
|
147
|
+
my_task.out = "Start measurement"
|
|
148
|
+
out = notify(json.dumps(measure()), topic=topic, channels=channels)
|
|
149
|
+
my_task.out = f"Measurement published: {out}, wait {interval}ms"
|
|
150
|
+
await my_task.feed(sleep_ms=interval)
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
def start(interval:int=5000, topic:str="MH_Z19C", channels:list=None):
|
|
154
|
+
"""
|
|
155
|
+
Start sensor measurement loop and publish results over micros notify feature
|
|
156
|
+
:param interval: update interval in milliseconds
|
|
157
|
+
:param topic: for MQTT channel, default: MH_Z19C
|
|
158
|
+
:param channels: selected notification channels, ex.: ["MQTT"], default: None (all)
|
|
159
|
+
"""
|
|
160
|
+
load()
|
|
161
|
+
return micro_task(tag=MHZ19.SENSOR_TASK, task=_run_sensor_loop(interval, topic, channels))
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
def stop():
|
|
165
|
+
"""
|
|
166
|
+
Stop sensor measurement loop and publish, delete MHZ19.INSTANCE
|
|
167
|
+
"""
|
|
168
|
+
mhz19 = load()
|
|
169
|
+
manage_task(MHZ19.SENSOR_TASK, "kill")
|
|
170
|
+
if mhz19:
|
|
171
|
+
mhz19.stop()
|
|
172
|
+
MHZ19.INSTANCE = None
|
|
173
|
+
return f"{MHZ19.SENSOR_TASK}: Stopped"
|
|
174
|
+
|
|
175
|
+
#######################
|
|
176
|
+
# LM helper functions #
|
|
177
|
+
#######################
|
|
178
|
+
|
|
179
|
+
def pinmap():
|
|
180
|
+
"""
|
|
181
|
+
[i] micrOS LM naming convention
|
|
182
|
+
Shows logical pins - pin number(s) used by this Load module
|
|
183
|
+
- info which pins to use for this application
|
|
184
|
+
:return dict: pin name (str) - pin value (int) pairs
|
|
185
|
+
"""
|
|
186
|
+
return pinmap_search(['mh_z19c_tx', 'mh_z19c_rx', 'mh_z19c_hd'])
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
def help(widgets=False):
|
|
190
|
+
"""
|
|
191
|
+
[i] micrOS LM naming convention - built-in help message
|
|
192
|
+
:return tuple:
|
|
193
|
+
(widgets=False) list of functions implemented by this application
|
|
194
|
+
(widgets=True) list of widget json for UI generation
|
|
195
|
+
"""
|
|
196
|
+
return resolve(('load',
|
|
197
|
+
'BUTTON start interval=5000',
|
|
198
|
+
'BUTTON stop', 'TEXTBOX measure', 'calibrate', 'pinmap'), widgets=widgets)
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -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,8 @@
|
|
|
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
|
+
from Types import resolve
|
|
5
6
|
|
|
6
7
|
# https://www.coderdojotc.org/micropython/sensors/10-rotary-encoder/
|
|
7
8
|
|
|
@@ -42,27 +43,43 @@ class Rotary:
|
|
|
42
43
|
|
|
43
44
|
class Data:
|
|
44
45
|
ROTARY_OBJ = None
|
|
45
|
-
VAL = 0
|
|
46
46
|
EVENT = True
|
|
47
|
+
VAL = 0
|
|
48
|
+
MIN_VAL = 0
|
|
49
|
+
MAX_VAL = 20
|
|
50
|
+
COLOR = (None, ())
|
|
47
51
|
|
|
48
52
|
|
|
49
53
|
def _rotary_changed(change):
|
|
50
54
|
if change == Rotary.ROT_CW:
|
|
51
55
|
Data.EVENT = True
|
|
52
56
|
Data.VAL = Data.VAL + 1
|
|
57
|
+
if Data.VAL > Data.MAX_VAL:
|
|
58
|
+
Data.VAL = Data.MIN_VAL
|
|
53
59
|
elif change == Rotary.ROT_CCW:
|
|
54
60
|
Data.EVENT = True
|
|
55
61
|
Data.VAL = Data.VAL - 1
|
|
62
|
+
if Data.VAL < Data.MIN_VAL:
|
|
63
|
+
Data.VAL = Data.MAX_VAL
|
|
64
|
+
# Color on neopixel
|
|
65
|
+
if callable(Data.COLOR[0]):
|
|
66
|
+
try:
|
|
67
|
+
r, g, b = Data.COLOR[1][Data.VAL]
|
|
68
|
+
Data.COLOR[0](r, g, b)
|
|
69
|
+
except Exception as e:
|
|
70
|
+
syslog(f"[ERR] rencoder color: {e}")
|
|
56
71
|
|
|
57
72
|
|
|
58
|
-
def
|
|
73
|
+
def load(min_val=0, max_val=20):
|
|
59
74
|
"""
|
|
60
75
|
Create rotary encoder
|
|
61
76
|
"""
|
|
62
77
|
if Data.ROTARY_OBJ is None:
|
|
63
78
|
# GPIO Pins 33 and 35 are for the encoder pins.
|
|
64
|
-
Data.ROTARY_OBJ = Rotary(
|
|
65
|
-
Data.
|
|
79
|
+
Data.ROTARY_OBJ = Rotary(bind_pin('rot_dt'), bind_pin('rot_clk'))
|
|
80
|
+
Data.MIN_VAL = min_val
|
|
81
|
+
Data.MAX_VAL = max_val
|
|
82
|
+
Data.VAL = min_val
|
|
66
83
|
Data.ROTARY_OBJ.add_handler(_rotary_changed)
|
|
67
84
|
return 'Init RotaryEncoder with IRQs.'
|
|
68
85
|
|
|
@@ -72,7 +89,7 @@ def read_state(msgobj=None):
|
|
|
72
89
|
"""
|
|
73
90
|
Read rotary encoder status / relative position
|
|
74
91
|
"""
|
|
75
|
-
|
|
92
|
+
load()
|
|
76
93
|
if msgobj is not None:
|
|
77
94
|
if Data.EVENT:
|
|
78
95
|
msgobj(f"[stream] RotaryState: {Data.VAL}")
|
|
@@ -87,19 +104,31 @@ def reset_state():
|
|
|
87
104
|
Reset rotary encoder state to 0
|
|
88
105
|
"""
|
|
89
106
|
msg = f"Reset state {Data.VAL} -> 0"
|
|
90
|
-
Data.VAL =
|
|
107
|
+
Data.VAL = Data.MIN_VAL
|
|
91
108
|
return msg
|
|
92
109
|
|
|
93
110
|
|
|
94
|
-
def pinmap(
|
|
111
|
+
def pinmap():
|
|
95
112
|
"""
|
|
96
113
|
[i] micrOS LM naming convention
|
|
97
114
|
Load Module built-in help message
|
|
98
115
|
:return tuple: list of functions implemented by this application (widgets=False)
|
|
99
116
|
:return tuple: list of widget json for UI generation (widgets=True)
|
|
100
117
|
"""
|
|
101
|
-
return
|
|
118
|
+
return pinmap_search(['rot_clk', 'rot_dt'])
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
def color_indicator():
|
|
122
|
+
"""Encoder visualization on LED colors (LM_neopixel)"""
|
|
123
|
+
from LM_neopixel import color
|
|
124
|
+
palette_template = ((20, 0, 0), (10, 10, 0), (0, 20, 0), (0, 10, 10), (0, 0, 20))
|
|
125
|
+
repeat = int(Data.MAX_VAL / len(palette_template))+1
|
|
126
|
+
palette = palette_template * repeat
|
|
127
|
+
Data.COLOR = (color, palette)
|
|
128
|
+
color(0, 0, 0) # initial color OFF
|
|
129
|
+
return palette
|
|
102
130
|
|
|
103
131
|
|
|
104
|
-
def help():
|
|
105
|
-
return '
|
|
132
|
+
def help(widgets=False):
|
|
133
|
+
return resolve(('load min_val=0 max_val=20', 'TEXTBOX read_state',
|
|
134
|
+
'reset_state', 'color_indicator', 'pinmap'), widgets=widgets)
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|