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
@@ -1,8 +1,7 @@
1
1
  from threading import Thread
2
2
  import time
3
3
  import micropython
4
- from sim_console import console
5
- import sys
4
+ from sim_common import console
6
5
 
7
6
 
8
7
  def machine(*args, **kwargs):
@@ -153,6 +152,10 @@ class I2C:
153
152
  console(f"[I2C readfrom_mem] scl: {self.scl} sda: {self.sda} freq: {self.freq} addr: {address} reg: {register} byte: {byte}")
154
153
  return b'00000000'
155
154
 
155
+ def scan(self):
156
+ # Test data: trackball, oled
157
+ return [0x0A, 0x3c]
158
+
156
159
 
157
160
  class I2S:
158
161
  MONO = 0
@@ -169,12 +172,35 @@ class SoftI2C(I2C):
169
172
  def __init__(self, scl, sda, freq=None):
170
173
  super().__init__(scl, sda, freq)
171
174
 
175
+ def writevto(self, *args, **kwargs):
176
+ pass
177
+
172
178
 
173
179
  class SoftSPI:
174
180
  def __init__(self, sck, mosi, miso):
175
181
  pass
176
182
 
177
183
 
184
+ class UART:
185
+
186
+ def __init__(self, pin, baudrate, tx, rx, timeout=1):
187
+ pass
188
+
189
+ def init(self, *args, **kwargs):
190
+ pass
191
+
192
+ def deinit(self):
193
+ pass
194
+
195
+ def write(self, frame):
196
+ pass
197
+
198
+ def read(self, *args, **kwargs):
199
+ pass
200
+
201
+ def any(self):
202
+ return False
203
+
178
204
  def freq(*args, **kwargs):
179
205
  return 1
180
206
 
@@ -199,3 +225,7 @@ def unique_id():
199
225
 
200
226
  def time_pulse_us():
201
227
  return time.time_ns()*1000
228
+
229
+
230
+ def SDCard():
231
+ pass
@@ -1,4 +1,4 @@
1
- from sim_console import console
1
+ from sim_common import console
2
2
  try:
3
3
  import resource
4
4
  except Exception as e:
@@ -25,8 +25,8 @@ def mem_info(*args, **kwargs):
25
25
  return total_heap, used_heap, free_heap
26
26
 
27
27
 
28
- def const(*args):
29
- return args
28
+ def const(arg):
29
+ return arg
30
30
 
31
31
 
32
32
  def schedule(callback, arg):
