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.
Files changed (368) hide show
  1. env/driver_cp210x/macOS_VCP_Driver/SiLabsUSBDriverDisk.dmg +0 -0
  2. env/driver_cp210x/macOS_VCP_Driver/macOS_VCP_Driver_Release_Notes.txt +17 -1
  3. micrOS/micropython/esp32-20251209-v1.27.0.bin +0 -0
  4. micrOS/micropython/esp32c3-20251209-v1.27.0.bin +0 -0
  5. micrOS/micropython/esp32c6-20251209-v1.27.0.bin +0 -0
  6. micrOS/micropython/esp32s2-20251209-v1.27.0.bin +0 -0
  7. micrOS/micropython/esp32s2-LOLIN_MINI-20251209-v1.27.0.bin +0 -0
  8. micrOS/micropython/{esp32s3-20241129-v1.24.1.bin → esp32s3-4MBflash-20241129-v1.24.1.bin} +0 -0
  9. micrOS/micropython/esp32s3-8MBflash-20251209-v1.27.0.bin +0 -0
  10. micrOS/micropython/esp32s3_spiram_oct-20251209-v1.27.0.bin +0 -0
  11. micrOS/micropython/rpi-pico-w-20251209-v1.27.0.uf2 +0 -0
  12. micrOS/micropython/tinypico-20251209-v1.27.0.bin +0 -0
  13. micrOS/release_info/micrOS_ReleaseInfo/system_analysis_sum.json +167 -163
  14. micrOS/source/Auth.py +37 -0
  15. micrOS/source/Common.py +361 -116
  16. micrOS/source/Config.py +32 -22
  17. micrOS/source/Debug.py +50 -94
  18. micrOS/source/Espnow.py +377 -100
  19. micrOS/source/Files.py +207 -0
  20. micrOS/source/Hooks.py +48 -20
  21. micrOS/source/InterConnect.py +126 -42
  22. micrOS/source/Interrupts.py +6 -6
  23. micrOS/source/Logger.py +63 -26
  24. micrOS/source/Network.py +41 -21
  25. micrOS/source/Notify.py +48 -22
  26. micrOS/source/Pacman.py +326 -0
  27. micrOS/source/Scheduler.py +14 -54
  28. micrOS/source/Server.py +67 -69
  29. micrOS/source/Shell.py +99 -91
  30. micrOS/source/Tasks.py +141 -95
  31. micrOS/source/Time.py +19 -18
  32. micrOS/source/Types.py +53 -9
  33. micrOS/source/Web.py +381 -76
  34. micrOS/source/__pycache__/Common.cpython-312.pyc +0 -0
  35. micrOS/source/__pycache__/Debug.cpython-312.pyc +0 -0
  36. micrOS/source/__pycache__/Files.cpython-312.pyc +0 -0
  37. micrOS/source/__pycache__/Logger.cpython-312.pyc +0 -0
  38. micrOS/source/__pycache__/Scheduler.cpython-312.pyc +0 -0
  39. micrOS/source/__pycache__/Server.cpython-312.pyc +0 -0
  40. micrOS/source/__pycache__/Shell.cpython-312.pyc +0 -0
  41. micrOS/source/__pycache__/replhelper.cpython-312.pyc +0 -0
  42. micrOS/source/config/_git.keep +0 -0
  43. micrOS/source/helpers.py +132 -0
  44. micrOS/source/micrOS.py +17 -7
  45. micrOS/source/micrOSloader.py +5 -12
  46. micrOS/source/microIO.py +44 -20
  47. micrOS/source/modules/IO_esp32c6.py +38 -0
  48. micrOS/source/{IO_esp32s3.py → modules/IO_esp32s3.py} +37 -1
  49. micrOS/source/{IO_m5stamp.py → modules/IO_m5stamp.py} +35 -1
  50. micrOS/source/{IO_qtpy.py → modules/IO_qtpy.py} +22 -17
  51. micrOS/source/{IO_tinypico.py → modules/IO_tinypico.py} +38 -0
  52. micrOS/source/modules/LM_L298N.py +161 -0
  53. {toolkit/workspace/precompiled → micrOS/source/modules}/LM_L9110_DCmotor.py +3 -3
  54. micrOS/source/{LM_OV2640.py → modules/LM_OV2640.py} +45 -27
  55. micrOS/source/{LM_VL53L0X.py → modules/LM_VL53L0X.py} +3 -3
  56. micrOS/source/{LM_aht10.py → modules/LM_aht10.py} +2 -2
  57. micrOS/source/{LM_bme280.py → modules/LM_bme280.py} +3 -3
  58. micrOS/source/{LM_buzzer.py → modules/LM_buzzer.py} +18 -25
  59. micrOS/source/{LM_cct.py → modules/LM_cct.py} +17 -21
  60. micrOS/source/modules/LM_cluster.py +255 -0
  61. micrOS/source/{LM_co2.py → modules/LM_co2.py} +3 -3
  62. micrOS/source/{LM_dht11.py → modules/LM_dht11.py} +2 -2
  63. micrOS/source/{LM_dht22.py → modules/LM_dht22.py} +2 -2
  64. micrOS/source/{LM_dimmer.py → modules/LM_dimmer.py} +9 -9
  65. micrOS/source/{LM_distance.py → modules/LM_distance.py} +4 -6
  66. micrOS/source/{LM_ds18.py → modules/LM_ds18.py} +2 -2
  67. micrOS/source/{LM_esp32.py → modules/LM_esp32.py} +5 -0
  68. micrOS/source/modules/LM_espnow.py +53 -0
  69. micrOS/source/modules/LM_fileserver.py +265 -0
  70. micrOS/source/{LM_genIO.py → modules/LM_genIO.py} +52 -37
  71. micrOS/source/{LM_haptic.py → modules/LM_haptic.py} +2 -2
  72. {toolkit/workspace/precompiled → micrOS/source/modules}/LM_i2c.py +5 -4
  73. micrOS/source/{LM_i2s_mic.py → modules/LM_i2s_mic.py} +6 -7
  74. micrOS/source/{LM_ld2410.py → modules/LM_ld2410.py} +2 -2
  75. micrOS/source/{LM_light_sensor.py → modules/LM_light_sensor.py} +10 -21
  76. micrOS/source/modules/LM_mh_z19c.py +198 -0
  77. micrOS/source/modules/LM_neoeffects.py +284 -0
  78. micrOS/source/{LM_neopixel.py → modules/LM_neopixel.py} +19 -23
  79. micrOS/source/{LM_oled.py → modules/LM_oled.py} +2 -2
  80. micrOS/source/{LM_oled_sh1106.py → modules/LM_oled_sh1106.py} +3 -3
  81. micrOS/source/{LM_oled_ui.py → modules/LM_oled_ui.py} +72 -64
  82. micrOS/source/modules/LM_pacman.py +320 -0
  83. micrOS/source/{LM_presence.py → modules/LM_presence.py} +11 -15
  84. micrOS/source/modules/LM_qmi8658.py +204 -0
  85. micrOS/source/{LM_rencoder.py → modules/LM_rencoder.py} +2 -2
  86. micrOS/source/{LM_rest.py → modules/LM_rest.py} +4 -6
  87. micrOS/source/{LM_rgb.py → modules/LM_rgb.py} +21 -29
  88. micrOS/source/{LM_roboarm.py → modules/LM_roboarm.py} +8 -8
  89. micrOS/source/modules/LM_robustness.py +137 -0
  90. micrOS/source/{LM_servo.py → modules/LM_servo.py} +3 -3
  91. micrOS/source/{LM_stepper.py → modules/LM_stepper.py} +5 -5
  92. micrOS/source/{LM_switch.py → modules/LM_switch.py} +11 -9
  93. micrOS/source/{LM_system.py → modules/LM_system.py} +38 -32
  94. micrOS/source/modules/LM_tcs3472.py +187 -0
  95. micrOS/source/{LM_telegram.py → modules/LM_telegram.py} +164 -116
  96. micrOS/source/{LM_trackball.py → modules/LM_trackball.py} +3 -3
  97. micrOS/source/{LM_veml7700.py → modules/LM_veml7700.py} +2 -2
  98. micrOS/source/modules/LM_web.py +38 -0
  99. micrOS/source/urequests.py +39 -15
  100. {toolkit/workspace/precompiled → micrOS/source/web}/dashboard.html +4 -0
  101. micrOS/source/web/editor.js +440 -0
  102. micrOS/source/web/filesui.html +178 -0
  103. micrOS/source/web/filesui.js +338 -0
  104. {toolkit/workspace/precompiled → micrOS/source/web}/index.html +44 -2
  105. micrOS/source/{uapi.js → web/uapi.js} +48 -7
  106. micrOS/source/{ustyle.css → web/ustyle.css} +6 -3
  107. micrOS/utests/__init__.py +0 -0
  108. micrOS/utests/test_scheduler.py +435 -0
  109. {micrOSDevToolKit-2.9.1.data → microsdevtoolkit-2.26.1.data}/scripts/devToolKit.py +33 -3
  110. {micrOSDevToolKit-2.9.1.dist-info → microsdevtoolkit-2.26.1.dist-info}/METADATA +327 -268
  111. microsdevtoolkit-2.26.1.dist-info/RECORD +396 -0
  112. {micrOSDevToolKit-2.9.1.dist-info → microsdevtoolkit-2.26.1.dist-info}/WHEEL +1 -1
  113. toolkit/DevEnvCompile.py +63 -33
  114. toolkit/DevEnvOTA.py +58 -22
  115. toolkit/DevEnvUSB.py +110 -55
  116. toolkit/Gateway.py +6 -6
  117. toolkit/LM_to_compile.dat +6 -4
  118. toolkit/MicrOSDevEnv.py +127 -57
  119. toolkit/WebRepl.py +73 -0
  120. toolkit/dashboard_apps/BackupRestore.py +20 -35
  121. toolkit/dashboard_apps/CCTDemo.py +12 -17
  122. toolkit/dashboard_apps/CCTTest.py +20 -24
  123. toolkit/dashboard_apps/CamStream.py +2 -6
  124. toolkit/dashboard_apps/CatGame.py +14 -16
  125. toolkit/dashboard_apps/Dimmer.py +11 -21
  126. toolkit/dashboard_apps/GetVersion.py +11 -19
  127. toolkit/dashboard_apps/MicrophoneTest.py +1 -6
  128. toolkit/dashboard_apps/NeoEffectsDemo.py +22 -35
  129. toolkit/dashboard_apps/NeopixelTest.py +20 -25
  130. toolkit/dashboard_apps/PresenceTest.py +2 -8
  131. toolkit/dashboard_apps/QMI8685_GYRO.py +68 -0
  132. toolkit/dashboard_apps/RGBTest.py +20 -24
  133. toolkit/dashboard_apps/RoboArm.py +24 -32
  134. toolkit/dashboard_apps/SED_test.py +10 -14
  135. toolkit/dashboard_apps/SensorsTest.py +61 -0
  136. toolkit/dashboard_apps/SystemTest.py +202 -105
  137. toolkit/dashboard_apps/Template_app.py +11 -23
  138. toolkit/dashboard_apps/_app_base.py +34 -0
  139. toolkit/dashboard_apps/_gyro_visualizer.py +78 -0
  140. toolkit/dashboard_apps/uLightDemo.py +15 -24
  141. toolkit/index.html +4 -4
  142. toolkit/lib/LocalMachine.py +6 -1
  143. toolkit/lib/MicrosFiles.py +46 -0
  144. toolkit/lib/Repository.py +64 -0
  145. toolkit/lib/TerminalColors.py +4 -0
  146. toolkit/lib/macroScript.py +6 -0
  147. toolkit/lib/micrOSClient.py +123 -50
  148. toolkit/lib/micrOSClientHistory.py +156 -0
  149. toolkit/lib/pip_package_installer.py +5 -2
  150. toolkit/micrOSdashboard.py +12 -17
  151. toolkit/micrOSlint.py +20 -8
  152. toolkit/simulator_lib/__pycache__/IO_darwin.cpython-312.pyc +0 -0
  153. toolkit/simulator_lib/__pycache__/aioespnow.cpython-312.pyc +0 -0
  154. toolkit/simulator_lib/__pycache__/framebuf.cpython-312.pyc +0 -0
  155. toolkit/simulator_lib/__pycache__/machine.cpython-312.pyc +0 -0
  156. toolkit/simulator_lib/__pycache__/micropython.cpython-312.pyc +0 -0
  157. toolkit/simulator_lib/__pycache__/mip.cpython-312.pyc +0 -0
  158. toolkit/simulator_lib/__pycache__/neopixel.cpython-312.pyc +0 -0
  159. toolkit/simulator_lib/__pycache__/network.cpython-312.pyc +0 -0
  160. toolkit/simulator_lib/__pycache__/sim_common.cpython-312.pyc +0 -0
  161. toolkit/simulator_lib/__pycache__/simgc.cpython-312.pyc +0 -0
  162. toolkit/simulator_lib/__pycache__/simulator.cpython-312.pyc +0 -0
  163. toolkit/simulator_lib/__pycache__/uasyncio.cpython-312.pyc +0 -0
  164. toolkit/simulator_lib/__pycache__/uos.cpython-312.pyc +0 -0
  165. toolkit/simulator_lib/__pycache__/urandom.cpython-312.pyc +0 -0
  166. toolkit/simulator_lib/__pycache__/usocket.cpython-312.pyc +0 -0
  167. toolkit/simulator_lib/__pycache__/ussl.cpython-312.pyc +0 -0
  168. toolkit/simulator_lib/aioespnow.py +28 -0
  169. toolkit/simulator_lib/dht.py +1 -1
  170. toolkit/simulator_lib/framebuf.py +49 -1
  171. toolkit/simulator_lib/machine.py +17 -2
  172. toolkit/simulator_lib/micropython.py +3 -3
  173. toolkit/simulator_lib/mip.py +165 -0
  174. toolkit/simulator_lib/neopixel.py +3 -2
  175. toolkit/simulator_lib/network.py +2 -1
  176. toolkit/simulator_lib/node_config.json +2 -3
  177. toolkit/simulator_lib/ntptime.py +1 -1
  178. toolkit/simulator_lib/{sim_console.py → sim_common.py} +2 -3
  179. toolkit/simulator_lib/simgc.py +6 -2
  180. toolkit/simulator_lib/simulator.py +137 -59
  181. toolkit/simulator_lib/uasyncio.py +33 -2
  182. toolkit/simulator_lib/uos.py +147 -0
  183. toolkit/simulator_lib/urandom.py +4 -0
  184. toolkit/socketClient.py +43 -23
  185. toolkit/user_data/webhooks/generic.py +1 -1
  186. toolkit/user_data/webhooks/macro.py +1 -1
  187. toolkit/user_data/webhooks/template.py +1 -1
  188. toolkit/workspace/precompiled/Auth.mpy +0 -0
  189. toolkit/workspace/precompiled/Common.mpy +0 -0
  190. toolkit/workspace/precompiled/Config.mpy +0 -0
  191. toolkit/workspace/precompiled/Debug.mpy +0 -0
  192. toolkit/workspace/precompiled/Espnow.mpy +0 -0
  193. toolkit/workspace/precompiled/Files.mpy +0 -0
  194. toolkit/workspace/precompiled/Hooks.mpy +0 -0
  195. toolkit/workspace/precompiled/InterConnect.mpy +0 -0
  196. toolkit/workspace/precompiled/Interrupts.mpy +0 -0
  197. toolkit/workspace/precompiled/Logger.mpy +0 -0
  198. toolkit/workspace/precompiled/Network.mpy +0 -0
  199. toolkit/workspace/precompiled/Notify.mpy +0 -0
  200. toolkit/workspace/precompiled/Pacman.mpy +0 -0
  201. toolkit/workspace/precompiled/Scheduler.mpy +0 -0
  202. toolkit/workspace/precompiled/Server.mpy +0 -0
  203. toolkit/workspace/precompiled/Shell.mpy +0 -0
  204. toolkit/workspace/precompiled/Tasks.mpy +0 -0
  205. toolkit/workspace/precompiled/Time.mpy +0 -0
  206. toolkit/workspace/precompiled/Types.mpy +0 -0
  207. toolkit/workspace/precompiled/Web.mpy +0 -0
  208. toolkit/workspace/precompiled/_mpy.version +1 -1
  209. toolkit/workspace/precompiled/config/_git.keep +0 -0
  210. toolkit/workspace/precompiled/helpers.mpy +0 -0
  211. toolkit/workspace/precompiled/micrOS.mpy +0 -0
  212. toolkit/workspace/precompiled/micrOSloader.mpy +0 -0
  213. toolkit/workspace/precompiled/microIO.mpy +0 -0
  214. toolkit/workspace/precompiled/{IO_esp32.mpy → modules/IO_esp32.mpy} +0 -0
  215. toolkit/workspace/precompiled/{IO_esp32c3.mpy → modules/IO_esp32c3.mpy} +0 -0
  216. toolkit/workspace/precompiled/modules/IO_esp32c6.mpy +0 -0
  217. toolkit/workspace/precompiled/{IO_esp32s2.mpy → modules/IO_esp32s2.mpy} +0 -0
  218. toolkit/workspace/precompiled/modules/IO_esp32s3.mpy +0 -0
  219. toolkit/workspace/precompiled/modules/IO_m5stamp.mpy +0 -0
  220. toolkit/workspace/precompiled/modules/IO_qtpy.mpy +0 -0
  221. toolkit/workspace/precompiled/modules/IO_rp2.mpy +0 -0
  222. toolkit/workspace/precompiled/modules/IO_tinypico.mpy +0 -0
  223. toolkit/workspace/precompiled/modules/LM_L298N.mpy +0 -0
  224. {micrOS/source → toolkit/workspace/precompiled/modules}/LM_L9110_DCmotor.py +3 -3
  225. toolkit/workspace/precompiled/modules/LM_OV2640.mpy +0 -0
  226. toolkit/workspace/precompiled/{LM_VL53L0X.py → modules/LM_VL53L0X.py} +3 -3
  227. toolkit/workspace/precompiled/{LM_aht10.mpy → modules/LM_aht10.mpy} +0 -0
  228. toolkit/workspace/precompiled/{LM_bme280.mpy → modules/LM_bme280.mpy} +0 -0
  229. toolkit/workspace/precompiled/{LM_buzzer.mpy → modules/LM_buzzer.mpy} +0 -0
  230. toolkit/workspace/precompiled/modules/LM_cct.mpy +0 -0
  231. toolkit/workspace/precompiled/modules/LM_cluster.mpy +0 -0
  232. toolkit/workspace/precompiled/{LM_co2.mpy → modules/LM_co2.mpy} +0 -0
  233. toolkit/workspace/precompiled/{LM_dht11.mpy → modules/LM_dht11.mpy} +0 -0
  234. toolkit/workspace/precompiled/{LM_dht22.mpy → modules/LM_dht22.mpy} +0 -0
  235. toolkit/workspace/precompiled/modules/LM_dimmer.mpy +0 -0
  236. toolkit/workspace/precompiled/modules/LM_distance.mpy +0 -0
  237. toolkit/workspace/precompiled/{LM_ds18.mpy → modules/LM_ds18.mpy} +0 -0
  238. toolkit/workspace/precompiled/{LM_esp32.py → modules/LM_esp32.py} +5 -0
  239. toolkit/workspace/precompiled/modules/LM_espnow.py +53 -0
  240. toolkit/workspace/precompiled/modules/LM_fileserver.mpy +0 -0
  241. toolkit/workspace/precompiled/{LM_gameOfLife.mpy → modules/LM_gameOfLife.mpy} +0 -0
  242. toolkit/workspace/precompiled/modules/LM_genIO.mpy +0 -0
  243. toolkit/workspace/precompiled/{LM_haptic.mpy → modules/LM_haptic.mpy} +0 -0
  244. {micrOS/source → toolkit/workspace/precompiled/modules}/LM_i2c.py +5 -4
  245. toolkit/workspace/precompiled/modules/LM_i2s_mic.mpy +0 -0
  246. toolkit/workspace/precompiled/{LM_ld2410.mpy → modules/LM_ld2410.mpy} +0 -0
  247. toolkit/workspace/precompiled/modules/LM_light_sensor.mpy +0 -0
  248. toolkit/workspace/precompiled/modules/LM_mh_z19c.py +198 -0
  249. toolkit/workspace/precompiled/modules/LM_neoeffects.mpy +0 -0
  250. toolkit/workspace/precompiled/modules/LM_neopixel.mpy +0 -0
  251. toolkit/workspace/precompiled/{LM_oled.mpy → modules/LM_oled.mpy} +0 -0
  252. toolkit/workspace/precompiled/{LM_oled_sh1106.mpy → modules/LM_oled_sh1106.mpy} +0 -0
  253. toolkit/workspace/precompiled/modules/LM_oled_ui.mpy +0 -0
  254. toolkit/workspace/precompiled/modules/LM_pacman.mpy +0 -0
  255. toolkit/workspace/precompiled/modules/LM_presence.mpy +0 -0
  256. toolkit/workspace/precompiled/modules/LM_qmi8658.py +204 -0
  257. toolkit/workspace/precompiled/{LM_rencoder.py → modules/LM_rencoder.py} +2 -2
  258. toolkit/workspace/precompiled/modules/LM_rest.mpy +0 -0
  259. toolkit/workspace/precompiled/modules/LM_rgb.mpy +0 -0
  260. toolkit/workspace/precompiled/{LM_rgbcct.mpy → modules/LM_rgbcct.mpy} +0 -0
  261. toolkit/workspace/precompiled/modules/LM_roboarm.mpy +0 -0
  262. toolkit/workspace/precompiled/modules/LM_robustness.py +137 -0
  263. toolkit/workspace/precompiled/{LM_servo.mpy → modules/LM_servo.mpy} +0 -0
  264. toolkit/workspace/precompiled/{LM_sound_event.mpy → modules/LM_sound_event.mpy} +0 -0
  265. toolkit/workspace/precompiled/{LM_stepper.mpy → modules/LM_stepper.mpy} +0 -0
  266. toolkit/workspace/precompiled/modules/LM_switch.mpy +0 -0
  267. toolkit/workspace/precompiled/modules/LM_system.mpy +0 -0
  268. toolkit/workspace/precompiled/modules/LM_tcs3472.py +187 -0
  269. toolkit/workspace/precompiled/modules/LM_telegram.mpy +0 -0
  270. toolkit/workspace/precompiled/{LM_tinyrgb.mpy → modules/LM_tinyrgb.mpy} +0 -0
  271. toolkit/workspace/precompiled/{LM_trackball.mpy → modules/LM_trackball.mpy} +0 -0
  272. toolkit/workspace/precompiled/{LM_veml7700.mpy → modules/LM_veml7700.mpy} +0 -0
  273. toolkit/workspace/precompiled/modules/LM_web.mpy +0 -0
  274. toolkit/workspace/precompiled/urequests.mpy +0 -0
  275. {micrOS/source → toolkit/workspace/precompiled/web}/dashboard.html +4 -0
  276. toolkit/workspace/precompiled/web/editor.js +440 -0
  277. toolkit/workspace/precompiled/web/filesui.html +178 -0
  278. toolkit/workspace/precompiled/web/filesui.js +338 -0
  279. {micrOS/source → toolkit/workspace/precompiled/web}/index.html +44 -2
  280. toolkit/workspace/precompiled/{uapi.js → web/uapi.js} +48 -7
  281. toolkit/workspace/precompiled/{ustyle.css → web/ustyle.css} +6 -3
  282. micrOS/micropython/esp32-20241129-v1.24.1.bin +0 -0
  283. micrOS/micropython/esp32c3-20240222-v1.22.2.bin +0 -0
  284. micrOS/micropython/esp32s2-20240602-v1.23.0.bin +0 -0
  285. micrOS/micropython/esp32s2-LOLIN_MINI-20220618-v1.19.1.bin +0 -0
  286. micrOS/micropython/esp32s2-LOLIN_MINI-20240602-v1.23.0.bin +0 -0
  287. micrOS/micropython/esp32s3-20240105-v1.22.1.bin +0 -0
  288. micrOS/micropython/esp32s3_spiram_oct-20231005-v1.21.0.bin +0 -0
  289. micrOS/micropython/esp32s3_spiram_oct-20241129-v1.24.1.bin +0 -0
  290. micrOS/micropython/rpi-pico-w-20241129-v1.24.1.uf2 +0 -0
  291. micrOS/micropython/tinypico-20241129-v1.24.1.bin +0 -0
  292. micrOS/source/LM_L298N_DCmotor.py +0 -86
  293. micrOS/source/LM_catgame.py +0 -75
  294. micrOS/source/LM_dashboard_be.py +0 -37
  295. micrOS/source/LM_demo.py +0 -97
  296. micrOS/source/LM_espnow.py +0 -23
  297. micrOS/source/LM_intercon.py +0 -57
  298. micrOS/source/LM_keychain.py +0 -322
  299. micrOS/source/LM_lmpacman.py +0 -126
  300. micrOS/source/LM_neoeffects.py +0 -331
  301. micrOS/source/LM_oledui.py +0 -972
  302. micrOS/source/LM_pet_feeder.py +0 -78
  303. micrOS/source/LM_ph_sensor.py +0 -51
  304. micrOS/source/LM_robustness.py +0 -74
  305. micrOS/source/reset.py +0 -11
  306. micrOSDevToolKit-2.9.1.dist-info/RECORD +0 -365
  307. toolkit/dashboard_apps/AirQualityBME280.py +0 -36
  308. toolkit/dashboard_apps/AirQualityDHT22_CO2.py +0 -36
  309. toolkit/lib/file_extensions.py +0 -16
  310. toolkit/simulator_lib/__pycache__/sim_console.cpython-312.pyc +0 -0
  311. toolkit/simulator_lib/__pycache__/sim_console.cpython-38.pyc +0 -0
  312. toolkit/simulator_lib/__pycache__/sim_console.cpython-39.pyc +0 -0
  313. toolkit/workspace/precompiled/IO_esp32s3.mpy +0 -0
  314. toolkit/workspace/precompiled/IO_m5stamp.mpy +0 -0
  315. toolkit/workspace/precompiled/IO_qtpy.mpy +0 -0
  316. toolkit/workspace/precompiled/IO_rp2.mpy +0 -0
  317. toolkit/workspace/precompiled/IO_tinypico.mpy +0 -0
  318. toolkit/workspace/precompiled/LM_L298N_DCmotor.mpy +0 -0
  319. toolkit/workspace/precompiled/LM_OV2640.mpy +0 -0
  320. toolkit/workspace/precompiled/LM_catgame.py +0 -75
  321. toolkit/workspace/precompiled/LM_cct.mpy +0 -0
  322. toolkit/workspace/precompiled/LM_dashboard_be.py +0 -37
  323. toolkit/workspace/precompiled/LM_demo.py +0 -97
  324. toolkit/workspace/precompiled/LM_dimmer.mpy +0 -0
  325. toolkit/workspace/precompiled/LM_distance.mpy +0 -0
  326. toolkit/workspace/precompiled/LM_espnow.py +0 -23
  327. toolkit/workspace/precompiled/LM_genIO.mpy +0 -0
  328. toolkit/workspace/precompiled/LM_i2s_mic.mpy +0 -0
  329. toolkit/workspace/precompiled/LM_intercon.mpy +0 -0
  330. toolkit/workspace/precompiled/LM_keychain.mpy +0 -0
  331. toolkit/workspace/precompiled/LM_light_sensor.mpy +0 -0
  332. toolkit/workspace/precompiled/LM_lmpacman.mpy +0 -0
  333. toolkit/workspace/precompiled/LM_neoeffects.mpy +0 -0
  334. toolkit/workspace/precompiled/LM_neopixel.mpy +0 -0
  335. toolkit/workspace/precompiled/LM_oled_ui.mpy +0 -0
  336. toolkit/workspace/precompiled/LM_oledui.mpy +0 -0
  337. toolkit/workspace/precompiled/LM_pet_feeder.py +0 -78
  338. toolkit/workspace/precompiled/LM_ph_sensor.py +0 -51
  339. toolkit/workspace/precompiled/LM_presence.mpy +0 -0
  340. toolkit/workspace/precompiled/LM_rest.mpy +0 -0
  341. toolkit/workspace/precompiled/LM_rgb.mpy +0 -0
  342. toolkit/workspace/precompiled/LM_roboarm.mpy +0 -0
  343. toolkit/workspace/precompiled/LM_robustness.py +0 -74
  344. toolkit/workspace/precompiled/LM_switch.mpy +0 -0
  345. toolkit/workspace/precompiled/LM_system.mpy +0 -0
  346. toolkit/workspace/precompiled/LM_telegram.mpy +0 -0
  347. toolkit/workspace/precompiled/node_config.json +0 -1
  348. toolkit/workspace/precompiled/reset.mpy +0 -0
  349. /micrOS/source/{IO_esp32.py → modules/IO_esp32.py} +0 -0
  350. /micrOS/source/{IO_esp32c3.py → modules/IO_esp32c3.py} +0 -0
  351. /micrOS/source/{IO_esp32s2.py → modules/IO_esp32s2.py} +0 -0
  352. /micrOS/source/{IO_rp2.py → modules/IO_rp2.py} +0 -0
  353. /micrOS/source/{LM_gameOfLife.py → modules/LM_gameOfLife.py} +0 -0
  354. /micrOS/source/{LM_rgbcct.py → modules/LM_rgbcct.py} +0 -0
  355. /micrOS/source/{LM_rp2w.py → modules/LM_rp2w.py} +0 -0
  356. /micrOS/source/{LM_sdcard.py → modules/LM_sdcard.py} +0 -0
  357. /micrOS/source/{LM_sound_event.py → modules/LM_sound_event.py} +0 -0
  358. /micrOS/source/{LM_tinyrgb.py → modules/LM_tinyrgb.py} +0 -0
  359. /micrOS/source/{udashboard.js → web/udashboard.js} +0 -0
  360. /micrOS/source/{uwidgets.js → web/uwidgets.js} +0 -0
  361. /micrOS/source/{uwidgets_pro.js → web/uwidgets_pro.js} +0 -0
  362. {micrOSDevToolKit-2.9.1.dist-info → microsdevtoolkit-2.26.1.dist-info/licenses}/LICENSE +0 -0
  363. {micrOSDevToolKit-2.9.1.dist-info → microsdevtoolkit-2.26.1.dist-info}/top_level.txt +0 -0
  364. /toolkit/workspace/precompiled/{LM_rp2w.py → modules/LM_rp2w.py} +0 -0
  365. /toolkit/workspace/precompiled/{LM_sdcard.py → modules/LM_sdcard.py} +0 -0
  366. /toolkit/workspace/precompiled/{udashboard.js → web/udashboard.js} +0 -0
  367. /toolkit/workspace/precompiled/{uwidgets.js → web/uwidgets.js} +0 -0
  368. /toolkit/workspace/precompiled/{uwidgets_pro.js → web/uwidgets_pro.js} +0 -0
