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
@@ -5,33 +5,79 @@ import sys
5
5
  import time
6
6
  import socket
7
7
  import ast
8
+ from pprint import pprint
9
+ try:
10
+ from ._app_base import AppBase
11
+ except:
12
+ from _app_base import AppBase
13
+
8
14
  MYPATH = os.path.dirname(os.path.abspath(__file__))
9
- sys.path.append(os.path.dirname(MYPATH))
10
- import socketClient
15
+ REPORT_OUTPUT_PATH = os.path.join(MYPATH, '../../micrOS/release_info/micrOS_ReleaseInfo/devices_system_metrics.json')
11
16
  sys.path.append(os.path.join(MYPATH, '../lib/'))
12
17
  from TerminalColors import Colors
13
18
  import requests
14
19
 
15
- # FILL OUT
16
- DEVICE = '__simulator__'
17
- PASSWD = None
18
-
19
-
20
- def base_cmd():
21
- if PASSWD is None:
22
- return ['--dev', DEVICE]
23
- return ['--dev', DEVICE, '--password', PASSWD]
20
+ CLIENT = None
21
+ TIMEOUT_SEC = 5
24
22
 
23
+ # COLLECT AND SAVE SYSTEM TEST METRICS
24
+ ENABLE_DATA_COLLECTION = os.environ.get("ENABLE_DATA_COLLECTION", False)
25
+ REPORT_DICT = {}
26
+ METRICS = {}
25
27
 
26
- def get_device():
27
- return DEVICE
28
-
28
+ #####################################
29
+ # METRICS #
30
+ #####################################
31
+ def load_reports():
32
+ global REPORT_DICT
33
+ previous_reports = {}
34
+ try:
35
+ with open(REPORT_OUTPUT_PATH, 'r') as f:
36
+ previous_reports = json.loads(f.read())
37
+ except FileNotFoundError:
38
+ pass
39
+ finally:
40
+ REPORT_DICT = previous_reports
41
+
42
+ def create_report(device_name:str, metrics:dict) -> None:
43
+ global REPORT_DICT
44
+
45
+ if not ENABLE_DATA_COLLECTION:
46
+ print(f"[SKIP] system test metrics export, ENABLE_DATA_COLLECTION={ENABLE_DATA_COLLECTION}")
47
+ pprint(metrics)
48
+ return
49
+ load_reports()
50
+ version = metrics.get('version')
51
+ device_type = metrics.get('board_type')
52
+ device_type = '???' if device_type is None else device_type.split()[-1]
53
+ if REPORT_DICT.get(version) is None:
54
+ REPORT_DICT[version] = {}
55
+ if REPORT_DICT.get(version).get(device_type) is None:
56
+ REPORT_DICT[version][device_type] = {}
57
+ REPORT_DICT[version][device_type][device_name] = metrics
58
+ # Cleanup - remove redundant elements
59
+ REPORT_DICT[version][device_type][device_name].pop("board_type", None)
60
+ REPORT_DICT[version][device_type][device_name].pop("version", None)
61
+ # Dump report
62
+ print(f"Save system test report: {REPORT_OUTPUT_PATH}")
63
+ pprint(metrics)
64
+ with open(REPORT_OUTPUT_PATH, 'w') as f:
65
+ f.write(json.dumps(REPORT_DICT, indent=4))
66
+
67
+
68
+ def _add_metrics(key:str, value):
69
+ global METRICS
70
+ METRICS[key] = value
71
+
72
+ #####################################
73
+ # TESTS #
74
+ #####################################
29
75
 
30
76
  def single_cmd_exec_check():
31
77
  info = "[ST] Run single command execution check [hello]"
32
78
  print(info)
33
79
  cmd_list = ['hello']
34
- output = execute(cmd_list)
80
+ output = CLIENT.execute(cmd_list)
35
81
  if output[0]:
36
82
  if output[1].startswith("hello:"):
37
83
  return True, info
@@ -41,17 +87,18 @@ def shell_cmds_check():
41
87
  info = "[ST] Run built-in shell commands [modules|version|help]"
42
88
  print(info)
43
89
  cmd_list = ['modules']
44
- output = execute(cmd_list)
90
+ output = CLIENT.execute(cmd_list)
45
91
  if output[0]:
92
+ _add_metrics("modules", ast.literal_eval(output[1]))
46
93
  if not (output[1].startswith("[") and output[1].endswith("]")):
