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
|
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,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
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -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
|
+
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|