@@ -0,0 +1,132 @@
1
+ """
2
+ MICROPYTHON REPL micrOS Cli over UART
3
+ - reset() - reboot board
4
+ - shell() - start async micrOS shell (same as ShellCli)
5
+ """
6
+
7
+ from time import sleep
8
+ from uos import listdir
9
+ from machine import soft_reset, reset as hard_reset
10
+
11
+ try:
12
+ from Shell import Shell
13
+ from Tasks import Manager
14
+ from Common import micro_task
15
+ # --- nonblocking stdin line reader (USB serial REPL) ---
16
+ import sys, uselect
17
+ _poll = uselect.poll()
18
+ _poll.register(sys.stdin, uselect.POLLIN)
19
+ _buf = []
20
+ except ImportError as e:
21
+ print(f"!!!Cannot import shell: {e}")
22
+ Shell = None
23
+
24
+ #############################################
25
+ # REBOOT DEVICE #
26
+ #############################################
27
+
28
+ def reset():
29
+ """
30
+ [HELPER] Reboot board
31
+ """
32
+ print('Device reboot now, boot micrOSloader...')
33
+ sleep(1)
34
+
35
+ if "main.py" in listdir():
36
+ soft_reset()
37
+ else:
38
+ hard_reset()
39
+
40
+ #############################################
41
+ # SHELL in REPL #
42
+ #############################################
43
+
44
+ def _read_line_nb(echo=True):
45
+ """
46
+ Non-blocking:
47
+ - returns a full line (str, without trailing newline) when '\n' received
48
+ - returns None if no complete line yet
49
+ Echoes typed characters and supports backspace locally.
50
+ """
51
+ while _poll.poll(0): # check without waiting
52
+ ch = sys.stdin.read(1)
53
+ if not ch:
54
+ break
55
+
56
+ if ch == '\n': # end-of-line (LF)
57
+ line = ''.join(_buf)
58
+ _buf.clear()
59
+ return line # NOTE: we do NOT print a newline
60
+ if ch == '\r': # ignore CR
61
+ continue
62
+
63
+ # backspace / delete
64
+ if ch in ('\x08', '\x7f'):
65
+ if _buf and echo:
66
+ _buf.pop()
67
+ sys.stdout.write('\x08 \x08') # erase last char visually
68
+ elif _buf:
69
+ _buf.pop()
70
+ continue
71
+
72
+ # regular char
73
+ _buf.append(ch)
74
+ if echo:
75
+ sys.stdout.write(ch)
76
+ return None
77
+
78
+
79
+ async def _shell_task(task_id):
80
+
81
+ class ReplShell(Shell):
82
+ async def a_send(self, msg):
83
+ print(f"\n{msg}", end='')
84
+
85
+ shell_inst = ReplShell()
86
+ with micro_task(task_id) as my_task:
87
+ # Init shell welcome msg in repl mode
88
+ await shell_inst.shell("help")
89
+ # Run shell interpreter
90
+ while True:
91
+ my_task.out = "ShellCli in REPL"
92
+ _msg = _read_line_nb() # NoN Blocking ...
93
+ #_msg = input() # Blocking input handling
94
+ if _msg is not None:
95
+ state = await shell_inst.shell(_msg)
96
+ if not state or _msg.strip() == "exit":
97
+ print(f"\nEXIT SHELL: {_msg} ({state}) [Ctrl-C to return micropython repl]")
98
+ break
99
+ await my_task.feed(sleep_ms=10)
100
+ return f"Shell in REPL stopped...({state})"
101
+
102
+
103
+ def shell():
104
+ """
105
+ [HELPER] Run Shell in REPL
106
+ """
107
+ if Shell is None:
108
+ return "Cannot run Shell in REPL, import error"
109
+ # Prepare micrOS Task manager
110
+ aio = Manager()
111
+ # Initiate Shell as repl task
112
+ task_id = "repl.shell"
113
+ aio.create_task(callback=_shell_task(task_id), tag=task_id)
114
+ # Run async main event loop
115
+ aio.run_forever()
116
+ return "Async Main Event Loop Stopped"
117
+
118
+
119
+ if __name__ == "helpers":
120
+ # COMMAND LINE INTERFACE
121
+ print("\nmicrOS REPL Tools\n-----------------")
122
+ print("\t[0] helpers.reset() - reboot board")
123
+ if Shell: print("\t[1] helpers.shell() - Start Shell in REPL")
124
+ CHOICES = (reset, shell)
125
+ CHOICE = None
126
+ try:
127
+ CHOICE = input("Select option: ").strip()
128
+ CHOICE = int(CHOICE)
129
+ # EXEC COMMAND
130
+ CHOICES[CHOICE]()
131
+ except Exception as e:
132
+ print(f"Invalid input {CHOICE}: {e}")
micrOS/source/micrOS.py CHANGED
@@ -4,16 +4,23 @@ dedicated to micrOS framework.
4
4
 