47
94
  return False, f"{info}modules: {output[1]}"
48
95
  cmd_list = ['version']
49
- output = execute(cmd_list)
96
+ output = CLIENT.execute(cmd_list)
50
97
  if output[0]:
51
98
  if not ('.' in output[1] and '-' in output[1]):
52
99
  return False, f"{info}version: {output[1]}"
53
100
  cmd_list = ['help']
54
- output = execute(cmd_list)
101
+ output = CLIENT.execute(cmd_list)
55
102
  if output[0]:
56
103
  if not ('[MICROS]' in output[1] and '[CONF]' in output[1] and '[TASK]' in output[1] and '[EXEC]' in output[1]):
57
104
  return False, f"{info}help: {output[1]}"
@@ -62,7 +109,7 @@ def lm_cmd_exec_check():
62
109
  info = "[ST] Run Load Module command execution check [system heartbeat]"
63
110
  print(info)
64
111
  cmd_list = ['system heartbeat']
65
- output = execute(cmd_list)
112
+ output = CLIENT.execute(cmd_list)
66
113
  if output[0]:
67
114
  if output[1].strip() == '<3 heartbeat <3':
68
115
  return True, info
@@ -73,7 +120,7 @@ def micrOS_config_get():
73
120
  info = "[ST] Run micrOS config get [conf -> socport]"
74
121
  print(info)
75
122
  cmd_list = ['config <a> socport']
76
- output = execute(cmd_list)
123
+ output = CLIENT.execute(cmd_list)
77
124
  if output[0]:
78
125
  if output[1].strip() == '9008':
79
126
  return True, info
@@ -87,7 +134,7 @@ def micrOS_config_set():
87
134
 
88
135
  # [1] Get actual utc value
89
136
  cmd_list = ['config <a> utc']
90
- output = execute(cmd_list)
137
+ output = CLIENT.execute(cmd_list)
91
138
  if output[0]:
92
139
  try:
93
140
  utc_bak = int(output[1].strip())
@@ -97,21 +144,21 @@ def micrOS_config_set():
97
144
  # [2] Set x+1 value as expected
98
145
  utc_expected = utc_bak+1
99
146
  cmd_list = ['config <a> utc {}'.format(utc_expected)]
100
- output = execute(cmd_list)
147
+ output = CLIENT.execute(cmd_list)
101
148
  if output[0]:
102
149
  if output[1].strip() != 'Saved':
103
150
  return False, f"{info} + utc overwrite issue: {output[1]}"
104
151
 
105
152
  # [3] Get modified utc value - veridy [2] step
106
153
  cmd_list = ['config <a> utc']
107
- output = execute(cmd_list)
154
+ output = CLIENT.execute(cmd_list)
108
155
  if output[0]:
109
156
  if int(output[1].strip()) != utc_expected:
110
157
  return False, f"{info} + utc modified value error: {output[1]} != {utc_expected}"
111
158
 
112
159
  # Restore original value
113
160
  cmd_list = ['config <a> utc {}'.format(utc_bak)]
114
- output = execute(cmd_list)
161
+ output = CLIENT.execute(cmd_list)
115
162
  if output[0]:
116
163
  if output[1].strip() != 'Saved':
117
164
  return False, f"{info} + utc overwrite issue: {output[1]}"
@@ -121,51 +168,51 @@ def micrOS_config_set():
121
168
 
122
169
 
123
170
  def micrOS_bgjob_one_shot_check():
124
- info = "[ST] Run micrOS BgJob check [system clock &]"
171
+ info = "[ST] Run async microTask check [system clock &]"
125
172
  print(info)
126
-
127
173
  # Initial task cleanup...
128
- execute(['task kill system.clock'])
129
-
130
- for _ in range(0, 2):
131
- cmd_list = ['system clock &']
132
- output = execute(cmd_list)
133
- time.sleep(1)
134
- if output[0]:
135
- if 'Start system.clock' not in output[1].strip():
136
- return False, f'{info} + not expected return: {output[1]}'
137
- return True, info
174
+ CLIENT.execute(['task kill system.clock'])
175
+ time.sleep(1)
176
+ cmd_list = ['system clock &']
177
+ output = CLIENT.execute(cmd_list)
178
+ if output[0]:
179
+ # Legacy return OR New dict return
180
+ if 'Start system.clock' in output[1].strip() or "{'system.clock': 'Starting'}" in output[1].strip():
181
+ return True, info
182
+ return False, f'{info} + not expected return: {output[1]}'
138
183
 
