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
toolkit/MicrOSDevEnv.py CHANGED
@@ -35,13 +35,13 @@ class MicrOSDevTool(OTA, USB):
35
35
  #####################################################
36
36
  # DevEnv METHODS #
37
37
  #####################################################
38
- def precompile_micros(self):
39
- micros_dev_env = Compile.is_mpycross_available()
38
+ def precompile_micros(self, cleanup=True):
39
+ micros_dev_env = Compile().is_mpycross_available()
40
40
  if not micros_dev_env:
41
41
  self.console("SKIP PRECOMPILE - DEV ENV INACTIVE\n\t-> mpy-cross not available", state='warn')
42
42
  return True
43
43
  self.console("PRECOMPILE - DEV ENV ACTIVE: mpy-cross available", state='ok')
44
- state = super(MicrOSDevTool, self).precompile_micros()
44
+ state = super(MicrOSDevTool, self).precompile_micros(cleanup)
45
45
  # Drops Segmentation fault: 11 error: simulator doc gen... TODO
46
46
  self.LM_functions_static_dump_gen()
47
47
  return state
@@ -62,8 +62,16 @@ class MicrOSDevTool(OTA, USB):
62
62
  if f.endswith('.json'):
63
63
  continue
64
64
  f_path = os.path.join(self.micrOS_dir_path, f)
65
- self.console("[SIM] Copy micrOS resources: {} -> {}".format(f_path, self.micros_sim_workspace))
66
- LocalMachine.FileHandler().copy(f_path, self.micros_sim_workspace)
65
+ if f.startswith("_") or f.startswith("."):
66
+ # SKIP files startswith `_` and `.`
67
+ continue
68
+ _, f_type = LocalMachine.FileHandler.path_is_exists(f_path)
69
+ target_dir = self.micros_sim_workspace
70
+ if f_type == "d":
71
+ target_dir = os.path.join(self.micros_sim_workspace, f)
72
+ self.console(f"[SIM] Copy micrOS resources: {f_path} -> {target_dir}")
73
+ if not LocalMachine.FileHandler().copy(f_path, target_dir):
74
+ self.console(f"[ERROR] Failed to copy: {f_path}")
67
75
 
68
76
  if prepare_only:
69
77
  # In case of automatic node_conf creation
@@ -128,26 +136,34 @@ class MicrOSDevTool(OTA, USB):
128
136
  self.console("[ERROR] micrOS SIM\n{}".format(e))
129
137
  workdir_handler.popd()
130
138
 
131
- def LM_functions_static_dump_gen(self):
132
- """
133
- Generate static module-function provider json description: sfuncman.json
134
- [!] name dependency with micrOS internal manual provider
135
- """
136
-
137
- if not os.path.isdir(self.sfuncman_output_path):
138
- self.console('DOC GEN DISABLED', state="WARN")
139
- return
140
-
141
- repo_version = self.get_micros_version_from_repo()
142
- static_help_json_path = os.path.join(self.sfuncman_output_path, 'sfuncman_{}.json'.format(repo_version))
143
- static_help_html_path = os.path.join(self.sfuncman_output_path, 'sfuncman.html')
139
+ def _build_doc_load_module_structure(self):
140
+
141
+ def _is_private_func(_line):
142
+ nonlocal decorator, line
143
+ if 'def ' in line and 'def _' not in line:
144
+ if "async" in line and decorator is not None and "@micro_task" in decorator:
145
+ # Enable (adjust) async task method with publish_micro_task decorator
146
+ line = line.replace("async", "").strip()
147
+ return False
148
+ if '(self' in line or '(cls' in _line or (decorator is not None and "staticmethod" in decorator):
149
+ # Ignore class methods
150
+ return True
151
+ return False
152
+ # Ignore non functions, and hidden functions (starts with _)
153
+ return True
144
154
 
145
155
  # [PARSING] Collect Load Module function structure buffer