5
5
  Designed by Marcell Ban aka BxNxM
6
6
  """
7
+
8
+ #################################################################
9
+ # INIT FS #
10
+ #################################################################
11
+ from Files import init_micros_dirs
12
+ init_micros_dirs()
13
+
7
14
  #################################################################
8
15
  # IMPORTS #
9
16
  #################################################################
10
17
  from Time import ntp_time, suntime
11
18
  from Tasks import Manager
12
- from Hooks import bootup, profiling_info
19
+ from Hooks import bootup, profiling_info, enableESPNow
13
20
  from Network import auto_nw_config
14
21
  from Server import Server
15
22
  from Interrupts import enableInterrupt, enableCron, initEventIRQs
16
- from Debug import errlog_add
23
+ from Debug import syslog
17
24
 
18
25
 
19
26
  #################################################################
@@ -26,7 +33,7 @@ def irq_handler():
26
33
  enableCron()
27
34
  except Exception as e:
28
35
  print(f"[micrOS main] InterruptHandler.enableInterrupt/CronInterrupt error: {e}")
29
- errlog_add(f"[ERR] irq_handler error: {e}")
36
+ syslog(f"[ERR] irq_handler error: {e}")
30
37
 
31
38
 
32
39
  def external_irq_handler():
@@ -34,7 +41,7 @@ def external_irq_handler():
34
41
  initEventIRQs()
35
42
  except Exception as e:
36
43
  print(f"[micrOS main] InterruptHandler.initEventIRQs error: {e}")
37
- errlog_add(f"[ERR] external_irq_handler error: {e}")
44
+ syslog(f"[ERR] external_irq_handler error: {e}")
38
45
 
39
46
 
40
47
  #################################################################
@@ -53,7 +60,7 @@ def micrOS():
53
60
  bootup()
54
61
  except Exception as e:
55
62
  print(f"[micrOS main] Hooks.boot() error: {e}")
56
- errlog_add(f"[ERR] safe_boot: {e}")
63
+ syslog(f"[ERR] safe_boot: {e}")
57
64
 
58
65
  # NETWORK setup
59
66
  nwmd = auto_nw_config()
@@ -74,10 +81,13 @@ def micrOS():
74
81
 
75
82
  # [Server] as async task
76
83
  aio.create_task(Server().run_server(), tag='server')
77
- profiling_info(label='[memUsage] SYSTEM IS UP')
84
+
85
+ # [ESPNow] server as async task
86
+ enableESPNow()
87
+ profiling_info(label='[memUsage] SYSTEM IS UP AND RUNNING')
78
88
 
79
89
  # [EVENT LOOP] Start async event loop
80
90
  aio.run_forever()
81
91
 
82
92
  # UNEXPECTED RESTART ???
83
- errlog_add("[ERR] !!! Unexpected micrOS restart")
93
+ syslog("[ERR] !!! Unexpected micrOS restart")
@@ -1,5 +1,6 @@
1
1
  """
