micrOSDevToolKit 2.9.9__py3-none-any.whl → 2.9.10__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.

Potentially problematic release.


This version of micrOSDevToolKit might be problematic. Click here for more details.

Files changed (52) hide show
  1. micrOS/release_info/micrOS_ReleaseInfo/system_analysis_sum.json +20 -20
  2. micrOS/source/LM_oled_ui.py +1 -1
  3. micrOS/source/LM_system.py +4 -4
  4. micrOS/source/Notify.py +4 -0
  5. micrOS/source/Server.py +1 -1
  6. micrOS/source/Shell.py +3 -3
  7. micrOS/source/Tasks.py +1 -1
  8. micrOS/source/Time.py +7 -8
  9. micrOS/source/__pycache__/Common.cpython-312.pyc +0 -0
  10. micrOS/source/__pycache__/Logger.cpython-312.pyc +0 -0
  11. micrOS/source/__pycache__/Server.cpython-312.pyc +0 -0
  12. micrOS/source/micrOSloader.py +0 -1
  13. micrOS/source/urequests.py +8 -6
  14. {micrOSDevToolKit-2.9.9.data → micrOSDevToolKit-2.9.10.data}/scripts/devToolKit.py +10 -0
  15. {micrOSDevToolKit-2.9.9.dist-info → micrOSDevToolKit-2.9.10.dist-info}/METADATA +14 -4
  16. {micrOSDevToolKit-2.9.9.dist-info → micrOSDevToolKit-2.9.10.dist-info}/RECORD +50 -46
  17. {micrOSDevToolKit-2.9.9.dist-info → micrOSDevToolKit-2.9.10.dist-info}/WHEEL +1 -1
  18. toolkit/MicrOSDevEnv.py +19 -5
  19. toolkit/WebRepl.py +73 -0
  20. toolkit/dashboard_apps/BackupRestore.py +20 -31
  21. toolkit/dashboard_apps/CCTDemo.py +12 -17
  22. toolkit/dashboard_apps/CCTTest.py +20 -24
  23. toolkit/dashboard_apps/CamStream.py +2 -6
  24. toolkit/dashboard_apps/CatGame.py +14 -16
  25. toolkit/dashboard_apps/Dimmer.py +11 -21
  26. toolkit/dashboard_apps/GetVersion.py +11 -19
  27. toolkit/dashboard_apps/MicrophoneTest.py +1 -6
  28. toolkit/dashboard_apps/NeoEffectsDemo.py +28 -34
  29. toolkit/dashboard_apps/NeopixelTest.py +20 -25
  30. toolkit/dashboard_apps/PresenceTest.py +2 -8
  31. toolkit/dashboard_apps/RGBTest.py +20 -24
  32. toolkit/dashboard_apps/RoboArm.py +24 -32
  33. toolkit/dashboard_apps/SED_test.py +10 -14
  34. toolkit/dashboard_apps/SensorsTest.py +61 -0
  35. toolkit/dashboard_apps/SystemTest.py +151 -77
  36. toolkit/dashboard_apps/Template_app.py +11 -23
  37. toolkit/dashboard_apps/_app_base.py +34 -0
  38. toolkit/dashboard_apps/uLightDemo.py +15 -24
  39. toolkit/lib/micrOSClient.py +11 -9
  40. toolkit/micrOSlint.py +3 -3
  41. toolkit/socketClient.py +0 -1
  42. toolkit/workspace/precompiled/LM_oled_ui.mpy +0 -0
  43. toolkit/workspace/precompiled/LM_system.mpy +0 -0
  44. toolkit/workspace/precompiled/Notify.mpy +0 -0
  45. toolkit/workspace/precompiled/Shell.mpy +0 -0
  46. toolkit/workspace/precompiled/Time.mpy +0 -0
  47. toolkit/workspace/precompiled/micrOSloader.mpy +0 -0
  48. toolkit/workspace/precompiled/urequests.mpy +0 -0
  49. toolkit/dashboard_apps/AirQualityBME280.py +0 -36
  50. toolkit/dashboard_apps/AirQualityDHT22_CO2.py +0 -36
  51. {micrOSDevToolKit-2.9.9.dist-info → micrOSDevToolKit-2.9.10.dist-info}/LICENSE +0 -0
  52. {micrOSDevToolKit-2.9.9.dist-info → micrOSDevToolKit-2.9.10.dist-info}/top_level.txt +0 -0
