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,86 @@
1
+ from micropython import const
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
+
37
+ # BUILTIN LED
38
+ builtin = _step_ws2812 # BUILT IN LED - progress_led
39
+
40
+ # ANALOG RGB + WW + CW
41
+ redgb = const(43) # - rgb red channel [PWM]
42
+ rgreenb = const(44) # - rgb green channel [PWM]
43
+ rgbue = const(0) # - rgb blue channel [PWM]
44
+
45
+ wwhite = const(39) # - warm white [PWM]
46
+ cwhite = const(40) # - cold white [PWM]
47
+
48
+ # DIGITAL LED
49
+ neop = const(0) # - neopixel OneWire bus [PWM]
50
+
51
+ # ACTUATORS
52
+ servo_1 = const(44) # - servo(1) [PWM]
53
+ servo_2 = const(42) # - servo(2) [PWM]
54
+
55
+ switch_1 = const(39) # - switch(1) [simple]
56
+ switch_2 = const(40) # - switch(2) [simple]
57
+ switch_3 = const(41) # - switch(3) [simple]
58
+ switch_4 = const(16) # - switch(4) [simple]
59
+
60
+ dim_1 = const(43) # - dimmer(1) [PWM]
61
+
62
+ buzzer = const(1) # - Buzzer pin - sound generator
63
+
64
+ # I2C BUS
65
+ i2c_sda = const(13) # - oled - data
66
+ i2c_scl = const(15) # - oled - clock
67
+ # I2S BUS
68
+ i2s_sck = const(5) # Serial clock
69
+ i2s_ws = const(7) # Word select
70
+ i2s_sd = const(9) # Serial data
71
+
72
+
73
+ # EXTERNAL EVENT IRQ
74
+ irq1 = const(15) # - event irq pin
75
+ irq2 = const(13) # - event irq pin
76
+ irq3 = const(14) # - event irq pin
77
+ irq4 = const(12) # - event irq pin
78
+
79
+ touch_0 = const(1) # - touch sensor TODO
80
+
81
+ # SENSORS
82
+ hcsrtrig = const(1) # - distance HCSR04 trigger pin
83
+ hcsrecho = const(3) # - distance HCSR04 echo pin
84
+ dhtpin = const(43) # - dht_pin 11 and 22
85
+ ds18 = const(0) # - DS18B20 - temp. sensor
86
+ mic = const(3) # - [ADC] microphone
@@ -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}")
14
18
 
15
19
 
16
- def _step_ws2812():
17
- global PLED_OBJ, NEO_WHEEL
20
+ def _step_ws2812(pin=False):
21
+ if pin:
22
+ return WS2812.PIN
23
+
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
@@ -77,7 +82,12 @@ irq1 = const(13) # MO - event irq pin
77
82
  irq2 = const(12) # MI - event irq pin
78
83
  irq3 = const(14) # SCK - event irq pin
79
84
  irq4 = const(7) # TX - event irq pin
80
- oleduibttn = const(32) # TX - oled_ui center/ok button
85
+
86
+ js_right = const(13) # oled_ui joystick
87
+ js_left = const(12)
88
+ js_up = const(14)
89
+ js_down = const(7)
90
+ js_press = const(32) # oled_ui center/ok button
81
91
 
82
92
 
83
93
  # SENSORS
@@ -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]
@@ -9,7 +47,7 @@ wwhite = const(15) # D15 - warm white [PWM CH4]
9
47
  cwhite = const(14) # D14 - cold white [PWM CH5]
10
48
 
11
49
  # DIGITAL LED
12
- neop = const(23) # D23 - WS2812 - neopixel OneWire bus [PWM]
50
+ neop = const(26) # D26 - WS2812 - neopixel OneWire bus [PWM]
13
51
 
14
52
 
15
53
  # ACTUATORS
@@ -28,12 +66,14 @@ l298dir_2 = const(19) # D19 - DC motor direction (2)
28
66
  l9110dir_1 = const(18) # D18 - DC motor direction (1)