2
2
  Module is responsible for invoke micrOS or recovery webrepl mode
3
+ [IMPORTANT] This module must never use any micrOS specific functions in main scope.
3
4
 
4
5
  Designed by Marcell Ban aka BxNxM
5
6
  """
@@ -11,11 +12,6 @@ try:
11
12
  import traceback
12
13
  except:
13
14
  traceback = None
14
- try:
15
- from Debug import errlog_add
16
- except Exception as e:
17
- print(f"[loader] Import error: {e}")
18
- errlog_add = None
19
15
  from machine import reset
20
16
 
21
17
 
@@ -59,6 +55,8 @@ def _is_micrOS():
59
55
 
60
56
  def __recovery_mode():
61
57
  # Recovery/Update mode (webrepl) - dependencies: Network, ConfigHandler
58
+ from sys import path
59
+ path.insert(0, "/modules")
62
60
  from Network import auto_nw_config
63
61
  from Config import cfgget
64
62
  pwd = cfgget('appwd') # Get pwd from config
@@ -70,16 +68,13 @@ def __recovery_mode():
70
68
  import webrepl
71
69
  webrepl.start(password=pwd)
72
70
  except Exception as e:
73
- if callable(errlog_add):
74
- errlog_add(f"[ERR][micrOSloader] webrepl failed: {e}")
75
- print("[loader] Reset .if_mode to micros and reboot")
71
+ print(f"[loader] webrepl failed: {e} - Reset .if_mode to micros and reboot")
76
72
  with open('.if_mode', 'w') as f:
77
73
  f.write("micros")
78
74
  # Reboot machine
79
75
  reset()
80
76
 
81
77
 
82
-
83
78
  def __auto_restart_event():
84
79
  """