@@ -4,28 +4,23 @@ import os
4
4
  import sys
5
5
  import time
6
6
  MYPATH = os.path.dirname(os.path.abspath(__file__))
7
- sys.path.append(os.path.dirname(MYPATH))
8
- import socketClient
9
7
  sys.path.append(os.path.join(MYPATH, '../lib/'))
10
8
  from TerminalColors import Colors
11
9
 
12
- # FILL OUT
13
- DEVICE = 'node01'
14
-
15
-
16
- def base_cmd():
17
- return ['--dev', DEVICE]
10
+ try:
11
+ from ._app_base import AppBase
12
+ except:
13
+ from _app_base import AppBase
18
14
 
15
+ CLIENT = None
19
16
 
20
17
  def light_demo(modules, smooth=True, sample=10):
21
18
  verdict = [True, []]
22
19
  smooth_str = '[smooth]' if smooth else '[simple]'
23
20
 
24
- if 'LM_rgb' in modules:
25
- args = base_cmd() + [f'rgb random {smooth}'] * sample + ['rgb toggle False']
26
- print(args)
21
+ if 'rgb' in modules:
27
22
  delta_t = time.time()
28
- status_rgb, answer_rgb = socketClient.run(args)
23
+ status_rgb, answer_rgb = CLIENT.run([f'rgb random {smooth}'] * sample + ['rgb toggle False'])
29
24
  delta_t = round((time.time() - delta_t) / sample, 2)
30
25
  if status_rgb:
31
26
  msg = f"{smooth_str} rgb module random color func: {Colors.OK}OK{Colors.NC} [{delta_t}sec]"
@@ -35,10 +30,9 @@ def light_demo(modules, smooth=True, sample=10):
35
30
  verdict[1].append(msg)
36
31
  verdict[0] &= False
37
32
 
38
- if 'LM_cct' in modules:
39
- args = base_cmd() + [f'cct random {smooth}'] * sample + ['cct toggle False']
33
+ if 'cct' in modules:
40
34
  delta_t = time.time()
41
- status_cct, answer_cct = socketClient.run(args)
35
+ status_cct, answer_cct = CLIENT.run([f'cct random {smooth}'] * sample + ['cct toggle False'])
42
36
  delta_t = round((time.time() - delta_t) / sample, 2)
43
37
  if status_cct:
44
38
  msg = f"{smooth_str} cct module random color func: {Colors.OK}OK{Colors.NC} [{delta_t}sec]"
@@ -48,10 +42,9 @@ def light_demo(modules, smooth=True, sample=10):
48
42
  verdict[1].append(msg)
49
43
  verdict[0] &= False
50
44
 
51
- if 'LM_neopixel' in modules:
52
- args = base_cmd() + [f'neopixel random {smooth}'] * sample + ['neopixel toggle False']
45
+ if 'neopixel' in modules:
53
46
  delta_t = time.time()
54
- status_neo, answer_neo = socketClient.run(args)
47
+ status_neo, answer_neo = CLIENT.run([f'neopixel random {smooth}'] * sample + ['neopixel toggle False'])
55
48
  delta_t = round((time.time() - delta_t) / sample, 2)
56
49
  if status_neo:
57
50
  msg = f"{smooth_str} neopixel module random color func: {Colors.OK}OK{Colors.NC} [{delta_t}sec]"
@@ -63,19 +56,17 @@ def light_demo(modules, smooth=True, sample=10):
63
56
  return verdict
64
57
 
65
58
 
66
- def app(devfid=None):
59
+ def app(devfid=None, pwd=None):
67
60
  """
68
61
  devfid: selected device input
69
62
  send command(s) over socket connection [socketClient.run(args)]
70
63
  list load module commands and send in single connection
71
64
  """
72
- global DEVICE
73
- if devfid is not None:
74
- DEVICE = devfid
65
+ global CLIENT
66
+ CLIENT = AppBase(device=devfid, password=pwd)
75
67
 
76
68
  # Get loaded modules