@@ -0,0 +1,165 @@
1
+ #!/usr/bin/env python3
2
+
3
+ try:
4
+ from sim_common import console
5
+ except:
6
+ console = print
7
+ from pathlib import Path
8
+ from urllib.parse import urlparse
9
+ from urllib.request import urlopen, Request
10
+ import json
11
+
12
+
13
+ def _guess_url_is_file(url):
14
+
15
+ # 1. URL path contains a filename-like pattern
16
+ url_content = Path(urlparse(url).path).name
17
+ if "." in url_content:
18
+ return True
19
+
20
+ # 2. HEAD request content-type
21
+ try:
22
+ with urlopen(Request(url, method="HEAD")) as resp:
23
+ ctype = resp.headers.get("Content-Type", "")
24
+ if not ctype.startswith("text/html"):
25
+ return True
26
+ except Exception as e:
27
+ if "404" in str(e) or "400" in str(e):
28
+ return False
29
+
30
+ # 4. GET small chunk and detect HTML
31
+ try:
32
+ with urlopen(url) as resp:
33
+ chunk = resp.read(256).lower()
34
+ if b"<html" in chunk:
35
+ return False
36
+ except:
37
+ pass
38
+
39
+ # last fallback: treat as file if unsure
40
+ return True
41
+
42
+
43
+ def _url_file_content(url):
44
+ data = ""
45
+ try:
46
+ with urlopen(url) as resp:
47
+ data = resp.read()
48
+ except Exception as e:
49
+ print()
50
+ console(f"❌ Failed to read {url}: {e}")
51
+ return data
52
+
53
+
54
+ def _save_file(path, data):
55
+ try:
56
+ # Write as binary
57
+ with open(path, "wb") as f:
58
+ f.write(data)
59
+ print(f"✅ Saved {path.parent.name}/{path.name}")
60
+ return True
61
+ except Exception as e:
62
+ console(f"Failed to save {path}: {e}")
63
+ return False
64
+
65
+
66
+ def _github_to_url(ref, branch="master"):
67
+ if ref.startswith("github"):
68
+ """
69
+ Convert: github:peterhinch/micropython-mqtt
70
+ https://raw.githubusercontent.com/peterhinch/micropython-mqtt/refs/heads/master/mqtt_as/clean.py
71
+ To: https://raw.githubusercontent.com/peterhinch/micropython-mqtt/refs/heads/master/XXX
72
+ """
73
+ base_github_url = "https://raw.githubusercontent.com"
74
+ _parts = ref.split("/")
75
+ user = _parts[0].split(":")[-1]
76
+ repo = _parts[1]
77
+ file_path = "/".join(_parts[2:])
78
+ branch = f"refs/heads/{branch}"
79
+ if "." in file_path:
80
+ # File mode - Build raw URL
81
+ ref = f"{base_github_url}/{user}/{repo}/{branch}/{file_path}"
82
+ else:
83
+ # Folder mode - Build raw URL
84
+ ref = f"{base_github_url}/{user}/{repo}/{branch}/{file_path}"
85
+ return ref
86
+ return None
87
+
88
+
89
+ def _mip_emu(ref, target:Path=Path("lib"), version:str="master"):
90
+ """
91
+ Tiny simulation of MicroPython's mip.install for normal Python.
92
+ """
93
+ installed = []
94
+
95
+ if isinstance(ref, str) and (ref.startswith("http") or ref.startswith("github")):
96
+
97
+ if ref.startswith("github"):
98
+ url = _github_to_url(ref, branch=version)
99
+ if url is None:
100
+ console(f"Invalid GitHub URL: {ref}")
101
+ return []
102
+ else:
103
+ url = ref
104
+ dest = target / Path(urlparse(url).path).name
105
+
106
+ if not _guess_url_is_file(url):
107
+ # Folder mode, redirect to package.json
108
+ url = f"{url.rstrip('/')}/package.json"
109
+ dest = target / Path(urlparse(url).path).name
110
+ console(f"Patch url (dir) to point to package.json: {url}")
111
+ try:
112
+ # File mode
113
+ print(f"🔻 Downloading {url} to {dest}", end="")
114
+ data = _url_file_content(url)
115
+ print(f" ({len(data)} bytes)")
116
+ except Exception as e:
117
+ console(f"❌ Failed to read {url}: {e}")
118
+ return []
119
+
120
+ if url.endswith("package.json"):
121
+ # Install based on package.json content
122
+ package_json_data = json.loads(data)
123
+ package_urls = package_json_data.get("urls", [])
124
+ for file_url in package_urls:
125
+ pack_source_file = file_url[1]
126
+ if pack_source_file.startswith("github"):
127
+ pack_source_file = _github_to_url(pack_source_file, branch=version)
128
+ pack_dest_file = Path(file_url[0])
129
+ pack_dest_dir = target / pack_dest_file.parent
130
+ pack_dest_dir.mkdir(parents=True, exist_ok=True)
131
+ pack_dest_file = pack_dest_dir / pack_dest_file.name
132
+ print(f"File download: {pack_source_file} -> {pack_dest_file}")
133
+ data = _url_file_content(pack_source_file)
134
+ if data:
135
+ if _save_file(pack_dest_file, data):
136
+ installed.append(pack_dest_dir.name)
137
+ else:
138
+ if data:
139
+ # Install based on file content - save url body to file
140
+ if _save_file(dest, data):
141
+ installed.append(dest.name)
142
+ return installed
143
+
144
+
145
+ def _dump_dir_content(target):
146
+ # Dump content
147
+ base_path = str(target.parent)
148
+ for item in target.iterdir():
149
+ print(f" 🗂️ {str(item).replace(base_path, '')}")
150
+ if item.is_dir():
151
+ for subitem in item.iterdir():
152
+ print(f" {str(subitem).replace(base_path, '')}")
153
+ print("")
154
+
155
+
156
+ def install(ref, **kwargs):
157
+ target = kwargs.get("target", Path.cwd() / "lib")
158
+ version = kwargs.get("version", "master")
159
+ console(f">>> mip install: {ref} {kwargs}")
160
+ if isinstance(target, str):
161
+ target = Path(target)
162
+ # Run mip emulation
163
+ _mip_emu(ref, target=target, version=version)
164
+ # Dump content
165
+ _dump_dir_content(target)
@@ -1,4 +1,4 @@
1
-
1
+ from sim_common import console
2
2
 