85
80
  Poll .if_mode value main loop in case of webrepl (background) mode:
@@ -107,7 +102,7 @@ def __auto_restart_event():
107
102
  if trigger_is_active and _is_micrOS():
108
103
  print("[loader][ota-rebooter][micros][trigger: True] OTA was finished - reboot")
109
104
  # Create cleanup indicator file for ConfigHandler
110
- with open('cleanup.pds', 'w') as f:
105
+ with open('.cleanup', 'w') as f:
111
106
  f.write('')
112
107
  # Reboot machine
113
108
  reset()
@@ -127,8 +122,6 @@ def main():
127
122
  # Handle micrOS system crash (never happened...but) -> webrepl mode default pwd: ADmin123
128
123
  print(f"[loader][main mode] micrOS start failed: {e}")
129
124
  print("[loader][main mode] -> [recovery mode]")
130
- if callable(errlog_add):
131
- errlog_add(f"[ERR][micrOSloader] start failed: {e}")
132
125
  # Recovery aka webrepl mode
133
126
  __recovery_mode()
134
127
  __auto_restart_event()
micrOS/source/microIO.py CHANGED
@@ -1,7 +1,8 @@
1
1
  """
2
- Module is responsible for board independent
3
- input/output handling dedicated to micrOS framework.
4
- - Hardware based pinout handling
2
+ This module manages board-independent input and output operations
3
+ for the micrOS framework, ensuring compatibility across different
4
+ microcontrollers.
5
+ - Handles hardware-based pin configurations.
5
6
 
6
7
  Designed by Marcell Ban aka BxNxM
7
8
  """
