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,28 @@
1
+
2
+
3
+ class AIOESPNow:
4
+
5
+ def __init__(self):
6
+ self._active = False
7
+ self.peers_table = None
8
+
9
+ def active(self, state=None):
10
+ if state is not None:
11
+ self._active = state
12
+ return self._active
13
+
14
+ def stats(self):
15
+ pass
16
+
17
+ def add_peer(self, mac):
18
+ pass
19
+
20
+ async def asend(self, mac, full_msg):
21
+ pass
22
+
23
+ def send(self, mac, full_msg):
24
+ pass
25
+
26
+ def __iter__(self):
27
+ return (i for i in range(0, 3))
28
+
@@ -1,4 +1,4 @@
1
- from sim_console import console
1
+ from sim_common import console
2
2
 
3
3
 
4
4
  class DHT22:
@@ -1,6 +1,54 @@
1
1
 
2
2
  MONO_VLSB = None
3
+ MONO_HMSB = None
3
4
 
4
5
 
5
6
  class FrameBuffer:
6
- pass
7
+
8
+ def __init__(self, *args, **kwargs):
9
+ pass
10
+
11
+ def fill(self, color=0):
12
+ pass
13
+
14
+ def show(self):
15
+ pass
16
+
17
+ def write_cmd(self, cmd):
18
+ pass
19
+
20
+ def reset(self):
21
+ pass
22
+
23
+ def poweron(self):
24
+ pass
25
+
26
+ def poweroff(self):
27
+ pass
28
+
29
+ def flip(self, *args, **kwargs):
30
+ pass
31
+
32
+ def rotate(self, *args, **kwargs):
33
+ pass
34
+
35
+ def text(self, string, x, y, color=0):
36
+ pass
37
+
38
+ def pixel(self, x, y, color=0):
39
+ pass
40
+
41
+ def line(self, x0, y0, x1, y1, color=0):
42
+ pass
43
+
44
+ def rect(self, x0, y0, x1, y1, color=0):
45
+ pass
46
+
47
+ def fill_rect(self, x, y, w, h, color=0):
48
+ pass
49
+
50
+ def blit(self, fbuf, x, y, key, palette):
51
+ pass
52
+
53
+ def scroll(self, dx, dy):
54
+ pass
@@ -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):
@@ -173,6 +172,9 @@ class SoftI2C(I2C):
173
172
  def __init__(self, scl, sda, freq=None):
174
173
  super().__init__(scl, sda, freq)
175
174
 
175
+ def writevto(self, *args, **kwargs):
176
+ pass
177
+
176
178
 
177
179
  class SoftSPI:
178
180
  def __init__(self, sck, mosi, miso):
@@ -184,12 +186,21 @@ class UART:
184
186
  def __init__(self, pin, baudrate, tx, rx, timeout=1):
185
187
  pass
186
188
 
189
+ def init(self, *args, **kwargs):
190
+ pass
191
+
192
+ def deinit(self):
193
+ pass
194
+
187
195
  def write(self, frame):
188
196
  pass
189
197
 
190
198
  def read(self, *args, **kwargs):
191
199
  pass
192
200
 
201
+ def any(self):
202
+ return False
203
+
193
204
  def freq(*args, **kwargs):
194
205
  return 1
195
206
 
@@ -214,3 +225,7 @@ def unique_id():
214
225
 
215
226
  def time_pulse_us():
216
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; neopixel load; #system top",
6
- "aioqueue": 4,
7
- "telegram": "6185435843:AAH71wEyoOil8bRKecQHp4zazTQ_MmE7bvE"}
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):
@@ -4,24 +4,58 @@ import multiprocessing
4
4
  import time
5
5
  import copy
6
6
  import json
7
+ from pathlib import Path
7
8
 
8
9
  MYPATH = os.path.dirname(__file__)
9
10
  SIM_PATH = os.path.join(MYPATH, '../workspace/simulator')
10
- sys.path.insert(0, SIM_PATH)
11
- sys.path.insert(0, os.path.join(MYPATH, '../lib'))
12
- 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
13
15
  import micrOSloader
14
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
15
27
 
28
+ # Enable/Disable Simulator Config and Packages import
16
29
  ENABLE_SIM_CONFIG = True
30
+ ENABLE_SIM_PACKAGES = True
31
+ EXTERNAL_LOAD_MODULES_FROM_PACKAGES = []
17
32
 
18
33
 
19
- 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...
20
41
  if ENABLE_SIM_CONFIG:
21
42
  print("Copy SIM config - for testing: enable webui, etc.")
22
43
  sim_config = os.path.join(MYPATH, 'node_config.json')
23
44
  LocalMachine.FileHandler().copy(sim_config, os.path.join(SIM_PATH))
24
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
+
25
59
 
26
60
  class micrOSIM():
27
61
  SIM_PROCESS_LIST = []
@@ -29,6 +63,7 @@ class micrOSIM():
29
63
  def __init__(self, doc_resolve=False):
