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,255 @@
|
|
|
1
|
+
"""
|
|
2
|
+
micrOS ESPNow cluster module.
|
|
3
|
+
-- STA/AP Channel sync [OK]
|
|
4
|
+
-- wifi settings sync [OK]
|
|
5
|
+
-- health (cluster availability) [OK]
|
|
6
|
+
-- cluster run <cmd> [OK]
|
|
7
|
+
ShellCli (socket) extension (todo)
|
|
8
|
+
-- health (cluster availability)
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
from binascii import hexlify
|
|
12
|
+
from machine import soft_reset
|
|
13
|
+
from Config import cfgget, cfgput
|
|
14
|
+
from Network import _select_available_wifi_nw, ifconfig, WLAN, STA_IF, AP_IF
|
|
15
|
+
from Common import micro_task, exec_cmd, syslog
|
|
16
|
+
if cfgget("espnow"):
|
|
17
|
+
from Espnow import ESPNowSS
|
|
18
|
+
ESPNOW = ESPNowSS()
|
|
19
|
+
else:
|
|
20
|
+
ESPNOW = None
|
|
21
|
+
|
|
22
|
+
class Cluster:
|
|
23
|
+
CHANNEL = 6 # Leader channel to align with
|
|
24
|
+
ANCHOR_SSID_POSTFIX = "-mCSA" # micrOS (Wifi) Channel Sync Anchor
|
|
25
|
+
ANCHOR_ENABLED = False # Anchor indicator
|
|
26
|
+
REFRESH_MS = 20 * 60_000 # 20min - refresh channel sync period (AP mode)
|
|
27
|
+
|
|
28
|
+
#########################################################
|
|
29
|
+
# CLUSTER - LOCAL EXECUTION "ON TARGET" #
|
|
30
|
+
#########################################################
|
|
31
|
+
|
|
32
|
+
@micro_task("cluster", _wrap=True)
|
|
33
|
+
async def _reboot(tag:str):
|
|
34
|
+
"""
|
|
35
|
+
Restart in the background
|
|
36
|
+
(Enable function return before restart...)
|
|
37
|
+
"""
|
|
38
|
+
with micro_task(tag) as my_task:
|
|
39
|
+
await my_task.feed(5000)
|
|
40
|
+
soft_reset()
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def _update_wifi(ssid:str, pwd:str):
|
|
44
|
+
"""
|
|
45
|
+
Local Config Setter - Add WiFi settings
|
|
46
|
+
:param ssid: str - SSID
|
|
47
|
+
:param pwd: str - Password
|
|
48
|
+
"""
|
|
49
|
+
def _update_sta_config():
|
|
50
|
+
nonlocal _ssid, _pwd
|
|
51
|
+
essids = cfgget("staessid")
|
|
52
|
+
passwords = cfgget("stapwd")
|
|
53
|
+
if _ssid in essids:
|
|
54
|
+
# [INFO] No password refresh is supported
|
|
55
|
+
return f"Wifi already known: {ssid}"
|
|
56
|
+
# Deserialize wifi settings from config file
|
|
57
|
+
essids_list = essids.split(";")
|
|
58
|
+
passwords_list = passwords.split(";")
|
|
59
|
+
# Extend with new wifi settings
|
|
60
|
+
essids_list.append(_ssid)
|
|
61
|
+
passwords_list.append(_pwd)
|
|
62
|
+
# Serialize back wifi settings to config file
|
|
63
|
+
cfgput("staessid",";".join(essids_list))
|
|
64
|
+
cfgput("stapwd", ";".join(passwords_list))
|
|
65
|
+
# REBOOT
|
|
66
|
+
_reboot()
|
|
67
|
+
return "Soft reboot, apply wifi settings"
|
|
68
|
+
|
|
69
|
+
if ';' in ssid or ';' in pwd:
|
|
70
|
+
return "Unsupported character in ssid or pwd ;"
|
|
71
|
+
# Check Wifi settings
|
|
72
|
+
if cfgget("nwmd").upper() == "STA":
|
|
73
|
+
# Check current wifi state
|
|
74
|
+
if ifconfig()[0] == "STA":
|
|
75
|
+
return "Device already connected to WiFi"
|
|
76
|
+
# Validate wifi essid is available
|
|
77
|
+
_ssid, _pwd = _select_available_wifi_nw(ssid, pwd)
|
|
78
|
+
if _ssid is None:
|
|
79
|
+
return f"Wifi SSID not available: {ssid}"
|
|
80
|
+
return _update_sta_config()
|
|
81
|
+
return "Wifi is in Access Point mode, skip sync"
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
def _run(cmd:str):
|
|
85
|
+
state, out = exec_cmd(cmd.split(), secure=True)
|
|
86
|
+
return f"[{'OK' if state else 'NOK'}] {out}"
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
@micro_task("cluster", _wrap=True)
|
|
90
|
+
async def _align_channel(tag:str, sta:STA_IF, ap:AP_IF):
|
|
91
|
+
_initialized = False
|
|
92
|
+
|
|
93
|
+
with micro_task(tag) as my_task:
|
|
94
|
+
while True:
|
|
95
|
+
my_task.out = "Sync in progress..."
|
|
96
|
+
ch = Cluster.CHANNEL
|
|
97
|
+
_refresh_ms = Cluster.REFRESH_MS
|
|
98
|
+
for s, b, c, *_ in sta.scan():
|
|
99
|
+
sta_name = (s.decode() if isinstance(s, bytes) else s)
|
|
100
|
+
if sta_name.endswith(Cluster.ANCHOR_SSID_POSTFIX):
|
|
101
|
+
my_task.out = f"Anchor {sta_name} channel: {c} (refresh: {int(_refresh_ms/60_000)}min)"
|
|
102
|
+
ch = c
|
|
103
|
+
break
|
|
104
|
+
|
|
105
|
+
if not _initialized or ch != Cluster.CHANNEL:
|
|
106
|
+
Cluster.CHANNEL = ch
|
|
107
|
+
if not sta.isconnected():
|
|
108
|
+
# ENABLE ESPNOW STA MAC ACCESS - AFTER THIS ALL DEVICES CAN REACH EACH OTHER ON STA MAC ADDRESS
|
|
109
|
+
try: sta.config(channel=ch)
|
|
110
|
+
except Exception as e:
|
|
111
|
+
my_task.out = f"STA Failed to set {ch} channel: {e}"
|
|
112
|
+
# ensure AP advertises/operates on the same channel (important when STA not connected yet)
|
|
113
|
+
try: ap.config(channel=ch)
|
|
114
|
+
except Exception as e:
|
|
115
|
+
my_task.out = f"AP Failed to set {ch} channel: {e}"
|
|
116
|
+
_initialized = True
|
|
117
|
+
await my_task.feed(_refresh_ms)
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
@micro_task("cluster", _wrap=True)
|
|
121
|
+
async def _network(tag:str, anchor=False):
|
|
122
|
+
"""
|
|
123
|
+
Support hybrid AP/STA ESPNow communication
|
|
124
|
+
For ESPNow communication all device should use the same Wifi channel!
|
|
125
|
+
- LEADER: STA*/AP mode - *channel is set by the router and can change
|
|
126
|
+
- AP deices should use the same channel as ANCHOR (discovery by leader/anchor(STA) over AP anchor)
|
|
127
|
+
- ESPNOW: STA mac addresses are stored on ANCHOR
|
|
128
|
+
:param anchor: enable anchor mode (AP) for ESPNow channel synchronization
|
|
129
|
+
"""
|
|
130
|
+
def _conf_ap_anchor():
|
|
131
|
+
_ap = WLAN(AP_IF)
|
|
132
|
+
if not _ap.active(): _ap.active(True)
|
|
133
|
+
anchor_ssid = f"{cfgget('devfid')}{Cluster.ANCHOR_SSID_POSTFIX}"
|
|
134
|
+
try:
|
|
135
|
+
_ap.config(essid=anchor_ssid, password=cfgget("appwd"), authmode=3, max_clients=5)
|
|
136
|
+
return True
|
|
137
|
+
except Exception as e:
|
|
138
|
+
syslog(f"[ERR] Anchor configuration failed: {e}")
|
|
139
|
+
return False
|
|
140
|
+
def _enable_sta():
|
|
141
|
+
sta = WLAN(STA_IF)
|
|
142
|
+
if not sta.active(): sta.active(True)
|
|
143
|
+
return sta
|
|
144
|
+
|
|
145
|
+
with micro_task(tag) as my_task:
|
|
146
|
+
# CONFIGURE WIFI CHANNEL SYNC ROLES
|
|
147
|
+
my_task.out = "Configure cluster network"
|
|
148
|
+
micros_nw = ifconfig()[0]
|
|
149
|
+
# MICROS in STA MODE
|
|
150
|
+
if micros_nw == "STA":
|
|
151
|
+
if anchor:
|
|
152
|
+
# CREATE CHANNEL ANCHOR - AP channel is inherited from STA
|
|
153
|
+
Cluster.ANCHOR_ENABLED = _conf_ap_anchor()
|
|
154
|
+
else:
|
|
155
|
+
# MICROS in AP MODE: CLUSTER FOLLOWER - WIFI CHANNEL SYNC WITH ANCHOR
|
|
156
|
+
ap, sta = WLAN(AP_IF), _enable_sta()
|
|
157
|
+
# Sync Channel with Cluster Anchor
|
|
158
|
+
_align_channel(sta, ap)
|
|
159
|
+
if anchor:
|
|
160
|
+
# MICROS in AP MODE - RECONFIGURE AP NAME to match Anchor
|
|
161
|
+
# EXPERIMENTAL FEATURE: Scans and Advertise the channel as well.
|
|
162
|
+
Cluster.ANCHOR_ENABLED = _conf_ap_anchor()
|
|
163
|
+
my_task.out = status()
|
|
164
|
+
|
|
165
|
+
#########################################################
|
|
166
|
+
# CLUSTER WIDE FEATURES #
|
|
167
|
+
#########################################################
|
|
168
|
+
|
|
169
|
+
def sync_wifi():
|
|
170
|
+
"""
|
|
171
|
+
ESPNow Cluster Wifi Settings Sync for Station (STA) Connection Mode
|
|
172
|
+
- Join devices to the same wifi network...
|
|
173
|
+
"""
|
|
174
|
+
if ESPNOW is None:
|
|
175
|
+
return "ESPNow is disabled"
|
|
176
|
+
# Check current wifi state
|
|
177
|
+
if ifconfig()[0] != "STA":
|
|
178
|
+
return "No WiFi STA Connection: no verified settings to share"
|
|
179
|
+
# [1] Get current wifi ssid and password
|
|
180
|
+
_ssid, _pwd = _select_available_wifi_nw(cfgget("staessid"), cfgget("stapwd"))
|
|
181
|
+
# [2] Send command: 'cluster _update_wifi "<ssid>" "<pwd>"'
|
|
182
|
+
command = f"cluster _update_wifi '{_ssid}' '{_pwd}'"
|
|
183
|
+
sync_tasks = ESPNOW.cluster_send(command)
|
|
184
|
+
return sync_tasks
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
def run(cmd:str):
|
|
188
|
+
"""
|
|
189
|
+
Run a command on the cluster
|
|
190
|
+
:param cmd: str - command to run on the cluster
|
|
191
|
+
Example: cmd='system heartbeat'
|
|
192
|
+
"""
|
|
193
|
+
command = f"cluster _run '{cmd}'"
|
|
194
|
+
sync_tasks = ESPNOW.cluster_send(command)
|
|
195
|
+
return sync_tasks
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
def health():
|
|
199
|
+
"""
|
|
200
|
+
Simple connection check
|
|
201
|
+
- with default espnow-micros hello message
|
|
202
|
+
"""
|
|
203
|
+
if ESPNOW is None:
|
|
204
|
+
return "ESPNow is disabled"
|
|
205
|
+
return ESPNOW.cluster_send("hello")
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
def members():
|
|
209
|
+
"""
|
|
210
|
+
List all members in the cluster
|
|
211
|
+
"""
|
|
212
|
+
if ESPNOW is None:
|
|
213
|
+
return "ESPNow is disabled"
|
|
214
|
+
return {hexlify(mac, ':').decode(): name for mac, name in ESPNOW.devices.items()}
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+
def status():
|
|
218
|
+
"""
|
|
219
|
+
Cluster setup status
|
|
220
|
+
"""
|
|
221
|
+
nw_if = ifconfig()[0]
|
|
222
|
+
cluster_settings = {"channel": Cluster.CHANNEL, "primary_nw": nw_if,
|
|
223
|
+
"anchor": Cluster.ANCHOR_ENABLED}
|
|
224
|
+
if nw_if == "AP":
|
|
225
|
+
cluster_settings["refresh"] = Cluster.REFRESH_MS
|
|
226
|
+
return cluster_settings
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
def load(anchor:bool=False, refresh:int=None):
|
|
230
|
+
"""
|
|
231
|
+
Enable ESPNow protocol 'cluster' module access
|
|
232
|
+
:param anchor: create AP as Channel Anchor (Channel Leader Role)
|
|
233
|
+
:param refresh: refresh channel sync period in minute (AP)
|
|
234
|
+
"""
|
|
235
|
+
if ESPNOW is None:
|
|
236
|
+
return "ESPNow is disabled"
|
|
237
|
+
if refresh is not None:
|
|
238
|
+
Cluster.REFRESH_MS = 60_000 if refresh < 1 else refresh * 60_000
|
|
239
|
+
# Configure cluster network - after micrOS network setup
|
|
240
|
+
_network(anchor)
|
|
241
|
+
return f"Enable cluster module access"
|
|
242
|
+
|
|
243
|
+
|
|
244
|
+
def help(widgets=True):
|
|
245
|
+
"""
|
|
246
|
+
[BETA]
|
|
247
|
+
Show help for cluster commands
|
|
248
|
+
"""
|
|
249
|
+
return ("load anchor=False refresh=20",
|
|
250
|
+
"run 'command'",
|
|
251
|
+
"sync_wifi",
|
|
252
|
+
"health",
|
|
253
|
+
"members",
|
|
254
|
+
"status",
|
|
255
|
+
"[Info] Get command results:\n\ttask show con.espnow.*")
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
from math import pow
|
|
2
2
|
from sys import platform
|
|
3
3
|
from machine import ADC, Pin
|
|
4
|
-
from microIO import
|
|
4
|
+
from microIO import bind_pin, pinmap_search
|
|
5
5
|
from Types import resolve
|
|
6
6
|
|
|
7
7
|
#########################################
|
|
@@ -20,10 +20,10 @@ def __get_resistance():
|
|
|
20
20
|
global __ADC, __ADC_PROP
|
|
21
21
|
if __ADC is None:
|
|
22
22
|
if 'esp8266' in platform:
|
|
23
|
-
__ADC = ADC(
|
|
23
|
+
__ADC = ADC(bind_pin('co2')) # 1V measure range
|
|
24
24
|
__ADC_PROP = (1023, 1.0)
|
|
25
25
|
else:
|
|
26
|
-
__ADC = ADC(Pin(
|
|
26
|
+
__ADC = ADC(Pin(bind_pin('co2')))
|
|
27
27
|
__ADC.atten(ADC.ATTN_11DB) # 3.6V measure range
|
|
28
28
|
__ADC.width(ADC.WIDTH_10BIT) # Default 10 bit ADC
|
|
29
29
|
__ADC_PROP = (1023, 3.6)
|
|
@@ -90,6 +90,13 @@ def __ppm_verdict(ppm):
|
|
|
90
90
|
# Application functions #
|
|
91
91
|
#########################
|
|
92
92
|
|
|
93
|
+
def load():
|
|
94
|
+
"""
|
|
95
|
+
Initialize mq135 CO2 (ppm) sensor module
|
|
96
|
+
"""
|
|
97
|
+
__get_resistance()
|
|
98
|
+
return "mq135 CO2 (ppm) sensor - loaded"
|
|
99
|
+
|
|
93
100
|
def raw_measure_mq135():
|
|
94
101
|
"""
|
|
95
102
|
Measure raw mq135 CO2 value
|
|
@@ -135,7 +142,7 @@ def pinmap():
|
|
|
135
142
|
- info which pins to use for this application
|
|
136
143
|
:return dict: pin name (str) - pin value (int) pairs
|
|
137
144
|
"""
|
|
138
|
-
return
|
|
145
|
+
return pinmap_search('co2')
|
|
139
146
|
|
|
140
147
|
|
|
141
148
|
def help(widgets=False):
|
|
@@ -145,6 +152,6 @@ def help(widgets=False):
|
|
|
145
152
|
(widgets=False) list of functions implemented by this application
|
|
146
153
|
(widgets=True) list of widget json for UI generation
|
|
147
154
|
"""
|
|
148
|
-
return resolve(('TEXTBOX measure_mq135 temp
|
|
149
|
-
'raw_measure_mq135', 'pinmap'), widgets=widgets)
|
|
155
|
+
return resolve(('TEXTBOX measure_mq135 temp=None hum=None',
|
|
156
|
+
'raw_measure_mq135', 'load', 'pinmap'), widgets=widgets)
|
|
150
157
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from microIO import
|
|
1
|
+
from microIO import bind_pin, pinmap_search
|
|
2
2
|
from Common import data_logger
|
|
3
3
|
from Types import resolve
|
|
4
4
|
|
|
@@ -14,7 +14,7 @@ def __init_DHT11():
|
|
|
14
14
|
if __DHT_OBJ is None:
|
|
15
15
|
from dht import DHT11
|
|
16
16
|
from machine import Pin
|
|
17
|
-
__DHT_OBJ = DHT11(Pin(
|
|
17
|
+
__DHT_OBJ = DHT11(Pin(bind_pin('dhtpin')))
|
|
18
18
|
return __DHT_OBJ
|
|
19
19
|
|
|
20
20
|
|
|
@@ -31,6 +31,13 @@ def __temp_hum():
|
|
|
31
31
|
# Application functions #
|
|
32
32
|
#########################
|
|
33
33
|
|
|
34
|
+
def load():
|
|
35
|
+
"""
|
|
36
|
+
Initialize DHT11 hum/temp sensor module
|
|
37
|
+
"""
|
|
38
|
+
__init_DHT11()
|
|
39
|
+
return "DHT11 hum/temp sensor module - loaded"
|
|
40
|
+
|
|
34
41
|
def measure(log=False):
|
|
35
42
|
"""
|
|
36
43
|
Measure with dht11
|
|
@@ -42,23 +49,9 @@ def measure(log=False):
|
|
|
42
49
|
data_logger(_LOG_NAME, data=str(data))
|
|
43
50
|
return data
|
|
44
51
|
|
|
45
|
-
|
|
46
|
-
def measure_w_co2(log=False):
|
|
47
|
-
"""
|
|
48
|
-
Measure with dht11 and mq135 (CO2)
|
|
49
|
-
:return dict: temp, hum, co2
|
|
50
|
-
"""
|
|
51
|
-
from LM_co2 import measure_mq135
|
|
52
|
-
_temp, _hum = __temp_hum()
|
|
53
|
-
data = {'temp[C]': round(_temp, 2), 'hum[%]': round(_hum, 2), 'co2[ppm]': measure_mq135(_temp, _hum)}
|
|
54
|
-
if log:
|
|
55
|
-
data_logger(_LOG_NAME, data=str(data))
|
|
56
|
-
return data
|
|
57
|
-
|
|
58
|
-
|
|
59
52
|
def logger():
|
|
60
53
|
"""
|
|
61
|
-
Return temp, hum
|
|
54
|
+
Return temp, hum logged data
|
|
62
55
|
"""
|
|
63
56
|
data_logger(_LOG_NAME)
|
|
64
57
|
return ''
|
|
@@ -68,15 +61,6 @@ def logger():
|
|
|
68
61
|
# LM helper functions #
|
|
69
62
|
#######################
|
|
70
63
|
|
|
71
|
-
def lmdep():
|
|
72
|
-
"""
|
|
73
|
-
Show Load Module dependency
|
|
74
|
-
- List of load modules used by this application
|
|
75
|
-
:return: tuple
|
|
76
|
-
"""
|
|
77
|
-
return 'co2'
|
|
78
|
-
|
|
79
|
-
|
|
80
64
|
def pinmap():
|
|
81
65
|
"""
|
|
82
66
|
[i] micrOS LM naming convention
|
|
@@ -84,7 +68,7 @@ def pinmap():
|
|
|
84
68
|
- info which pins to use for this application
|
|
85
69
|
:return dict: pin name (str) - pin value (int) pairs
|
|
86
70
|
"""
|
|
87
|
-
return
|
|
71
|
+
return pinmap_search('dhtpin')
|
|
88
72
|
|
|
89
73
|
|
|
90
74
|
def help(widgets=False):
|
|
@@ -94,5 +78,5 @@ def help(widgets=False):
|
|
|
94
78
|
(widgets=False) list of functions implemented by this application
|
|
95
79
|
(widgets=True) list of widget json for UI generation
|
|
96
80
|
"""
|
|
97
|
-
return resolve(('TEXTBOX measure log=False',
|
|
98
|
-
'logger', '
|
|
81
|
+
return resolve(('TEXTBOX measure log=False',
|
|
82
|
+
'logger', 'load', 'pinmap'), widgets=widgets)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from microIO import
|
|
1
|
+
from microIO import bind_pin, pinmap_search
|
|
2
2
|
from Common import data_logger
|
|
3
3
|
from Types import resolve
|
|
4
4
|
|
|
@@ -14,7 +14,7 @@ def __init_DHT22():
|
|
|
14
14
|
if __DHT_OBJ is None:
|
|
15
15
|
from dht import DHT22
|
|
16
16
|
from machine import Pin
|
|
17
|
-
__DHT_OBJ = DHT22(Pin(
|
|
17
|
+
__DHT_OBJ = DHT22(Pin(bind_pin('dhtpin')))
|
|
18
18
|
return __DHT_OBJ
|
|
19
19
|
|
|
20
20
|
|
|
@@ -31,6 +31,13 @@ def __temp_hum():
|
|
|
31
31
|
# Application functions #
|
|
32
32
|
#########################
|
|
33
33
|
|
|
34
|
+
def load():
|
|
35
|
+
"""
|
|
36
|
+
Initialize DHT22 hum/temp sensor module
|
|
37
|
+
"""
|
|
38
|
+
__init_DHT22()
|
|
39
|
+
return "DHT22 hum/temp sensor module - loaded"
|
|
40
|
+
|
|
34
41
|
def measure(log=False):
|
|
35
42
|
"""
|
|
36
43
|
Measure with dht22
|
|
@@ -43,22 +50,9 @@ def measure(log=False):
|
|
|
43
50
|
return data
|
|
44
51
|
|
|
45
52
|
|
|
46
|
-
def measure_w_co2(log=False):
|
|
47
|
-
"""
|
|
48
|
-
Measure with dht22 and mq135 (CO2)
|
|
49
|
-
:return dict: temp, hum, co2
|
|
50
|
-
"""
|
|
51
|
-
from LM_co2 import measure_mq135
|
|
52
|
-
_temp, _hum = __temp_hum()
|
|
53
|
-
data = {'temp[C]': round(_temp, 2), 'hum[%]': round(_hum, 2), 'co2[ppm]': measure_mq135(_temp, _hum)}
|
|
54
|
-
if log:
|
|
55
|
-
data_logger(_LOG_NAME, data=str(data))
|
|
56
|
-
return data
|
|
57
|
-
|
|
58
|
-
|
|
59
53
|
def logger():
|
|
60
54
|
"""
|
|
61
|
-
Return temp, hum
|
|
55
|
+
Return temp, hum logged data
|
|
62
56
|
"""
|
|
63
57
|
data_logger(_LOG_NAME)
|
|
64
58
|
return ''
|
|
@@ -68,15 +62,6 @@ def logger():
|
|
|
68
62
|
# LM helper functions #
|
|
69
63
|
#######################
|
|
70
64
|
|
|
71
|
-
def lmdep():
|
|
72
|
-
"""
|
|
73
|
-
Show Load Module dependency
|
|
74
|
-
- List of load modules used by this application
|
|
75
|
-
:return: tuple
|
|
76
|
-
"""
|
|
77
|
-
return 'co2'
|
|
78
|
-
|
|
79
|
-
|
|
80
65
|
def pinmap():
|
|
81
66
|
"""
|
|
82
67
|
[i] micrOS LM naming convention
|
|
@@ -84,7 +69,7 @@ def pinmap():
|
|
|
84
69
|
- info which pins to use for this application
|
|
85
70
|
:return dict: pin name (str) - pin value (int) pairs
|
|
86
71
|
"""
|
|
87
|
-
return
|
|
72
|
+
return pinmap_search('dhtpin')
|
|
88
73
|
|
|
89
74
|
|
|
90
75
|
def help(widgets=False):
|
|
@@ -94,5 +79,5 @@ def help(widgets=False):
|
|
|
94
79
|
(widgets=False) list of functions implemented by this application
|
|
95
80
|
(widgets=True) list of widget json for UI generation
|
|
96
81
|
"""
|
|
97
|
-
return resolve(('TEXTBOX measure log=False',
|
|
98
|
-
'logger', '
|
|
82
|
+
return resolve(('TEXTBOX measure log=False',
|
|
83
|
+
'logger', 'load', 'pinmap'), widgets=widgets)
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
from sys import platform
|
|
2
|
-
from microIO import
|
|
3
|
-
from Common import transition_gen, micro_task
|
|
4
|
-
import uasyncio as asyncio
|
|
2
|
+
from microIO import bind_pin, pinmap_search
|
|
3
|
+
from Common import transition_gen, micro_task, data_dir
|
|
5
4
|
from utime import sleep_ms
|
|
5
|
+
from Types import resolve
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
#########################################
|
|
@@ -15,6 +15,7 @@ class Data:
|
|
|
15
15
|
PERSISTENT_CACHE = False
|
|
16
16
|
DIMM_TASK_TAG = "dimmer._tran"
|
|
17
17
|
TASK_STATE = False
|
|
18
|
+
FILE_CACHE = data_dir('dimmer.cache')
|
|
18
19
|
|
|
19
20
|
|
|
20
21
|
#########################################
|
|
@@ -24,7 +25,7 @@ class Data:
|
|
|
24
25
|
def __dimmer_init():
|
|
25
26
|
if Data.DIMMER_OBJ is None:
|
|
26
27
|
from machine import Pin, PWM
|
|
27
|
-
dimmer_pin = Pin(
|
|
28
|
+
dimmer_pin = Pin(bind_pin('dim_1'))
|
|
28
29
|
if platform == 'esp8266':
|
|
29
30
|
Data.DIMMER_OBJ = PWM(dimmer_pin, freq=1024)
|
|
30
31
|
else:
|
|
@@ -34,7 +35,7 @@ def __dimmer_init():
|
|
|
34
35
|
|
|
35
36
|
def __persistent_cache_manager(mode='r'):
|
|
36
37
|
"""
|
|
37
|
-
|
|
38
|
+
File cache
|
|
38
39
|
modes:
|
|
39
40
|
r - recover, s - save
|
|
40
41
|
"""
|
|
@@ -42,12 +43,12 @@ def __persistent_cache_manager(mode='r'):
|
|
|
42
43
|
return
|
|
43
44
|
if mode == 's':
|
|
44
45
|
# SAVE CACHE
|
|
45
|
-
with open(
|
|
46
|
+
with open(Data.FILE_CACHE, 'w') as f:
|
|
46
47
|
f.write(','.join([str(k) for k in Data.DIMMER_CACHE]))
|
|
47
48
|
return
|
|
48
49
|
try:
|
|
49
50
|
# RESTORE CACHE
|
|
50
|
-
with open(
|
|
51
|
+
with open(Data.FILE_CACHE, 'r') as f:
|
|
51
52
|
Data.DIMMER_CACHE = [int(data) for data in f.read().strip().split(',')]
|
|
52
53
|
except:
|
|
53
54
|
pass
|
|
@@ -67,11 +68,11 @@ def __state_machine(value):
|
|
|
67
68
|
# Application functions #
|
|
68
69
|
#########################
|
|
69
70
|
|
|
70
|
-
def
|
|
71
|
+
def load(cache=None):
|
|
71
72
|
"""
|
|
72
|
-
|
|
73
|
+
Initialize dimmer module
|
|
73
74
|
:param cache bool: file state machine cache: True/False/None(default: automatic True)
|
|
74
|
-
- Load .
|
|
75
|
+
- Load .cache (state machine cache) for this load module
|
|
75
76
|
- Apply loaded states to gpio pins (boot function)
|
|
76
77
|
:return str: Cache state
|
|
77
78
|
"""
|
|
@@ -170,7 +171,7 @@ def transition(value, sec=1.0, wake=False):
|
|
|
170
171
|
# Update periphery cache (value check due to toggle ON value minimum)
|
|
171
172
|
Data.DIMMER_CACHE[1] = i if i > 5 else 5 # SAVE VALUE TO CACHE > 5 ! because toggle
|
|
172
173
|
my_task.out = f"Dimming: {i}"
|
|
173
|
-
await
|
|
174
|
+
await my_task.feed(sleep_ms=ms_period)
|
|
174
175
|
if Data.DIMMER_CACHE[0] == 1 or wake:
|
|
175
176
|
__state_machine(i)
|
|
176
177
|
my_task.out = f"Dimming DONE: {i}"
|
|
@@ -183,8 +184,7 @@ def transition(value, sec=1.0, wake=False):
|
|
|
183
184
|
# Create transition generator and calculate step_ms
|
|
184
185
|
fade_gen, fade_step_ms = transition_gen(from_dim, value, interval_sec=sec)
|
|
185
186
|
# [!] ASYNC TASK CREATION [1*] with async task callback + taskID (TAG) handling
|
|
186
|
-
|
|
187
|
-
return "Starting transition" if state else "Transition already running"
|
|
187
|
+
return micro_task(tag=Data.DIMM_TASK_TAG, task=_task(ms_period=fade_step_ms, iterable=fade_gen))
|
|
188
188
|
|
|
189
189
|
|
|
190
190
|
def subscribe_presence():
|
|
@@ -220,7 +220,7 @@ def pinmap():
|
|
|
220
220
|
- info which pins to use for this application
|
|
221
221
|
:return dict: pin name (str) - pin value (int) pairs
|
|
222
222
|
"""
|
|
223
|
-
return
|
|
223
|
+
return pinmap_search('dim_1')
|
|
224
224
|
|
|
225
225
|
|
|
226
226
|
def help(widgets=False):
|
|
@@ -230,5 +230,8 @@ def help(widgets=False):
|
|
|
230
230
|
(widgets=False) list of functions implemented by this application
|
|
231
231
|
(widgets=True) list of widget json for UI generation
|
|
232
232
|
"""
|
|
233
|
-
return 'set_value value=<0-1000> smooth=True force=True',
|
|
234
|
-
|
|
233
|
+
return resolve(('SLIDER set_value value=<0-1000> smooth=True force=True',
|
|
234
|
+
'BUTTON toggle state=<True,False> smooth=True',
|
|
235
|
+
'subscribe_presence',
|
|
236
|
+
'transition value=<0-1000> sec wake=False',
|
|
237
|
+
'status', 'load', 'pinmap'), widgets=widgets)
|