29
67
  l9110dir_2 = const(19) # D25 - DC motor direction (2)
30
68
 
31
- buzzer = const(18) # D18 - Buzzer pin - sound generator
69
+ buzzer = const(33) # D33 - Buzzer pin - sound generator
70
+ haptic = const(32) # D32 - Haptic - vibration motor
32
71
 
33
72
 
34
73
  # I2C BUS
35
74
  i2c_sda = const(21) # D22 - data
36
75
  i2c_scl = const(22) # D21 - clock
76
+ trackball_int = const(25) # D25 - event interrupt
37
77
 
38
78
 
39
79
  # EXTERNAL EVENT IRQ
@@ -41,7 +81,12 @@ irq1 = const(5) # D5 - event irq pin
41
81
  irq2 = const(18) # D18 - event irq pin
42
82
  irq3 = const(19) # D19 - event irq pin
43
83
  irq4 = const(23) # D23 - event irq pin
44
- oleduibttn = const(32) # D32 - oled_ui center/ok button
84
+
85
+ js_right = const(23) # oled_ui joystick
86
+ js_left = const(5)
87
+ js_up = const(18)
88
+ js_down = const(19)
89
+ js_press = const(32) # oled_ui center/ok button
45
90
 
46
91
  touch_0 = const(32) # D32 - builtin touch sensor TODO
47
92
 