3
3
  class NeoPixel:
4
4
  __instance = None
@@ -17,9 +17,10 @@ class NeoPixel:
17
17
  return cls.__pix_list[key]
18
18
 
19
19
  def __setitem__(cls, key, value):
20
+ console(f"Update NeoPixel at index {key} to {value}")
20
21
  cls.__pix_list[key] = value
21
22
 
22
23
  def write(cls):
23
- pass
24
+ console(f"Neopixel write: {cls.__pix_list}")
24
25
 
25
26
 
@@ -1,4 +1,4 @@
1
- from sim_console import console
1
+ from sim_common import console
2
2
  import socket
3
3
 
4
4
  AP_IF = "DUMMY_AP_IF"
@@ -45,6 +45,7 @@ class WLAN:
45
45
  self.__config_dict[key] = value
46
46
  for key in args:
47
47
  return self.__config_dict.get(key, None)
48
+ return None
48
49
 
49
50
  def ifconfig(self, addr_tuple=None):
50
51
  console("Local server IP: {}".format(self.__get_machine_ip()))
@@ -2,6 +2,5 @@
2
2
  "devfid": "simulator",
3
3
  "appwd": "ADmin123",
4
4
  "webui": true,
5
- "boothook": "dashboard_be load_n_init; neopixel load_n_init",
6
- "aioqueue": 4,
7
- "telegram": "n/a"}
5
+ "boothook": "web load dashboard=True fileserver=True fs_explore=True; fileserver mounts_write_access modules=True logs=True pwd=$pwd; neopixel load; #telegram load '6185435843:AAH71wEyoOil8bRKecQHp4zazTQ_MmE7bvE' &; #telegram receiver_loop &2000",
6
+ "aioqueue": 4}
@@ -1,4 +1,4 @@
1
- from sim_console import console
1
+ from sim_common import console
2
2
 
3
3
 
4
4
  def settime(*args, **kwargs):
@@ -1,8 +1,6 @@
1
1
  import sys
2
2
  import os
3
- #MYPATH = os.path.dirname(os.path.abspath(__file__))
4
- #DEV_ENV_DIR = os.path.dirname(MYPATH)
5
- #sys.path.append(DEV_ENV_DIR)
3
+ import time
6
4
 
7
5
  print("Module [sim_console] path: {} __package__: {} __name__: {}".format(sys.path[0], __package__, __name__))
8
6
 
@@ -16,6 +14,7 @@ except Exception as e:
16
14
  print("TerminalColors import error: {}".format(e))
17
15
  Colors = None
18
16
 
17
+
19
18
  def console(msg, end='\n', skip_tmp_msgs=True):
20
19
  if end == '\r' and skip_tmp_msgs:
21
20
  return
@@ -6,6 +6,10 @@ except Exception as e:
6
6
 
7
7
  MEM_BASELOAD = None
8
8
 
9
+ class MockMemory:
10
+ USED = 200_000 # 200 kb default memory usage
11
+ FREE = 1000_000 # 1 Mb default free memory
12
+
9
13
  def _get_memory_usage():