146
- modules_to_doc = (i.split('.')[0] for i in LocalMachine.FileHandler.list_dir(self.micrOS_dir_path) if
147
- i.startswith('LM_') and (i.endswith('.py')))
156
+ modules_sim_path = os.path.join(self.micros_sim_workspace, "modules")
157
+ if LocalMachine.FileHandler.path_is_exists(modules_sim_path):
158
+ modules_path = modules_sim_path
159
+ else:
160
+ modules_path = os.path.join(self.micrOS_dir_path, "modules")
161
+ self.console(f"[DOC-GEN] INPUT MODULES PATH: {modules_path}")
162
+ modules_to_doc = [i.split('.')[0] for i in LocalMachine.FileHandler.list_dir(modules_path) if
163
+ i.startswith('LM_') and (i.endswith('.py'))]
148
164
  module_function_dict = {}
149
165
  for LM in modules_to_doc:
150
- LMpath = '{}/{}.py'.format(self.micrOS_dir_path, LM)
166
+ LMpath = '{}/{}.py'.format(modules_path, LM)
151
167
  try:
152
168
  module_name = LM.replace('LM_', '')
153
169
  module_function_dict[module_name] = {}
@@ -157,29 +173,66 @@ class MicrOSDevTool(OTA, USB):
157
173
  line = f.readline()
158
174
  if not line:
159
175
  break
160
- if 'def ' in line and 'def _' not in line:
161
- if '(self' in line or '(cls' in line or (decorator is not None and "staticmethod" in decorator):
162
- continue
163
- # Gen proper func name
164
- command = '{}'.format(line.split(')')[0]).replace("def", '').strip()
165
- command = command.replace('(', ' ') \
166
- .replace(',', '') \
167
- .replace('msgobj=None', '') \
168
- .replace('force=True', '')
169
- func = command.strip().split()[0]
170
- param = ' '.join(command.strip().split()[1:])
171
- # Save record
172
- if module_function_dict[module_name].get(func, None) is None:
173
- module_function_dict[module_name][func] = {}
174
- module_function_dict[module_name][func]['param(s)'] = param if len(param) > 0 else ""
175
- elif line.strip().startswith("@"):
176
- decorator = line.strip()
177
- else:
178
- decorator = None
176
+ if _is_private_func(line):
177
+ if line.strip().startswith("@"):
178
+ decorator = line.strip()
179
+ else:
180
+ decorator = None
181
+ continue
182
+
183
+ # Gen proper func name
184
+ command = '{}'.format(line.split(')')[0]).replace("def", '').strip()
185
+ command = command.replace('(', ' ') \
186
+ .replace(',', '') \
187
+ .replace('msgobj=None', '') \
188
+ .replace('force=True', '')
189
+ func = command.strip().split()[0]
190
+ param = ' '.join(command.strip().split()[1:])
191
+ # Save record
192
+ if module_function_dict[module_name].get(func, None) is None:
193
+ module_function_dict[module_name][func] = {}
194
+ module_function_dict[module_name][func]['param(s)'] = param if len(param) > 0 else ""
195
+
179
196
  # Create / update module data fields
180
- module_function_dict[module_name]['img'] = f"https://github.com/BxNxM/micrOS/blob/master/media/lms/{module_name}.png?raw=true"
197
+ module_function_dict[module_name][
198
+ 'img'] = f"https://github.com/BxNxM/micrOS/blob/master/media/lms/{module_name}.png?raw=true"
181
199
  except Exception as e:
182
200
  self.console("STATIC micrOS HELP GEN: LM [{}] PARSER ERROR: {}".format(LM, e))