@@ -9,7 +10,8 @@ Designed by Marcell Ban aka BxNxM
9
10
  # IMPORTS #
10
11
  #################################################################
11
12
  from sys import platform
12
- from os import listdir
13
+ from uos import uname
14
+ from Files import ilist_fs, OSPath
13
15
  from Logger import syslog
14
16
 
15
17
  #################################################################
@@ -28,24 +30,25 @@ def detect_platform():
28
30
  """
29
31
  Unified platform detection for micrOS
30
32
  """
31
- if 'esp32' in platform:
32
- from os import uname
33
+ if 'esp32' in platform: # esp32 family
33
34
  board = str(uname()[-1]).lower()
34
35
  if 'tinypico' in board:
35
- return 'tinypico' # esp32 family - tinypico
36
+ return 'tinypico'
36
37
  if 'esp32s2' in board:
37
- return 'esp32s2' # esp32 family - esp32S2
38
+ return 'esp32s2'
38
39
  if 'esp32s3' in board:
39
- return 'esp32s3' # esp32 family - esp32s3
40
+ return 'esp32s3'
40
41
  if 'esp32c3' in board:
41
- return 'esp32c3' # esp32 family - esp32c3
42
- return 'esp32' # esp32 family - general
42
+ return 'esp32c3'
43
+ if 'esp32c6' in board:
44
+ return 'esp32c6'
45
+ return 'esp32' # esp32 family: general
43
46
  return platform # esp8266 or something else