10
14
  global MEM_BASELOAD
11
15
  if psutil:
@@ -16,7 +20,7 @@ def _get_memory_usage():
16
20
  if MEM_BASELOAD is None:
17
21
  MEM_BASELOAD = 0
18
22
  return memory_usage_bytes - MEM_BASELOAD
19
- return -1000
23
+ return MockMemory.USED
20
24
 
21
25
 
22
26
  MEM_BASELOAD = _get_memory_usage() # HACK: GET MEM BASELOAD - CLOSEST TO REALITY - GET REAL MICROS MEM USAGE
@@ -28,7 +32,7 @@ def _get_free_memory():
28
32
  # Free memory in bytes
29
33
  free_memory_bytes = virtual_memory.available
30
34
  return free_memory_bytes
31
- return -1000
35
+ return MockMemory.FREE
32
36
 
33
37
 
34
38
  def mem_free(*args, **kwargs):
@@ -3,24 +3,59 @@ import os
3
3
  import multiprocessing
4
4
  import time
5
5
  import copy
6
+ import json
7
+ from pathlib import Path
6
8
 
7
9
  MYPATH = os.path.dirname(__file__)
8
10
  SIM_PATH = os.path.join(MYPATH, '../workspace/simulator')
9
- sys.path.insert(0, SIM_PATH)
10
- sys.path.insert(0, os.path.join(MYPATH, '../lib'))
11
- from sim_console import console
11
+ PACKAGES_PATH = os.path.join(MYPATH, '../../micrOS/packages/')
12
+ sys.path.insert(0, SIM_PATH) # Add Sim to path
13
+ sys.path.append(os.path.join(MYPATH, '../lib')) # Add devtoolkit/lib to path
14
+ from sim_common import console
12
15
  import micrOSloader
13
16
  import LocalMachine
17
+ if os.path.exists(PACKAGES_PATH):
18
+ sys.path.append(PACKAGES_PATH)
19
+ try:
20
+ import _tools.unpack as package_unpack
21
+ except ImportError:
22
+ print(f"[WARNING] Import error Packages._tools: {PACKAGES_PATH}")
23
+ package_unpack = None
24
+ else:
25
+ print(f"[WARNING] No Packages._tools available: {PACKAGES_PATH}")
26
+ package_unpack = None
14
27
 
28
+ # Enable/Disable Simulator Config and Packages import
15
29
  ENABLE_SIM_CONFIG = True
30
+ ENABLE_SIM_PACKAGES = True
31
+ EXTERNAL_LOAD_MODULES_FROM_PACKAGES = []
16
32
 
17
33
 
18
- def apply_sim_node_config():
34
+ def apply_sim_patch():
35
+ """
36
+ Apply Config and more
37
+ """
38
+ global EXTERNAL_LOAD_MODULES_FROM_PACKAGES
39
+
40
+ # APPLY SIM CONFIG - for testing: enable webui, etc...
19
41
  if ENABLE_SIM_CONFIG:
20
42
  print("Copy SIM config - for testing: enable webui, etc.")
21
43
  sim_config = os.path.join(MYPATH, 'node_config.json')
22
44
  LocalMachine.FileHandler().copy(sim_config, os.path.join(SIM_PATH))
23
45
 
46
+ if ENABLE_SIM_PACKAGES and package_unpack is not None:
47
+ overwritten_files, ext_load_module = package_unpack.unpack_all(Path(SIM_PATH))
48
+ for mod in overwritten_files:
49
+ print(f"\t⚠️ [SIM][UNPACK] Overwritten file from packages submodule: {mod}")
50
+ EXTERNAL_LOAD_MODULES_FROM_PACKAGES = [elm.lstrip("LM_").split(".")[0] for elm in ext_load_module if elm.startswith("LM_")]
51
+ # Time module patch - extend with basic micropython utime features for micrOS Simulator
52
+ import utime
53
+ time.ticks_ms = utime.ticks_ms
54
+ time.ticks_diff = utime.ticks_diff
55
+ #sys.modules['time'] = time
56
+ else:
57
+ print("⚠️ [SIM][UNPACK] Package unpacking disabled or package_unpack module not available.")
58
+
24
59
 
