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.
Files changed (400) hide show
  1. env/driver_cp210x/.DS_Store +0 -0
  2. env/driver_cp210x/macOS_VCP_Driver/SiLabsUSBDriverDisk.dmg +0 -0
  3. env/driver_cp210x/macOS_VCP_Driver/macOS_VCP_Driver_Release_Notes.txt +17 -1
  4. micrOS/micropython/esp32-20251209-v1.27.0.bin +0 -0
  5. micrOS/micropython/esp32c3-20251209-v1.27.0.bin +0 -0
  6. micrOS/micropython/esp32c6-20251209-v1.27.0.bin +0 -0
  7. micrOS/micropython/esp32s2-20251209-v1.27.0.bin +0 -0
  8. micrOS/micropython/esp32s2-LOLIN_MINI-20251209-v1.27.0.bin +0 -0
  9. micrOS/micropython/esp32s3-4MBflash-20241129-v1.24.1.bin +0 -0
  10. micrOS/micropython/esp32s3-8MBflash-20251209-v1.27.0.bin +0 -0
  11. micrOS/micropython/esp32s3_spiram_oct-20251209-v1.27.0.bin +0 -0
  12. micrOS/micropython/rpi-pico-w-20251209-v1.27.0.uf2 +0 -0
  13. micrOS/micropython/tinypico-20251209-v1.27.0.bin +0 -0
  14. micrOS/release_info/micrOS_ReleaseInfo/system_analysis_sum.json +191 -151
  15. micrOS/source/Auth.py +37 -0
  16. micrOS/source/Common.py +376 -102
  17. micrOS/source/Config.py +55 -25
  18. micrOS/source/Debug.py +54 -193
  19. micrOS/source/Espnow.py +404 -0
  20. micrOS/source/Files.py +207 -0
  21. micrOS/source/Hooks.py +88 -16
  22. micrOS/source/InterConnect.py +130 -46
  23. micrOS/source/Interrupts.py +8 -8
  24. micrOS/source/Logger.py +131 -0
  25. micrOS/source/Network.py +41 -21
  26. micrOS/source/Notify.py +74 -198
  27. micrOS/source/Pacman.py +326 -0
  28. micrOS/source/Scheduler.py +18 -55
  29. micrOS/source/Server.py +84 -217
  30. micrOS/source/Shell.py +103 -93
  31. micrOS/source/Tasks.py +239 -173
  32. micrOS/source/Time.py +21 -22
  33. micrOS/source/Types.py +89 -54
  34. micrOS/source/Web.py +485 -0
  35. micrOS/source/__pycache__/Common.cpython-312.pyc +0 -0
  36. micrOS/source/__pycache__/Debug.cpython-312.pyc +0 -0
  37. micrOS/source/__pycache__/Files.cpython-312.pyc +0 -0
  38. micrOS/source/__pycache__/Logger.cpython-312.pyc +0 -0
  39. micrOS/source/__pycache__/Scheduler.cpython-312.pyc +0 -0
  40. micrOS/source/__pycache__/Server.cpython-312.pyc +0 -0
  41. micrOS/source/__pycache__/Shell.cpython-312.pyc +0 -0
  42. micrOS/source/__pycache__/replhelper.cpython-312.pyc +0 -0
  43. micrOS/source/helpers.py +132 -0
  44. micrOS/source/micrOS.py +25 -21
  45. micrOS/source/micrOSloader.py +14 -23
  46. micrOS/source/microIO.py +94 -57
  47. toolkit/simulator_lib/LP_darwin.py → micrOS/source/modules/IO_esp32.py +22 -11
  48. micrOS/source/{IO_esp32c3.py → modules/IO_esp32c3.py} +6 -1
  49. micrOS/source/modules/IO_esp32c6.py +38 -0
  50. micrOS/source/{IO_esp32s2.py → modules/IO_esp32s2.py} +6 -1
  51. micrOS/source/{IO_esp32s3.py → modules/IO_esp32s3.py} +43 -2
  52. micrOS/source/modules/IO_m5stamp.py +86 -0
  53. micrOS/source/{IO_qtpy.py → modules/IO_qtpy.py} +28 -18
  54. micrOS/source/{IO_tinypico.py → modules/IO_tinypico.py} +48 -3
  55. micrOS/source/modules/LM_L298N.py +161 -0
  56. {toolkit/workspace/precompiled → micrOS/source/modules}/LM_L9110_DCmotor.py +4 -4
  57. micrOS/source/{LM_OV2640.py → modules/LM_OV2640.py} +53 -42
  58. micrOS/source/{LM_VL53L0X.py → modules/LM_VL53L0X.py} +5 -5
  59. micrOS/source/{LM_aht10.py → modules/LM_aht10.py} +12 -4
  60. micrOS/source/{LM_bme280.py → modules/LM_bme280.py} +13 -25
  61. micrOS/source/{LM_buzzer.py → modules/LM_buzzer.py} +42 -40
  62. micrOS/source/{LM_cct.py → modules/LM_cct.py} +22 -27
  63. micrOS/source/modules/LM_cluster.py +255 -0
  64. micrOS/source/{LM_co2.py → modules/LM_co2.py} +13 -6
  65. micrOS/source/{LM_dht11.py → modules/LM_dht11.py} +13 -29
  66. micrOS/source/{LM_dht22.py → modules/LM_dht22.py} +13 -28
  67. micrOS/source/{LM_dimmer.py → modules/LM_dimmer.py} +19 -16
  68. micrOS/source/modules/LM_distance.py +135 -0
  69. micrOS/source/{LM_ds18.py → modules/LM_ds18.py} +12 -4
  70. micrOS/source/{LM_esp32.py → modules/LM_esp32.py} +16 -4
  71. micrOS/source/modules/LM_espnow.py +53 -0
  72. micrOS/source/modules/LM_fileserver.py +265 -0
  73. micrOS/source/{LM_gameOfLife.py → modules/LM_gameOfLife.py} +5 -5
  74. micrOS/source/{LM_genIO.py → modules/LM_genIO.py} +49 -35
  75. micrOS/source/modules/LM_haptic.py +111 -0
  76. micrOS/source/modules/LM_i2c.py +61 -0
  77. micrOS/source/{LM_i2s_mic.py → modules/LM_i2s_mic.py} +20 -23
  78. micrOS/source/{LM_ld2410.py → modules/LM_ld2410.py} +3 -3
  79. micrOS/source/{LM_light_sensor.py → modules/LM_light_sensor.py} +22 -26
  80. micrOS/source/modules/LM_mh_z19c.py +198 -0
  81. micrOS/source/modules/LM_neoeffects.py +284 -0
  82. micrOS/source/{LM_neopixel.py → modules/LM_neopixel.py} +26 -31
  83. micrOS/source/{LM_oled.py → modules/LM_oled.py} +28 -20
  84. micrOS/source/{LM_oled_sh1106.py → modules/LM_oled_sh1106.py} +28 -24
  85. micrOS/source/{LM_oled_ui.py → modules/LM_oled_ui.py} +132 -174
  86. micrOS/source/modules/LM_pacman.py +320 -0
  87. micrOS/source/{LM_presence.py → modules/LM_presence.py} +24 -36
  88. micrOS/source/modules/LM_qmi8658.py +204 -0
  89. micrOS/source/{LM_rencoder.py → modules/LM_rencoder.py} +40 -11
  90. micrOS/source/modules/LM_rest.py +81 -0
  91. micrOS/source/{LM_rgb.py → modules/LM_rgb.py} +25 -34
  92. micrOS/source/{LM_rgbcct.py → modules/LM_rgbcct.py} +5 -5
  93. micrOS/source/{LM_roboarm.py → modules/LM_roboarm.py} +37 -45
  94. micrOS/source/modules/LM_robustness.py +137 -0
  95. micrOS/source/{LM_rp2w.py → modules/LM_rp2w.py} +3 -0
  96. micrOS/source/{LM_sdcard.py → modules/LM_sdcard.py} +3 -0
  97. micrOS/source/{LM_servo.py → modules/LM_servo.py} +4 -4
  98. micrOS/source/modules/LM_sound_event.py +751 -0
  99. micrOS/source/{LM_stepper.py → modules/LM_stepper.py} +8 -8
  100. micrOS/source/{LM_switch.py → modules/LM_switch.py} +21 -18
  101. micrOS/source/{LM_system.py → modules/LM_system.py} +96 -59
  102. micrOS/source/modules/LM_tcs3472.py +187 -0
  103. micrOS/source/modules/LM_telegram.py +388 -0
  104. micrOS/source/modules/LM_trackball.py +287 -0
  105. micrOS/source/modules/LM_veml7700.py +159 -0
  106. micrOS/source/modules/LM_web.py +38 -0
  107. micrOS/source/urequests.py +204 -91
  108. {toolkit/workspace/precompiled → micrOS/source/web}/dashboard.html +9 -4
  109. micrOS/source/web/editor.js +440 -0
  110. micrOS/source/web/filesui.html +178 -0
  111. micrOS/source/web/filesui.js +338 -0
  112. micrOS/source/{index.html → web/index.html} +44 -2
  113. micrOS/source/web/uapi.js +103 -0
  114. micrOS/source/web/udashboard.js +129 -0
  115. micrOS/source/web/ustyle.css +55 -0
  116. micrOS/source/web/uwidgets.js +172 -0
  117. micrOS/source/web/uwidgets_pro.js +99 -0
  118. micrOS/utests/__init__.py +0 -0
  119. micrOS/utests/test_scheduler.py +435 -0
  120. {micrOSDevToolKit-2.1.5.data → microsdevtoolkit-2.26.1.data}/scripts/devToolKit.py +47 -4
  121. {micrOSDevToolKit-2.1.5.dist-info → microsdevtoolkit-2.26.1.dist-info}/METADATA +392 -279
  122. microsdevtoolkit-2.26.1.dist-info/RECORD +396 -0
  123. {micrOSDevToolKit-2.1.5.dist-info → microsdevtoolkit-2.26.1.dist-info}/WHEEL +1 -1
  124. toolkit/DevEnvCompile.py +63 -33
  125. toolkit/DevEnvOTA.py +72 -22
  126. toolkit/DevEnvUSB.py +147 -77
  127. toolkit/Gateway.py +9 -9
  128. toolkit/LM_to_compile.dat +12 -4
  129. toolkit/MicrOSDevEnv.py +129 -51
  130. toolkit/WebRepl.py +73 -0
  131. toolkit/dashboard_apps/BackupRestore.py +171 -0
  132. toolkit/dashboard_apps/CCTDemo.py +12 -17
  133. toolkit/dashboard_apps/CCTTest.py +20 -24
  134. toolkit/dashboard_apps/CamStream.py +2 -6
  135. toolkit/dashboard_apps/CatGame.py +14 -16
  136. toolkit/dashboard_apps/Dimmer.py +11 -21
  137. toolkit/dashboard_apps/GetVersion.py +11 -19
  138. toolkit/dashboard_apps/MicrophoneTest.py +2 -7
  139. toolkit/dashboard_apps/NeoEffectsDemo.py +22 -35
  140. toolkit/dashboard_apps/NeopixelTest.py +20 -25
  141. toolkit/dashboard_apps/PresenceTest.py +2 -8
  142. toolkit/dashboard_apps/QMI8685_GYRO.py +68 -0
  143. toolkit/dashboard_apps/RGBTest.py +20 -24
  144. toolkit/dashboard_apps/RoboArm.py +24 -32
  145. toolkit/dashboard_apps/SED_test.py +10 -14
  146. toolkit/dashboard_apps/SensorsTest.py +61 -0
  147. toolkit/dashboard_apps/SystemTest.py +219 -117
  148. toolkit/dashboard_apps/Template_app.py +12 -19
  149. toolkit/dashboard_apps/_app_base.py +34 -0
  150. toolkit/dashboard_apps/_gyro_visualizer.py +78 -0
  151. toolkit/dashboard_apps/uLightDemo.py +15 -24
  152. toolkit/index.html +6 -5
  153. toolkit/lib/LocalMachine.py +6 -1
  154. toolkit/lib/MicrosFiles.py +46 -0
  155. toolkit/lib/Repository.py +64 -0
  156. toolkit/lib/TerminalColors.py +4 -0
  157. toolkit/lib/macroScript.py +371 -0
  158. toolkit/lib/micrOSClient.py +124 -51
  159. toolkit/lib/micrOSClientHistory.py +156 -0
  160. toolkit/lib/pip_package_installer.py +31 -4
  161. toolkit/micrOSdashboard.py +16 -21
  162. toolkit/micrOSlint.py +28 -10
  163. toolkit/simulator_lib/.DS_Store +0 -0
  164. micrOS/source/IO_esp32.py → toolkit/simulator_lib/IO_darwin.py +3 -0
  165. toolkit/simulator_lib/__pycache__/IO_darwin.cpython-312.pyc +0 -0
  166. toolkit/simulator_lib/__pycache__/aioespnow.cpython-312.pyc +0 -0
  167. toolkit/simulator_lib/__pycache__/camera.cpython-312.pyc +0 -0
  168. toolkit/simulator_lib/__pycache__/framebuf.cpython-312.pyc +0 -0
  169. toolkit/simulator_lib/__pycache__/machine.cpython-312.pyc +0 -0
  170. toolkit/simulator_lib/__pycache__/micropython.cpython-312.pyc +0 -0
  171. toolkit/simulator_lib/__pycache__/mip.cpython-312.pyc +0 -0
  172. toolkit/simulator_lib/__pycache__/neopixel.cpython-312.pyc +0 -0
  173. toolkit/simulator_lib/__pycache__/network.cpython-312.pyc +0 -0
  174. toolkit/simulator_lib/__pycache__/sim_common.cpython-312.pyc +0 -0
  175. toolkit/simulator_lib/__pycache__/simgc.cpython-312.pyc +0 -0
  176. toolkit/simulator_lib/__pycache__/simulator.cpython-312.pyc +0 -0
  177. toolkit/simulator_lib/__pycache__/uasyncio.cpython-312.pyc +0 -0
  178. toolkit/simulator_lib/__pycache__/uos.cpython-312.pyc +0 -0
  179. toolkit/simulator_lib/__pycache__/urandom.cpython-312.pyc +0 -0
  180. toolkit/simulator_lib/__pycache__/usocket.cpython-312.pyc +0 -0
  181. toolkit/simulator_lib/__pycache__/ussl.cpython-312.pyc +0 -0
  182. toolkit/simulator_lib/aioespnow.py +28 -0
  183. toolkit/simulator_lib/camera.py +84 -0
  184. toolkit/simulator_lib/dht.py +1 -1
  185. toolkit/simulator_lib/framebuf.py +49 -1
  186. toolkit/simulator_lib/machine.py +32 -2
  187. toolkit/simulator_lib/micropython.py +3 -3
  188. toolkit/simulator_lib/mip.py +165 -0
  189. toolkit/simulator_lib/neopixel.py +3 -2
  190. toolkit/simulator_lib/network.py +2 -1
  191. toolkit/simulator_lib/node_config.json +2 -3
  192. toolkit/simulator_lib/ntptime.py +1 -1
  193. toolkit/simulator_lib/{sim_console.py → sim_common.py} +2 -3
  194. toolkit/simulator_lib/simgc.py +6 -2
  195. toolkit/simulator_lib/simulator.py +138 -46
  196. toolkit/simulator_lib/uasyncio.py +34 -3
  197. toolkit/simulator_lib/uos.py +147 -0
  198. toolkit/simulator_lib/urandom.py +4 -0
  199. toolkit/simulator_lib/usocket.py +5 -1
  200. toolkit/simulator_lib/view01.jpg +0 -0
  201. toolkit/simulator_lib/view02.jpg +0 -0
  202. toolkit/socketClient.py +43 -23
  203. toolkit/user_data/webhooks/generic.py +1 -1
  204. toolkit/user_data/webhooks/macro.py +44 -0
  205. toolkit/user_data/webhooks/template.macro +20 -0
  206. toolkit/user_data/webhooks/template.py +1 -1
  207. toolkit/workspace/precompiled/Auth.mpy +0 -0
  208. toolkit/workspace/precompiled/Common.mpy +0 -0
  209. toolkit/workspace/precompiled/Config.mpy +0 -0
  210. toolkit/workspace/precompiled/Debug.mpy +0 -0
  211. toolkit/workspace/precompiled/Espnow.mpy +0 -0
  212. toolkit/workspace/precompiled/Files.mpy +0 -0
  213. toolkit/workspace/precompiled/Hooks.mpy +0 -0
  214. toolkit/workspace/precompiled/InterConnect.mpy +0 -0
  215. toolkit/workspace/precompiled/Interrupts.mpy +0 -0
  216. toolkit/workspace/precompiled/Logger.mpy +0 -0
  217. toolkit/workspace/precompiled/Network.mpy +0 -0
  218. toolkit/workspace/precompiled/Notify.mpy +0 -0
  219. toolkit/workspace/precompiled/Pacman.mpy +0 -0
  220. toolkit/workspace/precompiled/Scheduler.mpy +0 -0
  221. toolkit/workspace/precompiled/Server.mpy +0 -0
  222. toolkit/workspace/precompiled/Shell.mpy +0 -0
  223. toolkit/workspace/precompiled/Tasks.mpy +0 -0
  224. toolkit/workspace/precompiled/Time.mpy +0 -0
  225. toolkit/workspace/precompiled/Types.mpy +0 -0
  226. toolkit/workspace/precompiled/Web.mpy +0 -0
  227. toolkit/workspace/precompiled/_mpy.version +1 -1
  228. toolkit/workspace/precompiled/config/_git.keep +0 -0
  229. toolkit/workspace/precompiled/helpers.mpy +0 -0
  230. toolkit/workspace/precompiled/micrOS.mpy +0 -0
  231. toolkit/workspace/precompiled/micrOSloader.mpy +0 -0
  232. toolkit/workspace/precompiled/microIO.mpy +0 -0
  233. toolkit/workspace/precompiled/modules/IO_esp32.mpy +0 -0
  234. toolkit/workspace/precompiled/modules/IO_esp32c3.mpy +0 -0
  235. toolkit/workspace/precompiled/modules/IO_esp32c6.mpy +0 -0
  236. toolkit/workspace/precompiled/modules/IO_esp32s2.mpy +0 -0
  237. toolkit/workspace/precompiled/modules/IO_esp32s3.mpy +0 -0
  238. toolkit/workspace/precompiled/modules/IO_m5stamp.mpy +0 -0
  239. toolkit/workspace/precompiled/modules/IO_qtpy.mpy +0 -0
  240. toolkit/workspace/precompiled/modules/IO_rp2.mpy +0 -0
  241. toolkit/workspace/precompiled/modules/IO_tinypico.mpy +0 -0
  242. toolkit/workspace/precompiled/modules/LM_L298N.mpy +0 -0
  243. {micrOS/source → toolkit/workspace/precompiled/modules}/LM_L9110_DCmotor.py +4 -4
  244. toolkit/workspace/precompiled/modules/LM_OV2640.mpy +0 -0
  245. toolkit/workspace/precompiled/{LM_VL53L0X.py → modules/LM_VL53L0X.py} +5 -5
  246. toolkit/workspace/precompiled/modules/LM_aht10.mpy +0 -0
  247. toolkit/workspace/precompiled/modules/LM_bme280.mpy +0 -0
  248. toolkit/workspace/precompiled/{LM_buzzer.mpy → modules/LM_buzzer.mpy} +0 -0
  249. toolkit/workspace/precompiled/modules/LM_cct.mpy +0 -0
  250. toolkit/workspace/precompiled/modules/LM_cluster.mpy +0 -0
  251. toolkit/workspace/precompiled/modules/LM_co2.mpy +0 -0
  252. toolkit/workspace/precompiled/modules/LM_dht11.mpy +0 -0
  253. toolkit/workspace/precompiled/modules/LM_dht22.mpy +0 -0
  254. toolkit/workspace/precompiled/modules/LM_dimmer.mpy +0 -0
  255. toolkit/workspace/precompiled/modules/LM_distance.mpy +0 -0
  256. toolkit/workspace/precompiled/modules/LM_ds18.mpy +0 -0
  257. toolkit/workspace/precompiled/{LM_esp32.py → modules/LM_esp32.py} +16 -4
  258. toolkit/workspace/precompiled/modules/LM_espnow.py +53 -0
  259. toolkit/workspace/precompiled/modules/LM_fileserver.mpy +0 -0
  260. toolkit/workspace/precompiled/{LM_gameOfLife.mpy → modules/LM_gameOfLife.mpy} +0 -0
  261. toolkit/workspace/precompiled/modules/LM_genIO.mpy +0 -0
  262. toolkit/workspace/precompiled/modules/LM_haptic.mpy +0 -0
  263. toolkit/workspace/precompiled/modules/LM_i2c.py +61 -0
  264. toolkit/workspace/precompiled/modules/LM_i2s_mic.mpy +0 -0
  265. toolkit/workspace/precompiled/{LM_ld2410.mpy → modules/LM_ld2410.mpy} +0 -0
  266. toolkit/workspace/precompiled/modules/LM_light_sensor.mpy +0 -0
  267. toolkit/workspace/precompiled/modules/LM_mh_z19c.py +198 -0
  268. toolkit/workspace/precompiled/modules/LM_neoeffects.mpy +0 -0
  269. toolkit/workspace/precompiled/modules/LM_neopixel.mpy +0 -0
  270. toolkit/workspace/precompiled/modules/LM_oled.mpy +0 -0
  271. toolkit/workspace/precompiled/modules/LM_oled_sh1106.mpy +0 -0
  272. toolkit/workspace/precompiled/modules/LM_oled_ui.mpy +0 -0
  273. toolkit/workspace/precompiled/modules/LM_pacman.mpy +0 -0
  274. toolkit/workspace/precompiled/modules/LM_presence.mpy +0 -0
  275. toolkit/workspace/precompiled/modules/LM_qmi8658.py +204 -0
  276. toolkit/workspace/precompiled/{LM_rencoder.py → modules/LM_rencoder.py} +40 -11
  277. toolkit/workspace/precompiled/modules/LM_rest.mpy +0 -0
  278. toolkit/workspace/precompiled/modules/LM_rgb.mpy +0 -0
  279. toolkit/workspace/precompiled/{LM_rgbcct.mpy → modules/LM_rgbcct.mpy} +0 -0
  280. toolkit/workspace/precompiled/modules/LM_roboarm.mpy +0 -0
  281. toolkit/workspace/precompiled/modules/LM_robustness.py +137 -0
  282. toolkit/workspace/precompiled/{LM_rp2w.py → modules/LM_rp2w.py} +3 -0
  283. toolkit/workspace/precompiled/{LM_sdcard.py → modules/LM_sdcard.py} +3 -0
  284. toolkit/workspace/precompiled/{LM_servo.mpy → modules/LM_servo.mpy} +0 -0
  285. toolkit/workspace/precompiled/modules/LM_sound_event.mpy +0 -0
  286. toolkit/workspace/precompiled/{LM_stepper.mpy → modules/LM_stepper.mpy} +0 -0
  287. toolkit/workspace/precompiled/modules/LM_switch.mpy +0 -0
  288. toolkit/workspace/precompiled/modules/LM_system.mpy +0 -0
  289. toolkit/workspace/precompiled/modules/LM_tcs3472.py +187 -0
  290. toolkit/workspace/precompiled/modules/LM_telegram.mpy +0 -0
  291. toolkit/workspace/precompiled/{LM_tinyrgb.mpy → modules/LM_tinyrgb.mpy} +0 -0
  292. toolkit/workspace/precompiled/modules/LM_trackball.mpy +0 -0
  293. toolkit/workspace/precompiled/modules/LM_veml7700.mpy +0 -0
  294. toolkit/workspace/precompiled/modules/LM_web.mpy +0 -0
  295. toolkit/workspace/precompiled/urequests.mpy +0 -0
  296. {micrOS/source → toolkit/workspace/precompiled/web}/dashboard.html +9 -4
  297. toolkit/workspace/precompiled/web/editor.js +440 -0
  298. toolkit/workspace/precompiled/web/filesui.html +178 -0
  299. toolkit/workspace/precompiled/web/filesui.js +338 -0
  300. toolkit/workspace/precompiled/{index.html → web/index.html} +44 -2
  301. toolkit/workspace/precompiled/web/uapi.js +103 -0
  302. toolkit/workspace/precompiled/web/udashboard.js +129 -0
  303. toolkit/workspace/precompiled/web/ustyle.css +55 -0
  304. toolkit/workspace/precompiled/web/uwidgets.js +172 -0
  305. toolkit/workspace/precompiled/web/uwidgets_pro.js +99 -0
  306. env/driver_cp210x/CH34XSER_MAC/CH34X_DRV_INSTALL_INSTRUCTIONS.pdf +0 -0
  307. env/driver_cp210x/CH34XSER_MAC/CH34xVCPDriver.pkg +0 -0
  308. micrOS/micropython/esp32-20231005-v1.21.0.bin +0 -0
  309. micrOS/micropython/esp32c3-GENERIC-20240105-v1.22.1.bin +0 -0
  310. micrOS/micropython/esp32c3-GENERIC-20240222-v1.22.2.bin +0 -0
  311. micrOS/micropython/esp32s2-GENERIC-20240105-v1.22.1.bin +0 -0
  312. micrOS/micropython/esp32s2-LOLIN_MINI-20220618-v1.19.1.bin +0 -0
  313. micrOS/micropython/esp32s3-GENERIC-20240105-v1.22.1.bin +0 -0
  314. micrOS/micropython/esp32s3_spiram_oct-20231005-v1.21.0.bin +0 -0
  315. micrOS/micropython/rpi-pico-w-20231005-v1.21.0.uf2 +0 -0
  316. micrOS/micropython/tinypico-20231005-v1.21.0.bin +0 -0
  317. micrOS/micropython/tinypico-usbc-UM-20240105-v1.22.1.bin +0 -0
  318. micrOS/source/LM_L298N_DCmotor.py +0 -86
  319. micrOS/source/LM_catgame.py +0 -74
  320. micrOS/source/LM_dashboard_be.py +0 -37
  321. micrOS/source/LM_demo.py +0 -85
  322. micrOS/source/LM_distance.py +0 -88
  323. micrOS/source/LM_i2c.py +0 -44
  324. micrOS/source/LM_intercon.py +0 -57
  325. micrOS/source/LM_keychain.py +0 -318
  326. micrOS/source/LM_lmpacman.py +0 -126
  327. micrOS/source/LM_neoeffects.py +0 -327
  328. micrOS/source/LM_pet_feeder.py +0 -76
  329. micrOS/source/LM_ph_sensor.py +0 -51
  330. micrOS/source/LM_rest.py +0 -40
  331. micrOS/source/LM_robustness.py +0 -73
  332. micrOS/source/LM_telegram.py +0 -96
  333. micrOS/source/reset.py +0 -11
  334. micrOS/source/uapi.js +0 -76
  335. micrOS/source/udashboard.js +0 -137
  336. micrOS/source/ustyle.css +0 -28
  337. micrOS/source/uwidgets.js +0 -179
  338. micrOSDevToolKit-2.1.5.dist-info/RECORD +0 -337
  339. toolkit/dashboard_apps/AirQualityBME280.py +0 -36
  340. toolkit/dashboard_apps/AirQualityDHT22_CO2.py +0 -36
  341. toolkit/lib/file_extensions.py +0 -16
  342. toolkit/simulator_lib/__pycache__/LP_darwin.cpython-312.pyc +0 -0
  343. toolkit/simulator_lib/__pycache__/LP_darwin.cpython-38.pyc +0 -0
  344. toolkit/simulator_lib/__pycache__/LP_darwin.cpython-39.pyc +0 -0
  345. toolkit/simulator_lib/__pycache__/sim_console.cpython-312.pyc +0 -0
  346. toolkit/simulator_lib/__pycache__/sim_console.cpython-38.pyc +0 -0
  347. toolkit/simulator_lib/__pycache__/sim_console.cpython-39.pyc +0 -0
  348. toolkit/workspace/precompiled/IO_esp32.mpy +0 -0
  349. toolkit/workspace/precompiled/IO_esp32c3.mpy +0 -0
  350. toolkit/workspace/precompiled/IO_esp32s2.mpy +0 -0
  351. toolkit/workspace/precompiled/IO_esp32s3.mpy +0 -0
  352. toolkit/workspace/precompiled/IO_qtpy.mpy +0 -0
  353. toolkit/workspace/precompiled/IO_rp2.mpy +0 -0
  354. toolkit/workspace/precompiled/IO_tinypico.mpy +0 -0
  355. toolkit/workspace/precompiled/LM_L298N_DCmotor.mpy +0 -0
  356. toolkit/workspace/precompiled/LM_OV2640.mpy +0 -0
  357. toolkit/workspace/precompiled/LM_aht10.mpy +0 -0
  358. toolkit/workspace/precompiled/LM_bme280.mpy +0 -0
  359. toolkit/workspace/precompiled/LM_catgame.py +0 -74
  360. toolkit/workspace/precompiled/LM_cct.mpy +0 -0
  361. toolkit/workspace/precompiled/LM_co2.mpy +0 -0
  362. toolkit/workspace/precompiled/LM_dashboard_be.py +0 -37
  363. toolkit/workspace/precompiled/LM_demo.py +0 -85
  364. toolkit/workspace/precompiled/LM_dht11.mpy +0 -0
  365. toolkit/workspace/precompiled/LM_dht22.mpy +0 -0
  366. toolkit/workspace/precompiled/LM_dimmer.mpy +0 -0
  367. toolkit/workspace/precompiled/LM_distance.py +0 -88
  368. toolkit/workspace/precompiled/LM_ds18.mpy +0 -0
  369. toolkit/workspace/precompiled/LM_genIO.mpy +0 -0
  370. toolkit/workspace/precompiled/LM_i2c.py +0 -44
  371. toolkit/workspace/precompiled/LM_i2s_mic.mpy +0 -0
  372. toolkit/workspace/precompiled/LM_intercon.mpy +0 -0
  373. toolkit/workspace/precompiled/LM_keychain.mpy +0 -0
  374. toolkit/workspace/precompiled/LM_light_sensor.mpy +0 -0
  375. toolkit/workspace/precompiled/LM_lmpacman.mpy +0 -0
  376. toolkit/workspace/precompiled/LM_neoeffects.mpy +0 -0
  377. toolkit/workspace/precompiled/LM_neopixel.mpy +0 -0
  378. toolkit/workspace/precompiled/LM_oled.mpy +0 -0
  379. toolkit/workspace/precompiled/LM_oled_sh1106.mpy +0 -0
  380. toolkit/workspace/precompiled/LM_oled_ui.mpy +0 -0
  381. toolkit/workspace/precompiled/LM_pet_feeder.py +0 -76
  382. toolkit/workspace/precompiled/LM_ph_sensor.py +0 -51
  383. toolkit/workspace/precompiled/LM_presence.mpy +0 -0
  384. toolkit/workspace/precompiled/LM_rest.mpy +0 -0
  385. toolkit/workspace/precompiled/LM_rgb.mpy +0 -0
  386. toolkit/workspace/precompiled/LM_roboarm.mpy +0 -0
  387. toolkit/workspace/precompiled/LM_robustness.py +0 -73
  388. toolkit/workspace/precompiled/LM_switch.mpy +0 -0
  389. toolkit/workspace/precompiled/LM_system.mpy +0 -0
  390. toolkit/workspace/precompiled/LM_telegram.mpy +0 -0
  391. toolkit/workspace/precompiled/reset.mpy +0 -0
  392. toolkit/workspace/precompiled/uapi.js +0 -76
  393. toolkit/workspace/precompiled/udashboard.js +0 -137
  394. toolkit/workspace/precompiled/ustyle.css +0 -28
  395. toolkit/workspace/precompiled/uwidgets.js +0 -179
  396. /toolkit/user_data/node_config_archive/.include → /micrOS/source/config/_git.keep +0 -0
  397. /micrOS/source/{IO_rp2.py → modules/IO_rp2.py} +0 -0
  398. /micrOS/source/{LM_tinyrgb.py → modules/LM_tinyrgb.py} +0 -0
  399. {micrOSDevToolKit-2.1.5.dist-info → microsdevtoolkit-2.26.1.dist-info/licenses}/LICENSE +0 -0
  400. {micrOSDevToolKit-2.1.5.dist-info → microsdevtoolkit-2.26.1.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,198 @@
1
+ """
2
+ MH-Z19 Co2 sensor driver for MicroPython (supports MH-Z19B and MH-Z19C)
3
+
4
+ Provides a simple interface to read:
5
+ - Co2 concentration (PPM)
6
+ - Temperature
7
+ - Status
8
+
9
+ Calibration (MH-Z19C)
10
+ ---------------------
11
+ There are two ways to calibrate the zero point on MH-Z19C:
12
+
13
+ 1) Apply a low-level signal for more than 7 seconds.
14
+
15
+ 2) Send the calibration command:
16
+ FF 01 87 00 00 00 00 00 78
17
+ On success the sensor returns:
18
+ FF 87 01 00 00 00 00 00 78
19
+
20
+ Auto-calibration (ABC) period
21
+ -----------------------------
22
+ Set 7-day automatic calibration period:
23
+ Command: FF 01 AF 01 07 00 00 00 48
24
+ Confirmation: FF AF 01 07 00 00 00 00 49
25
+
26
+ Set 1-day automatic calibration period:
27
+ Command: FF 01 AF 01 01 00 00 00 4E
28
+ Confirmation: FF AF 01 01 00 00 00 00 4F
29
+
30
+ Notes
31
+ -----
32
+ - Use a well-ventilated environment (around 400 ppm) for command-based zero calibration
33
+
34
+ :author: Florian Mandl
35
+ :version: 1.0
36
+ :date: 2025-12-06
37
+ """
38
+
39
+ import time
40
+ import json
41
+ from machine import Pin, UART
42
+ from microIO import bind_pin, pinmap_search
43
+ from Common import micro_task, manage_task, console, notify
44
+ from Types import resolve
45
+
46
+
47
+ class MHZ19:
48
+ INSTANCE = None
49
+
50
+ SENSOR_TASK = 'mh_z19c.sensor'
51
+ CALIBRATE_TASK = 'mh_z19c.calibrate'
52
+
53
+ def __init__(self):
54
+ self.uart_no = 1
55
+ self.ppm = 0
56
+ self.temp = 0
57
+ self.co2status = 0
58
+ self.tx_pin = Pin(bind_pin('mh_z19c_tx',16))
59
+ self.rx_pin = Pin(bind_pin('mh_z19c_rx',17))
60
+ self.hd_pin = Pin(bind_pin('mh_z19c_hd',19), Pin.OUT, Pin.PULL_UP)
61
+ self.start()
62
+
63
+ def start(self):
64
+ self.uart = UART(self.uart_no, baudrate=9600, tx=self.tx_pin, rx=self.rx_pin)
65
+ self.uart.init(9600, bits=8, parity=None, stop=1, timeout=10)
66
+
67
+ def stop(self):
68
+ while self.uart.any():
69
+ self.uart.read()
70
+ self.uart.deinit()
71
+
72
+ def get_data(self):
73
+ # Clear buffer
74
+ while self.uart.any():
75
+ self.uart.read()
76
+
77
+ self.uart.write(b"\xff\x01\x86\x00\x00\x00\x00\x00\x79")
78
+ time.sleep(0.1)
79
+ s = self.uart.read(9)
80
+ if not s or len(s) < 9:
81
+ return False
82
+ if self._crc8(s) != s[8]:
83
+ self.stop()
84
+ time.sleep(0.1)
85
+ self.start()
86
+ return False
87
+ self.ppm = s[2] * 256 + s[3]
88
+ self.temp = s[4] - 40
89
+ self.co2status = s[5]
90
+ return True
91
+
92
+ async def calibrate(self):
93
+ with micro_task(tag=self.CALIBRATE_TASK) as my_task:
94
+ try:
95
+ self.stop()
96
+ self.hd_pin.value(0)
97
+ await my_task.feed(sleep_ms=8000)
98
+ self.hd_pin.value(1)
99
+ self.start()
100
+ console("Calibration finished")
101
+ except Exception as e:
102
+ console(f"Calibration error: {e}")
103
+
104
+ @staticmethod
105
+ def _crc8(a):
106
+ crc = sum(bytearray(a)[1:8]) % 256
107
+ crc = (~crc & 0xFF) + 1
108
+ return crc
109
+
110
+ #########################
111
+ # Application functions #
112
+ #########################
113
+
114
+ def load():
115
+ """
116
+ Create MH-Z19 CO2 sensor (over UART)
117
+ """
118
+
119
+ if MHZ19.INSTANCE is None:
120
+ MHZ19.INSTANCE = MHZ19()
121
+ return MHZ19.INSTANCE
122
+
123
+
124
+ def measure():
125
+ """
126
+ Measure with MH-Z19 CO2 sensor
127
+ """
128
+ mhz19 = load()
129
+ mhz19.get_data()
130
+ return {"ppm": mhz19.ppm,
131
+ "temp": mhz19.temp,
132
+ "status": mhz19.co2status}
133
+
134
+
135
+ def calibrate():
136
+ """
137
+ Calibrate MH-Z19 sensor
138
+ """
139
+ mhz19 = load()
140
+ return micro_task(tag=MHZ19.CALIBRATE_TASK, task=mhz19.calibrate())
141
+
142
+
143
+ async def _run_sensor_loop(interval, topic, channels):
144
+ channels = [] if channels is None else channels
145
+ with micro_task(tag=MHZ19.SENSOR_TASK) as my_task:
146
+ while True:
147
+ my_task.out = "Start measurement"
148
+ out = notify(json.dumps(measure()), topic=topic, channels=channels)
149
+ my_task.out = f"Measurement published: {out}, wait {interval}ms"
150
+ await my_task.feed(sleep_ms=interval)
151
+
152
+
153
+ def start(interval:int=5000, topic:str="MH_Z19C", channels:list=None):
154
+ """
155
+ Start sensor measurement loop and publish results over micros notify feature
156
+ :param interval: update interval in milliseconds
157
+ :param topic: for MQTT channel, default: MH_Z19C
158
+ :param channels: selected notification channels, ex.: ["MQTT"], default: None (all)
159
+ """
160
+ load()
161
+ return micro_task(tag=MHZ19.SENSOR_TASK, task=_run_sensor_loop(interval, topic, channels))
162
+
163
+
164
+ def stop():
165
+ """
166
+ Stop sensor measurement loop and publish, delete MHZ19.INSTANCE
167
+ """
168
+ mhz19 = load()
169
+ manage_task(MHZ19.SENSOR_TASK, "kill")
170
+ if mhz19:
171
+ mhz19.stop()
172
+ MHZ19.INSTANCE = None
173
+ return f"{MHZ19.SENSOR_TASK}: Stopped"
174
+
175
+ #######################
176
+ # LM helper functions #
177
+ #######################
178
+
179
+ def pinmap():
180
+ """
181
+ [i] micrOS LM naming convention
182
+ Shows logical pins - pin number(s) used by this Load module
183
+ - info which pins to use for this application
184
+ :return dict: pin name (str) - pin value (int) pairs
185
+ """
186
+ return pinmap_search(['mh_z19c_tx', 'mh_z19c_rx', 'mh_z19c_hd'])
187
+
188
+
189
+ def help(widgets=False):
190
+ """
191
+ [i] micrOS LM naming convention - built-in help message
192
+ :return tuple:
193
+ (widgets=False) list of functions implemented by this application
194
+ (widgets=True) list of widget json for UI generation
195
+ """
196
+ return resolve(('load',
197
+ 'BUTTON start interval=5000',
198
+ 'BUTTON stop', 'TEXTBOX measure', 'calibrate', 'pinmap'), widgets=widgets)
@@ -0,0 +1,284 @@
1
+ from LM_neopixel import load as neoload, segment, Data, status, pinmap as pm
2
+ from random import randint
3
+ from Types import resolve
4
+ from Common import manage_task, AnimationPlayer
5
+
6
+
7
+ #################################
8
+ # NEOPIXEL EFFECT DRAWER CLASS #
9
+ #################################
10
+
11
+ class DrawEffectV2(AnimationPlayer):
12
+ INSTANCE = None
13
+
14
+ def __init__(self, pix_cnt=24):
15
+ super().__init__(tag="neoeffects")
16
+ neoload(ledcnt=pix_cnt)
17
+ DrawEffectV2.INSTANCE = self
18
+
19
+ @staticmethod
20
+ def normalize_index(value) -> int:
21
+ return value % Data.NEOPIXEL_OBJ.n
22
+
23
+ @staticmethod
24
+ def color_code(r:int=None, g:int=None, b:int=None) -> tuple[float, float, float]:
25
+ _r, _g, _b, _ = Data.DCACHE
26
+ r = _r if r is None else r
27
+ g = _g if g is None else g
28
+ b = _b if b is None else b
29
+ return r, g, b
30
+
31
+ def update(self, index:int, r:int|float, g:int|float, b:int|float):
32
+ # Animation player will call this method to update pixels.
33
+ segment(r=int(r), g=int(g), b=int(b), s=index, cache=False, write=False)
34
+
35
+ def draw(self):
36
+ # Animation player will call this method to update pixels.
37
+ Data.NEOPIXEL_OBJ.write()
38
+
39
+ def clear(self):
40
+ # Animation player will call this method to update pixels.
41
+ for i in range(0, Data.NEOPIXEL_OBJ.n):
42
+ self.update(i, 0, 0, 0)
43
+ self.draw()
44
+
45
+ ##################################################################################
46
+ # EFFECTS #
47
+ ##################################################################################
48
+
49
+ def meteor(speed_ms:int=60, shift:bool=True, batch:bool=True):
50
+ """
51
+ Meteor effect
52
+ :param speed_ms: animation speed in milliseconds
53
+ :param shift: automatic effect rotation
54
+ :param batch: batch mode
55
+ :return str: verdict
56
+ """
57
+ def effect_meteor():
58
+ """
59
+ Describe one full length color map
60
+ :return: yield tuple with r,g,b
61
+ """
62
+ nonlocal shift, pix_cnt
63
+ max_offset = pix_cnt if shift else 1
64
+ for offset in range(0, max_offset):
65
+ r, g, b = DrawEffectV2.color_code()
66
+ for pixel in range(0, pix_cnt):
67
+ br, norm = 0.6, pixel/pix_cnt
68
+ fade = br * norm ** 0.9 # exponent < 1 simulates log-like curve
69
+ yield DrawEffectV2.normalize_index(pixel+offset), r*fade, g*fade, b*fade
70
+
71
+ neoeffect = load()
72
+ pix_cnt = Data.NEOPIXEL_OBJ.n
73
+ return neoeffect.play(effect_meteor, speed_ms=speed_ms, bt_draw=batch, bt_size=pix_cnt)
74
+
75
+
76
+ def cycle(speed_ms:int=60, shift:bool=True, batch:bool=True):
77
+ """
78
+ Cycle effect
79
+ :param speed_ms: animation speed in milliseconds
80
+ :param shift: automatic effect rotation
81
+ :param batch: enable/disable batch update mode
82
+ """
83
+ def effect_cycle():
84
+ """
85
+ Describe one full length color map
86
+ :return: yield tuple with index, r,g,b
87
+ """
88
+ nonlocal shift
89
+ max_offset = Data.NEOPIXEL_OBJ.n if shift else 1
90
+ for offset in range(0, max_offset):
91
+ r, g, b = DrawEffectV2.color_code()
92
+ lr, lg, lb = int(r * 0.1), int(g * 0.1), int(b * 0.1)
93
+ # Clean last pixel
94
+ yield DrawEffectV2.normalize_index(offset-1), 0, 0, 0
95
+ # Draw pattern
96
+ yield DrawEffectV2.normalize_index(offset), lr, lg, lb
97
+ yield DrawEffectV2.normalize_index(offset + 1), r, g, b
98
+ yield DrawEffectV2.normalize_index(offset + 2), lr, lg, lb
99
+
100
+ return load().play(effect_cycle, speed_ms=speed_ms, bt_draw=batch, bt_size=4)
101
+
102
+
103
+ def rainbow(speed_ms=50, br=15, batch=True):
104
+ """
105
+ Rainbow effect animation
106
+ :param speed_ms: animation speed in milliseconds
107
+ :param br: Brightness of the pixels (0-100)
108
+ :param batch: Batch drawing of pixels (True/False)
109
+ """
110
+ def _wheel(pos):
111
+ # Input a value 0 to 255 to get a color value.
112
+ # The colours are a transition r - g - b - back to r.
113
+ if pos < 0 or pos > 255:
114
+ return 0, 0, 0
115
+ if pos < 85:
116
+ return 255 - pos * 3, pos * 3, 0
117
+ if pos < 170:
118
+ pos -= 85
119
+ return 0, 255 - pos * 3, pos * 3
120
+ pos -= 170
121
+ return pos * 3, 0, 255 - pos * 3
122
+
123
+ def effect_rainbow():
124
+ """
125
+ :param cnt: led segment count
126
+ :param br: max brightness 0-100%
127
+ :param step: step size
128
+ """
129
+ nonlocal pix_cnt, br
130
+ for color_wheel in range(0, 255):
131
+ for index in range(0, pix_cnt):
132
+ rc_index = (index * 256 // pix_cnt) + color_wheel
133
+ r, g, b = _wheel(rc_index & 255)
134
+ yield DrawEffectV2.normalize_index(index+color_wheel), round(r*br*0.01), round(g*br*0.01), round(b*br*0.01)
135
+
136
+ neoeffect = load()
137
+ pix_cnt = Data.NEOPIXEL_OBJ.n
138
+ return neoeffect.play(effect_rainbow, speed_ms=speed_ms, bt_draw=batch, bt_size=pix_cnt)
139
+
140
+
141
+ def fire(speed_ms:int=150, br:int=30, batch:bool=True):
142
+ """
143
+ Fire effect
144
+ :param speed_ms: animation speed in milliseconds
145
+ :param br: max brightness 0-100%
146
+ :param batch: batch update
147
+ """
148
+ def effect_fire():
149
+ nonlocal pix_cnt, br
150
+ max_value = int(255 * (br/100))
151
+ for index in range(pix_cnt):
152
+ r, g, b = DrawEffectV2.color_code()
153
+ rand_percent = float(round(randint(1, max_value)/max_value, 2))
154
+ new_r = min(max(int(r * rand_percent), 0), max_value)
155
+ new_g = min(max(int(g * rand_percent), 0), max_value)
156
+ new_b = min(max(int(b * rand_percent), 0), max_value)
157
+ yield index, new_r, new_g, new_b
158
+
159
+ neoeffect = load()
160
+ pix_cnt = Data.NEOPIXEL_OBJ.n
161
+ return neoeffect.play(effect_fire, speed_ms=speed_ms, bt_draw=batch, bt_size=pix_cnt)
162
+
163
+
164
+ def shader(offset=0, size=6):
165
+ """
166
+ Shader effect on neopixel ring.
167
+ :param offset: start pixel index
168
+ :param size: shader size (number of pixels)
169
+ """
170
+ def effect_shader():
171
+ nonlocal size, offset, neoeffect
172
+ pix_cnt = Data.NEOPIXEL_OBJ.n
173
+ # Conditional value load - with neopixel cache
174
+ r, g, b = DrawEffectV2.color_code()
175
+ # calculate 0->24 range
176
+ _slice1 = pix_cnt if size + offset > pix_cnt else size + offset
177
+ # calculate 24->0-> range (overflow)
178
+ _slice2 = size + offset - pix_cnt if size + offset > pix_cnt else 0
179
+ for i in range(0, pix_cnt):
180
+ if offset <= i < _slice1 or 0 <= i < _slice2:
181
+ neoeffect.update(i, 0, 0, 0)
182
+ else:
183
+ neoeffect.update(i, r, g, b)
184
+ neoeffect.draw()
185
+
186
+ neoeffect = load()
187
+ effect_shader()
188
+ return "Shader was set."
189
+
190
+
191
+ def color(r:int=None, g:int=None, b:int=None):
192
+ """
193
+ Set color buffer - for runtime effect color change
194
+ :param r: red channel 0-255 (default: None - cached value)
195
+ :param g: green channel 0-255 (default: None - cached value)
196
+ :param b: blue channel 0-255 (default: None - cached value)
197
+ :return dict: rgb status - states: R, G, B, S
198
+ """
199
+ # Conditional value load - with neopixel cache
200
+ r, g, b = DrawEffectV2.color_code(r, g, b)
201
+ Data.DCACHE[0] = r
202
+ Data.DCACHE[1] = g
203
+ Data.DCACHE[2] = b
204
+ return status()
205
+
206
+
207
+ def random(max_val=255):
208
+ """
209
+ Demo function: implements random color change
210
+ :param max_val: set channel maximum generated value: 0-255
211
+ :return str: rgb status - states: R, G, B
212
+ """
213
+ r = randint(0, max_val)
214
+ g = randint(0, max_val)
215
+ b = randint(0, max_val)
216
+ Data.DCACHE[0] = r
217
+ Data.DCACHE[1] = g
218
+ Data.DCACHE[2] = b
219
+ return "Set random: R:{} G: B:{}".format(r, g, b)
220
+
221
+
222
+ def stop():
223
+ """
224
+ Stop all running (neo)effects tasks
225
+ """
226
+ player_info = load().stop()
227
+ random_task = manage_task("neoeffects.random", "kill")
228
+ return f"{player_info}\n{random_task}"
229
+
230
+ def control(speed_ms=None, batch:bool=None):
231
+ """
232
+ Change the speed of frame generation for animations.
233
+ """
234
+ data = load().control(play_speed_ms=speed_ms, bt_draw=batch)
235
+ _speed_ms = data.get("player_speed", None)
236
+ return f"Control state: {data} (speed: {_speed_ms}ms)"
237
+
238
+
239
+ def load(pixel_cnt=24):
240
+ """
241
+ Load LM_neopixel and DrawEffectV2
242
+ """
243
+ if DrawEffectV2.INSTANCE is None:
244
+ DrawEffectV2(pix_cnt=pixel_cnt)
245
+ return DrawEffectV2.INSTANCE
246
+
247
+ #######################
248
+ # LM helper functions #
249
+ #######################
250
+
251
+
252
+ def pinmap():
253
+ """
254
+ [i] micrOS LM naming convention
255
+ Shows logical pins - pin number(s) used by this Load module
256
+ - info which pins to use for this application
257
+ :return dict: pin name (str) - pin value (int) pairs
258
+ """
259
+ return pm()
260
+
261
+
262
+ def help(widgets=False):
263
+ """
264
+ [i] micrOS LM naming convention - built-in help message
265
+ :return tuple:
266
+ (widgets=False) list of functions implemented by this application
267
+ (widgets=True) list of widget json for UI generation
268
+ """
269
+ return resolve(('load pixel_cnt=24',
270
+ 'meteor speed_ms=60 shift=True batch=True',
271
+ 'BUTTON meteor speed_ms=60',
272
+ 'cycle speed_ms=60 shift=True batch=True',
273
+ 'BUTTON cycle speed_ms=60',
274
+ 'rainbow speed_ms=50 br=15 batch=True',
275
+ 'BUTTON rainbow',
276
+ 'fire speed_ms=150 br=30 batch=True',
277
+ 'BUTTON fire speed_ms=150',
278
+ 'BUTTON stop',
279
+ 'shader offset=0 size=6',
280
+ 'SLIDER control speed_ms=<1-200> batch=None',
281
+ 'random max_val=255',
282
+ 'pinmap',
283
+ 'COLOR color r=<0-255-10> g b'
284
+ ), widgets=widgets)
@@ -1,10 +1,8 @@
1
1
  from neopixel import NeoPixel
2
2
  from machine import Pin
3
- from sys import platform
4
3
  from utime import sleep_ms
5
- from Common import transition_gen, micro_task
6
- import uasyncio as asyncio
7
- from microIO import physical_pin, pinmap_dump
4
+ from Common import transition_gen, micro_task, data_dir
5
+ from microIO import bind_pin, pinmap_search
8
6
  from random import randint
9
7
  from Types import resolve
10
8
 
@@ -20,6 +18,7 @@ class Data:
20
18
  PERSISTENT_CACHE = False
21
19
  RGB_TASK_TAG = "neopixel._tran"
22
20
  TASK_STATE = False
21
+ FILE_CACHE = data_dir('neopixel.cache')
23
22
 
24
23
 
25
24
  #########################################
@@ -27,13 +26,13 @@ class Data:
27
26
  #########################################
28
27
 
29
28
 
30
- def __init_NEOPIXEL(n=24):
29
+ def __init_NEOPIXEL(pin=None, n=24):
31
30
  """
32
31
  Init NeoPixel module
33
32
  n - number of led fragments
34
33
  """
35
34
  if Data.NEOPIXEL_OBJ is None:
36
- neopixel_pin = Pin(physical_pin('neop')) # Get Neopixel pin from LED PIN pool
35
+ neopixel_pin = Pin(bind_pin('neop', number=pin)) # Get Neopixel pin from LED PIN pool
37
36
  Data.NEOPIXEL_OBJ = NeoPixel(neopixel_pin, n) # initialize for max 8 segments
38
37
  del neopixel_pin
39
38
  return Data.NEOPIXEL_OBJ
@@ -41,7 +40,7 @@ def __init_NEOPIXEL(n=24):
41
40
 
42
41
  def __persistent_cache_manager(mode):
43
42
  """
44
- pds - persistent data structure
43
+ File cache
45
44
  modes:
46
45
  r - recover, s - save
47
46
  """
@@ -49,12 +48,12 @@ def __persistent_cache_manager(mode):
49
48
  return
50
49
  if mode == 's':
51
50
  # SAVE CACHE
52
- with open('neopixel.pds', 'w') as f:
51
+ with open(Data.FILE_CACHE, 'w') as f:
53
52
  f.write(','.join([str(k) for k in Data.DCACHE]))
54
53
  return
55
54
  try:
56
55
  # RESTORE CACHE
57
- with open('neopixel.pds', 'r') as f:
56
+ with open(Data.FILE_CACHE, 'r') as f:
58
57
  Data.DCACHE = [float(data) for data in f.read().strip().split(',')]
59
58
  except:
60
59
  pass
@@ -73,20 +72,17 @@ def __state_machine(r, g, b):
73
72
  # USER FUNCTIONS #
74
73
  #########################################
75
74
 
76
- def load_n_init(cache=None, ledcnt=24):
75
+ def load(ledcnt=24, pin=None, cache=True):
77
76
  """
78
77
  Initiate NeoPixel RGB module
79
- :param cache bool: file state machine cache: True/False/None(default: automatic True)
80
- - Load .pds (state machine cache) for this load module
81
- - Apply loaded states to gpio pins (boot function)
78
+ :param ledcnt: number of led segments
79
+ :param pin: optional number to overwrite default pin
80
+ :param cache: default True, store stages on disk + Load (.cache)
82
81
  :return str: Cache state
83
82
  """
84
- if cache is None:
85
- Data.PERSISTENT_CACHE = False if platform == 'esp8266' else True
86
- else:
87
- Data.PERSISTENT_CACHE = cache
83
+ Data.PERSISTENT_CACHE = cache
88
84
  __persistent_cache_manager('r') # recover data cache
89
- _ledcnt = __init_NEOPIXEL(n=ledcnt).n
85
+ _ledcnt = __init_NEOPIXEL(pin=pin, n=ledcnt).n
90
86
  if Data.PERSISTENT_CACHE and Data.DCACHE[3] == 1:
91
87
  Data.DCACHE[3] = 0 # Force ON at boot
92
88
  toggle(True)
@@ -186,13 +182,13 @@ def segment(r=None, g=None, b=None, s=0, cache=False, write=True):
186
182
  :param g: green value 0-255
187
183
  :param b: blue value 0-255
188
184
  :param s: segment - index 0-ledcnt
189
- :param cache: cache color (update .pds file)
185
+ :param cache: cache color (update .cache file)
190
186
  :param write: send color buffer to neopixel (update LEDs)
191
187
  :return dict: rgb status - states: R, G, B, S
192
188
  """
193
- r = Data.DCACHE[0] if r is None else r
194
- g = Data.DCACHE[1] if g is None else g
195
- b = Data.DCACHE[2] if b is None else b
189
+ r = int(Data.DCACHE[0]) if r is None else r
190
+ g = int(Data.DCACHE[1]) if g is None else g
191
+ b = int(Data.DCACHE[2]) if b is None else b
196
192
  neo_n = __init_NEOPIXEL().n
197
193
  if s <= neo_n:
198
194
  Data.NEOPIXEL_OBJ[s] = (r, g, b)
@@ -269,7 +265,7 @@ def transition(r=None, g=None, b=None, sec=1.0, wake=False):
269
265
  Data.DCACHE[1] = g_val if g_val > 5 else 5 # SAVE VALUE TO CACHE > 5 ! because toggle
270
266
  Data.DCACHE[2] = b_val if b_val > 5 else 5 # SAVE VALUE TO CACHE > 5 ! because toggle
271
267
  my_task.out = f"Dimming: R:{r_val} G:{g_val} B:{b_val}"
272
- await asyncio.sleep_ms(ms_period)
268
+ await my_task.feed(sleep_ms=ms_period)
273
269
  if Data.DCACHE[3] == 1 or wake:
274
270
  __state_machine(r=r_val, g=g_val, b=b_val)
275
271
  my_task.out = f"Dimming DONE: R:{r_val} G:{g_val} B:{b_val}"
@@ -282,8 +278,7 @@ def transition(r=None, g=None, b=None, sec=1.0, wake=False):
282
278
  # Create transition generator and calculate step_ms
283
279
  rgb_gen, step_ms = transition_gen(r_from, r_to, g_from, g_to, b_from, b_to, interval_sec=sec)
284
280
  # [!] ASYNC TASK CREATION [1*] with async task callback + taskID (TAG) handling
285
- state = micro_task(tag=Data.RGB_TASK_TAG, task=_task(ms_period=step_ms, iterable=rgb_gen))
286
- return "Starting transition" if state else "Transition already running"
281
+ return micro_task(tag=Data.RGB_TASK_TAG, task=_task(ms_period=step_ms, iterable=rgb_gen))
287
282
 
288
283
 
289
284
  def random(smooth=True, max_val=255):
@@ -332,7 +327,7 @@ def pinmap():
332
327
  - info which pins to use for this application
333
328
  :return dict: pin name (str) - pin value (int) pairs
334
329
  """
335
- return pinmap_dump('neop')
330
+ return pinmap_search('neop')
336
331
 
337
332
 
338
333
  def help(widgets=False):
@@ -342,12 +337,12 @@ def help(widgets=False):
342
337
  (widgets=False) list of functions implemented by this application
343
338
  (widgets=True) list of widget json for UI generation
344
339
  """
345
- return resolve(('COLOR color r=<0-255> g b smooth=True force=True',
346
- 'TOGGLE toggle state smooth=True',
347
- 'load_n_init ledcnt=24',
340
+ return resolve(('COLOR color r=<0-255-5> g b smooth=True force=True',
341
+ 'BUTTON toggle state=<True,False> smooth=True',
342
+ 'load ledcnt=24',
348
343
  'SLIDER brightness percent=<0-100> smooth=True wake=True',
349
- 'COLOR segment r g b s=<0-n>',
350
- 'transition r=None g=None b=None sec=1.0 wake=False',
344
+ 'segment r g b s=<0-n>',
345
+ 'transition r g b sec=1.0 wake=False',
351
346
  'BUTTON random smooth=True max_val=254',
352
347
  'status',
353
348
  'subscribe_presence',