44
47
 
45
48
 
46
49
  def set_pinmap(map_data=None):
47
50
  """
48
- Select pin map on device (init from ConfigHandler)
51
+ !Select pin map on device (init from ConfigHandler!!!)
49
52
  - map_data: default None (n/a), platform detection, like: esp32 -> IO_esp32.mpy
50
53
  - map_data: string input, like: my_pinmap -> IO_my_pinmap.mpy
51
54
  Parse map_data use cases:
@@ -65,18 +68,19 @@ def set_pinmap(map_data=None):
65
68
 
66
69
  # SELECT LOOKUP TABLE BASED ON PLATFORM / User input
67
70
  if isinstance(io_file, str) and io_file != 'n/a':
68
- if f"IO_{io_file}" in [io.split('.')[0] for io in listdir() if io.startswith('IO_')]:
71
+ if f"IO_{io_file}" in [io.split('.')[0] for io in ilist_fs(OSPath.MODULES, type_filter='f', select="IO")]:
69
72
  PinMap.MAPPING_LUT = io_file
70
73
  return PinMap.MAPPING_LUT
71
74
  PinMap.MAPPING_LUT = detect_platform()
72
75
  return PinMap.MAPPING_LUT
73
76
 
74
77
 
75
- def resolve_pin(tag):
78
+ def resolve_pin(tag:str) -> int:
76
79
  """
77
- Used in LoadModules
78
- tag - resolve pin name by logical name (like: switch_1)
80
+ DEPRECATED IN LoadModules - USE bind_pin(tag) wrapper instead
79
81
  This function implements IO allocation/booking (with overload protection)
82
+ - based on platform/custom IO_.py lookup table file
83
+ :parm tag: resolve pin name by logical name (like: switch_1)
80
84
  return: integer (pin number)
81
85
  """
82
86
  # Get pin number on platform by pin key/name
@@ -94,8 +98,9 @@ def resolve_pin(tag):
94
98
  return pin_num
95
99
 
96
100
 
97
- def register_pin(tag, number):
101
+ def register_pin(tag:str, number:int) -> int:
98
102
  """
103
+ DEPRECATED IN LoadModules - USE bind_pin(tag, number) wrapper instead
99
104
  Book pin (with overload protection) without IO_platform.py file editing
100
105
  :param tag: associated pin name for pin number
101
106
  :param number: pin number as integer
@@ -114,11 +119,30 @@ def register_pin(tag, number):
114
119
  return number
115
120
 
116
121
 
117
- def pinmap_info():
122
+ def bind_pin(tag, number=None) -> int:
123
+ """
124
+ Universal pin handler - assign+lock pin for a tag -> application
125
+ :param tag: tag for application pin booking with built-in tag detection from IO_<device>.py
126
+ :param number: optional parameter to overwrite default tag:pin relation
127
+ DO NOT HANDLE ERROR HERE - SUB ELEMENTS HAVE TO THROUGH ERROR INFO FOR LOAD MODULES
128
+ """
129
+ if number is None:
130
+ return resolve_pin(tag)
131
+ if isinstance(number, int):
132
+ return register_pin(tag, number)
133
+ raise Exception("microIO.allocate_pin number parameter must be integer!")
134
+
135
+
136
+ def pinmap_info(show_all=False) -> dict:
118
137
  """
119
138
  Debug info function to get active pinmap and booked IO-s
120
139
  """
121
- return {'map': PinMap.MAPPING_LUT, 'booked': PinMap.IO_USE_DICT, 'custom': PinMap.MAPPING}
140
+ inf = {'map': PinMap.MAPPING_LUT, 'booked': PinMap.IO_USE_DICT, 'custom': PinMap.MAPPING}
141
+ if show_all:
142
+ iomaps = list([iomap.replace("IO_", "").split(".")[0]
143
+ for iomap in ilist_fs(OSPath.MODULES, type_filter='f', select="IO")])
144
+ inf.update({"known_maps": iomaps})
145
+ return inf
122
146
 
123
147
 
124
148
  def pinmap_search(keys):
@@ -138,7 +162,7 @@ def pinmap_search(keys):
138
162
  return pins_cache
139
163
 
140
164
 