139
184
 
140
185
  def micrOS_bgjob_loop_check():
141
- info = "[ST] Run micrOS Async Task check [system clock &&] + task kill"
186
+ info = "[ST] Run async microTask check [system clock &&] + task kill"
142
187
  print(info)
143
188
 
144
189
  # Start background task loop
145
190
  cmd_list = ['system clock &&']
146
- output = execute(cmd_list)
191
+ output = CLIENT.execute(cmd_list)
147
192
  if output[0]:
148
- if 'Start system.clock' not in output[1].strip():
193
+ # Legacy return OR New dict return
194
+ if not ('Start system.clock' in output[1].strip() or "{'system.clock': 'Starting'}" in output[1]):
149
195
  return False, f'[Start Task error] {info} + not expected return: {output[1]}'
150
196
 
151
197
  # Attempt to overload background thread
152
198
  cmd_list = ['system clock &&']
153
- output = execute(cmd_list)
199
+ output = CLIENT.execute(cmd_list)
154
200
  if output[0]:
155
- if 'system.clock is Busy' not in output[1].strip():
201
+ # Legacy return OR New dict return
202
+ if not ('system.clock is Busy' in output[1].strip() or "{'system.clock': 'Already running'}" in output[1]):
156
203
  return False, f'[Overload task - run same] {info} + not expected return: {output[1]}'
157
204
 
158
205
  # Show task output by task tag
159
206
  time.sleep(0.1) # Give time for the task to start and update buffer... (sim)
160
207
  cmd_list = ['task show system.clock']
161
- output = execute(cmd_list)
208
+ output = CLIENT.execute(cmd_list)
162
209
  if output[0]:
163
210
  if "No task found" in output[1].strip() or len(output[1].strip()) == 0:
164
211
  return False, f'[No task output] {info} + not expected return: {output[1]}'
165
212
 
166
213
  # Stop BgJob
167
214
  cmd_list = ['task kill system.clock']
168
- output = execute(cmd_list)
215
+ output = CLIENT.execute(cmd_list)
169
216
  if output[0]:
170
217
  if 'Kill:' in output[1].strip() or 'system.clock' in output[1].strip():
171
218
  return True, f'[Stop task] {info}'
@@ -173,12 +220,13 @@ def micrOS_bgjob_loop_check():
173
220
  # Failed verdict
174
221
  return False, f'[Thread not stopped]{info} + not expected return: {output[1]}'
175
222
 
223
+
176
224
  def micrOS_task_list_check():
177
225
  info = "[ST] Run micrOS Task list feature check [task list][task list >json]"
178
226
  print(info)
179
227
 
180
228
  async_available_cmd_list = ['task list']
181
- output = execute(async_available_cmd_list)
229
+ output = CLIENT.execute(async_available_cmd_list)
182
230
  if output[0]:
183
231
  if "---- micrOS top ----" not in output[1]:
184
232
  return False, f"{info} - ERROR: missing response prefix {output[1]}"
@@ -186,7 +234,7 @@ def micrOS_task_list_check():
186
234
  return False, f"{info} - task list error: {output[1]}"
187
235
 
188
236
  async_available_cmd_list = ['task list >json']
189
- output = execute(async_available_cmd_list)
237
+ output = CLIENT.execute(async_available_cmd_list)
190
238
  if output[0]:
191
239
  starts = '{'
192
240
  ends = '}'
@@ -196,14 +244,16 @@ def micrOS_task_list_check():
196
244
  print(f"{info} - task list >json error: {output[1]}")
197
245
  return True, info
198
246
 
247
+
199
248
  def micrOS_get_version():
200
249
  info = "[ST] Run micrOS get version [version]"
201
250
  print(info)
202
251
  cmd_list = ['version']
203
- output = execute(cmd_list)
252
+ output = CLIENT.execute(cmd_list)
204
253
  if output[0]:
205
254
  if '.' in output[1].strip() and '-' in output[1].strip():
206
255
  return True, f"{info} v:{output[1].strip()}"
256
+ _add_metrics('version', output[1])
207
257
  return False, f"{info} out: {output[1]}"
208
258
 
209
259
 
@@ -211,7 +261,7 @@ def json_format_check():
211
261
  info = "[ST] Run micrOS raw output check aka >json [system rssi >json]"
