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
micrOS/source/Pacman.py
ADDED
|
@@ -0,0 +1,326 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Module is responsible for Package management and installation
|
|
3
|
+
Install from
|
|
4
|
+
Package URL (package.json):
|
|
5
|
+
https://github.com/BxNxM/micrOSPackages/tree/main/blinky_example
|
|
6
|
+
github:BxNxM/micrOSPackages/blinky_example
|
|
7
|
+
File URL:
|
|
8
|
+
https://github.com/BxNxM/micrOS/blob/master/toolkit/workspace/precompiled/modules/LM_rgb.mpy
|
|
9
|
+
github:BxNxM/micrOS/toolkit/workspace/precompiled/modules/LM_rgb.mpy
|
|
10
|
+
Default packages:
|
|
11
|
+
by name (micropython doc.)
|
|
12
|
+
|
|
13
|
+
Load Modules in /lib/LM_* will be automatically moved to /modules/LM_* as post install step.
|
|
14
|
+
|
|
15
|
+
Designed by Marcell Ban aka BxNxM
|
|
16
|
+
"""
|
|
17
|
+
|
|
18
|
+
from json import load
|
|
19
|
+
from mip import install as mipstall
|
|
20
|
+
from uos import rename, mkdir
|
|
21
|
+
from Files import OSPath, path_join, is_file, ilist_fs, is_dir, remove_file, remove_dir
|
|
22
|
+
from Debug import syslog, console_write
|
|
23
|
+
from urequests import get as uget
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
# ---------------------------------------------------------------------
|
|
27
|
+
# Utility helpers
|
|
28
|
+
# ---------------------------------------------------------------------
|
|
29
|
+
|
|
30
|
+
def _normalize_source(ref):
|
|
31
|
+
"""
|
|
32
|
+
Normalize GitHub URLs or shorthand for mip compatibility.
|
|
33
|
+
Converts:
|
|
34
|
+
- https://github.com/user/repo/blob/branch/path/file.py → https://raw.githubusercontent.com/user/repo/branch/path/file.py
|
|
35
|
+
- https://github.com/user/repo/tree/branch/path → github:user/repo/path
|
|
36
|
+
Returns (normalized_ref, branch)
|
|
37
|
+
"""
|
|
38
|
+
try:
|
|
39
|
+
ref = ref.strip().rstrip("/")
|
|
40
|
+
# Already in github: shorthand
|
|
41
|
+
if ref.startswith("github:"):
|
|
42
|
+
return ref, None
|
|
43
|
+
|
|
44
|
+
if ref.startswith("https://"):
|
|
45
|
+
ref = ref.replace("https://", "")
|
|
46
|
+
if ref.startswith("github.com"):
|
|
47
|
+
# Folder (tree) case → github:user/repo/path
|
|
48
|
+
if "/tree/" in ref:
|
|
49
|
+
console_write("[mip-normalize] detected GitHub tree folder link")
|
|
50
|
+
parts = ref.split("/")
|
|
51
|
+
user, repo = parts[1], parts[2]
|
|
52
|
+
branch = parts[4]
|
|
53
|
+
path = "/".join(parts[5:])
|
|
54
|
+
github_ref = f"github:{user}/{repo}/{path}".rstrip("/")
|
|
55
|
+
return github_ref, branch
|
|
56
|
+
|
|
57
|
+
# File (blob) case → raw.githubusercontent.com
|
|
58
|
+
if "/blob/" in ref:
|
|
59
|
+
console_write("[mip-normalize] detected GitHub blob file link")
|
|
60
|
+
url_base = "https://raw.githubusercontent.com/"
|
|
61
|
+
ref = ref.replace("github.com/", url_base).replace("/blob", "")
|
|
62
|
+
return ref, None
|
|
63
|
+
|
|
64
|
+
# Direct GitHub file (no blob/tree) → github:user/repo/path
|
|
65
|
+
if ref.count("/") >= 2:
|
|
66
|
+
console_write("[mip-normalize] direct GitHub path (no blob/tree)")
|
|
67
|
+
parts = ref.split("/")
|
|
68
|
+
user, repo = parts[1], parts[2]
|
|
69
|
+
path = "/".join(parts[3:])
|
|
70
|
+
github_ref = f"github:{user}/{repo}/{path}".rstrip("/")
|
|
71
|
+
return github_ref, None
|
|
72
|
+
|
|
73
|
+
console_write("[mip-normalize] unchanged")
|
|
74
|
+
return ref, None
|
|
75
|
+
|
|
76
|
+
except Exception as e:
|
|
77
|
+
syslog(f"[ERR][pacman] normalize failed: {ref}: {e}")
|
|
78
|
+
return str(ref), None
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
def _protected_resource(source_name):
|
|
82
|
+
return source_name.split(".")[0] in ("LM_system", "LM_pacman", "LM_cluster")
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
def _unpack_from_pacman_json(path:str, packages:tuple) -> tuple[bool, str]:
|
|
86
|
+
"""
|
|
87
|
+
Unpack Load Modules and other resources based on pacman.json
|
|
88
|
+
:param path: packages library path (default: /lib)
|
|
89
|
+
:param packages: list of package names, but least one to unpack
|
|
90
|
+
"""
|
|
91
|
+
verdict = ""
|
|
92
|
+
# Check all input packages
|
|
93
|
+
for pack in packages:
|
|
94
|
+
pack_meta_path = path_join(path, pack, 'pacman.json')
|
|
95
|
+
if is_file(pack_meta_path):
|
|
96
|
+
verdict += f"\n UNPACKING {pack_meta_path}"
|
|
97
|
+
# Load package layout metadata
|
|
98
|
+
try:
|
|
99
|
+
with open(pack_meta_path, 'r') as p:
|
|
100
|
+
layout = load(p).get('layout', {})
|
|
101
|
+
except Exception as e:
|
|
102
|
+
syslog(f"[ERR] Package unpack {pack_meta_path}: {e}")
|
|
103
|
+
layout = {}
|
|
104
|
+
# Unpack files based on layout metadata
|
|
105
|
+
for target, source_list in layout.items():
|
|
106
|
+
# Restrict write access for /config/*
|
|
107
|
+
if target.lstrip("/").startswith("config"):
|
|
108
|
+
verdict += f"\n ✗ Protected target dir: {target}"
|
|
109
|
+
continue
|
|
110
|
+
target_dir = path_join(OSPath._ROOT, target)
|
|
111
|
+
for source in source_list:
|
|
112
|
+
source_path = path_join(path, source)
|
|
113
|
+
source_name = source.split('/')[-1] if '/' in source else source
|
|
114
|
+
if _protected_resource(source_name):
|
|
115
|
+
verdict += f"\n ! Unpack skip - protected target: {source_name}"
|
|
116
|
+
continue
|
|
117
|
+
if is_file(source_path):
|
|
118
|
+
try:
|
|
119
|
+
if not is_dir(target_dir):
|
|
120
|
+
# Support single-level child dir
|
|
121
|
+
mkdir(target_dir)
|
|
122
|
+
except Exception as e:
|
|
123
|
+
verdict += f"\n ✗ Unpack subdir error {target_dir}: {e}"
|
|
124
|
+
try:
|
|
125
|
+
rename(source_path, path_join(target_dir, source_name))
|
|
126
|
+
verdict += f"\n ✓ Unpacked {source} -> {target_dir}"
|
|
127
|
+
except Exception as e:
|
|
128
|
+
verdict += f"\n ✗ Unpack error {source}: {e}"
|
|
129
|
+
elif not is_file(path_join(target_dir, source)):
|
|
130
|
+
# Check already unpacked target resource
|
|
131
|
+
verdict += f"\n ✗ Unpack error: {source} not exists"
|
|
132
|
+
return "\nNothing to unpack" if verdict == "" else verdict
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
# ---------------------------------------------------------------------
|
|
136
|
+
# Core installer
|
|
137
|
+
# ---------------------------------------------------------------------
|
|
138
|
+
|
|
139
|
+
def _install_any(ref, target=None):
|
|
140
|
+
"""Internal wrapper with consistent error handling and debug output."""
|
|
141
|
+
verdict = f"[mip] Installing: {ref}\n"
|
|
142
|
+
try:
|
|
143
|
+
ref, branch = _normalize_source(ref)
|
|
144
|
+
kwargs = {}
|
|
145
|
+
if branch:
|
|
146
|
+
kwargs["version"] = branch
|
|
147
|
+
kwargs["target"] = target or OSPath.LIB
|
|
148
|
+
verdict = f"[mip] Installing: {ref} {kwargs}\n"
|
|
149
|
+
# MIP Install
|
|
150
|
+
mipstall(ref, **kwargs)
|
|
151
|
+
verdict += f" ✓ Installed under {kwargs['target']}"
|
|
152
|
+
except Exception as e:
|
|
153
|
+
err = f" ✗ Failed to install '{ref}': {e}"
|
|
154
|
+
syslog(f"[ERR][pacman] {err}")
|
|
155
|
+
verdict += err
|
|
156
|
+
return verdict
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
# ---------------------------------------------------------------------
|
|
160
|
+
# Public install functions
|
|
161
|
+
# ---------------------------------------------------------------------
|
|
162
|
+
|
|
163
|
+
def install_requirements(source="requirements.txt"):
|
|
164
|
+
"""Install from a requirements.txt file under /config."""
|
|
165
|
+
source_path = path_join(OSPath.CONFIG, source)
|
|
166
|
+
verdict = f"[mip] Installing from requirements file: {source_path}\n"
|
|
167
|
+
if is_file(source_path):
|
|
168
|
+
with open(source_path, "r") as f:
|
|
169
|
+
for req in f:
|
|
170
|
+
try:
|
|
171
|
+
verdict += _install_any(req, target=OSPath.LIB) + "\n"
|
|
172
|
+
except Exception as e:
|
|
173
|
+
err = f" ✗ Failed to process {source}: {e}"
|
|
174
|
+
syslog(f"[ERR][pacman] {err}")
|
|
175
|
+
verdict += err
|
|
176
|
+
verdict += " ✓ All listed packages processed"
|
|
177
|
+
else:
|
|
178
|
+
err = f" ✗ {source_path} not exists"
|
|
179
|
+
syslog(f"[ERR][pacman] {err}")
|
|
180
|
+
verdict += err
|
|
181
|
+
return verdict
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
def unpack(ref:str=None):
|
|
185
|
+
"""
|
|
186
|
+
Unpack downloaded package from /lib
|
|
187
|
+
- use pacman.json metadata layout to unpack files to multiple targets
|
|
188
|
+
:param ref: install reference (extract package name from this)
|
|
189
|
+
"""
|
|
190
|
+
|
|
191
|
+
if ref is None:
|
|
192
|
+
# Collect all package names under /lib and unpack all
|
|
193
|
+
packages = tuple(ilist_fs(OSPath.LIB, type_filter='d'))
|
|
194
|
+
else:
|
|
195
|
+
# Handle single explicit ref for unpacking
|
|
196
|
+
ref_parts = [p for p in ref.split("/") if p]
|
|
197
|
+
pack_name = ref_parts[-2] if '.' in ref_parts[-1] else ref_parts[-1]
|
|
198
|
+
packages = (pack_name, )
|
|
199
|
+
|
|
200
|
+
return _unpack_from_pacman_json(OSPath.LIB, packages)
|
|
201
|
+
|
|
202
|
+
# ---------------------------------------------------------------------
|
|
203
|
+
# Unified entry point
|
|
204
|
+
# ---------------------------------------------------------------------
|
|
205
|
+
|
|
206
|
+
def install(ref):
|
|
207
|
+
"""
|
|
208
|
+
Unified mip-based installer for micrOS.
|
|
209
|
+
Automatically detects:
|
|
210
|
+
- requirements.txt files (local)
|
|
211
|
+
- Single-file load modules (LM_/IO_ names or URLs)
|
|
212
|
+
- GitHub or raw URLs (tree/blob/github:)
|
|
213
|
+
- Official MicroPython packages
|
|
214
|
+
"""
|
|
215
|
+
|
|
216
|
+
if not ref:
|
|
217
|
+
return "[mip] Nothing to install (empty input)"
|
|
218
|
+
|
|
219
|
+
# 1. Install from requirements.txt
|
|
220
|
+
if ref == "requirements.txt":
|
|
221
|
+
verdict = install_requirements(ref)
|
|
222
|
+
verdict += unpack()
|
|
223
|
+
return verdict
|
|
224
|
+
|
|
225
|
+
# 2. Install from URL or Shorthand file / package reference
|
|
226
|
+
if ref.startswith("github") or ref.startswith("http"):
|
|
227
|
+
# 2.1. Exact file ref: LM_/IO_ load modules → /modules
|
|
228
|
+
if ref.endswith("py") and ("LM_" in ref or "IO_" in ref):
|
|
229
|
+
return _install_any(ref, target=OSPath.MODULES)
|
|
230
|
+
|
|
231
|
+
# 2.2. Package ref: GitHub or raw URLs → /lib
|
|
232
|
+
verdict = _install_any(ref, target=OSPath.LIB)
|
|
233
|
+
verdict += unpack(ref)
|
|
234
|
+
return verdict
|
|
235
|
+
|
|
236
|
+
# 3. Fallback/Official micropython package → /lib
|
|
237
|
+
return _install_any(ref, target=OSPath.LIB)
|
|
238
|
+
|
|
239
|
+
|
|
240
|
+
def uninstall(package_name):
|
|
241
|
+
"""
|
|
242
|
+
Uninstalls package from /lib with its dependencies
|
|
243
|
+
:param package_name: package name under /lib
|
|
244
|
+
"""
|
|
245
|
+
pack_path = path_join(OSPath.LIB, package_name)
|
|
246
|
+
pack_meta = path_join(pack_path, "pacman.json")
|
|
247
|
+
|
|
248
|
+
if not is_dir(pack_path):
|
|
249
|
+
return f"✗ No packaged found: {pack_path}"
|
|
250
|
+
|
|
251
|
+
verdict = f"Uninstall {package_name}\n"
|
|
252
|
+
if is_file(pack_meta):
|
|
253
|
+
# Load package layout metadata
|
|
254
|
+
try:
|
|
255
|
+
with open(pack_meta, 'r') as p:
|
|
256
|
+
layout = load(p).get('layout', {})
|
|
257
|
+
except Exception as e:
|
|
258
|
+
syslog(f"[ERR] Package uninstall {pack_meta}: {e}")
|
|
259
|
+
layout = {}
|
|
260
|
+
|
|
261
|
+
for target, source_list in layout.items():
|
|
262
|
+
# Restrict write access for /config/*
|
|
263
|
+
if target.lstrip("/").startswith("config"):
|
|
264
|
+
verdict += f" ✗ Protected target dir: {target}\n"
|
|
265
|
+
continue
|
|
266
|
+
target_dir = path_join(OSPath._ROOT, target)
|
|
267
|
+
for source in source_list:
|
|
268
|
+
source_name = source.split('/')[-1] if '/' in source else source
|
|
269
|
+
if _protected_resource(source_name):
|
|
270
|
+
verdict += f" ✗ Remove skip - protected target: {source_name}\n"
|
|
271
|
+
continue
|
|
272
|
+
unpacked_path = path_join(target_dir, source_name)
|
|
273
|
+
if is_file(unpacked_path):
|
|
274
|
+
remove_file(unpacked_path)
|
|
275
|
+
verdict += f" ✓ Removed: {unpacked_path}\n"
|
|
276
|
+
|
|
277
|
+
# Delete package
|
|
278
|
+
verdict += " " + remove_dir(pack_path)
|
|
279
|
+
return verdict
|
|
280
|
+
|
|
281
|
+
def upgrade(package_name, force=False):
|
|
282
|
+
"""
|
|
283
|
+
Update package based on package name and paccman.json[versions][package]
|
|
284
|
+
- embeds unified mip-based installer for micrOS.: install paccman.json[url]
|
|
285
|
+
:param package_name: package name under /lib
|
|
286
|
+
:param force: skip version check
|
|
287
|
+
"""
|
|
288
|
+
pack_path = path_join(OSPath.LIB, package_name)
|
|
289
|
+
pack_meta = path_join(pack_path, "pacman.json")
|
|
290
|
+
|
|
291
|
+
if not is_dir(pack_path) or not is_file(pack_meta):
|
|
292
|
+
return f"✗ No packaged (metadata) found: {pack_path}"
|
|
293
|
+
|
|
294
|
+
verdict = f"Upgrade: collecting package info {package_name}\n"
|
|
295
|
+
# 1. Get local package info
|
|
296
|
+
with open(pack_meta, 'r') as f:
|
|
297
|
+
pm_json = load(f)
|
|
298
|
+
current_version = pm_json.get("versions", {"package": "0.0.0"}).get("package")
|
|
299
|
+
package_url = pm_json.get("url", "")
|
|
300
|
+
# 2. Get latest package version
|
|
301
|
+
latest_version = current_version
|
|
302
|
+
if package_url:
|
|
303
|
+
_part1 = '/'.join(package_url.split(':', 1)[1].split('/', 2)[:2])
|
|
304
|
+
_part2 = package_url.split(':', 1)[1].split('/', 2)[2]
|
|
305
|
+
package_json_url = f"https://raw.githubusercontent.com/{_part1}/refs/heads/main/{_part2}/package.json"
|
|
306
|
+
try:
|
|
307
|
+
code, body = uget(url=package_json_url, sock_size=256, jsonify=True)
|
|
308
|
+
if code == 200:
|
|
309
|
+
# Set remote/latest version for real
|
|
310
|
+
latest_version = body.get("version", current_version)
|
|
311
|
+
else:
|
|
312
|
+
verdict += f" ✗ Failed to retrieve remote version, code: {code}"
|
|
313
|
+
del body # Cleanup
|
|
314
|
+
except Exception as e:
|
|
315
|
+
verdict += f" ✗ Failed to retrieve remote version: {e}"
|
|
316
|
+
|
|
317
|
+
# Evaluate package upgrade request
|
|
318
|
+
if force or current_version != latest_version:
|
|
319
|
+
if package_url:
|
|
320
|
+
verdict += f" ✓ Upgrade package ({current_version}->{latest_version}): {package_url}\n"
|
|
321
|
+
verdict += install(package_url)
|
|
322
|
+
else:
|
|
323
|
+
verdict += f" ✗ Skip upgrade, package URL unavailable: {package_url}\n"
|
|
324
|
+
else:
|
|
325
|
+
verdict += f" ✓ Skip upgrade, up-to-date: {current_version} == {latest_version}\n"
|
|
326
|
+
return verdict
|
micrOS/source/Scheduler.py
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
from time import localtime
|
|
2
2
|
from re import compile
|
|
3
3
|
from Tasks import exec_lm_pipe_schedule
|
|
4
|
-
from Debug import console_write,
|
|
4
|
+
from Debug import console_write, syslog
|
|
5
5
|
from Time import Sun, suntime, ntp_time
|
|
6
|
+
from Config import cfgget
|
|
6
7
|
|
|
7
8
|
"""
|
|
8
9
|
# SYSTEM TIME FORMAT: Y, M, D, H, M, S, WD, YD
|
|
@@ -16,39 +17,6 @@ S: 0-59
|
|
|
16
17
|
|
|
17
18
|
LAST_CRON_TASKS = []
|
|
18
19
|
|
|
19
|
-
'''
|
|
20
|
-
#############################
|
|
21
|
-
# SYSTEM TEST MODULES #
|
|
22
|
-
#############################
|
|
23
|
-
|
|
24
|
-
def system_time_generator(max=100000000):
|
|
25
|
-
|
|
26
|
-
def systime(sec):
|
|
27
|
-
h = int(sec / 60 / 60) % 24
|
|
28
|
-
m = int(sec / 60 % 60)
|
|
29
|
-
s = sec % 60
|
|
30
|
-
wd = int(sec / 60 / 60 / 24) % 7
|
|
31
|
-
day = int(sec / 60 / 60 / 24) % 30
|
|
32
|
-
return 2020, 9, day, h, m, s, wd, 0
|
|
33
|
-
|
|
34
|
-
generator = (systime(sec) for sec in range(0, max, 3))
|
|
35
|
-
return generator
|
|
36
|
-
|
|
37
|
-
def dummy_irq(cron_data, irqperiod):
|
|
38
|
-
from time import sleep
|
|
39
|
-
while True:
|
|
40
|
-
scheduler(cron_data, irqperiod)
|
|
41
|
-
sleep(0.00001)
|
|
42
|
-
|
|
43
|
-
##### TEST CODE INIT #####
|
|
44
|
-
# Create time gen (use instead localtime)
|
|
45
|
-
GEN = system_time_generator()
|
|
46
|
-
from ConfigHandler import cfgget
|
|
47
|
-
# Emulate scheduler execution ... LOOP
|
|
48
|
-
dummy_irq(cfgget('crontasks'), int(cfgget('timirqseq')/1000))
|
|
49
|
-
'''
|
|
50
|
-
|
|
51
|
-
|
|
52
20
|
#############################
|
|
53
21
|
# SCHEDULER FUNCTIONS #
|
|
54
22
|
#############################
|
|
@@ -101,7 +69,7 @@ def __resolve_time_tag(check_time, crontask):
|
|
|
101
69
|
# Resolve tag
|
|
102
70
|
value = Sun.TIME.get(tag, None)
|
|
103
71
|
if value is None or len(value) < 3:
|
|
104
|
-
|
|
72
|
+
syslog(f'[ERR] cron syntax error: {tag}:{value}')
|
|
105
73
|
return ()
|
|
106
74
|
|
|
107
75
|
# Update check_time with resolved value by tag
|
|
@@ -186,7 +154,7 @@ def __scheduler_trigger(cron_time_now, crontask, deltasec=2):
|
|
|
186
154
|
console_write(f"[builtin cron] {crontask[1]()}")
|
|
187
155
|
lm_state = True
|
|
188
156
|
except Exception as e:
|
|
189
|
-
|
|
157
|
+
syslog(f"[ERR] cron function exec error: {e}")
|
|
190
158
|
if not lm_state:
|
|
191
159
|
console_write(f"[cron]now[{cron_time_now}] \
|
|
192
160
|
{__convert_sec_to_time(tolerance_min_sec)} <-> {__convert_sec_to_time(tolerance_max_sec)} \
|
|
@@ -202,10 +170,10 @@ def __scheduler_trigger(cron_time_now, crontask, deltasec=2):
|
|
|
202
170
|
return False
|
|
203
171
|
|
|
204
172
|
|
|
205
|
-
def
|
|
173
|
+
def deserialize_raw_tasks():
|
|
206
174
|
"""
|
|
207
175
|
Scheduler/Cron input string format
|
|
208
|
-
|
|
176
|
+
cron_data: raw cron tasks, time based task execution input (str)
|
|
209
177
|
example: WD:H:M:S!LM func;WD:H:M:S!LM func; ...
|
|
210
178
|
multi command example: WD:H:M:S!LM func;LM func2;; WD:H:M:S!LM func;; ...
|
|
211
179
|
|
|
@@ -218,31 +186,23 @@ def deserialize_raw_input(cron_data):
|
|
|
218
186
|
task: LoadModule function args
|
|
219
187
|
Returns tuple: (("WD:H:M:S", 'LM FUNC'), ("WD:H:M:S", 'LM FUNC'), ...)
|
|
220
188
|
"""
|
|
189
|
+
cron_data:str = cfgget('crontasks')
|
|
221
190
|
try:
|
|
222
191
|
# Parse and create return
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
return (tuple(cron.split('!')) for cron in cd.split(sep))
|
|
192
|
+
sep = ';;' if ';;' in cron_data else ';' # support multi command with ;;
|
|
193
|
+
return (tuple(cron.split('!')) for cron in cron_data.split(sep))
|
|
226
194
|
except Exception as e:
|
|
227
|
-
|
|
195
|
+
syslog(f"[ERR] cron deserialize - syntax error: {e}")
|
|
228
196
|
return ()
|
|
229
197
|
|
|
230
198
|
|
|
231
|
-
def scheduler(
|
|
199
|
+
def scheduler(irqperiod:int):
|
|
232
200
|
"""
|
|
233
|
-
:param
|
|
234
|
-
:param irqperiod: - in sec
|
|
235
|
-
RAW INPUT SYNTAX:
|
|
236
|
-
'WD:H:M:S!CMD;WD:H:M:S!CMD2;...'
|
|
237
|
-
RAW INPUT SYNTAX TAG SUPPORT:
|
|
238
|
-
'sunrise!CMD;sunset!CMD'
|
|
239
|
-
! - execute
|
|
240
|
-
; - cron task separator
|
|
201
|
+
:param irqperiod: sampling period in seconds
|
|
241
202
|
"""
|
|
242
203
|
builtin_tasks = (("*:3:0:0", suntime), ("*:3:5:0", ntp_time))
|
|
243
204
|
state = False
|
|
244
205
|
time_now = localtime()[3:7]
|
|
245
|
-
# time_now = next(GEN) # USE FOR TESTING (time machine)
|
|
246
206
|
|
|
247
207
|
# Actual time - WD, H, M, S
|
|
248
208
|
cron_time_now = (time_now[3], time_now[0], time_now[1], time_now[2])
|
|
@@ -252,9 +212,9 @@ def scheduler(cron_data, irqperiod):
|
|
|
252
212
|
for cron in builtin_tasks:
|
|
253
213
|
state |= __scheduler_trigger(cron_time_now, cron, deltasec=irqperiod)
|
|
254
214
|
# Check user tasks (str)
|
|
255
|
-
for cron in
|
|
215
|
+
for cron in deserialize_raw_tasks():
|
|
256
216
|
state |= __scheduler_trigger(cron_time_now, cron, deltasec=irqperiod)
|
|
257
217
|
return state
|
|
258
218
|
except Exception as e:
|
|
259
|
-
|
|
219
|
+
syslog(f'[ERR] cron callback error: {e}')
|
|
260
220
|
return False
|