201
+ self.console(f"[DOC-GEN] Detected modules: {module_function_dict.keys()}")
202
+ return module_function_dict
203
+
204
+ def LM_functions_static_dump_gen(self):
205
+ """
206
+ Generate static module-function provider json description: sfuncman.json
207
+ [!] name dependency with micrOS internal manual provider
208
+ """
209
+
210
+ def _my_json_to_html(mod_func_dict):
211
+ import json2html
212
+ table_attributes = 'border="1" cellspacing="1" cellpadding="5" width="80%"'
213
+
214
+ sorted_modules_w_data = dict(sorted(mod_func_dict.items(), key=lambda item: item[0].lower()))
215
+ module_shortcuts = ' | '.join(
216
+ f'<a href="#{mod_name.replace(" ", "_")}">{mod_name}</a>'
217
+ for mod_name in sorted_modules_w_data)
218
+ html_tables = module_shortcuts + "<br><hr><br>"
219
+ for key, value in sorted_modules_w_data.items():
220
+ anchor = key.replace(" ", "_") # Replace spaces with underscores for a valid anchor
221
+ html_tables += f'\n<br><br>\n<h2 id="{anchor}"><a href="#{anchor}">{key}</a></h2>\n'
222
+ html_tables += json2html.json2html.convert(json=value,
223
+ table_attributes=table_attributes,
224
+ clubbing=True,
225
+ escape=False,
226
+ encode=False)
227
+ return html_tables
228
+
229
+ if not os.path.isdir(self.sfuncman_output_path):
230
+ self.console('DOC GEN DISABLED', state="WARN")
231
+ return
232
+
233
+ repo_version = self.get_micros_version_from_repo()
234
+ static_help_json_path = os.path.join(self.sfuncman_output_path, 'sfuncman_{}.json'.format(repo_version))
235
+ static_help_html_path = os.path.join(self.sfuncman_output_path, 'sfuncman.html')
183
236
 
184
237
  # Prepare (update simulator workspace)
185
238
  self.simulator(prepare_only=True)
@@ -188,6 +241,7 @@ class MicrOSDevTool(OTA, USB):
188
241
  import simulator
189
242
  sim_proc = simulator.micrOSIM(doc_resolve=True)
190
243
  # Generate function doc-strings and pinmap info
244
+ module_function_dict = self._build_doc_load_module_structure()
191
245
  _out = sim_proc.gen_lm_doc_json_html(module_function_dict)
192
246
  if _out is None:
193
247
  self.console("#########################", state='ERR')
@@ -195,10 +249,15 @@ class MicrOSDevTool(OTA, USB):
195
249
  self.console("# -[micrOSIM][DOC ERR]- #", state='ERR')
196
250
  self.console("#########################", state='ERR')
197
251
  module_function_dict_html = module_function_dict
252
+ module_function_dict_ext = {}
253
+ module_function_dict_html_ext = {}
198
254
  else:
199
255
  # Unpack output
200
- module_function_dict, module_function_dict_html = _out
256
+ (module_function_dict, module_function_dict_html,
257
+ module_function_dict_ext, module_function_dict_html_ext) = _out
201
258
 