25
60
  class micrOSIM():
26
61
  SIM_PROCESS_LIST = []
@@ -28,6 +63,7 @@ class micrOSIM():
28
63
  def __init__(self, doc_resolve=False):
29
64
  if doc_resolve:
30
65
  console("[micrOSIM] Create micrOS LM doc (env proc)")
66
+ self._init_sim_doc_resolve()
31
67
  # json_structure, html_structure
32
68
  self.doc_output = (None, None)
33
69
  else:
@@ -37,7 +73,20 @@ class micrOSIM():
37
73
  self.pid = None
38
74
  micrOSIM.SIM_PROCESS_LIST.append(self.process)
39
75
 
76
+ def _init_sim_doc_resolve(self):
77
+ """
78
+ Init micrOS in simulator - folder structure creation
79
+ """
80
+ apply_sim_patch()
81
+ sim_path = LocalMachine.SimplePopPushd()
82
+ sim_path.pushd(SIM_PATH)
83
+ import micrOS # Init micrOS - DO NOT REMOVE
84
+ sim_path.popd()
85
+
40
86
  def micrOS_sim_worker(self, trace=False):
87
+ """
88
+ Start micrOS in python simulator
89
+ """
41
90
  sim_path = LocalMachine.SimplePopPushd()
42
91
  sim_path.pushd(SIM_PATH)
43
92
  console("[micrOSIM] Start micrOS loader in: {}".format(SIM_PATH))
@@ -57,7 +106,7 @@ class micrOSIM():
57
106
  # Trace handling - DEBUG
58
107
  sys.settrace(trace_func)
59
108
 
60
- apply_sim_node_config()
109
+ apply_sim_patch()
61
110
  micrOSloader.main()
62
111
 
63
112
  console("[micrOSIM] Stop micrOS ({})".format(SIM_PATH))
@@ -101,14 +150,77 @@ class micrOSIM():
101
150
  console("[micrOSIM] Proc was finished: {}/{}".format(i+1, proc_len))
102
151
  micrOSIM.SIM_PROCESS_LIST = []
103
152
 