@@ -0,0 +1,161 @@
1
+ from machine import Pin, PWM
2
+ from microIO import bind_pin, pinmap_search
3
+
4
+
5
+ # Cache of last set motor speeds (motor1, motor2) to ensure state() reports the latest values
6
+ # even if hardware PWM duty readout is delayed or unsupported on some boards
7
+ __MOTOR_SPEEDS = [0, 0] # motor1, motor2
8
+ __L298N_OBJS = []
9
+
10
+ PWM_FREQ = 50
11
+ # Deprecated LM_L298N_DCmotor: l298speed, l298dir_1, l298dir_2
12
+ PIN_BINDINGS = [
13
+ ('l298n_ENA', 10), ('l298n_INA', 12), ('l298n_INB', 11), # motor 1
14
+ ('l298n_ENB', 3), ('l298n_INC', 9), ('l298n_IND', 40), # motor 2
15
+ ]
16
+ STATE_MAP = {
17
+ (1, 0): 'forward',
18
+ (0, 1): 'backward',
19
+ (0, 0): 'coast',
20
+ (1, 1): 'brake'
21
+ }
22
+
23
+
24
+ def __l298n_init():
25
+ global __L298N_OBJS
26
+ if not __L298N_OBJS:
27
+ for index, (name, pin) in enumerate(PIN_BINDINGS):
28
+ if index % 3 == 0: # PWM pin
29
+ pwm = PWM(bind_pin(name, pin), freq=PWM_FREQ)
30
+ pwm.duty(0)
31
+ __L298N_OBJS.append(pwm)
32
+ else:
33
+ p = Pin(bind_pin(name, pin), Pin.OUT)
34
+ p.value(0)
35
+ __L298N_OBJS.append(p)
36
+ return __L298N_OBJS
37
+
38
+
39
+ def __get_motor_state(motor_index):
40
+ objlist = __l298n_init()
41
+ pwm_index = motor_index * 3
42
+ in1, in2 = objlist[pwm_index + 1].value(), objlist[pwm_index + 2].value()
43
+ state = STATE_MAP.get((in1, in2), 'unknown')
44
+ return {'speed': __MOTOR_SPEEDS[motor_index], 'state': state}
45
+
46
+
47
+ #########################
48
+ # Application functions #
49
+ #########################
50
+
51
+ def load(pwm_freq:int=None):
52
+ """
53
+ [i] micrOS LM naming convention
54
+ Load the L298N motor driver module
55
+ """
56
+ global PWM_FREQ
57
+ if pwm_freq is not None:
58
+ PWM_FREQ = pwm_freq
59
+ __l298n_init()
60
+ return "Motor driver loaded successfully."
61
+
62
+
63
+ def state(motor=0):
64
+ """
65
+ [i] micrOS LM naming convention
66
+ Get the current state of a motor or all motors
67
+ :param motor: Motor number (1 or 2) or None for all motors
68
+ """
69
+ if motor == 1:
70
+ return {'motor1': __get_motor_state(0)}
71
+ elif motor == 2:
72
+ return {'motor2': __get_motor_state(1)}
73
+ else:
74
+ return {
75
+ 'motor1': __get_motor_state(0),
76
+ 'motor2': __get_motor_state(1)
77
+ }
78
+
79
+
80
+ def _control_motor(motor, in1, in2):
81
+ objlist = __l298n_init()
82
+ motor_index = 0 if motor == 1 else 3
83
+ objlist[motor_index + 1].value(in1)
84
+ objlist[motor_index + 2].value(in2)
85
+
86
+
87
+ def speed(motor, speed:int=1023):
88
+ """
89
+ Set the speed of a motor
90
+ :param motor: Motor number (1 or 2)
91
+ :param speed: Speed value (0-1023)
92
+ :return: Current motor state
93
+ """
94
+ if not (0 <= speed <= 1023):
95
+ return {'speed': 'value range error'}
96
+ pwm_index = 0 if motor == 1 else 3
97
+ motor_index = 0 if motor == 1 else 1
98
+ __l298n_init()[pwm_index].duty(speed)
99
+ __MOTOR_SPEEDS[motor_index] = speed
100
+ return state(motor)
101
+
102
+
103
+ def direction(motor, forward: bool=True):
104
+ """
105
+ Set the direction of a motor
106
+ :param motor: Motor number (1 or 2)
107
+ :param forward: True if motor should move forward, False if backward
108
+ :return: Current motor state
109
+ """
110
+ _control_motor(motor, 1 if forward else 0, 0 if forward else 1)
111
+ return state(motor)
112
+
113
+
114
+ def coast(motor):
115
+ """
116
+ Coast the motor
117
+ :param motor: Motor number (1 or 2)
118
+ """
119
+ _control_motor(motor, 0, 0)
120
+ return state(motor)
121
+
122
+
123
+ def brake(motor):
124
+ """
125
+ Brake the motor
126
+ :param motor: Motor number (1 or 2)
127
+ :return: Current motor state
128
+ """
129
+ _control_motor(motor, 1, 1)
130
+ return state(motor)
131
+
132
+
133
+ #######################
134
+ # LM helper functions #
135
+ #######################
136
+
137
+ def pinmap():
138
+ """
139
+ [i] micrOS LM naming convention
140
+ Shows logical pins - pin number(s) used by this Load module
141
+ - info which pins to use for this application
142
+ :return dict: pin name (str) - pin value (int) pairs
143
+ """
144
+ return pinmap_search([name for name, _ in PIN_BINDINGS])
145
+
146
+
147
+ def help(widgets=False):
148
+ """
149
+ [i] micrOS LM naming convention - built-in help message
150
+ :return tuple:
151
+ (widgets=False) list of functions implemented by this application
152
+ (widgets=True) list of widget json for UI generation
153
+ """
154
+ return (
155
+ 'speed motor=<1/2> speed=<0-1023>',
156
+ 'direction motor=<1/2> forward=<True/False>',
157
+ 'coast motor=<1/2>',
158
+ 'brake motor=<1/2>',
159
+ 'state motor=<0/1/2>',
160
+ 'pinmap'
161
+ )
@@ -1,4 +1,4 @@
1
- from microIO import physical_pin, pinmap_dump
1
+ from microIO import bind_pin, pinmap_search
2
2
 
3
3
  #########################################
