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,86 @@
|
|
|
1
|
+
from micropython import const
|
|
2
|
+
|
|
3
|
+
#### DEFINE CUSTOM PROGRESS LED LOGIC ####
|
|
4
|
+
class WS2812:
|
|
5
|
+
NEOPIXEL = None
|
|
6
|
+
WHEEL = None
|
|
7
|
+
PIN = const(21) # BUILT IN LED - progress_led
|
|
8
|
+
|
|
9
|
+
try:
|
|
10
|
+
# init ws2812
|
|
11
|
+
from machine import Pin
|
|
12
|
+
from neopixel import NeoPixel
|
|
13
|
+
WS2812.NEOPIXEL = NeoPixel(Pin(WS2812.PIN), 1)
|
|
14
|
+
except Exception as e:
|
|
15
|
+
print(f"[Error] IO error, esp21se ws2812: {e}")
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def _step_ws2812(pin=False):
|
|
19
|
+
if pin:
|
|
20
|
+
return WS2812.PIN
|
|
21
|
+
|
|
22
|
+
def _color_wheel():
|
|
23
|
+
while True:
|
|
24
|
+
yield 10, 0, 0
|
|
25
|
+
yield 5, 5, 0
|
|
26
|
+
yield 0, 10, 0
|
|
27
|
+
yield 0, 5, 5
|
|
28
|
+
yield 0, 0, 10
|
|
29
|
+
yield 5, 0, 5
|
|
30
|
+
|
|
31
|
+
if WS2812.WHEEL is None:
|
|
32
|
+
WS2812.WHEEL = _color_wheel()
|
|
33
|
+
WS2812.NEOPIXEL[0] = next(WS2812.WHEEL)
|
|
34
|
+
WS2812.NEOPIXEL.write()
|
|
35
|
+
return True # No double-blink
|
|
36
|
+
|
|
37
|
+
# BUILTIN LED
|
|
38
|
+
builtin = _step_ws2812 # BUILT IN LED - progress_led
|
|
39
|
+
|
|
40
|
+
# ANALOG RGB + WW + CW
|
|
41
|
+
redgb = const(43) # - rgb red channel [PWM]
|
|
42
|
+
rgreenb = const(44) # - rgb green channel [PWM]
|
|
43
|
+
rgbue = const(0) # - rgb blue channel [PWM]
|
|
44
|
+
|
|
45
|
+
wwhite = const(39) # - warm white [PWM]
|
|
46
|
+
cwhite = const(40) # - cold white [PWM]
|
|
47
|
+
|
|
48
|
+
# DIGITAL LED
|
|
49
|
+
neop = const(0) # - neopixel OneWire bus [PWM]
|
|
50
|
+
|
|
51
|
+
# ACTUATORS
|
|
52
|
+
servo_1 = const(44) # - servo(1) [PWM]
|
|
53
|
+
servo_2 = const(42) # - servo(2) [PWM]
|
|
54
|
+
|
|
55
|
+
switch_1 = const(39) # - switch(1) [simple]
|
|
56
|
+
switch_2 = const(40) # - switch(2) [simple]
|
|
57
|
+
switch_3 = const(41) # - switch(3) [simple]
|
|
58
|
+
switch_4 = const(16) # - switch(4) [simple]
|
|
59
|
+
|
|
60
|
+
dim_1 = const(43) # - dimmer(1) [PWM]
|
|
61
|
+
|
|
62
|
+
buzzer = const(1) # - Buzzer pin - sound generator
|
|
63
|
+
|
|
64
|
+
# I2C BUS
|
|
65
|
+
i2c_sda = const(13) # - oled - data
|
|
66
|
+
i2c_scl = const(15) # - oled - clock
|
|
67
|
+
# I2S BUS
|
|
68
|
+
i2s_sck = const(5) # Serial clock
|
|
69
|
+
i2s_ws = const(7) # Word select
|
|
70
|
+
i2s_sd = const(9) # Serial data
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
# EXTERNAL EVENT IRQ
|
|
74
|
+
irq1 = const(15) # - event irq pin
|
|
75
|
+
irq2 = const(13) # - event irq pin
|
|
76
|
+
irq3 = const(14) # - event irq pin
|
|
77
|
+
irq4 = const(12) # - event irq pin
|
|
78
|
+
|
|
79
|
+
touch_0 = const(1) # - touch sensor TODO
|
|
80
|
+
|
|
81
|
+
# SENSORS
|
|
82
|
+
hcsrtrig = const(1) # - distance HCSR04 trigger pin
|
|
83
|
+
hcsrecho = const(3) # - distance HCSR04 echo pin
|
|
84
|
+
dhtpin = const(43) # - dht_pin 11 and 22
|
|
85
|
+
ds18 = const(0) # - DS18B20 - temp. sensor
|
|
86
|
+
mic = const(3) # - [ADC] microphone
|
|
@@ -1,20 +1,26 @@
|
|
|
1
1
|
from micropython import const
|
|
2
|
-
from machine import Pin
|
|
3
|
-
|
|
4
2
|
|
|
5
3
|
#### DEFINE CUSTOM PROGRESS LED LOGIC ####
|
|
4
|
+
class WS2812:
|
|
5
|
+
NEOPIXEL = None
|
|
6
|
+
WHEEL = None
|
|
7
|
+
PIN = const(5) # BUILT IN LED - progress_led
|
|
8
|
+
PIN_ENABLE = const(8) # Power ON LED
|
|
9
|
+
|
|
6
10
|
try:
|
|
11
|
+
# init ws2812
|
|
7
12
|
from neopixel import NeoPixel
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
13
|
+
from machine import Pin
|
|
14
|
+
Pin(WS2812.PIN_ENABLE, Pin.OUT).value(1) # Power ON LED
|
|
15
|
+
WS2812.NEOPIXEL = NeoPixel(Pin(WS2812.PIN), 1) # BUILT IN LED - progress_led
|
|
11
16
|
except Exception as e:
|
|
12
|
-
print(f"[
|
|
13
|
-
PLED_OBJ = None
|
|
17
|
+
print(f"[Error] IO error, esp21se ws2812: {e}")
|
|
14
18
|
|
|
15
19
|
|
|
16
|
-
def _step_ws2812():
|
|
17
|
-
|
|
20
|
+
def _step_ws2812(pin=False):
|
|
21
|
+
if pin:
|
|
22
|
+
return WS2812.PIN
|
|
23
|
+
|
|
18
24
|
def _color_wheel():
|
|
19
25
|
while True:
|
|
20
26
|
yield 10, 0, 0
|
|
@@ -23,15 +29,14 @@ def _step_ws2812():
|
|
|
23
29
|
yield 0, 5, 5
|
|
24
30
|
yield 0, 0, 10
|
|
25
31
|
yield 5, 0, 5
|
|
26
|
-
if PLED_OBJ is None:
|
|
27
|
-
return False
|
|
28
|
-
if NEO_WHEEL is None:
|
|
29
|
-
NEO_WHEEL = _color_wheel()
|
|
30
|
-
PLED_OBJ[0] = next(NEO_WHEEL)
|
|
31
|
-
PLED_OBJ.write()
|
|
32
|
-
return True
|
|
33
|
-
###########################################
|
|
34
32
|
|
|
33
|
+
if WS2812.WHEEL is None:
|
|
34
|
+
WS2812.WHEEL = _color_wheel()
|
|
35
|
+
WS2812.NEOPIXEL[0] = next(WS2812.WHEEL)
|
|
36
|
+
WS2812.NEOPIXEL.write()
|
|
37
|
+
return True # No double-blink
|
|
38
|
+
|
|
39
|
+
###########################################
|
|
35
40
|
|
|
36
41
|
# BUILTIN LED
|
|
37
42
|
builtin = _step_ws2812
|
|
@@ -77,7 +82,12 @@ irq1 = const(13) # MO - event irq pin
|
|
|
77
82
|
irq2 = const(12) # MI - event irq pin
|
|
78
83
|
irq3 = const(14) # SCK - event irq pin
|
|
79
84
|
irq4 = const(7) # TX - event irq pin
|
|
80
|
-
|
|
85
|
+
|
|
86
|
+
js_right = const(13) # oled_ui joystick
|
|
87
|
+
js_left = const(12)
|
|
88
|
+
js_up = const(14)
|
|
89
|
+
js_down = const(7)
|
|
90
|
+
js_press = const(32) # oled_ui center/ok button
|
|
81
91
|
|
|
82
92
|
|
|
83
93
|
# SENSORS
|
|
@@ -1,5 +1,43 @@
|
|
|
1
1
|
from micropython import const
|
|
2
2
|
|
|
3
|
+
#### DEFINE CUSTOM PROGRESS LED LOGIC ####
|
|
4
|
+
class APA102:
|
|
5
|
+
DOTSTAR = None
|
|
6
|
+
COLOR_WHEEL = None
|
|
7
|
+
COLOR_INDEX:int = 0
|
|
8
|
+
|
|
9
|
+
try:
|
|
10
|
+
# init apa102
|
|
11
|
+
from machine import Pin
|
|
12
|
+
from machine import SoftSPI
|
|
13
|
+
from dotstar import DotStar
|
|
14
|
+
from tinypico import DOTSTAR_CLK, DOTSTAR_DATA, SPI_MISO, set_dotstar_power, dotstar_color_wheel
|
|
15
|
+
spi = SoftSPI(sck=Pin(DOTSTAR_CLK), mosi=Pin(DOTSTAR_DATA), miso=Pin(SPI_MISO))
|
|
16
|
+
# Create a DotStar instance
|
|
17
|
+
APA102.DOTSTAR = DotStar(spi, 1, brightness=0.4) # Just one DotStar, half brightness
|
|
18
|
+
# Turn on the power to the DotStar
|
|
19
|
+
set_dotstar_power(True)
|
|
20
|
+
APA102.COLOR_WHEEL = dotstar_color_wheel
|
|
21
|
+
except Exception as e:
|
|
22
|
+
print(f"[Error] IO error, tinypico apa102: {e}")
|
|
23
|
+
|
|
24
|
+
def _step_apa102(pin=False):
|
|
25
|
+
if pin:
|
|
26
|
+
return None
|
|
27
|
+
# Get the R,G,B values of the next colour
|
|
28
|
+
r, g, b = APA102.COLOR_WHEEL(APA102.COLOR_INDEX*2)
|
|
29
|
+
# Set the colour on the DOTSTAR
|
|
30
|
+
APA102.DOTSTAR[0] = (int(r * 0.6), g, b, 0.4)
|
|
31
|
+
# Increase the wheel index
|
|
32
|
+
APA102.COLOR_INDEX = 0 if APA102.COLOR_INDEX > 1000 else APA102.COLOR_INDEX + 2
|
|
33
|
+
return True # No double-blink
|
|
34
|
+
|
|
35
|
+
###################################################
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
# BUILTIN LED
|
|
39
|
+
builtin = _step_apa102
|
|
40
|
+
|
|
3
41
|
# ANALOG RGB + WW + CW
|
|
4
42
|
redgb = const(25) # D25 - rgb red channel [PWM CH1]
|
|
5
43
|
rgreenb = const(26) # D26 - rgb green channel [PWM CH2]
|
|
@@ -9,7 +47,7 @@ wwhite = const(15) # D15 - warm white [PWM CH4]
|
|
|
9
47
|
cwhite = const(14) # D14 - cold white [PWM CH5]
|
|
10
48
|
|
|
11
49
|
# DIGITAL LED
|
|
12
|
-
neop = const(
|
|
50
|
+
neop = const(26) # D26 - WS2812 - neopixel OneWire bus [PWM]
|
|
13
51
|
|
|
14
52
|
|
|
15
53
|
# ACTUATORS
|
|
@@ -28,12 +66,14 @@ l298dir_2 = const(19) # D19 - DC motor direction (2)
|
|
|
28
66
|
l9110dir_1 = const(18) # D18 - DC motor direction (1)
|
|
29
67
|
l9110dir_2 = const(19) # D25 - DC motor direction (2)
|
|
30
68
|
|
|
31
|
-
buzzer = const(
|
|
69
|
+
buzzer = const(33) # D33 - Buzzer pin - sound generator
|
|
70
|
+
haptic = const(32) # D32 - Haptic - vibration motor
|
|
32
71
|
|
|
33
72
|
|
|
34
73
|
# I2C BUS
|
|
35
74
|
i2c_sda = const(21) # D22 - data
|
|
36
75
|
i2c_scl = const(22) # D21 - clock
|
|
76
|
+
trackball_int = const(25) # D25 - event interrupt
|
|
37
77
|
|
|
38
78
|
|
|
39
79
|
# EXTERNAL EVENT IRQ
|
|
@@ -41,7 +81,12 @@ irq1 = const(5) # D5 - event irq pin
|
|
|
41
81
|
irq2 = const(18) # D18 - event irq pin
|
|
42
82
|
irq3 = const(19) # D19 - event irq pin
|
|
43
83
|
irq4 = const(23) # D23 - event irq pin
|
|
44
|
-
|
|
84
|
+
|
|
85
|
+
js_right = const(23) # oled_ui joystick
|
|
86
|
+
js_left = const(5)
|
|
87
|
+
js_up = const(18)
|
|
88
|
+
js_down = const(19)
|
|
89
|
+
js_press = const(32) # oled_ui center/ok button
|
|
45
90
|
|
|
46
91
|
touch_0 = const(32) # D32 - builtin touch sensor TODO
|
|
47
92
|
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
from machine import Pin, PWM
|
|
2
|
+
from microIO import bind_pin, pinmap_search
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
# Cache of last set motor speeds (motor1, motor2) to ensure state() reports the latest values
|
|
6
|
+
# even if hardware PWM duty readout is delayed or unsupported on some boards
|
|
7
|
+
__MOTOR_SPEEDS = [0, 0] # motor1, motor2
|
|
8
|
+
__L298N_OBJS = []
|
|
9
|
+
|
|
10
|
+
PWM_FREQ = 50
|
|
11
|
+
# Deprecated LM_L298N_DCmotor: l298speed, l298dir_1, l298dir_2
|
|
12
|
+
PIN_BINDINGS = [
|
|
13
|
+
('l298n_ENA', 10), ('l298n_INA', 12), ('l298n_INB', 11), # motor 1
|
|
14
|
+
('l298n_ENB', 3), ('l298n_INC', 9), ('l298n_IND', 40), # motor 2
|
|
15
|
+
]
|
|
16
|
+
STATE_MAP = {
|
|
17
|
+
(1, 0): 'forward',
|
|
18
|
+
(0, 1): 'backward',
|
|
19
|
+
(0, 0): 'coast',
|
|
20
|
+
(1, 1): 'brake'
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def __l298n_init():
|
|
25
|
+
global __L298N_OBJS
|
|
26
|
+
if not __L298N_OBJS:
|
|
27
|
+
for index, (name, pin) in enumerate(PIN_BINDINGS):
|
|
28
|
+
if index % 3 == 0: # PWM pin
|
|
29
|
+
pwm = PWM(bind_pin(name, pin), freq=PWM_FREQ)
|
|
30
|
+
pwm.duty(0)
|
|
31
|
+
__L298N_OBJS.append(pwm)
|
|
32
|
+
else:
|
|
33
|
+
p = Pin(bind_pin(name, pin), Pin.OUT)
|
|
34
|
+
p.value(0)
|
|
35
|
+
__L298N_OBJS.append(p)
|
|
36
|
+
return __L298N_OBJS
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def __get_motor_state(motor_index):
|
|
40
|
+
objlist = __l298n_init()
|
|
41
|
+
pwm_index = motor_index * 3
|
|
42
|
+
in1, in2 = objlist[pwm_index + 1].value(), objlist[pwm_index + 2].value()
|
|
43
|
+
state = STATE_MAP.get((in1, in2), 'unknown')
|
|
44
|
+
return {'speed': __MOTOR_SPEEDS[motor_index], 'state': state}
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
#########################
|
|
48
|
+
# Application functions #
|
|
49
|
+
#########################
|
|
50
|
+
|
|
51
|
+
def load(pwm_freq:int=None):
|
|
52
|
+
"""
|
|
53
|
+
[i] micrOS LM naming convention
|
|
54
|
+
Load the L298N motor driver module
|
|
55
|
+
"""
|
|
56
|
+
global PWM_FREQ
|
|
57
|
+
if pwm_freq is not None:
|
|
58
|
+
PWM_FREQ = pwm_freq
|
|
59
|
+
__l298n_init()
|
|
60
|
+
return "Motor driver loaded successfully."
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
def state(motor=0):
|
|
64
|
+
"""
|
|
65
|
+
[i] micrOS LM naming convention
|
|
66
|
+
Get the current state of a motor or all motors
|
|
67
|
+
:param motor: Motor number (1 or 2) or None for all motors
|
|
68
|
+
"""
|
|
69
|
+
if motor == 1:
|
|
70
|
+
return {'motor1': __get_motor_state(0)}
|
|
71
|
+
elif motor == 2:
|
|
72
|
+
return {'motor2': __get_motor_state(1)}
|
|
73
|
+
else:
|
|
74
|
+
return {
|
|
75
|
+
'motor1': __get_motor_state(0),
|
|
76
|
+
'motor2': __get_motor_state(1)
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
def _control_motor(motor, in1, in2):
|
|
81
|
+
objlist = __l298n_init()
|
|
82
|
+
motor_index = 0 if motor == 1 else 3
|
|
83
|
+
objlist[motor_index + 1].value(in1)
|
|
84
|
+
objlist[motor_index + 2].value(in2)
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
def speed(motor, speed:int=1023):
|
|
88
|
+
"""
|
|
89
|
+
Set the speed of a motor
|
|
90
|
+
:param motor: Motor number (1 or 2)
|
|
91
|
+
:param speed: Speed value (0-1023)
|
|
92
|
+
:return: Current motor state
|
|
93
|
+
"""
|
|
94
|
+
if not (0 <= speed <= 1023):
|
|
95
|
+
return {'speed': 'value range error'}
|
|
96
|
+
pwm_index = 0 if motor == 1 else 3
|
|
97
|
+
motor_index = 0 if motor == 1 else 1
|
|
98
|
+
__l298n_init()[pwm_index].duty(speed)
|
|
99
|
+
__MOTOR_SPEEDS[motor_index] = speed
|
|
100
|
+
return state(motor)
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
def direction(motor, forward: bool=True):
|
|
104
|
+
"""
|
|
105
|
+
Set the direction of a motor
|
|
106
|
+
:param motor: Motor number (1 or 2)
|
|
107
|
+
:param forward: True if motor should move forward, False if backward
|
|
108
|
+
:return: Current motor state
|
|
109
|
+
"""
|
|
110
|
+
_control_motor(motor, 1 if forward else 0, 0 if forward else 1)
|
|
111
|
+
return state(motor)
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
def coast(motor):
|
|
115
|
+
"""
|
|
116
|
+
Coast the motor
|
|
117
|
+
:param motor: Motor number (1 or 2)
|
|
118
|
+
"""
|
|
119
|
+
_control_motor(motor, 0, 0)
|
|
120
|
+
return state(motor)
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
def brake(motor):
|
|
124
|
+
"""
|
|
125
|
+
Brake the motor
|
|
126
|
+
:param motor: Motor number (1 or 2)
|
|
127
|
+
:return: Current motor state
|
|
128
|
+
"""
|
|
129
|
+
_control_motor(motor, 1, 1)
|
|
130
|
+
return state(motor)
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
#######################
|
|
134
|
+
# LM helper functions #
|
|
135
|
+
#######################
|
|
136
|
+
|
|
137
|
+
def pinmap():
|
|
138
|
+
"""
|
|
139
|
+
[i] micrOS LM naming convention
|
|
140
|
+
Shows logical pins - pin number(s) used by this Load module
|
|
141
|
+
- info which pins to use for this application
|
|
142
|
+
:return dict: pin name (str) - pin value (int) pairs
|
|
143
|
+
"""
|
|
144
|
+
return pinmap_search([name for name, _ in PIN_BINDINGS])
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
def help(widgets=False):
|
|
148
|
+
"""
|
|
149
|
+
[i] micrOS LM naming convention - built-in help message
|
|
150
|
+
:return tuple:
|
|
151
|
+
(widgets=False) list of functions implemented by this application
|
|
152
|
+
(widgets=True) list of widget json for UI generation
|
|
153
|
+
"""
|
|
154
|
+
return (
|
|
155
|
+
'speed motor=<1/2> speed=<0-1023>',
|
|
156
|
+
'direction motor=<1/2> forward=<True/False>',
|
|
157
|
+
'coast motor=<1/2>',
|
|
158
|
+
'brake motor=<1/2>',
|
|
159
|
+
'state motor=<0/1/2>',
|
|
160
|
+
'pinmap'
|
|
161
|
+
)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from microIO import
|
|
1
|
+
from microIO import bind_pin, pinmap_search
|
|
2
2
|
|
|
3
3
|
#########################################
|
|
4
4
|
# ANALOG DIMMER CONTROLLER PARAMS #
|
|
@@ -15,8 +15,8 @@ def __l9110_init():
|
|
|
15
15
|
global __L9110_OBJS
|
|
16
16
|
if len(__L9110_OBJS) == 0:
|
|
17
17
|
from machine import Pin, PWM
|
|
18
|
-
__L9110_OBJS.append(PWM(Pin(
|
|
19
|
-
__L9110_OBJS.append(PWM(Pin(
|
|
18
|
+
__L9110_OBJS.append(PWM(Pin(bind_pin('l9110dir_1')), freq=1024))
|
|
19
|
+
__L9110_OBJS.append(PWM(Pin(bind_pin('l9110dir_2')), freq=1024))
|
|
20
20
|
__L9110_OBJS[0].duty(0) # Set default speed (PWM)
|
|
21
21
|
__L9110_OBJS[1].duty(0) # Set default speed (PWM)
|
|
22
22
|
return __L9110_OBJS
|
|
@@ -45,7 +45,7 @@ def pinmap():
|
|
|
45
45
|
- info which pins to use for this application
|
|
46
46
|
:return dict: pin name (str) - pin value (int) pairs
|
|
47
47
|
"""
|
|
48
|
-
return
|
|
48
|
+
return pinmap_search(['l9110dir_1', 'l9110dir_2'])
|
|
49
49
|
|
|
50
50
|
|
|
51
51
|
def help(widgets=False):
|
|
@@ -2,9 +2,9 @@ try:
|
|
|
2
2
|
import camera
|
|
3
3
|
except Exception as e:
|
|
4
4
|
camera = None
|
|
5
|
-
import
|
|
6
|
-
from
|
|
7
|
-
from Common import
|
|
5
|
+
from time import localtime, sleep
|
|
6
|
+
from json import loads
|
|
7
|
+
from Common import web_endpoint, syslog, exec_cmd
|
|
8
8
|
from Types import resolve
|
|
9
9
|
|
|
10
10
|
IN_CAPTURE = False # Make sure single capture in progress in the same time
|
|
@@ -12,7 +12,7 @@ CAM_INIT = False
|
|
|
12
12
|
FLASH_LIGHT = None # Flashlight object
|
|
13
13
|
|
|
14
14
|
|
|
15
|
-
def
|
|
15
|
+
def load(quality='medium', freq='default', effect="NONE"):
|
|
16
16
|
"""
|
|
17
17
|
Load Camera module OV2640
|
|
18
18
|
:param quality: high (HD), medium (SVGA), low (240x240)
|
|
@@ -30,7 +30,7 @@ def load_n_init(quality='medium', freq='default', effect="NONE"):
|
|
|
30
30
|
return CAM_INIT
|
|
31
31
|
|
|
32
32
|
for cnt in range(0, 3):
|
|
33
|
-
|
|
33
|
+
print(f"Init OV2640 cam {cnt+1}/3")
|
|
34
34
|
try:
|
|
35
35
|
# ESP32-CAM (default configuration) - https://bit.ly/2Ndn8tN
|
|
36
36
|
if freq.strip().lower() == 'high':
|
|
@@ -45,7 +45,7 @@ def load_n_init(quality='medium', freq='default', effect="NONE"):
|
|
|
45
45
|
except Exception as e:
|
|
46
46
|
syslog(f"[ERR] OV2640: {e}")
|
|
47
47
|
camera.deinit()
|
|
48
|
-
|
|
48
|
+
sleep(1)
|
|
49
49
|
if not CAM_INIT:
|
|
50
50
|
return "Cannot init OV2640 cam"
|
|
51
51
|
|
|
@@ -56,8 +56,10 @@ def load_n_init(quality='medium', freq='default', effect="NONE"):
|
|
|
56
56
|
|
|
57
57
|
def _set_web_endpoints():
|
|
58
58
|
# Register rest endpoint
|
|
59
|
-
|
|
60
|
-
|
|
59
|
+
web_endpoint('cam/snapshot', _snapshot_clb)
|
|
60
|
+
web_endpoint('cam/stream', _image_stream_clb)
|
|
61
|
+
web_endpoint('cam/photo', lambda: ('text/plain', photo()))
|
|
62
|
+
return "Endpoint created: /cam/snapshot, /cam/stream, /cam/photo"
|
|
61
63
|
|
|
62
64
|
|
|
63
65
|
def settings(quality=None, flip=None, mirror=None, effect=None, saturation=None, brightness=None, contrast=None, whitebalace=None, q=None):
|
|
@@ -138,7 +140,7 @@ def settings(quality=None, flip=None, mirror=None, effect=None, saturation=None,
|
|
|
138
140
|
def capture():
|
|
139
141
|
if camera is None:
|
|
140
142
|
return "Non supported feature - use esp32cam image!"
|
|
141
|
-
|
|
143
|
+
load()
|
|
142
144
|
global IN_CAPTURE
|
|
143
145
|
# Capture image
|
|
144
146
|
buf = False
|
|
@@ -153,24 +155,54 @@ def capture():
|
|
|
153
155
|
if buf:
|
|
154
156
|
break
|
|
155
157
|
n_try += 1
|
|
156
|
-
|
|
158
|
+
sleep(0.1)
|
|
157
159
|
except Exception as e:
|
|
158
160
|
syslog(f"[OV2640] Failed to capture: {e}")
|
|
159
161
|
IN_CAPTURE = False
|
|
160
162
|
return buf
|
|
161
163
|
|
|
162
164
|
|
|
163
|
-
def photo(name='photo.
|
|
164
|
-
|
|
165
|
-
|
|
165
|
+
def photo(name='photo.jpeg'):
|
|
166
|
+
"""
|
|
167
|
+
Beta feature - with storage limit
|
|
168
|
+
Create photo and save it under /web/<user_data>
|
|
169
|
+
"""
|
|
170
|
+
def _storage_check(storage_limit=60):
|
|
171
|
+
_status, _usage = exec_cmd(cmd=['fileserver', '_disk_usage_clb'], jsonify=False, secure=True)
|
|
172
|
+
if not _status:
|
|
173
|
+
return False, f"Cannot get storage info: {_usage}"
|
|
174
|
+
# Eval hack to be able to reuse web endpoint callback for disk usage
|
|
175
|
+
usage = loads(str(eval(_usage)[-1]))
|
|
176
|
+
usage_percent = int((usage.get("used", 0) / (usage.get("free", 0) + usage.get("used", 0))) * 100)
|
|
177
|
+
print(usage_percent)
|
|
178
|
+
if usage_percent > storage_limit:
|
|
179
|
+
return False, f"Storage is full < {storage_limit}%"
|
|
180
|
+
return True, ""
|
|
181
|
+
|
|
182
|
+
status, path = exec_cmd(cmd=['fileserver', 'get_user_dir'], jsonify=False, secure=True)
|
|
183
|
+
if not status:
|
|
184
|
+
return "No shared path available: fileserver get_user_dir"
|
|
185
|
+
s, v = _storage_check()
|
|
186
|
+
if not s:
|
|
187
|
+
return v
|
|
188
|
+
t = localtime()
|
|
189
|
+
ts = "{:02d}{:02d}{:02d}-{:02d}{:02d}{:02d}".format(t[0] % 100, t[1], t[2], t[3], t[4], t[5])
|
|
190
|
+
# Create file name with time stamp
|
|
191
|
+
photo_path = f"{path}/{ts}-{name}"
|
|
192
|
+
# Take a Photo
|
|
193
|
+
_ = capture() # Dump current cached image
|
|
194
|
+
buf = capture() # Create new image
|
|
195
|
+
# Save the Photo
|
|
196
|
+
with open(photo_path, 'wb') as f:
|
|
166
197
|
if buf:
|
|
167
198
|
f.write(buf)
|
|
168
|
-
return "Image saved as
|
|
169
|
-
return "Cannot save...
|
|
199
|
+
return f"Image saved as {photo_path}"
|
|
200
|
+
return f"Cannot save... {photo_path}"
|
|
170
201
|
|
|
171
202
|
|
|
172
203
|
def _snapshot_clb():
|
|
173
|
-
|
|
204
|
+
_ = capture() # Dump current cached image
|
|
205
|
+
image = capture() # Take new image
|
|
174
206
|
if image is not None:
|
|
175
207
|
return 'image/jpeg', image
|
|
176
208
|
return 'text/plain', f'capture error: {image}'
|
|
@@ -180,21 +212,7 @@ def _image_stream_clb():
|
|
|
180
212
|
return 'multipart/x-mixed-replace', {'callback': capture, 'content-type': 'image/jpeg'}
|
|
181
213
|
|
|
182
214
|
|
|
183
|
-
def
|
|
184
|
-
with open(name, 'rb') as f:
|
|
185
|
-
image = f.read()
|
|
186
|
-
return 'image/jpeg', image
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
def set_photo_endpoint():
|
|
190
|
-
"""
|
|
191
|
-
Set photo endpoint (rest endpoint)
|
|
192
|
-
"""
|
|
193
|
-
rest_endpoint('photo', _img_clb)
|
|
194
|
-
return "Endpoint created: /photo"
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
def __light_init():
|
|
215
|
+
def _light_init():
|
|
198
216
|
global FLASH_LIGHT
|
|
199
217
|
if FLASH_LIGHT is None:
|
|
200
218
|
from machine import Pin
|
|
@@ -206,20 +224,13 @@ def flashlight(state=None):
|
|
|
206
224
|
Camera flashlight
|
|
207
225
|
:param state: True/False/None(automatic)
|
|
208
226
|
"""
|
|
209
|
-
fl =
|
|
227
|
+
fl = _light_init()
|
|
210
228
|
if state is None:
|
|
211
229
|
state = fl.value(not fl.value())
|
|
212
230
|
else:
|
|
213
231
|
state = fl.value(state)
|
|
214
232
|
return {'S': state}
|
|
215
233
|
|
|
216
|
-
def lmdep():
|
|
217
|
-
"""
|
|
218
|
-
Show Load Module dependency
|
|
219
|
-
- List of load modules used by this application
|
|
220
|
-
:return: tuple
|
|
221
|
-
"""
|
|
222
|
-
return 'dashboard_be'
|
|
223
234
|
|
|
224
235
|
def help(widgets=False):
|
|
225
236
|
"""
|
|
@@ -228,14 +239,14 @@ def help(widgets=False):
|
|
|
228
239
|
(widgets=False) list of functions implemented by this application
|
|
229
240
|
(widgets=True) list of widget json for UI generation
|
|
230
241
|
"""
|
|
231
|
-
return resolve(('
|
|
242
|
+
return resolve(('load quality="medium/low/high" freq="default/high"',
|
|
232
243
|
'settings quality=None flip=None mirror=None effect="NONE"',
|
|
233
244
|
'SLIDER settings saturation=<0-100>',
|
|
234
245
|
'SLIDER settings brightness=<0-100>',
|
|
235
246
|
'SLIDER settings contrast=<0-100>',
|
|
247
|
+
'BUTTON settings effect=<NONE,NEG,BW,RED,GREEN,BLUE,RETRO>',
|
|
236
248
|
'capture',
|
|
237
249
|
'photo',
|
|
238
|
-
'set_photo_endpoint',
|
|
239
250
|
'BUTTON flashlight state=None',
|
|
240
|
-
'[Hint] after
|
|
251
|
+
'[Hint] after load you can access the /cam/snapshot and /cam/stream endpoints',
|
|
241
252
|
'Thanks to :) https://github.com/lemariva/micropython-camera-driver'), widgets=widgets)
|
|
@@ -2,7 +2,7 @@ from micropython import const
|
|
|
2
2
|
import ustruct
|
|
3
3
|
import utime
|
|
4
4
|
from machine import I2C, Pin
|
|
5
|
-
from microIO import
|
|
5
|
+
from microIO import bind_pin, pinmap_search
|
|
6
6
|
|
|
7
7
|
__TOF_OBJ = None
|
|
8
8
|
|
|
@@ -31,7 +31,7 @@ class TimeoutError(RuntimeError):
|
|
|
31
31
|
|
|
32
32
|
class VL53L0X:
|
|
33
33
|
def __init__(self, address=57):
|
|
34
|
-
self.i2c = I2C(-1, Pin(
|
|
34
|
+
self.i2c = I2C(-1, Pin(bind_pin('i2c_scl')), Pin(bind_pin('i2c_sda')), freq=9600)
|
|
35
35
|
self.address = address
|
|
36
36
|
self.init()
|
|
37
37
|
self._started = False
|
|
@@ -343,7 +343,7 @@ class VL53L0X:
|
|
|
343
343
|
|
|
344
344
|
def measure():
|
|
345
345
|
"""
|
|
346
|
-
Experimental
|
|
346
|
+
Experimental - Time of Flight Distance Sensor
|
|
347
347
|
"""
|
|
348
348
|
global __TOF_OBJ
|
|
349
349
|
if __TOF_OBJ is None:
|
|
@@ -365,12 +365,12 @@ def pinmap():
|
|
|
365
365
|
- info which pins to use for this application
|
|
366
366
|
:return dict: pin name (str) - pin value (int) pairs
|
|
367
367
|
"""
|
|
368
|
-
return
|
|
368
|
+
return pinmap_search(['i2c_scl', 'i2c_sda'])
|
|
369
369
|
|
|
370
370
|
|
|
371
371
|
def help(widgets=False):
|
|
372
372
|
"""
|
|
373
|
-
[i] micrOS LM naming convention - built-in help message
|
|
373
|
+
[BETA][i] micrOS LM naming convention - built-in help message
|
|
374
374
|
:return tuple:
|
|
375
375
|
(widgets=False) list of functions implemented by this application
|
|
376
376
|
(widgets=True) list of widget json for UI generation
|