77
- args = base_cmd() + ['pacman module']
78
- status, modules = socketClient.run(args)
69
+ status, modules = CLIENT.run(['modules'])
79
70
  print("status: {}\nanswer: {}".format(status, modules))
80
71
 
81
72
  if not status:
@@ -355,8 +355,9 @@ class micrOSClient:
355
355
  verdict.append(console_msg)
356
356
  print(f"===>\t\t{console_msg}")
357
357
  self.close()
358
- verdict.append(f"SINGLE CONNECTION LOAD TEST X{cnt}, AVERAGE REPLY TIME: {round(delta_t_all/cnt, 3)} sec\n")
359
- return verdict
358
+ delta_t_result = round(delta_t_all / cnt, 3)
359
+ verdict.append(f"SINGLE CONNECTION LOAD TEST X{cnt}, AVERAGE REPLY TIME: {delta_t_result} sec\n")
360
+ return verdict, delta_t_result
360
361
 
361
362
  def __del__(self):
362
363
  if self.dbg and self.avg_reply[1] > 0:
@@ -385,9 +386,10 @@ def micros_connection_metrics(address):
385
386
  print(f"\t\t{_console_msg}")
386
387
  all_reply.append(_console_msg)
387
388
  success_rate = int(round(_success / cnt, 2) * 100)
388
- all_reply.append(f"MULTI CONNECTION LOAD TEST X{cnt}, AVERAGE REPLY TIME: {round(_all_delta_t/cnt, 3)}s, "
389
- f"SERVER AVAILABILITY: {success_rate}% ({round(_all_delta_t/_success, 3)}s)")
390
- return all_reply
389
+ delta_t_result = round(_all_delta_t/cnt, 3)
390
+ all_reply.append(f"MULTI CONNECTION LOAD TEST X{cnt}, AVERAGE REPLY TIME: {delta_t_result}s, "
391
+ f"SERVER AVAILABILITY: {success_rate}% ({int((_all_delta_t/_success)*1000)} ms)")
392
+ return all_reply, delta_t_result
391
393
 
392
394
  # ---------------------------------------------------- #
393
395
  high_level_verdict = []
@@ -395,12 +397,12 @@ def micros_connection_metrics(address):
395
397
  # [1] Create micrOSClient object + Run LOAD tests
396
398
  com_obj = micrOSClient(host=address, port=9008, pwd="ADmin123", dbg=True)
397
399
  # [1.1] Run load test in one connection
398
- verdict_list = com_obj.load_test()
400
+ verdict_list, delta_t_single_session = com_obj.load_test()
399
401
  com_obj.close()
400
402
  high_level_verdict.append(verdict_list[-1])
401
403
 
402
404
  # [2] Run multi connection load test - reconnect - raw connection (without retry)
403
- verdict_multi = multi_conn_load(address)
405
+ verdict_multi, delta_t_multi_session = multi_conn_load(address)
404
406
  high_level_verdict.append((verdict_multi[-1]))
405
407
 
406
408
  ############################################################################
@@ -412,7 +414,7 @@ def micros_connection_metrics(address):
412
414
  for k in verdict_multi:
413
415
  print(f"\t{k}")
414
416
 
415
- return high_level_verdict
417
+ return high_level_verdict, delta_t_single_session, delta_t_multi_session
416
418
 
417
419
 
418
420
  if __name__ == "__main__":
@@ -446,7 +448,7 @@ if __name__ == "__main__":
446
448
  print(f"noconf out: {noconf_mode}")
447
449
  if force_close: com_obj.close()
448
450
 
449
- verdict = micros_connection_metrics(address=address)
451
+ verdict, delta_t_single, delta_t_multi = micros_connection_metrics(address=address)
450
452
  for k in verdict:
451
453
  print(f"+\t\t{k}")
452
454
 
toolkit/micrOSlint.py CHANGED
@@ -172,7 +172,7 @@ def core_dep_checker(categories, verbose=True):
172
172
  def load_module_checker(categories, verbose=True):
173
173
 
174
174
  def _is_allowed(_relation):
175
- _allowed_whitelist = ['Common', 'microIO', 'Types']
175
+ _allowed_whitelist = ['Common', 'microIO', 'Types', 'urequests']
176
176
  _allowed = []