153
+ @staticmethod
154
+ def _lm_doc_builder(mod, func_dict, structure, structure_to_html):
155
+ # Embed img url to table - module level
156
+ img_url = structure[mod]['img']
157
+ structure_to_html[mod]['img'] = f'<img src="{img_url}" alt="{mod}" height=150>'
158
+ # Parse function doc strings
159
+ for func in func_dict:
160
+ # -- Skip functions --
161
+ if not isinstance(structure[mod][func], dict):
162
+ continue
163
+ # -- Skip functions --
164
+
165
+ console(f"[micrOSIM][Extract doc-str] LM_{mod}.{func}.__doc__")
166
+ try:
167
+ # Get function doc string
168
+ exec(f"from modules import LM_{mod}")
169
+ doc_str = eval(f"LM_{mod}.{func}.__doc__")
170
+ # Get function pin map
171
+ if func == 'pinmap':
172
+ # Get module pin map - module level
173
+ console(f"[micrOSIM][Extract pin map tokens] LM_{mod}.pinmap()")
174
+ try:
175
+ mod_pinmap = eval(f"LM_{mod}.pinmap()")
176
+ if mod_pinmap is not None:
177
+ mod_pinmap = ', '.join(dict(mod_pinmap).keys())
178
+ mod_pinmap = f"\npin map: {mod_pinmap}"
179
+ except:
180
+ mod_pinmap = ''
181
+ # Add pinmap to doc string of pinmap() function
182
+ doc_str = "" if doc_str is None else doc_str
183
+ doc_str += mod_pinmap
184
+ if func == 'help':
185
+ console(f"[micrOSIM][Render widgets from help] LM_{mod}.help(True)")
186
+ if f"{mod}" in EXTERNAL_LOAD_MODULES_FROM_PACKAGES:
187
+ mod_help = f"\n\tEXTERNAL PACKAGE: https://github.com/BxNxM/micrOSPackages"
188
+ else:
189
+ mod_help = ""
190
+ mod_help += f"\n[i] micrOS Widget Types:"
191
+ try:
192
+ widgets_help = eval(f"LM_{mod}.help(True)")
193
+ if widgets_help is not None and isinstance(widgets_help, tuple):
194
+ for widget in widgets_help:
195
+ widget = json.loads(widget)
196
+ mod_help += f"\n\t{widget}"
197
+ except:
198
+ mod_help += '\n\tN/A'
199
+ # Add help renderes widgets to doc string
200
+ doc_str = "" if doc_str is None else doc_str
201
+ doc_str += mod_help
202
+ except Exception as e:
203
+ doc_str = str(e)
204
+ # Update structure with doc-str
205
+ structure[mod][func]['doc'] = doc_str
206
+ structure_to_html[mod][func]['doc'] = 'No doc string available' if doc_str is None else doc_str.strip() \
207
+ .replace('\n', '<br>\n').replace(' ', '&nbsp;')
208
+ # Remove empty param(s) cells
209
+ param_cell = structure_to_html[mod][func].get('param(s)', None)
210
+ if param_cell is not None and len(param_cell.strip()) == 0:
211
+ structure_to_html[mod][func].pop('param(s)')
212
+
213
+
104
214
  def _lm_doc_strings(self, structure):
105
215
  """
106
216
  Collect function doc strings and module logical pins (pin map)
107
- Create 2 dict structures adding docstring
108
- - html hack structure
109
- - json raw structure
217
+ Create 4 dict structures adding docstring
218
+ - html json + raw json for built-in modules
219
+ - html json + raw json for external (installable packages) modules
110
220
  """
111
221
  structure_to_html = copy.deepcopy(structure)
222
+ structure_ext_to_html = copy.deepcopy(structure)
223
+ structure_external = copy.deepcopy(structure)
112
224
 
113
225
  # Step into workspace path
114
226
  popd = LocalMachine.SimplePopPushd()
@@ -117,47 +229,27 @@ class micrOSIM():
117
229
  # Based on created module-function structure collect doc strings
118
230
  for mod, func_dict in structure.items():
119
231
  # Embed img url to table - module level
120
- img_url = structure[mod]['img']
121
- structure_to_html[mod]['img'] = f'<img src="{img_url}" alt="{mod}" height=150>'
122
- # Parse function doc strings
123
- for func in func_dict:
124
- # -- Skip functions --
125
- if not isinstance(structure[mod][func], dict):
126
- continue
127
- # -- Skip functions --
128
-
129
- console(f"[micrOSIM][Extract doc-str] LM_{mod}.{func}.__doc__")
130
- try:
131
- # Get function doc string
132
- exec(f"import LM_{mod}")
133
- doc_str = eval(f"LM_{mod}.{func}.__doc__")
134
- # Get function pin map
135
- if func == 'pinmap':
136
- # Get module pin map - module level
137
- console(f"[micrOSIM][Extract pin map tokens] LM_{mod}.pinmap()")
138
- try:
139
- mod_pinmap = eval(f"LM_{mod}.pinmap()")
140
- if mod_pinmap is not None:
141
- mod_pinmap = ', '.join(dict(mod_pinmap).keys())
142
- mod_pinmap = f"\npin map: {mod_pinmap}"
143
- except:
144
- mod_pinmap = ''
145
- # Add pinmap to doc string of pinmap() function
146
- doc_str += mod_pinmap
147
- except Exception as e:
148
- doc_str = str(e)
149
- # Update structure with doc-str
150
- structure[mod][func]['doc'] = doc_str
151
- structure_to_html[mod][func]['doc'] = 'No doc string available' if doc_str is None else doc_str.strip()\
152
- .replace('\n', '<br>\n').replace(' ', '&nbsp;')
153
- # Remove empty param(s) cells
154
- param_cell = structure_to_html[mod][func].get('param(s)', None)
155
- if param_cell is not None and len(param_cell.strip()) == 0:
156
- structure_to_html[mod][func].pop('param(s)')
232
+ if mod in EXTERNAL_LOAD_MODULES_FROM_PACKAGES:
233
+ # EXTERNAL MODULE STRUCTURE
234
+ self._lm_doc_builder(mod, func_dict, structure_external, structure_ext_to_html)
235
+ else:
236
+ # BUILT-IN MODULE STRUCTURE
237
+ self._lm_doc_builder(mod, func_dict, structure, structure_to_html)
238
+ # CLEANUP DUPLICATES:
239
+ for mod, func_dict in structure_external.items():
240
+ if mod in EXTERNAL_LOAD_MODULES_FROM_PACKAGES:
241
+ # Remove mod from built-ins
242
+ del structure[mod]
243
+ del structure_to_html[mod]
244
+ for mod, func_dict in structure.items():
245
+ if mod not in EXTERNAL_LOAD_MODULES_FROM_PACKAGES:
246
+ # Remove mod from external packages
247
+ del structure_external[mod]
248
+ del structure_ext_to_html[mod]
157
249
 