4
4
  # ANALOG DIMMER CONTROLLER PARAMS #
@@ -15,8 +15,8 @@ def __l9110_init():
15
15
  global __L9110_OBJS
16
16
  if len(__L9110_OBJS) == 0:
17
17
  from machine import Pin, PWM
18
- __L9110_OBJS.append(PWM(Pin(physical_pin('l9110dir_1')), freq=1024))
19
- __L9110_OBJS.append(PWM(Pin(physical_pin('l9110dir_2')), freq=1024))
18
+ __L9110_OBJS.append(PWM(Pin(bind_pin('l9110dir_1')), freq=1024))
19
+ __L9110_OBJS.append(PWM(Pin(bind_pin('l9110dir_2')), freq=1024))
20
20
  __L9110_OBJS[0].duty(0) # Set default speed (PWM)
21
21
  __L9110_OBJS[1].duty(0) # Set default speed (PWM)
22
22
  return __L9110_OBJS
@@ -45,7 +45,7 @@ def pinmap():
45
45
  - info which pins to use for this application
46
46
  :return dict: pin name (str) - pin value (int) pairs
47
47
  """
48
- return pinmap_dump(['l9110dir_1', 'l9110dir_2'])
48
+ return pinmap_search(['l9110dir_1', 'l9110dir_2'])
49
49
 
50
50
 
51
51
  def help(widgets=False):
@@ -2,9 +2,9 @@ try:
2
2
  import camera
3
3
  except Exception as e:
4
4
  camera = None
5
- import time
6
- from Debug import console_write
7
- from Common import rest_endpoint, syslog
5
+ from time import localtime, sleep
6
+ from json import loads
7
+ from Common import web_endpoint, syslog, exec_cmd
8
8
  from Types import resolve
9
9
 
10
10
  IN_CAPTURE = False # Make sure single capture in progress in the same time
@@ -12,7 +12,7 @@ CAM_INIT = False
12
12
  FLASH_LIGHT = None # Flashlight object
13
13
 
14
14
 
15
- def load_n_init(quality='medium', freq='default', effect="NONE"):
15
+ def load(quality='medium', freq='default', effect="NONE"):
16
16
  """
17
17
  Load Camera module OV2640
18
18
  :param quality: high (HD), medium (SVGA), low (240x240)
@@ -30,7 +30,7 @@ def load_n_init(quality='medium', freq='default', effect="NONE"):
30
30
  return CAM_INIT
31
31
 
32
32
  for cnt in range(0, 3):
33
- console_write(f"Init OV2640 cam {cnt+1}/3")
33
+ print(f"Init OV2640 cam {cnt+1}/3")
34
34
  try:
35
35
  # ESP32-CAM (default configuration) - https://bit.ly/2Ndn8tN
36
36
  if freq.strip().lower() == 'high':
@@ -45,7 +45,7 @@ def load_n_init(quality='medium', freq='default', effect="NONE"):
45
45
  except Exception as e:
46
46
  syslog(f"[ERR] OV2640: {e}")
47
47
  camera.deinit()
48
- time.sleep(1)
48
+ sleep(1)
49
49
  if not CAM_INIT:
50
50
  return "Cannot init OV2640 cam"
51
51
 
@@ -56,8 +56,10 @@ def load_n_init(quality='medium', freq='default', effect="NONE"):
56
56
 
57
57
  def _set_web_endpoints():
58
58
  # Register rest endpoint
59
- rest_endpoint('cam/snapshot', _snapshot_clb)
60
- rest_endpoint('cam/stream', _image_stream_clb)
59
+ web_endpoint('cam/snapshot', _snapshot_clb)
60
+ web_endpoint('cam/stream', _image_stream_clb)
61
+ web_endpoint('cam/photo', lambda: ('text/plain', photo()))
62
+ return "Endpoint created: /cam/snapshot, /cam/stream, /cam/photo"
61
63
 
62
64
 