212
262
  print(info)
213
263
  cmd_list = ['system rssi >json']
214
- output = execute(cmd_list)
264
+ output = CLIENT.execute(cmd_list)
215
265
  if output[0] and output[1].startswith("{") and output[1].endswith("}"):
216
266
  return True, info + f" out: {output[1]}"
217
267
  return False, info + f" out: {output[1]}"
@@ -222,25 +272,25 @@ def negative_interface_check():
222
272
  print(info)
223
273
 
224
274
  cmd_list = ['Apple']
225
- output = execute(cmd_list)
275
+ output = CLIENT.execute(cmd_list)
226
276
  if output[0]:
227
277
  if 'Shell: for hints type help.' not in output[1].strip():
228
278
  return False, f'[Wrong single command] {info} + not expected return: {output[1]}'
229
279
 
230
280
  cmd_list = ['Apple test']
231
- output = execute(cmd_list)
281
+ output = CLIENT.execute(cmd_list)
232
282
  if output[0]:
233
283
  if 'no module named' not in output[1].strip().lower():
234
284
  return False, f'[Missing module] {info} + not expected return: {output[1]}'
235
285
 
236
286
  cmd_list = ['conf', 'gmttimaaaa']
237
- output = execute(cmd_list)
287
+ output = CLIENT.execute(cmd_list)
238
288
  if output[0]:
239
289
  if output[1].strip() != 'None':
240
290
  return False, f'[Config invalid key] {info} + not expected return: {output[1]}'
241
291
 
242
292
  cmd_list = ['conf', 'utc "type"']
243
- output = execute(cmd_list)
293
+ output = CLIENT.execute(cmd_list)
244
294
  if output[0]:
245
295
  if output[1].strip() != 'Failed to save':
246
296
  return False, f'[Config invalid key type] {info} + not expected return: {output[1]}'
@@ -264,11 +314,12 @@ def measure_package_response_time():
264
314
  # Start time
265
315
  start = time.time()
266
316
  # Command exec
267
- output = execute(cmd_list)
317
+ output = CLIENT.execute(cmd_list)
268
318
  # Stop time
269
319
  end = time.time() - start
270
320
  # Get average response time
271
321
  delta_cmd_rep_time = round(end/10, 4)
322
+ _add_metrics('shell_heartbeatX10_response_ms', int(delta_cmd_rep_time*1000))
272
323
  # Create verdict
273
324
  print(output)
274
325
  if output[0] and "<3 heartbeat <3" in output[1]:
@@ -280,7 +331,7 @@ def micros_alarm_check():
280
331
  info = "[ST] Test alarm state - system alarms should be null"
281
332
  print(info)
282
333
  cmd_list = ['system alarms']
283
- output = execute(cmd_list)
334
+ output = CLIENT.execute(cmd_list)
284
335
  alarm_cnt = 0
285
336
  if output[0]:
286
337
  try:
@@ -291,7 +342,7 @@ def micros_alarm_check():
291
342
  print(e)
292
343
  # Clean alarms
293
344
  cmd_list = ['system alarms True']
294
- execute(cmd_list)
345
+ CLIENT.execute(cmd_list)
295
346
  # Evaluation
296
347
  if alarm_cnt > 0:
297
348
  return True, info + f" -1 !!!WARN!!! [{alarm_cnt}] out: {output[1]}"
@@ -299,11 +350,11 @@ def micros_alarm_check():
299
350
 
300
351
 
301
352
  def oled_msg_end_result(result):
302
- cmd_list = ['lmpacman module >json']
303
- output = execute(cmd_list)
353
+ cmd_list = ['pacman moduls >json']
354
+ output = CLIENT.execute(cmd_list)
304
355
  if output[0] and 'LM_oled_ui' in output[1]:
305
356
  cmd_list = [f'oled_ui msgbox "{result} %"']
306
- print(execute(cmd_list))
357
+ print(CLIENT.execute(cmd_list))
307
358
 
308
359
 
309
360
  def check_device_by_hostname(dev):
@@ -324,7 +375,7 @@ def check_robustness_exception():
324
375
  info_msg = '[ST] Check robustness - exception [robustness raise_error]'
325
376
  print(info_msg)
326
377
  cmd_list = ['robustness raise_error']
327
- output = execute(cmd_list)
378
+ output = CLIENT.execute(cmd_list)
328
379
  if output[0] and "Core error: LM_robustness->raise_error: Test exception" in output[1]:
329
380
  return True, f'{info_msg}: Valid error msg: exec_lm_core *->raise_error: *'
330
381
  else:
@@ -335,7 +386,7 @@ def check_robustness_memory():
335
386
  info_msg = '[ST] Check robustness - memory_leak [robustness memory_leak 12]'
336
387
  print(info_msg)
337
388
  cmd_list = ['robustness memory_leak 12']
338
- output = execute(cmd_list)
389
+ output = CLIENT.execute(cmd_list)
339
390
  if output[0] and "[12] RAM Alloc" in output[1]:
340
391
  end_result = output[1].split("\n")[-1]
341
392
  return True, f'{info_msg}: Mem alloc: {end_result}'
@@ -347,7 +398,7 @@ def check_robustness_recursion():
347
398
  info_msg = '[ST] Check robustness - recursion [robustness recursion_limit 8]'
348
399
  print(info_msg)
349
400
  cmd_list = ['robustness recursion_limit 8']
350
- output = execute(cmd_list, tout=10)
401
+ output = CLIENT.execute(cmd_list, tout=10)
351
402
  if output[0]:
352
403
  last_line = output[1].split("\n")[-1]
353
404
  if "Recursion limit:" in last_line:
@@ -359,9 +410,14 @@ def check_robustness_recursion():
359
410
  def check_intercon(host=None):
360
411
  def _convert_return_to_dict(data):
361
412
  try:
362
- data_dict = ast.literal_eval(data[1])
413
+ data_dict = ast.literal_eval(data[1].split("\n")[0])
363
414
  except Exception as e:
415
+ print(f"WARNING: cannot parse output as dir: {e}")
364
416
  data_dict = {'tag': None, 'verdict': f'{data}: {str(e)}'}
417
+ # Handle new syntax: {"taskID": "verdict"}
418
+ if data[0] and data_dict.get("tag") is None:
419
+ _ttag = list(data_dict.keys())[0]
420
+ data_dict = {'tag': _ttag, 'verdict': f'{list(data_dict.values())[0]}: task show {_ttag}'}
365
421
  return data[0], data_dict
366
422
 
367
423
  def _get_intercon_output(tag):
@@ -370,23 +426,29 @@ def check_intercon(host=None):
370
426
  _output = None
371
427
  for _ in range(0, 2):
372
428
  time.sleep(1)
373
- _output = execute(_cmd_list, tout=8)
429
+ _output = CLIENT.execute(_cmd_list, tout=8)
374
430
  if _output[0] and 'No task found:' not in _output[1]:
375
431
  _state = True
376
432
  break
377
433
  return _state, _output
378
434
 
435
+ def run_intercon_hello(tout=8):
436
+ nonlocal host
437
+ cmd_list = [f'hello >>{host}']
438
+ _output = CLIENT.execute(cmd_list, tout=tout)
439
+ return _output
440
+
379
441
  info_msg = '[ST] Check device-device connectivity'
380
442
  print(info_msg)
381
443
  host = 'test.local' if host is None else host
382
- cmd_list = ['intercon sendcmd "{}" "hello" >json'.format(host)]
383
- output = execute(cmd_list, tout=8)
444
+ output = run_intercon_hello(tout=8)
384
445
  output = _convert_return_to_dict(output)
446
+
385
447
  device_was_found = False
386
448
  if output[0] is False or output[1] is None:
387
449
  output = 'Device was not found: {}:{}'.format(host, output)
388
450
  return False, output
389
- elif output[1] == '[]':
451
+ if output[1] == '[]':
390
452
  # Valid input, device was not found
391
453
  output = 'Device was not found: {}:{}'.format(host, output)
392
454
  state = True, f'{info_msg}:\n\t\t{output}'
@@ -394,30 +456,37 @@ def check_intercon(host=None):
394
456
  response_state, response = _get_intercon_output(output[1]['tag'])
395
457
  # Valid input on online device
396
458
  output = "Device was found: {}:{}".format(host, f"{output}: {response}")
397
- state = True & response_state, f'{info_msg}:\n\t\t{output}'
459
+ state = response_state, f'{info_msg}:\n\t\t{output}'
398
460
  device_was_found = True
399
461
  else:
400
- state = False, output
462
+ state = False, f" InterCon Failed: {output}"
401
463
 
402
464
  if device_was_found:
403
465
  # DO Negative testing as well
404
- cmd_list = ['intercon sendcmd "notavailable.local" "hello" >json']
405
- output_neg = execute(cmd_list, tout=15)
466
+ host = "notavailable.local"
467
+ output_neg = run_intercon_hello(tout=20)
468
+ if output_neg[0] and output_neg[1] == '':
469
+ # NO HOST TIMEOUT ...
470
+ output_neg = f'Device was not found (dhcp timeout): {host}:{output_neg}: {output_neg[1]}'
471
+ return True & state[0], f"{state[1]}\n\t\tNegative test: {output_neg}"
472
+ # Valid return on negative testing
406
473
  output_neg = _convert_return_to_dict(output_neg)
407
- state_neg = False, output_neg
474
+ state_neg = False, f"Negative test failed: {output_neg}"
408
475
  if len(output_neg[1]) > 1 and "hello" in output_neg[1]['verdict']:
409
476
  response_state, response = _get_intercon_output(output_neg[1]['tag'])
410
- output_neg = f'Device was not found: "notavailable.local":{output_neg}: {response}'
411
- state_neg = True & response_state, output_neg
412
- return state[0] & state_neg[0], "{}\n\t\tNegative test: {}".format(state[1], state_neg[1])
477
+ output_neg = f'Device was not found: {host}":{output_neg}: {response}'
478
+ state_neg = response_state, output_neg
479
+ return state[0] & state_neg[0], f"{state[1]}\n\t\tNegative test: {state_neg[1]}"
413
480
  return state
414
481
 
415
482
 
416
483
  def measure_conn_metrics():
417
484
  try:
418
- verdict = socketClient.connection_metrics(f"{get_device().strip()}.local")
485
+ verdict, delta_t_single, delta_t_multi = CLIENT.connection_metrics()
486
+ _add_metrics("shell_single_session_dt_ms", int(delta_t_single*1000))
487
+ _add_metrics("shell_multi_session_dt_ms", int(delta_t_multi*1000))
419
488
  for k in verdict:
420
- print("\t\t{}".format(k))
489
+ print(f"\t\t{k}")
421
490
  state = True if len(verdict) > 0 else False
422
491
  except Exception as e:
423
492
  state = False
@@ -427,7 +496,7 @@ def measure_conn_metrics():
427
496
 
428
497
  def memory_usage():
429
498
  cmd = ['system memory_usage >json']
430
- out = execute(cmd, tout=3)
499
+ out = CLIENT.execute(cmd, tout=TIMEOUT_SEC)
431
500
  state, raw_output = out[0], out[1]
432
501
  try:
433
502
  json_out = json.loads(raw_output)
@@ -435,7 +504,9 @@ def memory_usage():
435
504
  return False, '[ST] {}ERR{}: {}: {}'.format(Colors.ERR, Colors.NC, raw_output, e)
436
505
 
437
506
  # {"percent": 93.11, "mem_used": 103504}
438
- if json_out.get('percent') > 80: # MEM USAGE WARNING INDICATOR: 85%
507
+ _add_metrics('mem_percent', json_out.get('percent'))
508
+ _add_metrics('mem_used_byte', json_out.get('mem_used'))
509
+ if json_out.get('percent') > 70: # MEM USAGE WARNING INDICATOR: 80%
439
510
  return state, '[ST] {}WARNING{}: memory usage {}% ({} bytes)'.format(Colors.WARN, Colors.NC,
440
511
  json_out.get('percent'),
441
512
  json_out.get('mem_used'))
@@ -448,7 +519,7 @@ def disk_usage():
448
519
  Check disk usage - manually defined 16% (336_000 byte) - check degradations...
