smartpi 0.1.15__py3-none-any.whl → 0.1.17__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 +1 -1
- smartpi/base_driver.py +24 -3
- smartpi/trace.py +2 -2
- {smartpi-0.1.15.dist-info → smartpi-0.1.17.dist-info}/METADATA +1 -1
- {smartpi-0.1.15.dist-info → smartpi-0.1.17.dist-info}/RECORD +7 -7
- {smartpi-0.1.15.dist-info → smartpi-0.1.17.dist-info}/WHEEL +0 -0
- {smartpi-0.1.15.dist-info → smartpi-0.1.17.dist-info}/top_level.txt +0 -0
smartpi/__init__.py
CHANGED
smartpi/base_driver.py
CHANGED
|
@@ -443,13 +443,13 @@ def read_battery() -> Optional[bytes]:
|
|
|
443
443
|
|
|
444
444
|
"""读取外设连接情况"""
|
|
445
445
|
def read_peripheral() -> Optional[bytes]:
|
|
446
|
-
serial_lock.acquire() #获取线程锁
|
|
446
|
+
# serial_lock.acquire() #获取线程锁
|
|
447
447
|
write_data(READ_PERIPH_H, READ_PERIPH_L)
|
|
448
448
|
start_time = time.time()
|
|
449
449
|
while True:
|
|
450
450
|
response =process_received_data()
|
|
451
451
|
if response:
|
|
452
|
-
serial_lock.release() #释放线程锁
|
|
452
|
+
# serial_lock.release() #释放线程锁
|
|
453
453
|
display_data = response[6:-3]
|
|
454
454
|
# for x in display_data:
|
|
455
455
|
# print(f"{x:02X}", end=' ')
|
|
@@ -459,7 +459,7 @@ def read_peripheral() -> Optional[bytes]:
|
|
|
459
459
|
if time.time() - start_time > 3:
|
|
460
460
|
print("读取超时")
|
|
461
461
|
buffer.clear()
|
|
462
|
-
serial_lock.release() #释放线程锁
|
|
462
|
+
# serial_lock.release() #释放线程锁
|
|
463
463
|
return None
|
|
464
464
|
|
|
465
465
|
"""单次操作外设"""
|
|
@@ -534,6 +534,27 @@ def mode_change(send_data: str) -> Optional[bytes]:
|
|
|
534
534
|
buffer.clear()
|
|
535
535
|
serial_lock.release() #释放线程锁
|
|
536
536
|
return None
|
|
537
|
+
|
|
538
|
+
def shut_down():
|
|
539
|
+
serial_lock.acquire() #获取线程锁
|
|
540
|
+
write_data(0XFF, 0XFE)
|
|
541
|
+
serial_lock.release() #释放线程锁
|
|
542
|
+
time.sleep(0.5)
|
|
543
|
+
|
|
544
|
+
def shut_down_state() -> bool:
|
|
545
|
+
serial_lock.acquire() #获取线程锁
|
|
546
|
+
response =process_received_data()
|
|
547
|
+
if response:
|
|
548
|
+
receive_data = response[4:-3]
|
|
549
|
+
if receive_data[0]==0XFF and receive_data[1]==0XFE:
|
|
550
|
+
serial_lock.release() #释放线程锁
|
|
551
|
+
return True
|
|
552
|
+
else:
|
|
553
|
+
serial_lock.release() #释放线程锁
|
|
554
|
+
return False
|
|
555
|
+
else:
|
|
556
|
+
serial_lock.release() #释放线程锁
|
|
557
|
+
return False
|
|
537
558
|
|
|
538
559
|
"""H2-RCU初始化"""
|
|
539
560
|
def smartpi_init():
|
smartpi/trace.py
CHANGED
|
@@ -7,14 +7,14 @@ from smartpi import base_driver
|
|
|
7
7
|
def get_analog(port:bytes, chn:bytes) -> Optional[bytes]:
|
|
8
8
|
trace_str=[0xA0, 0x21, 0x01, 0x71, 0x00, 0xBE]
|
|
9
9
|
trace_str[0]=0XA0+port
|
|
10
|
-
trace_str[4]=
|
|
10
|
+
trace_str[4]=20+chn
|
|
11
11
|
response = base_driver.single_operate_sensor(trace_str)
|
|
12
12
|
if response == None:
|
|
13
13
|
return None
|
|
14
14
|
else:
|
|
15
15
|
trace_data=response[4:-1]
|
|
16
16
|
trace_num=int.from_bytes(trace_data, byteorder='big', signed=True)
|
|
17
|
-
return
|
|
17
|
+
return response[4]
|
|
18
18
|
|
|
19
19
|
#循迹卡设置全部颜色 port:连接P端口;正常返回:通道光值数据; 读取错误:None
|
|
20
20
|
def set_color(port:bytes, color:bytes) -> Optional[bytes]:
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
smartpi/__init__.py,sha256=
|
|
2
|
-
smartpi/base_driver.py,sha256=
|
|
1
|
+
smartpi/__init__.py,sha256=QvBc8l0qX84e0M5-X8BCEcxwyPCioMaK72G9o0Bpc00,55
|
|
2
|
+
smartpi/base_driver.py,sha256=itd5Qe5MMiTBUeOLoIjrZO3dvCXS-Mgaz8soKqzveAk,20874
|
|
3
3
|
smartpi/color_sensor.py,sha256=sTqD3jApjmc6qHMrDyEy2UjaRt8vhJZNR88vzgUiLKs,496
|
|
4
4
|
smartpi/cw2015.py,sha256=1lAF-pi_ye_ya1AZQS1sjbgsDf7MThO5IAskKsNGBzA,5695
|
|
5
5
|
smartpi/flash.py,sha256=Luz0TjinQSkx31uVknqfSWkiAiVrqIE2Iba7lk3AOzM,4132
|
|
@@ -12,9 +12,9 @@ smartpi/move.py,sha256=3qzrJCGA-qbsLXBpklY2DErtw0jlzMELzozjhEvRzKs,6028
|
|
|
12
12
|
smartpi/servo.py,sha256=B6X3yCoEz82qqpUIE5MSO0Eg9YZJ5zDzJEcRpioZpUo,4625
|
|
13
13
|
smartpi/temperature.py,sha256=px2YeqgG63nPkyhJA1wDg3dwYx_oOCYuhMjtsVm_YO0,460
|
|
14
14
|
smartpi/touch_sensor.py,sha256=F6IIQGewNRhC9U1RbHpVzuGYqb8H41lpeQ1Ejwsc_T8,438
|
|
15
|
-
smartpi/trace.py,sha256=
|
|
15
|
+
smartpi/trace.py,sha256=2sqMZhaT1x2pR7qO-U5w4XHyFssx3swRka88mJlcxPw,1095
|
|
16
16
|
smartpi/ultrasonic.py,sha256=0meczFKXFLUt92kLxipeEc37vb5duvJjPs4kgtlpO8M,622
|
|
17
|
-
smartpi-0.1.
|
|
18
|
-
smartpi-0.1.
|
|
19
|
-
smartpi-0.1.
|
|
20
|
-
smartpi-0.1.
|
|
17
|
+
smartpi-0.1.17.dist-info/METADATA,sha256=87afL8yQ8pS-mVIR6YVbQPsqAfQXddk48WJQvSNNu5A,311
|
|
18
|
+
smartpi-0.1.17.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
|
|
19
|
+
smartpi-0.1.17.dist-info/top_level.txt,sha256=PoLhUCmWAiQUg5UeN2fS-Y1iQyBbF2rdUlizXtpHGRQ,8
|
|
20
|
+
smartpi-0.1.17.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|