63
65
  def settings(quality=None, flip=None, mirror=None, effect=None, saturation=None, brightness=None, contrast=None, whitebalace=None, q=None):
@@ -138,7 +140,7 @@ def settings(quality=None, flip=None, mirror=None, effect=None, saturation=None,
138
140
  def capture():
139
141
  if camera is None:
140
142
  return "Non supported feature - use esp32cam image!"
141
- load_n_init()
143
+ load()
142
144
  global IN_CAPTURE
143
145
  # Capture image
144
146
  buf = False
@@ -153,24 +155,54 @@ def capture():
153
155
  if buf:
154
156
  break
155
157
  n_try += 1
156
- time.sleep(0.1)
158
+ sleep(0.1)
157
159
  except Exception as e:
158
160
  syslog(f"[OV2640] Failed to capture: {e}")
159
161
  IN_CAPTURE = False
160
162
  return buf
161
163
 
162
164
 
163
- def photo(name='photo.jpg'):
164
- buf = capture()
165
- with open(name, 'w') as f:
165
+ def photo(name='photo.jpeg'):
166
+ """
167
+ Beta feature - with storage limit
168
+ Create photo and save it under /web/<user_data>
169
+ """
170
+ def _storage_check(storage_limit=60):
171
+ _status, _usage = exec_cmd(cmd=['fileserver', '_disk_usage_clb'], jsonify=False, secure=True)
172
+ if not _status:
173
+ return False, f"Cannot get storage info: {_usage}"
174
+ # Eval hack to be able to reuse web endpoint callback for disk usage
175
+ usage = loads(str(eval(_usage)[-1]))
176
+ usage_percent = int((usage.get("used", 0) / (usage.get("free", 0) + usage.get("used", 0))) * 100)
177
+ print(usage_percent)
178
+ if usage_percent > storage_limit:
179
+ return False, f"Storage is full < {storage_limit}%"
180
+ return True, ""
181
+
182
+ status, path = exec_cmd(cmd=['fileserver', 'get_user_dir'], jsonify=False, secure=True)
183
+ if not status:
184
+ return "No shared path available: fileserver get_user_dir"
185
+ s, v = _storage_check()
186
+ if not s:
187
+ return v
188
+ t = localtime()
189
+ ts = "{:02d}{:02d}{:02d}-{:02d}{:02d}{:02d}".format(t[0] % 100, t[1], t[2], t[3], t[4], t[5])
190
+ # Create file name with time stamp
191
+ photo_path = f"{path}/{ts}-{name}"
192
+ # Take a Photo
193
+ _ = capture() # Dump current cached image
194
+ buf = capture() # Create new image
195
+ # Save the Photo
196
+ with open(photo_path, 'wb') as f:
166
197
  if buf:
167
198
  f.write(buf)
168
- return "Image saved as photo.jpg"
169
- return "Cannot save... photo.jpg"
199
+ return f"Image saved as {photo_path}"
200
+ return f"Cannot save... {photo_path}"
170
201
 
171
202
 
172
203
  def _snapshot_clb():
173
- image = capture()
204
+ _ = capture() # Dump current cached image
205
+ image = capture() # Take new image
174
206
  if image is not None:
175
207
  return 'image/jpeg', image
176
208
  return 'text/plain', f'capture error: {image}'
@@ -180,21 +212,7 @@ def _image_stream_clb():
180
212
  return 'multipart/x-mixed-replace', {'callback': capture, 'content-type': 'image/jpeg'}
181
213
 
182
214
 
183
- def _img_clb(name="photo.jpg"):
184
- with open(name, 'rb') as f:
185
- image = f.read()
186
- return 'image/jpeg', image
187
-
188
-
189
- def set_photo_endpoint():
190
- """
191
- Set photo endpoint (rest endpoint)
192
- """
193
- rest_endpoint('photo', _img_clb)
194
- return "Endpoint created: /photo"
195
-
196
-
197
- def __light_init():
215
+ def _light_init():
198
216
  global FLASH_LIGHT
199
217
  if FLASH_LIGHT is None:
200
218
  from machine import Pin
@@ -206,20 +224,13 @@ def flashlight(state=None):
206
224
  Camera flashlight
207
225
  :param state: True/False/None(automatic)
208
226
  """
209
- fl = __light_init()
227
+ fl = _light_init()
210
228
  if state is None:
211
229
  state = fl.value(not fl.value())
212
230
  else:
213
231
  state = fl.value(state)
214
232
  return {'S': state}
215
233
 
216
- def lmdep():
217
- """
218
- Show Load Module dependency
219
- - List of load modules used by this application
220
- :return: tuple
221
- """
222
- return 'dashboard_be'
223
234
 
224
235
  def help(widgets=False):
225
236
  """
@@ -228,14 +239,14 @@ def help(widgets=False):
228
239
  (widgets=False) list of functions implemented by this application
229
240
  (widgets=True) list of widget json for UI generation
230
241
  """
231
- return resolve(('load_n_init quality="medium/low/high" freq="default/high"',
242
+ return resolve(('load quality="medium/low/high" freq="default/high"',
232
243
  'settings quality=None flip=None mirror=None effect="NONE"',
233
244
  'SLIDER settings saturation=<0-100>',
234
245
  'SLIDER settings brightness=<0-100>',
235
246
  'SLIDER settings contrast=<0-100>',
247
+ 'BUTTON settings effect=<NONE,NEG,BW,RED,GREEN,BLUE,RETRO>',
236
248
  'capture',
237
249
  'photo',
238
- 'set_photo_endpoint',
239
250
  'BUTTON flashlight state=None',
240
- '[Hint] after load_n_init you can access the /cam/snapshot and /cam/stream endpoints',
251
+ '[Hint] after load you can access the /cam/snapshot and /cam/stream endpoints',
241
252
  'Thanks to :) https://github.com/lemariva/micropython-camera-driver'), widgets=widgets)
@@ -2,7 +2,7 @@ from micropython import const
2
2
  import ustruct
3
3
  import utime
4
4
  from machine import I2C, Pin
5
- from microIO import physical_pin, pinmap_dump
5
+ from microIO import bind_pin, pinmap_search
6
6
 
7
7
  __TOF_OBJ = None
8
8
 
@@ -31,7 +31,7 @@ class TimeoutError(RuntimeError):
31
31
 
32
32
  class VL53L0X:
33
33
  def __init__(self, address=57):
34
- self.i2c = I2C(-1, Pin(physical_pin('i2c_scl')), Pin(physical_pin('i2c_sda')), freq=9600)
34
+ self.i2c = I2C(-1, Pin(bind_pin('i2c_scl')), Pin(bind_pin('i2c_sda')), freq=9600)
35
35
  self.address = address
36
36
  self.init()
37
37
  self._started = False
@@ -343,7 +343,7 @@ class VL53L0X:
343
343
 
344
344
  def measure():
345
345
  """
346
- Experimental
346
+ Experimental - Time of Flight Distance Sensor
347
347
  """
348
348
  global __TOF_OBJ
349
349
  if __TOF_OBJ is None:
@@ -365,12 +365,12 @@ def pinmap():
365
365
  - info which pins to use for this application
366
366
  :return dict: pin name (str) - pin value (int) pairs
367
367
  """
368
- return pinmap_dump(['i2c_scl', 'i2c_sda'])
368
+ return pinmap_search(['i2c_scl', 'i2c_sda'])
369
369
 
370
370
 
371
371
  def help(widgets=False):
372
372
  """
373
- [i] micrOS LM naming convention - built-in help message
373
+ [BETA][i] micrOS LM naming convention - built-in help message
374
374
  :return tuple:
375
375
  (widgets=False) list of functions implemented by this application
376
376
  (widgets=True) list of widget json for UI generation