177
177
  for _allow in _relation:
178
178
  if _allow in _allowed_whitelist:
@@ -239,7 +239,7 @@ def _run_pylint(file_name):
239
239
 
240
240
  def run_pylint(categories, verbose=True, dry_run=False):
241
241
  # ERROR CONFIG: drop error if this is in pylint output
242
- error_msg_core = ['syntax-error', 'undefined-variable', 'no-member']
242
+ error_msg_core = ['syntax-error', 'undefined-variable', 'bad-indentation'] # 'no-member' ?
243
243
  # BYPASS 'no-member' due to duty and sleep_ms micropython functions is drops false alarm, etc.
244
244
  error_msg_lm = ['syntax-error', 'undefined-variable']
245
245
 
@@ -467,7 +467,7 @@ def short_report(categories, states, verbose=True):
467
467
  print(f"load_module_checker: load module dependency check (no core): {c_OK if lm_dep[0] else c_NOK} {'' if lm_dep[1] == 0 else f'{lm_dep[1]}{_vis(lm_dep_diff)} warning(s)'}")
468
468
  print(f" core pylint score: {core_pylint}{_pyl_vis(core_score_diff)}")
469
469
  print(f"load module pylint score: {lm_pylint}{_pyl_vis(load_score_diff)}")
470
- print(f"pylint resource check (syntax): {c_OK if pylint_check[0] else f'{c_NOK}: {pylint_check[1]}' }")
470
+ print(f"pylint resource check (syntax?): {c_OK if pylint_check[0] else f'{c_NOK}: {pylint_check[1]}' }")
471
471
 
472
472
  exitcode = sum([1 for k, v in states.items() if not v[0]])
473
473
  print(f"micrOSlint verdict: {c_OK if exitcode == 0 else c_NOK}")
toolkit/socketClient.py CHANGED
@@ -4,7 +4,6 @@
4
4
  import sys
5
5
  import socket
6
6
  import os
7
- import select
8
7
  import time
9
8
  import json
10
9
  import threading
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -1,36 +0,0 @@
1
- #!/usr/bin/env python3
2
-
3
- import os
4
- import sys
5
- import time
6
- MYPATH = os.path.dirname(os.path.abspath(__file__))
7
- sys.path.append(os.path.dirname(MYPATH))
8
- import socketClient
9
-
10
- # FILL OUT
11
- DEVICE = 'AirQualityPro'
12
-
13
-
14
- def base_cmd():
15
- return ['--dev', DEVICE]
16
-
17
-
18
- def app(devfid=None):
19
- global DEVICE
20
- if devfid is not None:
21
- DEVICE = devfid
22
- for k in range(0, 20):
23
- args = base_cmd() + ['bme280 measure']
24
- try:
25
- status, answer = socketClient.run(args)
26
- if status:
27
- print("|- [{}/20] OK".format(k+1))
28
- else:
29
- print("|- [{}/20] ERR".format(k+1))
30
- time.sleep(3)
31
- except KeyboardInterrupt:
32
- break
33
-
34
-
35
- if __name__ == "__main__":
36
- app()
@@ -1,36 +0,0 @@
1
- #!/usr/bin/env python3
2
-
3
- import os
4
- import sys
5
- import time
6
- MYPATH = os.path.dirname(os.path.abspath(__file__))
7
- sys.path.append(os.path.dirname(MYPATH))
8
- import socketClient
9
-
10
- # FILL OUT
11
- DEVICE = 'airquality'
12
-
13
-
14
- def base_cmd():
15
- return ['--dev', DEVICE]
16
-
17
-
18
- def app(devfid=None):
19
- global DEVICE
20
- if devfid is not None:
21
- DEVICE = devfid
22
- for k in range(0, 20):
23
- args = base_cmd() + ['dht22 measure_w_co2']
24
- try:
25
- status, answer = socketClient.run(args)
26
- if status:
27
- print("|- [{}/20] OK".format(k+1))
28
- else:
29
- print("|- [{}/20] ERR".format(k+1))
30
- time.sleep(3)
31
- except KeyboardInterrupt:
32
- break
33
-
34
-
35
- if __name__ == "__main__":
36
- app()