30
64
  if doc_resolve:
31
65
  console("[micrOSIM] Create micrOS LM doc (env proc)")
66
+ self._init_sim_doc_resolve()
32
67
  # json_structure, html_structure
33
68
  self.doc_output = (None, None)
34
69
  else:
@@ -38,7 +73,20 @@ class micrOSIM():
38
73
  self.pid = None
39
74
  micrOSIM.SIM_PROCESS_LIST.append(self.process)
40
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
+
41
86
  def micrOS_sim_worker(self, trace=False):
87
+ """
88
+ Start micrOS in python simulator
89
+ """
42
90
  sim_path = LocalMachine.SimplePopPushd()
43
91
  sim_path.pushd(SIM_PATH)
44
92
  console("[micrOSIM] Start micrOS loader in: {}".format(SIM_PATH))
@@ -58,7 +106,7 @@ class micrOSIM():
58
106
  # Trace handling - DEBUG
59
107
  sys.settrace(trace_func)
60
108
 
61
- apply_sim_node_config()
109
+ apply_sim_patch()
62
110
  micrOSloader.main()
63
111
 
64
112
  console("[micrOSIM] Stop micrOS ({})".format(SIM_PATH))
@@ -102,14 +150,77 @@ class micrOSIM():
102
150
  console("[micrOSIM] Proc was finished: {}/{}".format(i+1, proc_len))
103
151
  micrOSIM.SIM_PROCESS_LIST = []
104
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
+
105
214
  def _lm_doc_strings(self, structure):
106
215
  """
107
216
  Collect function doc strings and module logical pins (pin map)
108
- Create 2 dict structures adding docstring
109
- - html hack structure
110
- - 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
111
220
  """
112
221
  structure_to_html = copy.deepcopy(structure)
222
+ structure_ext_to_html = copy.deepcopy(structure)
223
+ structure_external = copy.deepcopy(structure)
113
224
 
114
225
  # Step into workspace path
115
226
  popd = LocalMachine.SimplePopPushd()
@@ -118,60 +229,27 @@ class micrOSIM():
118
229
  # Based on created module-function structure collect doc strings
119
230
  for mod, func_dict in structure.items():
120
231
  # Embed img url to table - module level
121
- img_url = structure[mod]['img']
122
- structure_to_html[mod]['img'] = f'<img src="{img_url}" alt="{mod}" height=150>'
123
- # Parse function doc strings
124
- for func in func_dict:
125
- # -- Skip functions --
126
- if not isinstance(structure[mod][func], dict):
127
- continue
128
- # -- Skip functions --
129
-
130
- console(f"[micrOSIM][Extract doc-str] LM_{mod}.{func}.__doc__")
131
- try:
132
- # Get function doc string
133
- exec(f"import LM_{mod}")
134
- doc_str = eval(f"LM_{mod}.{func}.__doc__")
135
- # Get function pin map
136
- if func == 'pinmap':
137
- # Get module pin map - module level
138
- console(f"[micrOSIM][Extract pin map tokens] LM_{mod}.pinmap()")
139
- try:
140
- mod_pinmap = eval(f"LM_{mod}.pinmap()")
141
- if mod_pinmap is not None:
142
- mod_pinmap = ', '.join(dict(mod_pinmap).keys())
143
- mod_pinmap = f"\npin map: {mod_pinmap}"
144
- except:
145
- mod_pinmap = ''
146
- # Add pinmap to doc string of pinmap() function
147
- doc_str += mod_pinmap
148
- if func == 'help':
149
- console(f"[micrOSIM][Render widgets from help] LM_{mod}.help(True)")
150
- mod_help = f"\n[i] micrOS Widget Types:"
151
- try:
152
- widgets_help = eval(f"LM_{mod}.help(True)")
153
- if widgets_help is not None and isinstance(widgets_help, tuple):
154
- for widget in widgets_help:
155
- widget = json.loads(widget)
156
- mod_help += f"\n\t{widget}"
157
- except:
158
- mod_help += '\n\tN/A'
159
- # Add help renderes widgets to doc string
160
- doc_str += mod_help
161
- except Exception as e:
162
- doc_str = str(e)
163
- # Update structure with doc-str
164
- structure[mod][func]['doc'] = doc_str
165
- structure_to_html[mod][func]['doc'] = 'No doc string available' if doc_str is None else doc_str.strip()\
166
- .replace('\n', '<br>\n').replace(' ', '&nbsp;')
167
- # Remove empty param(s) cells
168
- param_cell = structure_to_html[mod][func].get('param(s)', None)
169
- if param_cell is not None and len(param_cell.strip()) == 0:
170
- 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]
171
249
 
172
250
  # restore path
173
251
  popd.popd()
174
- self.doc_output = (structure, structure_to_html)
252
+ self.doc_output = (structure, structure_to_html, structure_external, structure_ext_to_html)
175
253
 
176
254
  def gen_lm_doc_json_html(self, structure):
177
255
  try: