smartpi 0.1.11__py3-none-any.whl → 0.1.12__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.
smartpi/__init__.py CHANGED
@@ -1,4 +1,4 @@
1
1
  __all__ = ["base_driver"]
2
2
 
3
- __version__ = "0.1.11"
3
+ __version__ = "0.1.12"
4
4
 
smartpi/base_driver.py CHANGED
@@ -331,7 +331,7 @@ def update_request() -> Optional[bytes]:
331
331
  if time.time() - start_time > 3:
332
332
  print("读取超时")
333
333
  buffer.clear()
334
- return -1
334
+ return None
335
335
 
336
336
  """查询最大通讯长度"""
337
337
  def read_max_com_len() -> Optional[bytes]:
@@ -347,7 +347,7 @@ def read_max_com_len() -> Optional[bytes]:
347
347
  if time.time() - start_time > 3:
348
348
  print("读取超时")
349
349
  buffer.clear()
350
- return -1
350
+ return None
351
351
 
352
352
  """下载文件的信息"""
353
353
  #def download_massage() -> Optional[bytes]:
@@ -363,7 +363,7 @@ def read_max_com_len() -> Optional[bytes]:
363
363
  # if time.time() - start_time > 3:
364
364
  # print("读取超时")
365
365
  # buffer.clear()
366
- # return -1
366
+ # return None
367
367
  #
368
368
  #"""查询设备状态"""
369
369
  #def read_device_status() -> Optional[bytes]:
@@ -379,7 +379,7 @@ def read_max_com_len() -> Optional[bytes]:
379
379
  # if time.time() - start_time > 3:
380
380
  # print("读取超时")
381
381
  # buffer.clear()
382
- # return -1
382
+ # return None
383
383
  #
384
384
  #"""发送页校验码"""
385
385
  #def write_page_check() -> Optional[bytes]:
@@ -395,7 +395,7 @@ def read_max_com_len() -> Optional[bytes]:
395
395
  # if time.time() - start_time > 3:
396
396
  # print("读取超时")
397
397
  # buffer.clear()
398
- # return -1
398
+ # return None
399
399
  #
400
400
  #"""发送页数据"""
401
401
  #def write_page_check() -> Optional[bytes]:
@@ -411,7 +411,7 @@ def read_max_com_len() -> Optional[bytes]:
411
411
  # if time.time() - start_time > 3:
412
412
  # print("读取超时")
413
413
  # buffer.clear()
414
- # return -1
414
+ # return None
415
415
 
416
416
  ###############################################################################读取传感器信息
417
417
 
smartpi/gui.py CHANGED
@@ -1,6 +1,7 @@
1
1
  import socket
2
2
  import json
3
3
  import sys
4
+ import time
4
5
 
5
6
  # 连接对象(模块级单例)
6
7
  _connection = None
@@ -16,8 +17,10 @@ def _send(cmd):
16
17
  """发送命令到服务器"""
17
18
  if _connection is None and "pytest" not in sys.modules: # 允许测试环境不初始化
18
19
  raise ConnectionError("GUI not initialized. Call gui.init() first.")
20
+ time.sleep(0.1)
19
21
  if _connection:
20
22
  _connection.sendall((json.dumps(cmd) + "\n").encode())
23
+ time.sleep(0.1)
21
24
 
22
25
  def show_text(x, y, text, color="black", size=16):
23
26
  _send({"type": "text", "x": x, "y": y, "text": text, "color": color, "size": size})
smartpi/servo.py CHANGED
@@ -95,7 +95,7 @@ def set_speed(port:bytes,speed:int) -> Optional[bytes]:
95
95
  if response == None:
96
96
  return None
97
97
  else:
98
- return 0
98
+ return 0
99
99
 
100
100
  #���ֶ������ת�� port:����P�˿ڣ�code:����(0~65535)��speed:�ٶ�(-100~100)��
101
101
  def set_code_speed(port:bytes,code:int,speed:int) -> Optional[bytes]:
@@ -119,7 +119,7 @@ def set_code_speed(port:bytes,code:int,speed:int) -> Optional[bytes]:
119
119
  if response == None:
120
120
  return None
121
121
  else:
122
- return 0
122
+ return 0
123
123
 
124
124
  #���ֶ������ֵ���� port:����P�˿ڣ�
125
125
  def reset_encode(port:bytes) -> Optional[bytes]:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: smartpi
3
- Version: 0.1.11
3
+ Version: 0.1.12
4
4
  Summary: A library use for H2-RCU
5
5
  Author: ZMROBO
6
6
  Classifier: Programming Language :: Python :: 3
@@ -1,18 +1,18 @@
1
- smartpi/__init__.py,sha256=CD_hKLtgmxyccH-ALP0bESCFPd6DvzMJQDqN9sKrtwg,55
2
- smartpi/base_driver.py,sha256=RVZQX1wbSVToJ_fsvxeVcc-v31LnND3YUPCybyUZa3s,18021
1
+ smartpi/__init__.py,sha256=ynl00MdZK44BRltFscnxPvaQB9vT8qwdufP2vRovzWc,55
2
+ smartpi/base_driver.py,sha256=FmnwZFqKE2HVUsDoqxXigdX1YlElcY07YkLnlvKY_x8,18033
3
3
  smartpi/color_sensor.py,sha256=sTqD3jApjmc6qHMrDyEy2UjaRt8vhJZNR88vzgUiLKs,496
4
4
  smartpi/cw2015.py,sha256=1lAF-pi_ye_ya1AZQS1sjbgsDf7MThO5IAskKsNGBzA,5695
5
- smartpi/gui.py,sha256=E98_soyWbEf_dwYhXZgMSXrgY5QuYoDTuFCPK63flIQ,2102
5
+ smartpi/gui.py,sha256=VuZEhuM3M-Lz12dpzRhcdLxE8p-Hosdq4wa0jAbnnbc,2165
6
6
  smartpi/humidity.py,sha256=xtALQ_IlcwR2RCYvopCSmeNajB45kQU_ckk6FZ0rqko,497
7
7
  smartpi/led.py,sha256=n3_k1jGcQptfGXhezDLaYzH6UptgluP4Ze6qP_Y4WmU,536
8
8
  smartpi/light_sensor.py,sha256=kWmoXklYS1QG0eDz4Qn9FF4WueR3GARb3OwQSkXqUNA,569
9
9
  smartpi/motor.py,sha256=uvuAwt2j5LjdLaMfNisXqaGh1ro3fZDvHU8IXd2fn9Q,4527
10
10
  smartpi/move.py,sha256=3qzrJCGA-qbsLXBpklY2DErtw0jlzMELzozjhEvRzKs,6028
11
- smartpi/servo.py,sha256=0KfWM1PEBL2u15-lZnzav_qTWErf0ldeuX265c6oUPM,4623
11
+ smartpi/servo.py,sha256=B6X3yCoEz82qqpUIE5MSO0Eg9YZJ5zDzJEcRpioZpUo,4625
12
12
  smartpi/temperature.py,sha256=px2YeqgG63nPkyhJA1wDg3dwYx_oOCYuhMjtsVm_YO0,460
13
13
  smartpi/touch_sensor.py,sha256=F6IIQGewNRhC9U1RbHpVzuGYqb8H41lpeQ1Ejwsc_T8,438
14
14
  smartpi/ultrasonic.py,sha256=0meczFKXFLUt92kLxipeEc37vb5duvJjPs4kgtlpO8M,622
15
- smartpi-0.1.11.dist-info/METADATA,sha256=Vthva8Lex9bj8dr-QULiRbD0GuitBBR_0hRnCLlFRZQ,311
16
- smartpi-0.1.11.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
17
- smartpi-0.1.11.dist-info/top_level.txt,sha256=PoLhUCmWAiQUg5UeN2fS-Y1iQyBbF2rdUlizXtpHGRQ,8
18
- smartpi-0.1.11.dist-info/RECORD,,
15
+ smartpi-0.1.12.dist-info/METADATA,sha256=0HdhhFfnoSXNc6LVxBdE-zqiKdxdu1U7x7NxGLcAbcU,311
16
+ smartpi-0.1.12.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
17
+ smartpi-0.1.12.dist-info/top_level.txt,sha256=PoLhUCmWAiQUg5UeN2fS-Y1iQyBbF2rdUlizXtpHGRQ,8
18
+ smartpi-0.1.12.dist-info/RECORD,,