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
micrOS/source/Config.py
CHANGED
|
@@ -12,20 +12,28 @@ Designed by Marcell Ban aka BxNxM
|
|
|
12
12
|
#################################################################
|
|
13
13
|
# IMPORTS #
|
|
14
14
|
#################################################################
|
|
15
|
-
from
|
|
15
|
+
from re import search
|
|
16
16
|
from json import load, dump
|
|
17
|
+
from uos import remove
|
|
17
18
|
from utime import sleep
|
|
18
|
-
from Debug import DebugCfg, console_write,
|
|
19
|
+
from Debug import DebugCfg, console_write, syslog
|
|
20
|
+
from Files import OSPath, path_join, is_file
|
|
21
|
+
from uos import rename as move_file
|
|
19
22
|
try:
|
|
20
23
|
from microIO import set_pinmap
|
|
21
24
|
except:
|
|
22
|
-
|
|
25
|
+
syslog("[ERR] microIO import: set_pinmap")
|
|
23
26
|
set_pinmap = None
|
|
24
27
|
|
|
25
28
|
|
|
26
29
|
class Data:
|
|
27
|
-
|
|
28
|
-
|
|
30
|
+
"""
|
|
31
|
+
Data class for managing configuration data.
|
|
32
|
+
"""
|
|
33
|
+
__slots__ = []
|
|
34
|
+
|
|
35
|
+
CONFIG_NAME = "node_config.json"
|
|
36
|
+
CONFIG_PATH = path_join(OSPath.CONFIG, CONFIG_NAME)
|
|
29
37
|
CONFIG_CACHE = {"version": "n/a",
|
|
30
38
|
"auth": False,
|
|
31
39
|
"staessid": "your_wifi_name",
|
|
@@ -58,21 +66,28 @@ class Data:
|
|
|
58
66
|
"irq4_trig": "n/a",
|
|
59
67
|
"irq_prell_ms": 300,
|
|
60
68
|
"boothook": "n/a",
|
|
61
|
-
"aioqueue":
|
|
69
|
+
"aioqueue": 5,
|
|
62
70
|
"utc": +60,
|
|
63
71
|
"boostmd": True,
|
|
64
|
-
"guimeta": "...",
|
|
72
|
+
"guimeta": "...", # special "offloaded" key indicator
|
|
65
73
|
"cstmpmap": "n/a",
|
|
66
|
-
"
|
|
74
|
+
"espnow": False}
|
|
67
75
|
|
|
68
76
|
@staticmethod
|
|
69
77
|
def init():
|
|
78
|
+
# Migrate config from / to /config
|
|
79
|
+
if is_file(Data.CONFIG_NAME):
|
|
80
|
+
console_write(f"[CONF] Migrate {Data.CONFIG_NAME} to {Data.CONFIG_PATH}")
|
|
81
|
+
move_file(Data.CONFIG_NAME, Data.CONFIG_PATH)
|
|
70
82
|
# Inject user config into template
|
|
71
83
|
Data.__inject_default_conf()
|
|
72
84
|
# [!!!] Init selected pinmap - default pinmap calculated by platform
|
|
73
|
-
if set_pinmap
|
|
74
|
-
|
|
75
|
-
|
|
85
|
+
if callable(set_pinmap):
|
|
86
|
+
try:
|
|
87
|
+
pinmap = set_pinmap(Data.CONFIG_CACHE['cstmpmap'])
|
|
88
|
+
console_write(f"[PIN MAP] {pinmap}")
|
|
89
|
+
except Exception as e:
|
|
90
|
+
console_write(f"\n[PIN MAP] !!! SETUP ERROR !!!: {e}\n")
|
|
76
91
|
# SET dbg based on config settings (inject user conf)
|
|
77
92
|
DebugCfg.DEBUG = Data.CONFIG_CACHE['dbg']
|
|
78
93
|
if DebugCfg.DEBUG:
|
|
@@ -89,12 +104,12 @@ class Data:
|
|
|
89
104
|
liveconf = Data.read_cfg_file(nosafe=True)
|
|
90
105
|
# Remove obsolete keys from conf
|
|
91
106
|
try:
|
|
92
|
-
remove('cleanup
|
|
107
|
+
remove('.cleanup') # Try to remove .cleanup (cleanup indicator by micrOSloader)
|
|
93
108
|
console_write("[CONF] Purge obsolete keys")
|
|
94
109
|
for key in (key for key in liveconf if key not in Data.CONFIG_CACHE):
|
|
95
110
|
liveconf.pop(key, None)
|
|
96
111
|
except Exception:
|
|
97
|
-
console_write("[CONF] SKIP obsolete keys check (no cleanup
|
|
112
|
+
console_write("[CONF] SKIP obsolete keys check (no .cleanup)")
|
|
98
113
|
# Merge template to live conf (store active conf in Data.CONFIG_CACHE)
|
|
99
114
|
Data.CONFIG_CACHE.update(liveconf)
|
|
100
115
|
console_write("[CONF] User config injection done")
|
|
@@ -103,7 +118,7 @@ class Data:
|
|
|
103
118
|
Data.write_cfg_file()
|
|
104
119
|
console_write("[CONF] Save conf successful")
|
|
105
120
|
except Exception as e:
|
|
106
|
-
|
|
121
|
+
syslog(f"[ERR] Save (__inject) conf failed: {e}")
|
|
107
122
|
finally:
|
|
108
123
|
del liveconf
|
|
109
124
|
|
|
@@ -121,7 +136,7 @@ class Data:
|
|
|
121
136
|
if nosafe:
|
|
122
137
|
break
|
|
123
138
|
sleep(0.2)
|
|
124
|
-
|
|
139
|
+
syslog(f'[ERR] read_cfg_file error: {e}')
|
|
125
140
|
# Return config cache
|
|
126
141
|
return conf
|
|
127
142
|
|
|
@@ -134,7 +149,7 @@ class Data:
|
|
|
134
149
|
dump(Data.CONFIG_CACHE, f)
|
|
135
150
|
break
|
|
136
151
|
except Exception as e:
|
|
137
|
-
|
|
152
|
+
syslog(f'[ERR] write_cfg_file {Data.CONFIG_PATH} (json): {e}')
|
|
138
153
|
sleep(0.2)
|
|
139
154
|
return True
|
|
140
155
|
|
|
@@ -143,20 +158,16 @@ class Data:
|
|
|
143
158
|
value_in_cfg = Data.CONFIG_CACHE[key]
|
|
144
159
|
try:
|
|
145
160
|
if isinstance(value_in_cfg, bool):
|
|
146
|
-
del value_in_cfg
|
|
147
161
|
if str(value).lower() == 'true':
|
|
148
162
|
return True
|
|
149
163
|
if str(value).lower() == 'false':
|
|
150
164
|
return False
|
|
151
165
|
raise Exception("type_handler type handling error")
|
|
152
166
|
if isinstance(value_in_cfg, str):
|
|
153
|
-
del value_in_cfg
|
|
154
167
|
return str(value)
|
|
155
168
|
if isinstance(value_in_cfg, int):
|
|
156
|
-
del value_in_cfg
|
|
157
169
|
return int(value)
|
|
158
170
|
if isinstance(value_in_cfg, float):
|
|
159
|
-
del value_in_cfg
|
|
160
171
|
return float(value)
|
|
161
172
|
except Exception as e:
|
|
162
173
|
console_write(f"Input value type error! {e}")
|
|
@@ -169,21 +180,37 @@ class Data:
|
|
|
169
180
|
These kind of parameters are not cached in memory
|
|
170
181
|
"""
|
|
171
182
|
# Write str value to file
|
|
183
|
+
offloaded_key = path_join(OSPath.CONFIG, f'.{key}.key')
|
|
172
184
|
if isinstance(value, str) and key in Data.CONFIG_CACHE:
|
|
173
185
|
try:
|
|
174
|
-
with open(
|
|
186
|
+
with open(offloaded_key, 'w') as f:
|
|
175
187
|
f.write(value)
|
|
176
188
|
return True
|
|
177
189
|
except Exception:
|
|
178
190
|
return False
|
|
179
191
|
# Read str value from file
|
|
180
192
|
try:
|
|
181
|
-
with open(
|
|
193
|
+
with open(offloaded_key, 'r') as f:
|
|
182
194
|
return f.read().strip()
|
|
183
195
|
except Exception:
|
|
184
196
|
# Return default value if key not exists
|
|
185
197
|
return 'n/a'
|
|
186
198
|
|
|
199
|
+
@staticmethod
|
|
200
|
+
def validate_pwd(password):
|
|
201
|
+
"""
|
|
202
|
+
Validate appwd parameter
|
|
203
|
+
- webrepl password
|
|
204
|
+
- micrOS auth password (Shell/WebCli)
|
|
205
|
+
- wifi access point password
|
|
206
|
+
"""
|
|
207
|
+
# Check password rules
|
|
208
|
+
if 4 <= len(password) <= 9:
|
|
209
|
+
if search(r"[A-Z]", password) and search(r"[a-z]", password):
|
|
210
|
+
if search(r"\d", password):
|
|
211
|
+
return True, ''
|
|
212
|
+
return False, 'Password must include [0-9] both [a-z][A-Z] and length between 4-9 char.'
|
|
213
|
+
|
|
187
214
|
|
|
188
215
|
#################################################################
|
|
189
216
|
# CONFIGHANDLER FUNCTIONS #
|
|
@@ -200,11 +227,14 @@ def cfgget(key=None):
|
|
|
200
227
|
return Data.disk_keys(key)
|
|
201
228
|
return val
|
|
202
229
|
except Exception as e:
|
|
203
|
-
|
|
230
|
+
syslog(f'[ERR] cfgget {key} error: {e}')
|
|
204
231
|
return None
|
|
205
232
|
|
|
206
|
-
|
|
207
233
|
def cfgput(key, value, type_check=False):
|
|
234
|
+
if key == 'appwd':
|
|
235
|
+
is_valid, verdict = Data.validate_pwd(value)
|
|
236
|
+
if not is_valid:
|
|
237
|
+
raise Exception(verdict)
|
|
208
238
|
# Handle special "offloaded" keys
|
|
209
239
|
if str(Data.CONFIG_CACHE.get(key, None)) == '...':
|
|
210
240
|
return Data.disk_keys(key, value)
|
|
@@ -222,7 +252,7 @@ def cfgput(key, value, type_check=False):
|
|
|
222
252
|
del value
|
|
223
253
|
return True
|
|
224
254
|
except Exception as e:
|
|
225
|
-
|
|
255
|
+
syslog(f'[ERR] cfgput {key} error: {e}')
|
|
226
256
|
return False
|
|
227
257
|
|
|
228
258
|
#################################################################
|
micrOS/source/Debug.py
CHANGED
|
@@ -1,11 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"""
|
|
2
|
+
micrOS Console and Log write interface implementations.
|
|
3
|
+
- with progress led feature, simple and custom
|
|
4
|
+
Designed by Marcell Ban aka BxNxM
|
|
5
|
+
"""
|
|
4
6
|
|
|
7
|
+
from machine import Pin
|
|
8
|
+
try:
|
|
9
|
+
from Logger import syslog as logger_syslog
|
|
10
|
+
except:
|
|
11
|
+
logger_syslog = None
|
|
5
12
|
try:
|
|
6
|
-
from microIO import
|
|
13
|
+
from microIO import resolve_pin, pinmap_search, register_pin
|
|
7
14
|
except:
|
|
8
|
-
|
|
15
|
+
pinmap_search = None
|
|
9
16
|
|
|
10
17
|
|
|
11
18
|
#############################################
|
|
@@ -16,109 +23,60 @@ except:
|
|
|
16
23
|
class DebugCfg:
|
|
17
24
|
DEBUG = True # DEBUG PRINT ON/OFF - SET FROM ConfigHandler
|
|
18
25
|
PLED_STEP = None # PROGRESS LED OBJECT - init in init_pled
|
|
19
|
-
NEO_WHEEL = None # NEOPIXEL (ws2812/esp32s3) color wheel object
|
|
20
|
-
COLOR_INDEX = 0 # APA102 TinyPico color wheel counter
|
|
21
26
|
|
|
22
27
|
@staticmethod
|
|
23
28
|
def init_pled():
|
|
24
29
|
# CALL FROM ConfigHandler
|
|
25
|
-
if
|
|
30
|
+
if pinmap_search is None:
|
|
26
31
|
# Check LogicalPins module loadable (robustness...)
|
|
27
32
|
return
|
|
28
|
-
|
|
29
|
-
pled
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
#
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
- automatic selection based on board type + builtin logical pin number
|
|
52
|
-
"""
|
|
53
|
-
try:
|
|
54
|
-
if callable(DebugCfg.PLED_STEP):
|
|
55
|
-
return DebugCfg.PLED_STEP() # Run step function (return None: double-blink OR True: no d-b)
|
|
56
|
-
except Exception as e:
|
|
57
|
-
errlog_add(f"[PLED] step error: {e}")
|
|
58
|
-
return True
|
|
33
|
+
pled = pinmap_search('builtin')['builtin']
|
|
34
|
+
if pled is None:
|
|
35
|
+
# No available builtin pin, skip pled init...
|
|
36
|
+
return
|
|
37
|
+
# CONFIGURE PROGRESS LED
|
|
38
|
+
if isinstance(pled, int):
|
|
39
|
+
# [MODE] Simple flashing progress LED
|
|
40
|
+
try:
|
|
41
|
+
# Progress led for esp32/etc
|
|
42
|
+
led_obj = Pin(abs(resolve_pin('builtin')), Pin.OUT)
|
|
43
|
+
if resolve_pin('builtin') < 0:
|
|
44
|
+
# Pin number start with (-), like -8 (means inverted output)
|
|
45
|
+
led_obj.value(1) # Turn OFF built-in LED state invert (1:OFF)
|
|
46
|
+
# Set function callback for step function (simple led - blink)
|
|
47
|
+
DebugCfg.PLED_STEP = lambda: led_obj.value(not led_obj.value()) # # double-blink: return None
|
|
48
|
+
except Exception as e:
|
|
49
|
+
syslog(f"[PLED] led error: {e}")
|
|
50
|
+
elif callable(pled):
|
|
51
|
+
# [MODE] OVERRIDE PROGRESS LED WITH CUSTOM step FUNCTION
|
|
52
|
+
DebugCfg.PLED_STEP = pled
|
|
53
|
+
DebugCfg._auto_register_pin()
|
|
54
|
+
else:
|
|
55
|
+
syslog(f"[WARN] pled type not supported: {pled}")
|
|
59
56
|
|
|
60
|
-
@staticmethod
|
|
61
|
-
def _init_simple():
|
|
62
|
-
try:
|
|
63
|
-
# Progress led for esp32/etc
|
|
64
|
-
led_obj = Pin(abs(physical_pin('builtin')), Pin.OUT)
|
|
65
|
-
if physical_pin('builtin') < 0: # Pin number start with (-), like -8 (means inverted output)
|
|
66
|
-
led_obj.value(1) # Turn OFF built-in LED state invert (1:OFF)
|
|
67
|
-
# Set function callback for step function (simple led - blink)
|
|
68
|
-
DebugCfg.PLED_STEP = lambda: led_obj.value(not led_obj.value()) # # double-blink: return None
|
|
69
|
-
except Exception as e:
|
|
70
|
-
errlog_add(f"[PLED] led error: {e}")
|
|
71
57
|
|
|
72
58
|
@staticmethod
|
|
73
|
-
def
|
|
59
|
+
def _auto_register_pin():
|
|
74
60
|
try:
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
spi = SoftSPI(sck=Pin(DOTSTAR_CLK), mosi=Pin(DOTSTAR_DATA), miso=Pin(SPI_MISO))
|
|
79
|
-
# Create a DotStar instance
|
|
80
|
-
dotstar = DotStar(spi, 1, brightness=0.4) # Just one DotStar, half brightness
|
|
81
|
-
# Turn on the power to the DotStar
|
|
82
|
-
set_dotstar_power(True)
|
|
83
|
-
DebugCfg.PLED_STEP = lambda: DebugCfg._step_apa102(led_obj=dotstar, color_wheel=dotstar_color_wheel)
|
|
61
|
+
pin = DebugCfg.PLED_STEP(pin=True)
|
|
62
|
+
if isinstance(pin, int):
|
|
63
|
+
register_pin('builtin', pin)
|
|
84
64
|
except Exception as e:
|
|
85
|
-
|
|
65
|
+
syslog(f"[ERR] pled pin registration: {e}", console=False)
|
|
86
66
|
|
|
87
|
-
@staticmethod
|
|
88
|
-
def _step_apa102(led_obj, color_wheel):
|
|
89
|
-
# Get the R,G,B values of the next colour
|
|
90
|
-
r, g, b = color_wheel(DebugCfg.COLOR_INDEX*2)
|
|
91
|
-
# Set the colour on the DOTSTAR
|
|
92
|
-
led_obj[0] = (int(r * 0.6), g, b, 0.4)
|
|
93
|
-
# Increase the wheel index
|
|
94
|
-
DebugCfg.COLOR_INDEX = 0 if DebugCfg.COLOR_INDEX > 1000 else DebugCfg.COLOR_INDEX + 2
|
|
95
|
-
return True # No double-blink
|
|
96
67
|
|
|
97
68
|
@staticmethod
|
|
98
|
-
def
|
|
69
|
+
def step():
|
|
70
|
+
"""
|
|
71
|
+
DEBUG LED FLASHING FEEDBACK
|
|
72
|
+
- handle step callback function execution
|
|
73
|
+
"""
|
|
99
74
|
try:
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
led_obj = NeoPixel(neo_pin, 1)
|
|
103
|
-
DebugCfg.PLED_STEP = lambda: DebugCfg._step_ws2812(led_obj)
|
|
75
|
+
if callable(DebugCfg.PLED_STEP):
|
|
76
|
+
return DebugCfg.PLED_STEP() # Run step function (return None: double-blink OR True: no d-b)
|
|
104
77
|
except Exception as e:
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
@staticmethod
|
|
108
|
-
def _step_ws2812(led_obj):
|
|
109
|
-
def _color_wheel():
|
|
110
|
-
while True:
|
|
111
|
-
yield 10, 0, 0
|
|
112
|
-
yield 5, 5, 0
|
|
113
|
-
yield 0, 10, 0
|
|
114
|
-
yield 0, 5, 5
|
|
115
|
-
yield 0, 0, 10
|
|
116
|
-
yield 5, 0, 5
|
|
117
|
-
if DebugCfg.NEO_WHEEL is None:
|
|
118
|
-
DebugCfg.NEO_WHEEL = _color_wheel()
|
|
119
|
-
led_obj[0] = next(DebugCfg.NEO_WHEEL)
|
|
120
|
-
led_obj.write()
|
|
121
|
-
return True # No double-blink
|
|
78
|
+
syslog(f"[PLED] step error: {e}")
|
|
79
|
+
return True
|
|
122
80
|
|
|
123
81
|
|
|
124
82
|
def console_write(msg):
|
|
@@ -129,112 +87,15 @@ def console_write(msg):
|
|
|
129
87
|
if analog is None:
|
|
130
88
|
DebugCfg.step() # Double-blink
|
|
131
89
|
except Exception as e:
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
#############################################
|
|
135
|
-
# LOGGING WITH DATA ROTATION #
|
|
136
|
-
#############################################
|
|
90
|
+
syslog(f"[ERR] console_write: {e}", console=False)
|
|
137
91
|
|
|
138
92
|
|
|
139
|
-
def
|
|
140
|
-
"""
|
|
141
|
-
Create generic logger function
|
|
142
|
-
- implements log line rotation
|
|
143
|
-
- automatic time stump
|
|
144
|
-
:param data: input string data to log
|
|
145
|
-
:param f_name: file name to use
|
|
146
|
-
:param limit: line limit for log rotation
|
|
147
|
-
return write verdict - true / false
|
|
148
|
-
INFO: hardcoded max data number = 30
|
|
149
|
-
"""
|
|
150
|
-
def _logger(_data, _f_name, _limit, f_mode='r+'):
|
|
151
|
-
_limit = 30 if _limit > 30 else _limit
|
|
152
|
-
# [1] GET TIME STUMP
|
|
153
|
-
ts_buff = [str(k) for k in localtime()]
|
|
154
|
-
ts = ".".join(ts_buff[0:3]) + "-" + ":".join(ts_buff[3:6])
|
|
155
|
-
# [2] OPEN FILE - WRITE DATA WITH TS
|
|
156
|
-
with open(_f_name, f_mode) as f:
|
|
157
|
-
_data = f"{ts} {_data}\n"
|
|
158
|
-
# read file lines and filter by time stump chunks (hack for replace truncate)
|
|
159
|
-
lines = [_l for _l in f.readlines() if '-' in _l and '.' in _l]
|
|
160
|
-
# get file params
|
|
161
|
-
lines_len = len(lines)
|
|
162
|
-
lines.append(_data)
|
|
163
|
-
f.seek(0)
|
|
164
|
-
# line data rotate
|
|
165
|
-
if lines_len >= _limit:
|
|
166
|
-
lines = lines[-_limit:]
|
|
167
|
-
lines_str = ''.join(lines)
|
|
168
|
-
else:
|
|
169
|
-
lines_str = ''.join(lines)
|
|
170
|
-
# write file
|
|
171
|
-
f.write(lines_str)
|
|
172
|
-
|
|
173
|
-
# Run logger
|
|
174
|
-
try:
|
|
175
|
-
# There is file - append 'r+'
|
|
176
|
-
_logger(data, f_name, limit)
|
|
177
|
-
except:
|
|
178
|
-
try:
|
|
179
|
-
# There is no file - create 'a+'
|
|
180
|
-
_logger(data, f_name, limit, 'a+')
|
|
181
|
-
except:
|
|
182
|
-
return False
|
|
183
|
-
return True
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
def log_get(f_name, msgobj=None):
|
|
187
|
-
"""
|
|
188
|
-
Get and stream (ver osocket/stdout) .log file's content and count "critical" errors
|
|
189
|
-
- critical error tag in log line: [ERR]
|
|
190
|
-
"""
|
|
191
|
-
err_cnt = 0
|
|
192
|
-
try:
|
|
193
|
-
with open(f_name, 'r') as f:
|
|
194
|
-
eline = f.readline().strip()
|
|
195
|
-
while eline:
|
|
196
|
-
# GET error from log line (tag: [ERR])
|
|
197
|
-
err_cnt += 1 if "[ERR]" in eline else 0
|
|
198
|
-
# GIVE BACK .log file contents
|
|
199
|
-
if msgobj is None:
|
|
200
|
-
console_write(eline)
|
|
201
|
-
else:
|
|
202
|
-
msgobj(eline)
|
|
203
|
-
eline = f.readline().strip()
|
|
204
|
-
except:
|
|
205
|
-
pass
|
|
206
|
-
return err_cnt
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
#############################################
|
|
210
|
-
# ERROR LOGGING #
|
|
211
|
-
#############################################
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
def errlog_add(data, console=True):
|
|
93
|
+
def syslog(data, console=True):
|
|
215
94
|
"""
|
|
216
95
|
:param data: msg string / data
|
|
217
96
|
:param console: activate console_write (default: True)
|
|
218
97
|
:return: is ok
|
|
219
98
|
"""
|
|
220
99
|
if console:
|
|
221
|
-
console_write(
|
|
222
|
-
return
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
def errlog_get(msgobj=None):
|
|
226
|
-
f_name = 'err.log'
|
|
227
|
-
errcnt = log_get(f_name, msgobj)
|
|
228
|
-
# Return error number
|
|
229
|
-
return errcnt
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
def errlog_clean(msgobj=None):
|
|
233
|
-
to_del = [file for file in os.listdir() if file.endswith('.log')]
|
|
234
|
-
for _del in to_del:
|
|
235
|
-
del_msg = f" Delete: {_del}"
|
|
236
|
-
if msgobj is None:
|
|
237
|
-
console_write(del_msg)
|
|
238
|
-
else:
|
|
239
|
-
msgobj(del_msg)
|
|
240
|
-
os.remove(_del)
|
|
100
|
+
console_write(data)
|
|
101
|
+
return False if logger_syslog is None else logger_syslog(data)
|