141
- def __resolve_pin(name):
165
+ def __resolve_pin(name:str):
142
166
  """
143
167
  Dynamic const lookup table handling by var name
144
168
  :param name: logical pin name, example: neop, dht, etc.
@@ -0,0 +1,38 @@
1
+ from micropython import const
2
+
3
+ """
4
+ Seeed Studio XIAO ESP32-C6
5
+
6
+ BOARD MICROPYTHON
7
+ D0/A0 - GPIO 0
8
+ D1/A1 - GPIO 1
9
+ D2/A2 - GPIO 2
10
+ D3 - GPIO 21
11
+ D4 SDA - GPIO 22
12
+ D5 SCL - GPIO 23
13
+ D6 TX0 - GPIO 16
14
+ D7 RX0 - GPIO 17
15
+ D8 SCK - GPIO 19
16
+ D9 MISO - GPIO 20
17
+ D10 MOSI - GPIO 18
18
+ BUILTIN LED - GPIO 15
19
+ """
20
+
21
+ # BUILTIN LED
22
+ builtin = const(-15) # BUILT IN LED - progress_led
23
+
24
+
25
+ # I2C BUS
26
+ i2c_sda = const(22) # D4 - data
27
+ i2c_scl = const(23) # D5 - clock
28
+
29
+
30
+ # EXTERNAL EVENT IRQ
31
+ irq1 = const(21) # D3 - event irq1 pin
32
+ irq2 = const(2) # D2 - event irq2 pin
33
+ irq3 = const(1) # D1 - event irq3 pin
34
+ irq4 = const(0) # D0 - event irq4 pin
35
+
36
+
37
+ neop = const(18) # D10 - neopixel OneWire bus [PWM]
38
+
@@ -1,7 +1,43 @@
1
1
  from micropython import const
2
2
 
3
+ #### DEFINE CUSTOM PROGRESS LED LOGIC ####
4
+ class WS2812:
5
+ NEOPIXEL = None
6
+ WHEEL = None
7
+ PIN = const(38) # BUILT IN LED - progress_led
8
+
9
+ try:
10
+ # init ws2812
11
+ from machine import Pin
12
+ from neopixel import NeoPixel
13
+ WS2812.NEOPIXEL = NeoPixel(Pin(WS2812.PIN), 1)
14
+ except Exception as e:
15
+ print(f"[Error] IO error, esp21se ws2812: {e}")
16
+
17
+
18
+ def _step_ws2812(pin=False):
19
+ if pin:
20
+ return WS2812.PIN
21
+
22
+ def _color_wheel():
23
+ while True:
24
+ yield 10, 0, 0
25
+ yield 5, 5, 0
26
+ yield 0, 10, 0
27
+ yield 0, 5, 5
28
+ yield 0, 0, 10
29
+ yield 5, 0, 5
30
+
31
+ if WS2812.WHEEL is None:
32
+ WS2812.WHEEL = _color_wheel()
33
+ WS2812.NEOPIXEL[0] = next(WS2812.WHEEL)
34
+ WS2812.NEOPIXEL.write()
35
+ return True # No double-blink
36
+
37
+ #######################################
38
+
3
39
  # BUILTIN LED
4
- builtin = const(38) # BUILT IN LED - progress_led
40
+ builtin = _step_ws2812 # BUILT IN LED - progress_led
5
41
 
6
42
  # ANALOG RGB + WW + CW
7
43
  redgb = const(37) # - rgb red channel [PWM]
@@ -1,7 +1,41 @@
1
1
  from micropython import const
2
2
 
3
+ #### DEFINE CUSTOM PROGRESS LED LOGIC ####
4
+ class WS2812:
5
+ NEOPIXEL = None
6
+ WHEEL = None
7
+ PIN = const(21) # BUILT IN LED - progress_led
8
+
9
+ try:
10
+ # init ws2812
11
+ from machine import Pin
12
+ from neopixel import NeoPixel
13
+ WS2812.NEOPIXEL = NeoPixel(Pin(WS2812.PIN), 1)
14
+ except Exception as e:
15
+ print(f"[Error] IO error, esp21se ws2812: {e}")
16
+
17
+
18
+ def _step_ws2812(pin=False):
19
+ if pin:
20
+ return WS2812.PIN
21
+
22
+ def _color_wheel():
23
+ while True:
24
+ yield 10, 0, 0
25
+ yield 5, 5, 0
26
+ yield 0, 10, 0
27
+ yield 0, 5, 5
28
+ yield 0, 0, 10
29
+ yield 5, 0, 5
30
+
31
+ if WS2812.WHEEL is None:
32
+ WS2812.WHEEL = _color_wheel()
33
+ WS2812.NEOPIXEL[0] = next(WS2812.WHEEL)
34
+ WS2812.NEOPIXEL.write()
35
+ return True # No double-blink
36
+
3
37
  # BUILTIN LED
4
- builtin = const(21) # BUILT IN LED - progress_led
38
+ builtin = _step_ws2812 # BUILT IN LED - progress_led
5
39
 
6
40
  # ANALOG RGB + WW + CW
7
41
  redgb = const(43) # - rgb red channel [PWM]
@@ -1,20 +1,26 @@
1
1
  from micropython import const
2
- from machine import Pin
3
-
4
2
 
5
3
  #### DEFINE CUSTOM PROGRESS LED LOGIC ####
4
+ class WS2812:
5
+ NEOPIXEL = None
6
+ WHEEL = None
7
+ PIN = const(5) # BUILT IN LED - progress_led
8
+ PIN_ENABLE = const(8) # Power ON LED
9
+
6
10
  try:
11
+ # init ws2812
7
12
  from neopixel import NeoPixel
8
- Pin(8, Pin.OUT).value(1) # Power ON LED
9
- PLED_OBJ = NeoPixel(Pin(5), 1) # Init neopixel
10
- NEO_WHEEL = None
13
+ from machine import Pin
14
+ Pin(WS2812.PIN_ENABLE, Pin.OUT).value(1) # Power ON LED
15
+ WS2812.NEOPIXEL = NeoPixel(Pin(WS2812.PIN), 1) # BUILT IN LED - progress_led
11
16
  except Exception as e:
12
- print(f"[PLED CUSTOM] ws2812 error: {e}")
13
- PLED_OBJ = None
17
+ print(f"[Error] IO error, esp21se ws2812: {e}")
18
+
14
19
 
20
+ def _step_ws2812(pin=False):
21
+ if pin:
22
+ return WS2812.PIN
15
23
 
16
- def _step_ws2812():
17
- global PLED_OBJ, NEO_WHEEL
18
24
  def _color_wheel():
19
25
  while True:
20
26
  yield 10, 0, 0
@@ -23,15 +29,14 @@ def _step_ws2812():
23
29
  yield 0, 5, 5
24
30
  yield 0, 0, 10
25
31
  yield 5, 0, 5
26
- if PLED_OBJ is None:
27
- return False
28
- if NEO_WHEEL is None:
29
- NEO_WHEEL = _color_wheel()
30
- PLED_OBJ[0] = next(NEO_WHEEL)
31
- PLED_OBJ.write()
32
- return True
33
- ###########################################
34
32
 
33
+ if WS2812.WHEEL is None:
34
+ WS2812.WHEEL = _color_wheel()
35
+ WS2812.NEOPIXEL[0] = next(WS2812.WHEEL)
36
+ WS2812.NEOPIXEL.write()
37
+ return True # No double-blink
38
+
39
+ ###########################################
35
40
 
36
41
  # BUILTIN LED
37
42
  builtin = _step_ws2812
@@ -1,5 +1,43 @@
1
1
  from micropython import const
2
2
 
3
+ #### DEFINE CUSTOM PROGRESS LED LOGIC ####
4
+ class APA102:
5
+ DOTSTAR = None
6
+ COLOR_WHEEL = None
7
+ COLOR_INDEX:int = 0
8
+
9
+ try:
10
+ # init apa102
11
+ from machine import Pin
12
+ from machine import SoftSPI
13
+ from dotstar import DotStar
14
+ from tinypico import DOTSTAR_CLK, DOTSTAR_DATA, SPI_MISO, set_dotstar_power, dotstar_color_wheel
15
+ spi = SoftSPI(sck=Pin(DOTSTAR_CLK), mosi=Pin(DOTSTAR_DATA), miso=Pin(SPI_MISO))
16
+ # Create a DotStar instance
17
+ APA102.DOTSTAR = DotStar(spi, 1, brightness=0.4) # Just one DotStar, half brightness
18
+ # Turn on the power to the DotStar
19
+ set_dotstar_power(True)
20
+ APA102.COLOR_WHEEL = dotstar_color_wheel
21
+ except Exception as e:
22
+ print(f"[Error] IO error, tinypico apa102: {e}")
23
+
24
+ def _step_apa102(pin=False):
25
+ if pin:
26
+ return None
27
+ # Get the R,G,B values of the next colour
28
+ r, g, b = APA102.COLOR_WHEEL(APA102.COLOR_INDEX*2)
29
+ # Set the colour on the DOTSTAR
30
+ APA102.DOTSTAR[0] = (int(r * 0.6), g, b, 0.4)
31
+ # Increase the wheel index
32
+ APA102.COLOR_INDEX = 0 if APA102.COLOR_INDEX > 1000 else APA102.COLOR_INDEX + 2
33
+ return True # No double-blink
34
+
35
+ ###################################################
36
+
37
+
38
+ # BUILTIN LED
39
+ builtin = _step_apa102
40
+
3
41
  # ANALOG RGB + WW + CW
4
42
  redgb = const(25) # D25 - rgb red channel [PWM CH1]
5
43
  rgreenb = const(26) # D26 - rgb green channel [PWM CH2]