449
520
  """
450
521
  cmd = ['system disk_usage >json']
451
- out = execute(cmd, tout=3)
522
+ out = CLIENT.execute(cmd, tout=TIMEOUT_SEC)
452
523
  state, raw_output = out[0], out[1]
453
524
  try:
454
525
  json_out = json.loads(raw_output)
@@ -456,7 +527,9 @@ def disk_usage():
456
527
  return False, '[ST] {}ERR{}: {}: {}'.format(Colors.ERR, Colors.NC, raw_output, e)
457
528
 
458
529
  # {"percent": 15.4, "fs_used": 323_584}
459
- if json_out.get('fs_used') > 500_000: # MEM USAGE WARNING INDICATOR: 500_000 bytes (500kb)
530
+ _add_metrics('fs_percent', json_out.get('percent'))
531
+ _add_metrics('fs_used_byte', json_out.get('fs_used'))
532
+ if json_out.get('fs_used') > 800_000: # MEM USAGE WARNING INDICATOR: (800kb)
460
533
  return state, '[ST] {}WARNING{}: disk usage {}% ({} bytes)'.format(Colors.WARN, Colors.NC,
461
534
  json_out.get('percent'),
462
535
  json_out.get('fs_used'))
@@ -466,7 +539,7 @@ def disk_usage():
466
539
 
467
540
  def task_list():
468
541
  cmd = ['task list']
469
- out = execute(cmd, tout=3)
542
+ out = CLIENT.execute(cmd, tout=TIMEOUT_SEC)
470
543
  state, output = out[0], out[1]
471
544
  if state:
472
545
  return state, output.replace('\n', f'\n{" "*51}') # TODO format output
@@ -476,40 +549,51 @@ def task_list():
476
549
  def webcli_test():
477
550
  endpoints = []
478
551
  cmd = ['conf', 'webui']
479
- out = execute(cmd, tout=3)
552
+ out = CLIENT.execute(cmd, tout=TIMEOUT_SEC)
480
553
  state, output = out[0], out[1]
481
554
  if state:
482
555
  verdict = f"[ST] WEBUI IS ENABLED ({output})" if output.strip() == 'True' else f"[ST] WEBUI IS DISABLED ({output})"
483
556
  if output.strip() == 'True':
484
- out = execute(['conf', 'devip'], tout=3)
557
+ out = CLIENT.execute(['conf', 'devip'], tout=TIMEOUT_SEC)
485
558
  if out[0] and out[1] is not None:
486
559
  devip = out[1]
487
- endpoints.append(f'http://{devip}')
488
560
  endpoints.append(f'http://{devip}/rest')
561
+ endpoints.append(f'http://{devip}')
489
562
 
490
563
  for endpoint in endpoints:
491
564
  _start_t = time.time()
565
+ delta_t = -1
492
566
  try:
493
567
  response = requests.get(endpoint, timeout=5)
568
+ delta_t = round(time.time() - _start_t, 2)
494
569
  # Check if the request was successful
495
570
  if not (response.status_code == 200 and ('<!DOCTYPE html>' in str(response.content) or '"micrOS"' in str(response.content))):
496
- verdict += f" Endpoint: {endpoint} [{Colors.ERR}NOK{Colors.NC}]({round(time.time()-_start_t, 2)}s)"
497
- print(response.content)
498
- state = False
571
+ if response.status_code == 400 and "Low memory" in str(response.content):
572
+ verdict += f" Endpoint: {endpoint} - Low memory mode [{Colors.WARN}OK{Colors.NC}]({delta_t}s)"
573
+ print(response.content)
574
+ else:
575
+ verdict += f" Endpoint: {endpoint} [{Colors.ERR}NOK{Colors.NC}]({delta_t}s)"
576
+ print(response.content)
577
+ state = False
499
578
  else:
500
- verdict += f" Endpoint: {endpoint} [{Colors.OK}OK{Colors.NC}]({round(time.time()-_start_t, 2)}s)"
579
+ verdict += f" Endpoint: {endpoint} [{Colors.OK}OK{Colors.NC}]({delta_t}s)"
580
+ metrics_name = 'landingpage' if "." in endpoint.split('/')[-1] else endpoint.split('/')[-1]
581
+ _add_metrics(f"web_{metrics_name}_response_ms", int(delta_t*1000))
501
582
  except Exception as e:
502
- verdict += f" Endpoint: {endpoint} [{Colors.ERR}NOK{Colors.NC}]({round(time.time()-_start_t, 2)}s)"
583
+ verdict += f" Endpoint: {endpoint} [{Colors.ERR}NOK{Colors.NC}]({delta_t}s)"
503
584
  print(f"webcli_test error: {e}")
504
585
  state = False
505
586
  return state, verdict
506
587
  return state, output
507
588
 
589
+ #####################################
590
+ # HELPERS #
591
+ #####################################
508
592
 
509
593
  def after_st_reboot():
510
594
  verdict = False, 'reboot -h failed'
511
595
  cmd = ['reboot -h']
512
- out = execute(cmd, tout=3)
596
+ out = CLIENT.execute(cmd, tout=TIMEOUT_SEC)
513
597
  state, output = out[0], out[1]
514
598
  if state:
515
599
  verdict = state, f'[reboot-h] commad out: {output}'
@@ -517,7 +601,7 @@ def after_st_reboot():
517
601
  print(f"[reboot-h] Wait for node up again ({retry}/{retry*2}sec)")
518
602
  time.sleep(2)
519
603
  try:
520
- up, o = execute(['hello'], tout=3)
604
+ up, o = CLIENT.execute(['hello'], tout=TIMEOUT_SEC)
521
605
  if up:
522
606
  verdict = True, f"[reboot-h][OK] successfully rebooted: {o} (boot time: ~{retry * 2}sec)"
523
607
  print(verdict[1])
@@ -530,19 +614,37 @@ def after_st_reboot():
530
614
 
531
615
  def get_dev_version():
532
616
  cmd = ['version']
533
- out = execute(cmd, tout=3)
617
+ out = CLIENT.execute(cmd, tout=TIMEOUT_SEC)
534
618
  state, output = out[0], out[1]
619
+ _add_metrics("version", output)
535
620
  if state:
536
621
  return output
537
622
  return '0.0.0-0'
538
623
 
624
+ def get_dev_board_type():
625
+ cmd = ['system info >json']
626
+ out = CLIENT.execute(cmd, tout=TIMEOUT_SEC)
627
+ state, output = out[0], out[1]
628
+ output = ast.literal_eval(output)
629
+ board = output.get("board")
630
+ upython = output.get("upython")
631
+ _add_metrics("board_type", board)
632
+ _add_metrics("micropython_version", str(upython))
633
+ if state:
634
+ return board, upython
635
+ return None, None
636
+
637
+ #####################################
638
+ # MAIN APP #
639
+ #####################################
640
+
539
641
  def app(devfid=None, pwd=None):
540
- global DEVICE, PASSWD
541
- if devfid is not None:
542
- DEVICE = devfid
543
- if pwd is not None:
544
- PASSWD = pwd
642
+ global CLIENT
643
+ CLIENT = AppBase(device=devfid, password=pwd)
545
644
 
645
+ # Get device info
646
+ version = get_dev_version()
647
+ get_dev_board_type() # update metrics
546
648
  # Get test verdict
547
649
  verdict = {'single_cmds': single_cmd_exec_check(),
548
650
  'shell_cmds': shell_cmds_check(),
@@ -556,7 +658,7 @@ def app(devfid=None, pwd=None):
556
658
  'json_check': json_format_check(),
557
659
  'response_time': measure_package_response_time(),
558
660
  'negative_api': negative_interface_check(),
559
- 'dhcp_hostname': check_device_by_hostname(DEVICE),
661
+ 'dhcp_hostname': check_device_by_hostname(CLIENT.get_device()),
560
662
  'lm_exception': check_robustness_exception(),
561
663
  'mem_usage': memory_usage(),
562
664
  'disk_usage': disk_usage(),
@@ -570,11 +672,12 @@ def app(devfid=None, pwd=None):
570
672
  'clean-reboot': after_st_reboot()
571
673
  }
572
674
 
675
+
573
676
  # Test Evaluation
574
677
  final_state = True
575
678
  ok_cnt = 0
576
- version = get_dev_version()
577
- print(f"\n----------------------------------- micrOS System Test results on {DEVICE}:{version} device -----------------------------------")
679
+ create_report(CLIENT.get_device(), METRICS)
680
+ print(f"\n----------------------------------- micrOS System Test results on {CLIENT.get_device()}:{version} device -----------------------------------")
578
681
  print("\tTEST NAME\t\tSTATE\t\tDescription\n")
579
682
  for test, state_data in verdict.items():
580
683
  state = Colors.ERR + 'NOK' + Colors.NC
@@ -594,11 +697,5 @@ def app(devfid=None, pwd=None):
594
697
  oled_msg_end_result(f"System[{state}] {pass_rate}")
595
698
 
596
699
 
597
- def execute(cmd_list, tout=5):
598
- cmd_args = base_cmd() + cmd_list
599
- print("[ST] test cmd: {}".format(cmd_args))
600
- return socketClient.run(cmd_args, timeout=tout)
601
-
602
-
603
700
  if __name__ == "__main__":
604
701
  app()