259
+ # Merge built-in and external packages at json dco level (unified document) - external modules has annotation by default
260
+ module_function_dict.update(module_function_dict_ext)
202
261
  hardcoded_manual = {"task": {"list": {"doc": "list micrOS tasks by taskID", "param(s)": ""},
203
262
  "kill": {"doc": "kill / stop micrOS task", "param(s)": "taskID"},
204
263
  "img": "https://github.com/BxNxM/micrOS/blob/master/media/lms/tasks.png?raw=true"}
@@ -214,12 +273,10 @@ class MicrOSDevTool(OTA, USB):
214
273
  _url = hardcoded_manual["task"]["img"]
215
274
  hardcoded_manual['task']['img'] = f'<img src="{_url}" alt="tasks" height=150>'
216
275
  module_function_dict_html.update(hardcoded_manual)
217
- module_function_json = json.dumps(module_function_dict_html, indent=4)
218
- import json2html
219
- table_attributes = 'border="1" cellspacing="1" cellpadding="5" width="80%"'
220
- html_table = json2html.json2html.convert(json=module_function_json,
221
- table_attributes=table_attributes,
222
- clubbing=True, escape=False, encode=False)
276
+ html_tables = _my_json_to_html(module_function_dict_html)
277
+ html_tables_ext = _my_json_to_html(module_function_dict_html_ext)
278
+ if len(html_tables_ext) > 0:
279
+ html_tables_ext = '<br><h2 id="external-modules"> External modules (packages).:</h2>' + html_tables_ext
223
280
 
224
281
  # http://corelangs.com/css/table/tablecolor.html
225
282
  # http://corelangs.com/css/table/tablecolor.html
@@ -253,25 +310,38 @@ micrOS Load Modules
253
310
  </p>
254
311
 
255
312
  <h2>
256
- Logical pin names aka pin map
313
+ microIO Pin-Mapping (names to integers)
257
314
  </h2>
258
315
  <b> Multi-platform pinmap IO handling feature - resolve pin number by name (tag)<br>
259
316
  <b>[i] Use 'module_name pinmap()' function to get pins on a runtime system (micrOS shell) and start DIY</b>
260
317
  <ul>
261
- <li><a href="https://github.com/BxNxM/micrOS/blob/master/micrOS/source/IO_esp32.py" target="_blank">esp32</a></li>
262
- <li><a href="https://github.com/BxNxM/micrOS/blob/master/micrOS/source/IO_esp32s3.py" target="_blank">esp32s3</a></li>
263
- <li><a href="https://github.com/BxNxM/micrOS/blob/master/micrOS/source/IO_m5stamp.py" target="_blank">m5stamp</a></li>
264
- <li><a href="https://github.com/BxNxM/micrOS/blob/master/micrOS/source/IO_tinypico.py" target="_blank">tinypico</a></li>
265
- <li><a href="https://github.com/BxNxM/micrOS/blob/master/micrOS/source/IO_esp32c3.py" target="_blank">esp32c3</a></li>
266
- <li><a href="https://github.com/BxNxM/micrOS/blob/master/micrOS/source/IO_esp32s2.py" target="_blank">esp32s2</a></li>
267
- <li><a href="https://github.com/BxNxM/micrOS/blob/master/micrOS/source/IO_rp2.py" target="_blank">rp2 (experimental)</a></li>
318
+ <li><a href="https://github.com/BxNxM/micrOS/blob/master/micrOS/source/modules/IO_m5stamp.py" target="_blank">m5stamp</a></li>
319
+ <li><a href="https://github.com/BxNxM/micrOS/blob/master/micrOS/source/modules/IO_tinypico.py" target="_blank">tinypico</a></li>
320
+ <li><a href="https://github.com/BxNxM/micrOS/blob/master/micrOS/source/modules/IO_s3matrix.py" target="_blank">s3matrix</a></li>
321
+
322
+ <li><a href="https://github.com/BxNxM/micrOS/blob/master/micrOS/source/modules/IO_esp32.py" target="_blank">esp32</a></li>
323
+ <li><a href="https://github.com/BxNxM/micrOS/blob/master/micrOS/source/modules/IO_esp32s3.py" target="_blank">esp32s3</a></li>
324
+ <li><a href="https://github.com/BxNxM/micrOS/blob/master/micrOS/source/modules/IO_esp32c3.py" target="_blank">esp32c3</a></li>
325
+ <li><a href="https://github.com/BxNxM/micrOS/blob/master/micrOS/source/modules/IO_esp32c6.py" target="_blank">esp32c6</a></li>
326
+ <li><a href="https://github.com/BxNxM/micrOS/blob/master/micrOS/source/modules/IO_esp32s2.py" target="_blank">esp32s2</a></li>
327
+ <li><a href="https://github.com/BxNxM/micrOS/blob/master/micrOS/source/modules/IO_rp2.py" target="_blank">rp2 (experimental)</a></li>
268
328
  </ul>
269
329
 
330
+ <h2>External package support</h2>
331
+ <a href="#external-modules">Go to external packages</a>
332
+ &nbsp;|&nbsp;
333
+ <a href="https://github.com/BxNxM/micrOSPackages" target="_blank">
334
+ View Packages on GitHub
335
+ </a>
336
+ <br>
337
+
338
+ <h2> Built-in control modules for various peripheries.: </h2>
339
+
270
340
  """
271
341
  html_body_end = """</body>
272
342
  </html>"""
273
343
 
274
- html_page = html_body_start + html_table + html_body_end
344
+ html_page = html_body_start + html_tables + html_tables_ext + html_body_end
275
345
  # Write html to file
276
346
  with open(static_help_html_path, 'w') as f:
277
347
  f.write(html_page)
toolkit/WebRepl.py ADDED
@@ -0,0 +1,73 @@
1
+ import sys
2
+ import os
3
+
4
+ MYDIR = os.path.dirname(__file__)
5
+ print("Module [WebRepl] path: {} __package__: {} __name__: {} __file__: {}".format(
6
+ sys.path[0], __package__, __name__, MYDIR))
7
+ try:
8
+ from .lib.TerminalColors import Colors
9
+ from .lib.LocalMachine import FileHandler, CommandHandler, SimplePopPushd
10
+ from .socketClient import ConnectionData
11
+ except Exception as e:
12
+ print("Import warning __name__:{}: {}".format(__name__, e))
13
+ from lib.TerminalColors import Colors
14
+ from lib.LocalMachine import FileHandler, CommandHandler, SimplePopPushd
15
+ from socketClient import ConnectionData
16
+
17
+ WEBREPL_DIR = os.path.join(MYDIR, "workspace/webrepl")
18
+ MAKE_HTML_WEBPAGE_PATH = os.path.join(WEBREPL_DIR, "make_html_js.py")
19
+ WEBREPL_WEBPAGE_PATH = os.path.join(WEBREPL_DIR, "webrepl.html")
20
+
21
+ def init_webrepl_frontend():
22
+ webrepldir_handler = SimplePopPushd()
23
+ webrepldir_handler.pushd(WEBREPL_DIR)
24
+
25
+ is_exists, ftype = FileHandler.path_is_exists(MAKE_HTML_WEBPAGE_PATH)
26
+ if is_exists and ftype == 'f':
27
+ print("RUN webrepl/make_html_js.py")
28
+ exitcode, _, stderr = CommandHandler.run_command(f"{sys.executable} {MAKE_HTML_WEBPAGE_PATH}", shell=True)
29
+ webrepldir_handler.popd()
30
+ if exitcode == 0:
31
+ return True
32
+ print(f"Cannot init {MAKE_HTML_WEBPAGE_PATH}: {stderr}")
33
+ return False
34
+ print(f"WEBREPL MAKE MISSING: {MAKE_HTML_WEBPAGE_PATH}")
35
+ return False
36
+
37
+ def open_webrepl_webpage(address=None, port=8266):
38
+ # file:///Users/usrname/micrOS/micrOS/toolkit/workspace/webrepl/webrepl.html#10.0.1.76:8266
39
+ fuid = ''
40
+ if address is None:
41
+ try:
42
+ address, _, fuid, _ = ConnectionData.select_device()
43
+ except KeyboardInterrupt:
44
+ address = None
45
+
46
+ device = "" if address is None else f"#{address}:{port}"
47
+ webrepl_html = f"file://{WEBREPL_WEBPAGE_PATH}{device}"
48
+ is_exists, ftype = FileHandler.path_is_exists(WEBREPL_WEBPAGE_PATH)
49
+ if is_exists and ftype == "f":
50
+ print(f"OPEN {fuid} webrepl {webrepl_html}")
51
+ if sys.platform == "darwin":
52
+ CommandHandler.run_command(f"open '{webrepl_html}'", shell=True)
53
+ elif sys.platform == "win32":
54
+ CommandHandler.run_command(f"start {webrepl_html}", shell=True)
55
+ elif sys.platform == "linux":
56
+ CommandHandler.run_command(f"xdg-open {webrepl_html}", shell=True)
57
+ else:
58
+ print("Unsupported OS")
59
+ return False
60
+ return True
61
+ print(f"{WEBREPL_WEBPAGE_PATH} not exists.")
62
+ return False
63
+
64
+
65
+ def open_webrepl():
66
+ state = init_webrepl_frontend()
67
+ if state:
68
+ open_webrepl_webpage()
69
+
70
+
71
+
72
+ if __name__ == "__main__":
73
+ open_webrepl()
@@ -5,27 +5,17 @@ import sys
5
5
  import json
6
6
  MYPATH = os.path.dirname(os.path.abspath(__file__))
7
7
  BACKUP_DIR = os.path.join(MYPATH, "../user_data/node_config_archive/")
8
- sys.path.append(os.path.dirname(MYPATH))
9
- import socketClient
10
8
  sys.path.append(os.path.join(MYPATH, '../lib/'))
11
9
  from TerminalColors import Colors
12
10
 
13
- # FILL OUT
14
- DEVICE = 'node01'
15
- PASSWD = None
11
+ try:
12
+ from ._app_base import AppBase
13
+ except:
14
+ from _app_base import AppBase
16
15
 
17
- def base_cmd():
18
- if PASSWD is None:
19
- return ['--dev', DEVICE]
20
- return ['--dev', DEVICE, '--password', PASSWD]
16
+ CLIENT = None
21
17
 
22
18
 
23
- def run_command(cmd):
24
- # EDIT YOUR COMMAND
25
- args = base_cmd() + cmd
26
- status, answer = socketClient.run(args)
27
- return status, answer
28
-
29
19
  ###########################################################
30
20
  def _value_type(value):
31
21
  value = value.strip()
@@ -42,15 +32,16 @@ def _value_type(value):
42
32
 
43
33
 
44
34
  def backup():
45
- print(f"\tBackup name format: {DEVICE}-<tag>-node_config.json")
46
- print(f"\t\t tag is optional (press simply enter): {DEVICE}-node_config.json")
47
- backup_tag = input(f"\tFill backup tag for {DEVICE}: ").strip()
35
+ device = CLIENT.get_device()
36
+ print(f"\tBackup name format: {device}-<tag>-node_config.json")
37
+ print(f"\t\t tag is optional (press simply enter): {device}-node_config.json")
38
+ backup_tag = input(f"\tFill backup tag for {device}: ").strip()
48
39
  backup_tag = "" if len(backup_tag) == 0 else f"-{backup_tag}"
49
- backup_name = f"{DEVICE}{backup_tag}-node_config.json"
40
+ backup_name = f"{device}{backup_tag}-node_config.json"
50
41
  backup_path = os.path.join(BACKUP_DIR, backup_name)
51
42
  print(f"\tBackup path: {backup_path}")
52
43
 
53
- status, answer = run_command(["conf", "dump"])
44
+ status, answer = CLIENT.run(["conf", "dump"])
54
45
  if status:
55
46
  configuration = {line.split(":")[0].strip(): _value_type(':'.join(line.split(":")[1:])) for line in answer.strip().split("\n") if ":" in line}
56
47
  with open(backup_path, 'w') as f:
@@ -61,7 +52,8 @@ def backup():
61
52
 
62
53
 
63
54
  def restore():
64
- print(f"\tRestore backup for: {DEVICE}")
55
+ device = CLIENT.get_device()
56
+ print(f"\tRestore backup for: {device}")
65
57
  diff_config = {}
66
58
 
67
59
  # SELECT AND LOAD CONFIG BACKUP
@@ -81,7 +73,7 @@ def restore():
81
73
  print(f"BACKUP CONFIG DICT:\n{backup_dict}")
82
74
 
83
75
  # LOAD LIVE DEVICE CONFIG - create config diff
84
- status, answer = run_command(["conf", "dump"])
76
+ status, answer = CLIENT.run(["conf", "dump"])
85
77
  if not status:
86
78
  return f"Cannot load live device config"
87
79
  live_configuration = {line.split(":")[0].strip(): _value_type(':'.join(line.split(":")[1:])) for line in answer.strip().split("\n") if ":" in line}
@@ -103,20 +95,16 @@ def restore():
103
95
  print(f"{Colors.WARN}SKIP restore...{Colors.NC}")
104
96
  return
105
97
 
106
- print(f"PACKAGE CONFIG DIFFS...{DEVICE}")
98
+ print(f"PACKAGE CONFIG DIFFS...{device}")
107
99
  conf_cmd_list = ["conf"]
108
100
  for key, value in diff_config.items():
109
101
  print(f"\tADD {key} : {value}")
110
102
  conf_cmd_list.append(f"{key} {value}")
111
103
  conf_cmd_list.append("reboot")
112
104
 
113
- verify = input(f"{Colors.WARN}This is BETA feature, are you sure?{Colors.NC} [YY/n]: ")
114
- if verify != "YY":
115
- print(f"{Colors.WARN}SKIP restore...{Colors.NC}")
116
- return
117
105
  # Restore
118
- print(f"APPLY CONFIG DIFFS...{DEVICE}")
119
- status, answer = run_command(conf_cmd_list)
106
+ print(f"APPLY CONFIG DIFFS...{device}")
107
+ status, answer = CLIENT.run(conf_cmd_list)
120
108
  if status:
121
109
  print(f"{Colors.OKGREEN}Backup was successfully restored:{Colors.NC} {backup_path}\nRebooting...")
122
110
  else:
@@ -148,15 +136,12 @@ def app(devfid=None, pwd=None):
148
136
  send command(s) over socket connection [socketClient.run(args)]
149
137
  list load module commands and send in single connection
150
138
  """
151
- global DEVICE, PASSWD
152
- if devfid is not None:
153
- DEVICE = devfid
154
- if pwd is not None:
155
- PASSWD = pwd
139
+ global CLIENT
140
+ CLIENT = AppBase(device=devfid, password=pwd)
156
141
 
157
142
  print(f"{Colors.WARN}Backup & Restore management{Colors.NC}\n")
158
143
  while True:
159
- print(f"{Colors.UNDERLINE}Operations on {DEVICE}{Colors.NC}")
144
+ print(f"{Colors.UNDERLINE}Operations on {CLIENT.get_device()}{Colors.NC}")
160
145
  print("\t[1] Backup")
161
146
  print("\t[2] Restore")
162
147
  print("\t[3] Delete backups")
@@ -2,38 +2,33 @@
2
2
 
3
3
  import os
4
4
  import sys
5
- import time
6
5
  MYPATH = os.path.dirname(os.path.abspath(__file__))
7
- sys.path.append(os.path.dirname(MYPATH))
8
- import socketClient
9
6
  sys.path.append(os.path.join(MYPATH, '../lib/'))
10
- from TerminalColors import Colors
11
7
 
12
- # FILL OUT
13
- DEVICE = 'node01'
8
+ try:
9
+ from ._app_base import AppBase
10
+ except:
11
+ from _app_base import AppBase
14
12
 
13
+ CLIENT = None
15
14
 
16
- def base_cmd():
17
- return ['--dev', DEVICE]
18
15
 
19
-
20
- def app(devfid=None):
16
+ def app(devfid=None, pwd=None):
21
17
  """
22
18
  devfid: selected device input
23
19
  send command(s) over socket connection [socketClient.run(args)]
24
20
  list load module commands and send in single connection
25
21
  """
26
- global DEVICE
27
- if devfid is not None:
28
- DEVICE = devfid
22
+ global CLIENT
23
+ CLIENT = AppBase(device=devfid, password=pwd)
29
24
 
30
- status, answer = socketClient.run(base_cmd() + ['cct white 50 400',
25
+ status, answer = CLIENT.run(['cct white 50 400',
31
26
  'cct brightness 50'])
32
- status, answer = socketClient.run(base_cmd() + ['cct brightness 100', 'cct brightness 20',
27
+ status, answer = CLIENT.run(['cct brightness 100', 'cct brightness 20',
33
28
  'cct brightness 60'])
34
- status, answer = socketClient.run(base_cmd() + ['cct white 400 50',
29
+ status, answer = CLIENT.run(['cct white 400 50',
35
30
  'cct brightness 100', 'cct brightness 20'])
36
- status, answer = socketClient.run(base_cmd() + ['cct white 600 700',
31
+ status, answer = CLIENT.run(['cct white 600 700',
37
32
  'cct white 50 300'])
38
33
 
39
34
 
@@ -5,18 +5,15 @@ import sys
5
5
  import time
6
6
  import random
7
7
  MYPATH = os.path.dirname(os.path.abspath(__file__))
8
- sys.path.append(os.path.dirname(MYPATH))
9
- import socketClient
10
- import time
11
8
  sys.path.append(os.path.join(MYPATH, '../lib/'))
12
9
  from TerminalColors import Colors
13
10
 
14
- # FILL OUT
15
- DEVICE = 'node01'
16
-
11
+ try:
12
+ from ._app_base import AppBase
13
+ except:
14
+ from _app_base import AppBase
17
15
 
18
- def base_cmd():
19
- return ['--dev', DEVICE]
16
+ CLIENT = None
20
17
 
21
18
 
22
19
  def test_random_colors(test_len=8, smooth=False):
@@ -30,12 +27,12 @@ def test_random_colors(test_len=8, smooth=False):
30
27
 
31
28
  # Generate command
32
29
  cmd_list_str = " <a> ".join(["{} {} {} {} >json".format(main_function, k[0], k[1], smooth) for k in cct_list])
33
- args = base_cmd() + [cmd_list_str]
30
+ args = [cmd_list_str]
34
31
  print("{} Generated command {} - multi message single connection single connection: {} cold warm {}\n{}".format(Colors.HEADER, Colors.NC, main_function, smooth, args))
35
32
 
36
33
  start_t = time.time()
37
34
  # SEND MESSSAGE OVER micrOS client
38
- status, answer = socketClient.run(args)
35
+ status, answer = CLIENT.run(args)
39
36
  delta_t = round((time.time() - start_t)/test_len, 1)
40
37
 
41
38
  #Evaluate last message
@@ -51,14 +48,14 @@ def test_random_colors(test_len=8, smooth=False):
51
48
 
52
49
  def test_toogle():
53
50
  main_function = 'cct toggle'
54
- args_on = base_cmd() + [f'{main_function} True >json']
55
- args_toggle = base_cmd() + [f'{main_function} >json']
51
+ args_on = [f'{main_function} True >json']
52
+ args_toggle = [f'{main_function} >json']
56
53
 
57
54
  # SEND MESSSAGE OVER micrOS client
58
- status, answer = socketClient.run(args_on)
55
+ status, answer = CLIENT.run(args_on)
59
56
  if status and '"S": 1' in answer:
60
57
  # SEND MESSSAGE OVER micrOS client
61
- status, answer = socketClient.run(args_toggle)
58
+ status, answer = CLIENT.run(args_toggle)
62
59
  if status and '"S": 0' in answer:
63
60
  return True, '{} works {}OK{}'.format(main_function, Colors.OK, Colors.NC)
64
61
  return False, '{} not works {}NOK{}: {}'.format(main_function, Colors.ERR, Colors.NC, answer)
@@ -66,24 +63,23 @@ def test_toogle():
66
63
 
67
64
  def test_brightness():
68
65
  main_function = 'cct brightness'
69
- args_10 = base_cmd() + [f'{main_function} 10 >json']
70
- args_50 = base_cmd() + [f'{main_function} 50 >json']
71
- args_actual_br = base_cmd() + [f'{main_function} >json']
66
+ args_10 = [f'{main_function} 10 >json']
67
+ args_50 = [f'{main_function} 50 >json']
68
+ args_actual_br = [f'{main_function} >json']
72
69
 
73
- status, answer = socketClient.run(args_10)
70
+ status, answer = CLIENT.run(args_10)
74
71
  if status:
75
- status, answer = socketClient.run(args_50)
72
+ status, answer = CLIENT.run(args_50)
76
73
  if status:
77
- status, answer = socketClient.run(args_actual_br)
74
+ status, answer = CLIENT.run(args_actual_br)
78
75
  if status and "50.0 %" in answer:
79
76
  return True, "{} function {}OK{} (50.0 % == {})".format(main_function, Colors.OK, Colors.NC, answer)
80
77
  return False, "{} function {}NOK{} (50.0 % == {})".format(main_function, Colors.ERR, Colors.NC, answer)
81
78
 
82
79
 
83
- def app(devfid=None):
84
- global DEVICE
85
- if devfid is not None:
86
- DEVICE = devfid
80
+ def app(devfid=None, pwd=None):
81
+ global CLIENT
82
+ CLIENT = AppBase(device=devfid, password=pwd)
87
83
 
88
84
  test_pool = { 'Color change test': test_random_colors(test_len=8, smooth=False),
89
85
  'Color smooth test': test_random_colors(test_len=4, smooth=True),
@@ -2,14 +2,10 @@ import sys, os
2
2
  import subprocess
3
3
  MYPATH = os.path.dirname(os.path.abspath(__file__))
4
4
 
5
- DEVICE = "node01"
6
5
 
7
- def app(devfid=None):
6
+ def app(devfid=None, pwd=None):
8
7
  """
9
8
  Wrapper function to start subprocess plotting... (threading limitation)
10
9
  """
11
- global DEVICE
12
- if devfid is not None:
13
- DEVICE = devfid
14
- result = subprocess.run([f'{sys.executable}', os.path.join(MYPATH, '_capture.py'), DEVICE])
10
+ result = subprocess.run([f'{sys.executable}', os.path.join(MYPATH, '_capture.py'), devfid])
15
11
  print(result)