158
250
  # restore path
159
251
  popd.popd()
160
- self.doc_output = (structure, structure_to_html)
252
+ self.doc_output = (structure, structure_to_html, structure_external, structure_ext_to_html)
161
253
 
162
254
  def gen_lm_doc_json_html(self, structure):
163
255
  try:
@@ -1,8 +1,16 @@
1
1
  import asyncio
2
+ import ssl
2
3
 
4
+ ssl_context = ssl.create_default_context()
5
+ ssl_context.check_hostname = False # Disable hostname check
6
+ ssl_context.verify_mode = ssl.CERT_NONE # Disable certificate verification
3
7
 
4
- def open_connection(host, port):
5
- return asyncio.open_connection(host, port)
8
+ class TimeoutError(Exception):
9
+ pass
10
+
11
+ def open_connection(host, port, ssl=False):
12
+ #return asyncio.open_connection(host, port, ssl=ssl)
13
+ return asyncio.open_connection(host, port, ssl=ssl_context if ssl else None)
6
14
 
7
15
 
8
16
  class Lock(asyncio.Lock):
@@ -13,6 +21,10 @@ class Event(asyncio.Event):
13
21
  pass
14
22
 
15
23
 
24
+ async def wait_for(fut, timeout):
25
+ return asyncio.wait_for(fut, timeout)
26
+
27
+
16
28
  async def sleep(sec):
17
29
  await asyncio.sleep(sec)
18
30
 
@@ -22,7 +34,26 @@ async def sleep_ms(ms):
22
34
 
23
35
 
24
36
  def get_event_loop():
25
- return asyncio.get_event_loop()
37
+ """
38
+ Returns asyncio.EventLoop
39
+ """
40
+ try:
41
+ # LEGACY: NOT WORKS FROM PYTHON 3.13
42
+ # BUT THIS IS THE MICROPYTHON WAY...
43
+ return asyncio.get_event_loop()
44
+ except Exception as e:
45
+ print(f"[SIM] get_event_loop exception: {e}")
46
+ # PYTHON <3.13 NEW WAY
47
+ try:
48
+ # Check running event loop
49
+ # MICROPYTHON HAS A SINGLE EVENT LOOP
50
+ loop = asyncio.get_running_loop()
51
+ except RuntimeError:
52
+ # Create event loop with new method
53
+ loop = asyncio.new_event_loop()
54
+ asyncio.set_event_loop(loop)
55
+ # return new "singleton" event loop
56
+ return loop
26
57
 
27
58
 
28
59
  class Event: