micrOSDevToolKit 2.9.1__py3-none-any.whl → 2.26.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- env/driver_cp210x/macOS_VCP_Driver/SiLabsUSBDriverDisk.dmg +0 -0
- env/driver_cp210x/macOS_VCP_Driver/macOS_VCP_Driver_Release_Notes.txt +17 -1
- micrOS/micropython/esp32-20251209-v1.27.0.bin +0 -0
- micrOS/micropython/esp32c3-20251209-v1.27.0.bin +0 -0
- micrOS/micropython/esp32c6-20251209-v1.27.0.bin +0 -0
- micrOS/micropython/esp32s2-20251209-v1.27.0.bin +0 -0
- micrOS/micropython/esp32s2-LOLIN_MINI-20251209-v1.27.0.bin +0 -0
- micrOS/micropython/{esp32s3-20241129-v1.24.1.bin → esp32s3-4MBflash-20241129-v1.24.1.bin} +0 -0
- micrOS/micropython/esp32s3-8MBflash-20251209-v1.27.0.bin +0 -0
- micrOS/micropython/esp32s3_spiram_oct-20251209-v1.27.0.bin +0 -0
- micrOS/micropython/rpi-pico-w-20251209-v1.27.0.uf2 +0 -0
- micrOS/micropython/tinypico-20251209-v1.27.0.bin +0 -0
- micrOS/release_info/micrOS_ReleaseInfo/system_analysis_sum.json +167 -163
- micrOS/source/Auth.py +37 -0
- micrOS/source/Common.py +361 -116
- micrOS/source/Config.py +32 -22
- micrOS/source/Debug.py +50 -94
- micrOS/source/Espnow.py +377 -100
- micrOS/source/Files.py +207 -0
- micrOS/source/Hooks.py +48 -20
- micrOS/source/InterConnect.py +126 -42
- micrOS/source/Interrupts.py +6 -6
- micrOS/source/Logger.py +63 -26
- micrOS/source/Network.py +41 -21
- micrOS/source/Notify.py +48 -22
- micrOS/source/Pacman.py +326 -0
- micrOS/source/Scheduler.py +14 -54
- micrOS/source/Server.py +67 -69
- micrOS/source/Shell.py +99 -91
- micrOS/source/Tasks.py +141 -95
- micrOS/source/Time.py +19 -18
- micrOS/source/Types.py +53 -9
- micrOS/source/Web.py +381 -76
- micrOS/source/__pycache__/Common.cpython-312.pyc +0 -0
- micrOS/source/__pycache__/Debug.cpython-312.pyc +0 -0
- micrOS/source/__pycache__/Files.cpython-312.pyc +0 -0
- micrOS/source/__pycache__/Logger.cpython-312.pyc +0 -0
- micrOS/source/__pycache__/Scheduler.cpython-312.pyc +0 -0
- micrOS/source/__pycache__/Server.cpython-312.pyc +0 -0
- micrOS/source/__pycache__/Shell.cpython-312.pyc +0 -0
- micrOS/source/__pycache__/replhelper.cpython-312.pyc +0 -0
- micrOS/source/config/_git.keep +0 -0
- micrOS/source/helpers.py +132 -0
- micrOS/source/micrOS.py +17 -7
- micrOS/source/micrOSloader.py +5 -12
- micrOS/source/microIO.py +44 -20
- micrOS/source/modules/IO_esp32c6.py +38 -0
- micrOS/source/{IO_esp32s3.py → modules/IO_esp32s3.py} +37 -1
- micrOS/source/{IO_m5stamp.py → modules/IO_m5stamp.py} +35 -1
- micrOS/source/{IO_qtpy.py → modules/IO_qtpy.py} +22 -17
- micrOS/source/{IO_tinypico.py → modules/IO_tinypico.py} +38 -0
- micrOS/source/modules/LM_L298N.py +161 -0
- {toolkit/workspace/precompiled → micrOS/source/modules}/LM_L9110_DCmotor.py +3 -3
- micrOS/source/{LM_OV2640.py → modules/LM_OV2640.py} +45 -27
- micrOS/source/{LM_VL53L0X.py → modules/LM_VL53L0X.py} +3 -3
- micrOS/source/{LM_aht10.py → modules/LM_aht10.py} +2 -2
- micrOS/source/{LM_bme280.py → modules/LM_bme280.py} +3 -3
- micrOS/source/{LM_buzzer.py → modules/LM_buzzer.py} +18 -25
- micrOS/source/{LM_cct.py → modules/LM_cct.py} +17 -21
- micrOS/source/modules/LM_cluster.py +255 -0
- micrOS/source/{LM_co2.py → modules/LM_co2.py} +3 -3
- micrOS/source/{LM_dht11.py → modules/LM_dht11.py} +2 -2
- micrOS/source/{LM_dht22.py → modules/LM_dht22.py} +2 -2
- micrOS/source/{LM_dimmer.py → modules/LM_dimmer.py} +9 -9
- micrOS/source/{LM_distance.py → modules/LM_distance.py} +4 -6
- micrOS/source/{LM_ds18.py → modules/LM_ds18.py} +2 -2
- micrOS/source/{LM_esp32.py → modules/LM_esp32.py} +5 -0
- micrOS/source/modules/LM_espnow.py +53 -0
- micrOS/source/modules/LM_fileserver.py +265 -0
- micrOS/source/{LM_genIO.py → modules/LM_genIO.py} +52 -37
- micrOS/source/{LM_haptic.py → modules/LM_haptic.py} +2 -2
- {toolkit/workspace/precompiled → micrOS/source/modules}/LM_i2c.py +5 -4
- micrOS/source/{LM_i2s_mic.py → modules/LM_i2s_mic.py} +6 -7
- micrOS/source/{LM_ld2410.py → modules/LM_ld2410.py} +2 -2
- micrOS/source/{LM_light_sensor.py → modules/LM_light_sensor.py} +10 -21
- micrOS/source/modules/LM_mh_z19c.py +198 -0
- micrOS/source/modules/LM_neoeffects.py +284 -0
- micrOS/source/{LM_neopixel.py → modules/LM_neopixel.py} +19 -23
- micrOS/source/{LM_oled.py → modules/LM_oled.py} +2 -2
- micrOS/source/{LM_oled_sh1106.py → modules/LM_oled_sh1106.py} +3 -3
- micrOS/source/{LM_oled_ui.py → modules/LM_oled_ui.py} +72 -64
- micrOS/source/modules/LM_pacman.py +320 -0
- micrOS/source/{LM_presence.py → modules/LM_presence.py} +11 -15
- micrOS/source/modules/LM_qmi8658.py +204 -0
- micrOS/source/{LM_rencoder.py → modules/LM_rencoder.py} +2 -2
- micrOS/source/{LM_rest.py → modules/LM_rest.py} +4 -6
- micrOS/source/{LM_rgb.py → modules/LM_rgb.py} +21 -29
- micrOS/source/{LM_roboarm.py → modules/LM_roboarm.py} +8 -8
- micrOS/source/modules/LM_robustness.py +137 -0
- micrOS/source/{LM_servo.py → modules/LM_servo.py} +3 -3
- micrOS/source/{LM_stepper.py → modules/LM_stepper.py} +5 -5
- micrOS/source/{LM_switch.py → modules/LM_switch.py} +11 -9
- micrOS/source/{LM_system.py → modules/LM_system.py} +38 -32
- micrOS/source/modules/LM_tcs3472.py +187 -0
- micrOS/source/{LM_telegram.py → modules/LM_telegram.py} +164 -116
- micrOS/source/{LM_trackball.py → modules/LM_trackball.py} +3 -3
- micrOS/source/{LM_veml7700.py → modules/LM_veml7700.py} +2 -2
- micrOS/source/modules/LM_web.py +38 -0
- micrOS/source/urequests.py +39 -15
- {toolkit/workspace/precompiled → micrOS/source/web}/dashboard.html +4 -0
- micrOS/source/web/editor.js +440 -0
- micrOS/source/web/filesui.html +178 -0
- micrOS/source/web/filesui.js +338 -0
- {toolkit/workspace/precompiled → micrOS/source/web}/index.html +44 -2
- micrOS/source/{uapi.js → web/uapi.js} +48 -7
- micrOS/source/{ustyle.css → web/ustyle.css} +6 -3
- micrOS/utests/__init__.py +0 -0
- micrOS/utests/test_scheduler.py +435 -0
- {micrOSDevToolKit-2.9.1.data → microsdevtoolkit-2.26.1.data}/scripts/devToolKit.py +33 -3
- {micrOSDevToolKit-2.9.1.dist-info → microsdevtoolkit-2.26.1.dist-info}/METADATA +327 -268
- microsdevtoolkit-2.26.1.dist-info/RECORD +396 -0
- {micrOSDevToolKit-2.9.1.dist-info → microsdevtoolkit-2.26.1.dist-info}/WHEEL +1 -1
- toolkit/DevEnvCompile.py +63 -33
- toolkit/DevEnvOTA.py +58 -22
- toolkit/DevEnvUSB.py +110 -55
- toolkit/Gateway.py +6 -6
- toolkit/LM_to_compile.dat +6 -4
- toolkit/MicrOSDevEnv.py +127 -57
- toolkit/WebRepl.py +73 -0
- toolkit/dashboard_apps/BackupRestore.py +20 -35
- toolkit/dashboard_apps/CCTDemo.py +12 -17
- toolkit/dashboard_apps/CCTTest.py +20 -24
- toolkit/dashboard_apps/CamStream.py +2 -6
- toolkit/dashboard_apps/CatGame.py +14 -16
- toolkit/dashboard_apps/Dimmer.py +11 -21
- toolkit/dashboard_apps/GetVersion.py +11 -19
- toolkit/dashboard_apps/MicrophoneTest.py +1 -6
- toolkit/dashboard_apps/NeoEffectsDemo.py +22 -35
- toolkit/dashboard_apps/NeopixelTest.py +20 -25
- toolkit/dashboard_apps/PresenceTest.py +2 -8
- toolkit/dashboard_apps/QMI8685_GYRO.py +68 -0
- toolkit/dashboard_apps/RGBTest.py +20 -24
- toolkit/dashboard_apps/RoboArm.py +24 -32
- toolkit/dashboard_apps/SED_test.py +10 -14
- toolkit/dashboard_apps/SensorsTest.py +61 -0
- toolkit/dashboard_apps/SystemTest.py +202 -105
- toolkit/dashboard_apps/Template_app.py +11 -23
- toolkit/dashboard_apps/_app_base.py +34 -0
- toolkit/dashboard_apps/_gyro_visualizer.py +78 -0
- toolkit/dashboard_apps/uLightDemo.py +15 -24
- toolkit/index.html +4 -4
- toolkit/lib/LocalMachine.py +6 -1
- toolkit/lib/MicrosFiles.py +46 -0
- toolkit/lib/Repository.py +64 -0
- toolkit/lib/TerminalColors.py +4 -0
- toolkit/lib/macroScript.py +6 -0
- toolkit/lib/micrOSClient.py +123 -50
- toolkit/lib/micrOSClientHistory.py +156 -0
- toolkit/lib/pip_package_installer.py +5 -2
- toolkit/micrOSdashboard.py +12 -17
- toolkit/micrOSlint.py +20 -8
- toolkit/simulator_lib/__pycache__/IO_darwin.cpython-312.pyc +0 -0
- toolkit/simulator_lib/__pycache__/aioespnow.cpython-312.pyc +0 -0
- toolkit/simulator_lib/__pycache__/framebuf.cpython-312.pyc +0 -0
- toolkit/simulator_lib/__pycache__/machine.cpython-312.pyc +0 -0
- toolkit/simulator_lib/__pycache__/micropython.cpython-312.pyc +0 -0
- toolkit/simulator_lib/__pycache__/mip.cpython-312.pyc +0 -0
- toolkit/simulator_lib/__pycache__/neopixel.cpython-312.pyc +0 -0
- toolkit/simulator_lib/__pycache__/network.cpython-312.pyc +0 -0
- toolkit/simulator_lib/__pycache__/sim_common.cpython-312.pyc +0 -0
- toolkit/simulator_lib/__pycache__/simgc.cpython-312.pyc +0 -0
- toolkit/simulator_lib/__pycache__/simulator.cpython-312.pyc +0 -0
- toolkit/simulator_lib/__pycache__/uasyncio.cpython-312.pyc +0 -0
- toolkit/simulator_lib/__pycache__/uos.cpython-312.pyc +0 -0
- toolkit/simulator_lib/__pycache__/urandom.cpython-312.pyc +0 -0
- toolkit/simulator_lib/__pycache__/usocket.cpython-312.pyc +0 -0
- toolkit/simulator_lib/__pycache__/ussl.cpython-312.pyc +0 -0
- toolkit/simulator_lib/aioespnow.py +28 -0
- toolkit/simulator_lib/dht.py +1 -1
- toolkit/simulator_lib/framebuf.py +49 -1
- toolkit/simulator_lib/machine.py +17 -2
- toolkit/simulator_lib/micropython.py +3 -3
- toolkit/simulator_lib/mip.py +165 -0
- toolkit/simulator_lib/neopixel.py +3 -2
- toolkit/simulator_lib/network.py +2 -1
- toolkit/simulator_lib/node_config.json +2 -3
- toolkit/simulator_lib/ntptime.py +1 -1
- toolkit/simulator_lib/{sim_console.py → sim_common.py} +2 -3
- toolkit/simulator_lib/simgc.py +6 -2
- toolkit/simulator_lib/simulator.py +137 -59
- toolkit/simulator_lib/uasyncio.py +33 -2
- toolkit/simulator_lib/uos.py +147 -0
- toolkit/simulator_lib/urandom.py +4 -0
- toolkit/socketClient.py +43 -23
- toolkit/user_data/webhooks/generic.py +1 -1
- toolkit/user_data/webhooks/macro.py +1 -1
- toolkit/user_data/webhooks/template.py +1 -1
- toolkit/workspace/precompiled/Auth.mpy +0 -0
- toolkit/workspace/precompiled/Common.mpy +0 -0
- toolkit/workspace/precompiled/Config.mpy +0 -0
- toolkit/workspace/precompiled/Debug.mpy +0 -0
- toolkit/workspace/precompiled/Espnow.mpy +0 -0
- toolkit/workspace/precompiled/Files.mpy +0 -0
- toolkit/workspace/precompiled/Hooks.mpy +0 -0
- toolkit/workspace/precompiled/InterConnect.mpy +0 -0
- toolkit/workspace/precompiled/Interrupts.mpy +0 -0
- toolkit/workspace/precompiled/Logger.mpy +0 -0
- toolkit/workspace/precompiled/Network.mpy +0 -0
- toolkit/workspace/precompiled/Notify.mpy +0 -0
- toolkit/workspace/precompiled/Pacman.mpy +0 -0
- toolkit/workspace/precompiled/Scheduler.mpy +0 -0
- toolkit/workspace/precompiled/Server.mpy +0 -0
- toolkit/workspace/precompiled/Shell.mpy +0 -0
- toolkit/workspace/precompiled/Tasks.mpy +0 -0
- toolkit/workspace/precompiled/Time.mpy +0 -0
- toolkit/workspace/precompiled/Types.mpy +0 -0
- toolkit/workspace/precompiled/Web.mpy +0 -0
- toolkit/workspace/precompiled/_mpy.version +1 -1
- toolkit/workspace/precompiled/config/_git.keep +0 -0
- toolkit/workspace/precompiled/helpers.mpy +0 -0
- toolkit/workspace/precompiled/micrOS.mpy +0 -0
- toolkit/workspace/precompiled/micrOSloader.mpy +0 -0
- toolkit/workspace/precompiled/microIO.mpy +0 -0
- toolkit/workspace/precompiled/{IO_esp32.mpy → modules/IO_esp32.mpy} +0 -0
- toolkit/workspace/precompiled/{IO_esp32c3.mpy → modules/IO_esp32c3.mpy} +0 -0
- toolkit/workspace/precompiled/modules/IO_esp32c6.mpy +0 -0
- toolkit/workspace/precompiled/{IO_esp32s2.mpy → modules/IO_esp32s2.mpy} +0 -0
- toolkit/workspace/precompiled/modules/IO_esp32s3.mpy +0 -0
- toolkit/workspace/precompiled/modules/IO_m5stamp.mpy +0 -0
- toolkit/workspace/precompiled/modules/IO_qtpy.mpy +0 -0
- toolkit/workspace/precompiled/modules/IO_rp2.mpy +0 -0
- toolkit/workspace/precompiled/modules/IO_tinypico.mpy +0 -0
- toolkit/workspace/precompiled/modules/LM_L298N.mpy +0 -0
- {micrOS/source → toolkit/workspace/precompiled/modules}/LM_L9110_DCmotor.py +3 -3
- toolkit/workspace/precompiled/modules/LM_OV2640.mpy +0 -0
- toolkit/workspace/precompiled/{LM_VL53L0X.py → modules/LM_VL53L0X.py} +3 -3
- toolkit/workspace/precompiled/{LM_aht10.mpy → modules/LM_aht10.mpy} +0 -0
- toolkit/workspace/precompiled/{LM_bme280.mpy → modules/LM_bme280.mpy} +0 -0
- toolkit/workspace/precompiled/{LM_buzzer.mpy → modules/LM_buzzer.mpy} +0 -0
- toolkit/workspace/precompiled/modules/LM_cct.mpy +0 -0
- toolkit/workspace/precompiled/modules/LM_cluster.mpy +0 -0
- toolkit/workspace/precompiled/{LM_co2.mpy → modules/LM_co2.mpy} +0 -0
- toolkit/workspace/precompiled/{LM_dht11.mpy → modules/LM_dht11.mpy} +0 -0
- toolkit/workspace/precompiled/{LM_dht22.mpy → modules/LM_dht22.mpy} +0 -0
- toolkit/workspace/precompiled/modules/LM_dimmer.mpy +0 -0
- toolkit/workspace/precompiled/modules/LM_distance.mpy +0 -0
- toolkit/workspace/precompiled/{LM_ds18.mpy → modules/LM_ds18.mpy} +0 -0
- toolkit/workspace/precompiled/{LM_esp32.py → modules/LM_esp32.py} +5 -0
- toolkit/workspace/precompiled/modules/LM_espnow.py +53 -0
- toolkit/workspace/precompiled/modules/LM_fileserver.mpy +0 -0
- toolkit/workspace/precompiled/{LM_gameOfLife.mpy → modules/LM_gameOfLife.mpy} +0 -0
- toolkit/workspace/precompiled/modules/LM_genIO.mpy +0 -0
- toolkit/workspace/precompiled/{LM_haptic.mpy → modules/LM_haptic.mpy} +0 -0
- {micrOS/source → toolkit/workspace/precompiled/modules}/LM_i2c.py +5 -4
- toolkit/workspace/precompiled/modules/LM_i2s_mic.mpy +0 -0
- toolkit/workspace/precompiled/{LM_ld2410.mpy → modules/LM_ld2410.mpy} +0 -0
- toolkit/workspace/precompiled/modules/LM_light_sensor.mpy +0 -0
- toolkit/workspace/precompiled/modules/LM_mh_z19c.py +198 -0
- toolkit/workspace/precompiled/modules/LM_neoeffects.mpy +0 -0
- toolkit/workspace/precompiled/modules/LM_neopixel.mpy +0 -0
- toolkit/workspace/precompiled/{LM_oled.mpy → modules/LM_oled.mpy} +0 -0
- toolkit/workspace/precompiled/{LM_oled_sh1106.mpy → modules/LM_oled_sh1106.mpy} +0 -0
- toolkit/workspace/precompiled/modules/LM_oled_ui.mpy +0 -0
- toolkit/workspace/precompiled/modules/LM_pacman.mpy +0 -0
- toolkit/workspace/precompiled/modules/LM_presence.mpy +0 -0
- toolkit/workspace/precompiled/modules/LM_qmi8658.py +204 -0
- toolkit/workspace/precompiled/{LM_rencoder.py → modules/LM_rencoder.py} +2 -2
- toolkit/workspace/precompiled/modules/LM_rest.mpy +0 -0
- toolkit/workspace/precompiled/modules/LM_rgb.mpy +0 -0
- toolkit/workspace/precompiled/{LM_rgbcct.mpy → modules/LM_rgbcct.mpy} +0 -0
- toolkit/workspace/precompiled/modules/LM_roboarm.mpy +0 -0
- toolkit/workspace/precompiled/modules/LM_robustness.py +137 -0
- toolkit/workspace/precompiled/{LM_servo.mpy → modules/LM_servo.mpy} +0 -0
- toolkit/workspace/precompiled/{LM_sound_event.mpy → modules/LM_sound_event.mpy} +0 -0
- toolkit/workspace/precompiled/{LM_stepper.mpy → modules/LM_stepper.mpy} +0 -0
- toolkit/workspace/precompiled/modules/LM_switch.mpy +0 -0
- toolkit/workspace/precompiled/modules/LM_system.mpy +0 -0
- toolkit/workspace/precompiled/modules/LM_tcs3472.py +187 -0
- toolkit/workspace/precompiled/modules/LM_telegram.mpy +0 -0
- toolkit/workspace/precompiled/{LM_tinyrgb.mpy → modules/LM_tinyrgb.mpy} +0 -0
- toolkit/workspace/precompiled/{LM_trackball.mpy → modules/LM_trackball.mpy} +0 -0
- toolkit/workspace/precompiled/{LM_veml7700.mpy → modules/LM_veml7700.mpy} +0 -0
- toolkit/workspace/precompiled/modules/LM_web.mpy +0 -0
- toolkit/workspace/precompiled/urequests.mpy +0 -0
- {micrOS/source → toolkit/workspace/precompiled/web}/dashboard.html +4 -0
- toolkit/workspace/precompiled/web/editor.js +440 -0
- toolkit/workspace/precompiled/web/filesui.html +178 -0
- toolkit/workspace/precompiled/web/filesui.js +338 -0
- {micrOS/source → toolkit/workspace/precompiled/web}/index.html +44 -2
- toolkit/workspace/precompiled/{uapi.js → web/uapi.js} +48 -7
- toolkit/workspace/precompiled/{ustyle.css → web/ustyle.css} +6 -3
- micrOS/micropython/esp32-20241129-v1.24.1.bin +0 -0
- micrOS/micropython/esp32c3-20240222-v1.22.2.bin +0 -0
- micrOS/micropython/esp32s2-20240602-v1.23.0.bin +0 -0
- micrOS/micropython/esp32s2-LOLIN_MINI-20220618-v1.19.1.bin +0 -0
- micrOS/micropython/esp32s2-LOLIN_MINI-20240602-v1.23.0.bin +0 -0
- micrOS/micropython/esp32s3-20240105-v1.22.1.bin +0 -0
- micrOS/micropython/esp32s3_spiram_oct-20231005-v1.21.0.bin +0 -0
- micrOS/micropython/esp32s3_spiram_oct-20241129-v1.24.1.bin +0 -0
- micrOS/micropython/rpi-pico-w-20241129-v1.24.1.uf2 +0 -0
- micrOS/micropython/tinypico-20241129-v1.24.1.bin +0 -0
- micrOS/source/LM_L298N_DCmotor.py +0 -86
- micrOS/source/LM_catgame.py +0 -75
- micrOS/source/LM_dashboard_be.py +0 -37
- micrOS/source/LM_demo.py +0 -97
- micrOS/source/LM_espnow.py +0 -23
- micrOS/source/LM_intercon.py +0 -57
- micrOS/source/LM_keychain.py +0 -322
- micrOS/source/LM_lmpacman.py +0 -126
- micrOS/source/LM_neoeffects.py +0 -331
- micrOS/source/LM_oledui.py +0 -972
- micrOS/source/LM_pet_feeder.py +0 -78
- micrOS/source/LM_ph_sensor.py +0 -51
- micrOS/source/LM_robustness.py +0 -74
- micrOS/source/reset.py +0 -11
- micrOSDevToolKit-2.9.1.dist-info/RECORD +0 -365
- toolkit/dashboard_apps/AirQualityBME280.py +0 -36
- toolkit/dashboard_apps/AirQualityDHT22_CO2.py +0 -36
- toolkit/lib/file_extensions.py +0 -16
- toolkit/simulator_lib/__pycache__/sim_console.cpython-312.pyc +0 -0
- toolkit/simulator_lib/__pycache__/sim_console.cpython-38.pyc +0 -0
- toolkit/simulator_lib/__pycache__/sim_console.cpython-39.pyc +0 -0
- toolkit/workspace/precompiled/IO_esp32s3.mpy +0 -0
- toolkit/workspace/precompiled/IO_m5stamp.mpy +0 -0
- toolkit/workspace/precompiled/IO_qtpy.mpy +0 -0
- toolkit/workspace/precompiled/IO_rp2.mpy +0 -0
- toolkit/workspace/precompiled/IO_tinypico.mpy +0 -0
- toolkit/workspace/precompiled/LM_L298N_DCmotor.mpy +0 -0
- toolkit/workspace/precompiled/LM_OV2640.mpy +0 -0
- toolkit/workspace/precompiled/LM_catgame.py +0 -75
- toolkit/workspace/precompiled/LM_cct.mpy +0 -0
- toolkit/workspace/precompiled/LM_dashboard_be.py +0 -37
- toolkit/workspace/precompiled/LM_demo.py +0 -97
- toolkit/workspace/precompiled/LM_dimmer.mpy +0 -0
- toolkit/workspace/precompiled/LM_distance.mpy +0 -0
- toolkit/workspace/precompiled/LM_espnow.py +0 -23
- toolkit/workspace/precompiled/LM_genIO.mpy +0 -0
- toolkit/workspace/precompiled/LM_i2s_mic.mpy +0 -0
- toolkit/workspace/precompiled/LM_intercon.mpy +0 -0
- toolkit/workspace/precompiled/LM_keychain.mpy +0 -0
- toolkit/workspace/precompiled/LM_light_sensor.mpy +0 -0
- toolkit/workspace/precompiled/LM_lmpacman.mpy +0 -0
- toolkit/workspace/precompiled/LM_neoeffects.mpy +0 -0
- toolkit/workspace/precompiled/LM_neopixel.mpy +0 -0
- toolkit/workspace/precompiled/LM_oled_ui.mpy +0 -0
- toolkit/workspace/precompiled/LM_oledui.mpy +0 -0
- toolkit/workspace/precompiled/LM_pet_feeder.py +0 -78
- toolkit/workspace/precompiled/LM_ph_sensor.py +0 -51
- toolkit/workspace/precompiled/LM_presence.mpy +0 -0
- toolkit/workspace/precompiled/LM_rest.mpy +0 -0
- toolkit/workspace/precompiled/LM_rgb.mpy +0 -0
- toolkit/workspace/precompiled/LM_roboarm.mpy +0 -0
- toolkit/workspace/precompiled/LM_robustness.py +0 -74
- toolkit/workspace/precompiled/LM_switch.mpy +0 -0
- toolkit/workspace/precompiled/LM_system.mpy +0 -0
- toolkit/workspace/precompiled/LM_telegram.mpy +0 -0
- toolkit/workspace/precompiled/node_config.json +0 -1
- toolkit/workspace/precompiled/reset.mpy +0 -0
- /micrOS/source/{IO_esp32.py → modules/IO_esp32.py} +0 -0
- /micrOS/source/{IO_esp32c3.py → modules/IO_esp32c3.py} +0 -0
- /micrOS/source/{IO_esp32s2.py → modules/IO_esp32s2.py} +0 -0
- /micrOS/source/{IO_rp2.py → modules/IO_rp2.py} +0 -0
- /micrOS/source/{LM_gameOfLife.py → modules/LM_gameOfLife.py} +0 -0
- /micrOS/source/{LM_rgbcct.py → modules/LM_rgbcct.py} +0 -0
- /micrOS/source/{LM_rp2w.py → modules/LM_rp2w.py} +0 -0
- /micrOS/source/{LM_sdcard.py → modules/LM_sdcard.py} +0 -0
- /micrOS/source/{LM_sound_event.py → modules/LM_sound_event.py} +0 -0
- /micrOS/source/{LM_tinyrgb.py → modules/LM_tinyrgb.py} +0 -0
- /micrOS/source/{udashboard.js → web/udashboard.js} +0 -0
- /micrOS/source/{uwidgets.js → web/uwidgets.js} +0 -0
- /micrOS/source/{uwidgets_pro.js → web/uwidgets_pro.js} +0 -0
- {micrOSDevToolKit-2.9.1.dist-info → microsdevtoolkit-2.26.1.dist-info/licenses}/LICENSE +0 -0
- {micrOSDevToolKit-2.9.1.dist-info → microsdevtoolkit-2.26.1.dist-info}/top_level.txt +0 -0
- /toolkit/workspace/precompiled/{LM_rp2w.py → modules/LM_rp2w.py} +0 -0
- /toolkit/workspace/precompiled/{LM_sdcard.py → modules/LM_sdcard.py} +0 -0
- /toolkit/workspace/precompiled/{udashboard.js → web/udashboard.js} +0 -0
- /toolkit/workspace/precompiled/{uwidgets.js → web/uwidgets.js} +0 -0
- /toolkit/workspace/precompiled/{uwidgets_pro.js → web/uwidgets_pro.js} +0 -0
|
@@ -0,0 +1,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
|
|
@@ -2,8 +2,9 @@ try:
|
|
|
2
2
|
import camera
|
|
3
3
|
except Exception as e:
|
|
4
4
|
camera = None
|
|
5
|
-
import
|
|
6
|
-
from
|
|
5
|
+
from time import localtime, sleep
|
|
6
|
+
from json import loads
|
|
7
|
+
from Common import web_endpoint, syslog, exec_cmd
|
|
7
8
|
from Types import resolve
|
|
8
9
|
|
|
9
10
|
IN_CAPTURE = False # Make sure single capture in progress in the same time
|
|
@@ -44,7 +45,7 @@ def load(quality='medium', freq='default', effect="NONE"):
|
|
|
44
45
|
except Exception as e:
|
|
45
46
|
syslog(f"[ERR] OV2640: {e}")
|
|
46
47
|
camera.deinit()
|
|
47
|
-
|
|
48
|
+
sleep(1)
|
|
48
49
|
if not CAM_INIT:
|
|
49
50
|
return "Cannot init OV2640 cam"
|
|
50
51
|
|
|
@@ -57,6 +58,8 @@ def _set_web_endpoints():
|
|
|
57
58
|
# Register rest endpoint
|
|
58
59
|
web_endpoint('cam/snapshot', _snapshot_clb)
|
|
59
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"
|
|
60
63
|
|
|
61
64
|
|
|
62
65
|
def settings(quality=None, flip=None, mirror=None, effect=None, saturation=None, brightness=None, contrast=None, whitebalace=None, q=None):
|
|
@@ -152,24 +155,54 @@ def capture():
|
|
|
152
155
|
if buf:
|
|
153
156
|
break
|
|
154
157
|
n_try += 1
|
|
155
|
-
|
|
158
|
+
sleep(0.1)
|
|
156
159
|
except Exception as e:
|
|
157
160
|
syslog(f"[OV2640] Failed to capture: {e}")
|
|
158
161
|
IN_CAPTURE = False
|
|
159
162
|
return buf
|
|
160
163
|
|
|
161
164
|
|
|
162
|
-
def photo(name='photo.
|
|
163
|
-
|
|
164
|
-
|
|
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:
|
|
165
197
|
if buf:
|
|
166
198
|
f.write(buf)
|
|
167
|
-
return "Image saved as
|
|
168
|
-
return "Cannot save...
|
|
199
|
+
return f"Image saved as {photo_path}"
|
|
200
|
+
return f"Cannot save... {photo_path}"
|
|
169
201
|
|
|
170
202
|
|
|
171
203
|
def _snapshot_clb():
|
|
172
|
-
|
|
204
|
+
_ = capture() # Dump current cached image
|
|
205
|
+
image = capture() # Take new image
|
|
173
206
|
if image is not None:
|
|
174
207
|
return 'image/jpeg', image
|
|
175
208
|
return 'text/plain', f'capture error: {image}'
|
|
@@ -179,21 +212,7 @@ def _image_stream_clb():
|
|
|
179
212
|
return 'multipart/x-mixed-replace', {'callback': capture, 'content-type': 'image/jpeg'}
|
|
180
213
|
|
|
181
214
|
|
|
182
|
-
def
|
|
183
|
-
with open(name, 'rb') as f:
|
|
184
|
-
image = f.read()
|
|
185
|
-
return 'image/jpeg', image
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
def set_photo_endpoint():
|
|
189
|
-
"""
|
|
190
|
-
Set photo endpoint (rest endpoint)
|
|
191
|
-
"""
|
|
192
|
-
web_endpoint('photo', _img_clb)
|
|
193
|
-
return "Endpoint created: /photo"
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
def __light_init():
|
|
215
|
+
def _light_init():
|
|
197
216
|
global FLASH_LIGHT
|
|
198
217
|
if FLASH_LIGHT is None:
|
|
199
218
|
from machine import Pin
|
|
@@ -205,7 +224,7 @@ def flashlight(state=None):
|
|
|
205
224
|
Camera flashlight
|
|
206
225
|
:param state: True/False/None(automatic)
|
|
207
226
|
"""
|
|
208
|
-
fl =
|
|
227
|
+
fl = _light_init()
|
|
209
228
|
if state is None:
|
|
210
229
|
state = fl.value(not fl.value())
|
|
211
230
|
else:
|
|
@@ -228,7 +247,6 @@ def help(widgets=False):
|
|
|
228
247
|
'BUTTON settings effect=<NONE,NEG,BW,RED,GREEN,BLUE,RETRO>',
|
|
229
248
|
'capture',
|
|
230
249
|
'photo',
|
|
231
|
-
'set_photo_endpoint',
|
|
232
250
|
'BUTTON flashlight state=None',
|
|
233
251
|
'[Hint] after load you can access the /cam/snapshot and /cam/stream endpoints',
|
|
234
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:
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
from machine import I2C, Pin
|
|
2
|
-
from microIO import
|
|
2
|
+
from microIO import bind_pin, pinmap_search
|
|
3
3
|
from Common import syslog
|
|
4
4
|
from time import sleep
|
|
5
5
|
from binascii import hexlify
|
|
@@ -24,7 +24,7 @@ def _handle_connection_error(f):
|
|
|
24
24
|
|
|
25
25
|
class AHT10:
|
|
26
26
|
def __init__(self, address = 0x38):
|
|
27
|
-
self.i2c = I2C(-1, Pin(
|
|
27
|
+
self.i2c = I2C(-1, Pin(bind_pin('i2c_scl')), Pin(bind_pin('i2c_sda')), freq = 9600)
|
|
28
28
|
self.address = address
|
|
29
29
|
if not self.init_sensor():
|
|
30
30
|
raise Exception("Could not initialize the sensor!")
|
|
@@ -6,7 +6,7 @@ https://randomnerdtutorials.com/micropython-bme280-esp32-esp8266/
|
|
|
6
6
|
|
|
7
7
|
import utime as time
|
|
8
8
|
from machine import Pin, I2C
|
|
9
|
-
from microIO import
|
|
9
|
+
from microIO import bind_pin, pinmap_search
|
|
10
10
|
from Common import notify
|
|
11
11
|
from Types import resolve
|
|
12
12
|
|
|
@@ -299,7 +299,7 @@ class BME280:
|
|
|
299
299
|
def __init_bme280_i2c():
|
|
300
300
|
global BME280_OBJ
|
|
301
301
|
if BME280_OBJ is None:
|
|
302
|
-
i2c = I2C(scl=Pin(
|
|
302
|
+
i2c = I2C(scl=Pin(bind_pin('i2c_scl')), sda=Pin(bind_pin('i2c_sda')), freq=10000)
|
|
303
303
|
BME280_OBJ = BME280(i2c=i2c)
|
|
304
304
|
return BME280_OBJ
|
|
305
305
|
|
|
@@ -349,5 +349,5 @@ def help(widgets=False):
|
|
|
349
349
|
(widgets=False) list of functions implemented by this application
|
|
350
350
|
(widgets=True) list of widget json for UI generation
|
|
351
351
|
"""
|
|
352
|
-
return resolve(('TEXTBOX measure ntfy=False',
|
|
352
|
+
return resolve(('TEXTBOX{"refresh": 2000} measure ntfy=False',
|
|
353
353
|
'load', 'pinmap'), widgets=widgets)
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
from sys import platform
|
|
2
1
|
from utime import sleep
|
|
3
|
-
from microIO import
|
|
4
|
-
from Common import micro_task, notify
|
|
2
|
+
from microIO import bind_pin, pinmap_search
|
|
3
|
+
from Common import micro_task, notify, data_dir
|
|
5
4
|
from Types import resolve
|
|
6
5
|
|
|
7
6
|
|
|
@@ -13,6 +12,7 @@ __BUZZER_OBJ = None
|
|
|
13
12
|
__BUZZER_CACHE = [600]
|
|
14
13
|
__PERSISTENT_CACHE = False
|
|
15
14
|
__TASK_TAG = "buzzer._play"
|
|
15
|
+
__FILE_CACHE = data_dir('buzzer.cache')
|
|
16
16
|
CHECK_NOTIFY = False
|
|
17
17
|
|
|
18
18
|
#########################################
|
|
@@ -175,22 +175,22 @@ def _builtin_tones(tone=None):
|
|
|
175
175
|
#########################################
|
|
176
176
|
|
|
177
177
|
|
|
178
|
-
def __buzzer_init():
|
|
178
|
+
def __buzzer_init(pin=None):
|
|
179
|
+
"""
|
|
180
|
+
:param pin: optional number to overwrite default pin
|
|
181
|
+
"""
|
|
179
182
|
global __BUZZER_OBJ
|
|
180
183
|
if __BUZZER_OBJ is None:
|
|
181
184
|
from machine import Pin, PWM
|
|
182
|
-
dimmer_pin = Pin(
|
|
183
|
-
|
|
184
|
-
__BUZZER_OBJ = PWM(dimmer_pin, freq=600)
|
|
185
|
-
else:
|
|
186
|
-
__BUZZER_OBJ = PWM(dimmer_pin, freq=600)
|
|
185
|
+
dimmer_pin = Pin(bind_pin('buzzer', number=pin))
|
|
186
|
+
__BUZZER_OBJ = PWM(dimmer_pin, freq=600)
|
|
187
187
|
__BUZZER_OBJ.duty(512) # 50%
|
|
188
188
|
return __BUZZER_OBJ
|
|
189
189
|
|
|
190
190
|
|
|
191
191
|
def __persistent_cache_manager(mode='r'):
|
|
192
192
|
"""
|
|
193
|
-
|
|
193
|
+
File cache
|
|
194
194
|
modes:
|
|
195
195
|
r - recover, s - save
|
|
196
196
|
"""
|
|
@@ -199,12 +199,12 @@ def __persistent_cache_manager(mode='r'):
|
|
|
199
199
|
global __BUZZER_CACHE
|
|
200
200
|
if mode == 's':
|
|
201
201
|
# SAVE CACHE
|
|
202
|
-
with open(
|
|
202
|
+
with open(__FILE_CACHE, 'w') as f:
|
|
203
203
|
f.write(','.join([str(k) for k in __BUZZER_CACHE]))
|
|
204
204
|
return
|
|
205
205
|
try:
|
|
206
206
|
# RESTORE CACHE
|
|
207
|
-
with open(
|
|
207
|
+
with open(__FILE_CACHE, 'r') as f:
|
|
208
208
|
__BUZZER_CACHE = [int(data) for data in f.read().strip().split(',')]
|
|
209
209
|
except:
|
|
210
210
|
pass
|
|
@@ -270,10 +270,7 @@ def play(rtttlstr='Indiana'):
|
|
|
270
270
|
global CHECK_NOTIFY
|
|
271
271
|
if CHECK_NOTIFY and not notify():
|
|
272
272
|
return "NoBipp - notify off"
|
|
273
|
-
|
|
274
|
-
if state:
|
|
275
|
-
return 'Play song'
|
|
276
|
-
return 'Song already playing'
|
|
273
|
+
return micro_task(tag=__TASK_TAG, task=_play(rtttlstr))
|
|
277
274
|
|
|
278
275
|
|
|
279
276
|
def list_tones():
|
|
@@ -283,23 +280,19 @@ def list_tones():
|
|
|
283
280
|
return '\n'.join(list(_builtin_tones()))
|
|
284
281
|
|
|
285
282
|
|
|
286
|
-
def load(
|
|
283
|
+
def load(check_notify=False, pin=None, cache=True):
|
|
287
284
|
"""
|
|
288
285
|
Initialize buzzer module
|
|
289
|
-
:param cache bool: file state machine cache: True/False/None(default: automatic True)
|
|
290
|
-
- Load .pds (state machine cache) for this load module
|
|
291
|
-
- Apply loaded states to gpio pins (boot function)
|
|
292
286
|
:param check_notify: check notify enabled/disabled - make noise if enabled only
|
|
287
|
+
:param pin: optional number to overwrite default pin
|
|
288
|
+
:param cache: default True, store stages on disk (.cache)
|
|
293
289
|
:return str: Verdict
|
|
294
290
|
"""
|
|
295
|
-
from sys import platform
|
|
296
291
|
global __PERSISTENT_CACHE, CHECK_NOTIFY
|
|
297
|
-
|
|
298
|
-
__PERSISTENT_CACHE = False if platform == 'esp8266' else True
|
|
299
|
-
else:
|
|
300
|
-
__PERSISTENT_CACHE = cache
|
|
292
|
+
__PERSISTENT_CACHE = cache
|
|
301
293
|
__persistent_cache_manager('r')
|
|
302
294
|
CHECK_NOTIFY = check_notify
|
|
295
|
+
__buzzer_init(pin=pin)
|
|
303
296
|
return f"CACHE: {__PERSISTENT_CACHE}, check notify: {CHECK_NOTIFY}"
|
|
304
297
|
|
|
305
298
|
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
from machine import Pin, PWM
|
|
5
5
|
from sys import platform
|
|
6
6
|
from utime import sleep_ms
|
|
7
|
-
from Common import transition_gen, micro_task
|
|
8
|
-
from microIO import
|
|
7
|
+
from Common import transition_gen, micro_task, data_dir
|
|
8
|
+
from microIO import bind_pin, pinmap_search
|
|
9
9
|
from random import randint
|
|
10
10
|
from Types import resolve
|
|
11
11
|
|
|
@@ -18,16 +18,17 @@ class Data:
|
|
|
18
18
|
CCT_TASK_TAG = 'cct._tran'
|
|
19
19
|
HUE_TASK_TAG = 'cct._hue'
|
|
20
20
|
TASK_STATE = False
|
|
21
|
+
FILE_CACHE = data_dir('cwww.cache')
|
|
21
22
|
|
|
22
23
|
|
|
23
24
|
#########################################
|
|
24
25
|
# ANALOG CCT WITH 2 channel PWM #
|
|
25
26
|
#########################################
|
|
26
27
|
|
|
27
|
-
def __cwww_init():
|
|
28
|
+
def __cwww_init(pin_warm=None, pin_cold=None):
|
|
28
29
|
if Data.CWWW_OBJS[0] is None or Data.CWWW_OBJS[1] is None:
|
|
29
|
-
cw = Pin(
|
|
30
|
-
ww = Pin(
|
|
30
|
+
cw = Pin(bind_pin('cwhite', pin_cold))
|
|
31
|
+
ww = Pin(bind_pin('wwhite', pin_warm))
|
|
31
32
|
if platform == 'esp8266':
|
|
32
33
|
Data.CWWW_OBJS = (PWM(cw, freq=1024),
|
|
33
34
|
PWM(ww, freq=1024))
|
|
@@ -39,7 +40,7 @@ def __cwww_init():
|
|
|
39
40
|
|
|
40
41
|
def __persistent_cache_manager(mode):
|
|
41
42
|
"""
|
|
42
|
-
|
|
43
|
+
File state cache
|
|
43
44
|
modes:
|
|
44
45
|
r - recover, s - save
|
|
45
46
|
"""
|
|
@@ -47,12 +48,12 @@ def __persistent_cache_manager(mode):
|
|
|
47
48
|
return
|
|
48
49
|
if mode == 's':
|
|
49
50
|
# SAVE CACHE
|
|
50
|
-
with open(
|
|
51
|
+
with open(Data.FILE_CACHE, 'w') as f:
|
|
51
52
|
f.write(','.join([str(k) for k in Data.CWWW_CACHE]))
|
|
52
53
|
return
|
|
53
54
|
try:
|
|
54
55
|
# RESTORE CACHE
|
|
55
|
-
with open(
|
|
56
|
+
with open(Data.FILE_CACHE, 'r') as f:
|
|
56
57
|
Data.CWWW_CACHE = [float(data) for data in f.read().strip().split(',')]
|
|
57
58
|
except:
|
|
58
59
|
pass
|
|
@@ -72,19 +73,16 @@ def __state_machine(c, w):
|
|
|
72
73
|
# Application functions #
|
|
73
74
|
#########################
|
|
74
75
|
|
|
75
|
-
def load(cache=
|
|
76
|
+
def load(pin_warm=None, pin_cold=None, cache=True):
|
|
76
77
|
"""
|
|
77
78
|
Initialize Cold white / Warm white LED module
|
|
78
|
-
:param
|
|
79
|
-
|
|
80
|
-
|
|
79
|
+
:param pin_warm: optional number to overwrite default pin
|
|
80
|
+
:param pin_cold: optional number to overwrite default pin
|
|
81
|
+
:param cache: save/load state machine to disk (.cache)
|
|
81
82
|
:return str: Cache state
|
|
82
83
|
"""
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
Data.PERSISTENT_CACHE = False if platform == 'esp8266' else True
|
|
86
|
-
else:
|
|
87
|
-
Data.PERSISTENT_CACHE = cache
|
|
84
|
+
__cwww_init(pin_warm, pin_cold)
|
|
85
|
+
Data.PERSISTENT_CACHE = cache
|
|
88
86
|
__persistent_cache_manager('r') # recover data cache
|
|
89
87
|
if Data.CWWW_CACHE[2] == 1:
|
|
90
88
|
Data.CWWW_CACHE[2] = 0 # Force ON at boot
|
|
@@ -240,8 +238,7 @@ def transition(cw=None, ww=None, sec=1.0, wake=False):
|
|
|
240
238
|
# Create transition generator and calculate step_ms
|
|
241
239
|
cct_gen, step_ms = transition_gen(cw_from, cw_to, ww_from, ww_to, interval_sec=sec)
|
|
242
240
|
# [!] ASYNC TASK CREATION [1*] with async task callback + taskID (TAG) handling
|
|
243
|
-
|
|
244
|
-
return "Starting transition" if state else "Transition already running"
|
|
241
|
+
return micro_task(tag=Data.CCT_TASK_TAG, task=_task(ms_period=step_ms, iterable=cct_gen))
|
|
245
242
|
|
|
246
243
|
|
|
247
244
|
def hue_transition(percent, sec=1.0, wake=False):
|
|
@@ -290,8 +287,7 @@ def hue_transition(percent, sec=1.0, wake=False):
|
|
|
290
287
|
#print("Actual percent: {}, target percent: {}".format(actual_percent, warm_percent))
|
|
291
288
|
hue_gen, step_ms = transition_gen(hue_curr_percent, percent*10, interval_sec=sec)
|
|
292
289
|
# [!] ASYNC TASK CREATION [1*] with async task callback + taskID (TAG) handling
|
|
293
|
-
|
|
294
|
-
return "Starting transition" if state else "Transition already running"
|
|
290
|
+
return micro_task(tag=Data.HUE_TASK_TAG, task=_task(ms_period=step_ms, iterable=hue_gen))
|
|
295
291
|
else:
|
|
296
292
|
return "Invalid range, percent=<0-100>"
|
|
297
293
|
|