smartpi 0.1.18__py3-none-any.whl → 0.1.19__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 +23 -20
- {smartpi-0.1.18.dist-info → smartpi-0.1.19.dist-info}/METADATA +1 -1
- {smartpi-0.1.18.dist-info → smartpi-0.1.19.dist-info}/RECORD +6 -6
- {smartpi-0.1.18.dist-info → smartpi-0.1.19.dist-info}/WHEEL +0 -0
- {smartpi-0.1.18.dist-info → smartpi-0.1.19.dist-info}/top_level.txt +0 -0
smartpi/__init__.py
CHANGED
smartpi/base_driver.py
CHANGED
|
@@ -201,8 +201,8 @@ def process_received_data():
|
|
|
201
201
|
##############################################################################读取设备信息
|
|
202
202
|
"""读取设备型号"""
|
|
203
203
|
def read_device_model() -> Optional[bytes]:
|
|
204
|
-
fcntl.flock(ser.fileno(), fcntl.LOCK_EX) # 进程锁,阻塞其他进程
|
|
205
204
|
serial_lock.acquire() #获取线程锁
|
|
205
|
+
fcntl.flock(ser.fileno(), fcntl.LOCK_EX) # 进程锁,阻塞其他进程
|
|
206
206
|
write_data(READ_MODEL_H, READ_MODEL_L)
|
|
207
207
|
start_time = time.time()
|
|
208
208
|
while True:
|
|
@@ -223,8 +223,8 @@ def read_device_model() -> Optional[bytes]:
|
|
|
223
223
|
|
|
224
224
|
"""读取版本号"""
|
|
225
225
|
def read_version() -> Optional[bytes]:
|
|
226
|
-
fcntl.flock(ser.fileno(), fcntl.LOCK_EX) # 进程锁,阻塞其他进程
|
|
227
226
|
serial_lock.acquire() #获取线程锁
|
|
227
|
+
fcntl.flock(ser.fileno(), fcntl.LOCK_EX) # 进程锁,阻塞其他进程
|
|
228
228
|
write_data(READ_VERSION_H, READ_VERSION_L)
|
|
229
229
|
start_time = time.time()
|
|
230
230
|
while True:
|
|
@@ -245,8 +245,8 @@ def read_version() -> Optional[bytes]:
|
|
|
245
245
|
|
|
246
246
|
"""读取工厂信息"""
|
|
247
247
|
def read_factory_data() -> Optional[bytes]:
|
|
248
|
-
fcntl.flock(ser.fileno(), fcntl.LOCK_EX) # 进程锁,阻塞其他进程
|
|
249
248
|
serial_lock.acquire() #获取线程锁
|
|
249
|
+
fcntl.flock(ser.fileno(), fcntl.LOCK_EX) # 进程锁,阻塞其他进程
|
|
250
250
|
write_data(READ_FACTORY_H, READ_FACTORY_L)
|
|
251
251
|
start_time = time.time()
|
|
252
252
|
while True:
|
|
@@ -267,8 +267,8 @@ def read_factory_data() -> Optional[bytes]:
|
|
|
267
267
|
|
|
268
268
|
"""读取硬件ID"""
|
|
269
269
|
def read_hardware_ID() -> Optional[bytes]:
|
|
270
|
-
fcntl.flock(ser.fileno(), fcntl.LOCK_EX) # 进程锁,阻塞其他进程
|
|
271
270
|
serial_lock.acquire() #获取线程锁
|
|
271
|
+
fcntl.flock(ser.fileno(), fcntl.LOCK_EX) # 进程锁,阻塞其他进程
|
|
272
272
|
write_data(READ_HW_ID_H, READ_HW_ID_L)
|
|
273
273
|
start_time = time.time()
|
|
274
274
|
while True:
|
|
@@ -289,8 +289,8 @@ def read_hardware_ID() -> Optional[bytes]:
|
|
|
289
289
|
|
|
290
290
|
"""读取设备名称"""
|
|
291
291
|
def read_device_name() -> Optional[bytes]:
|
|
292
|
-
|
|
293
|
-
|
|
292
|
+
serial_lock.acquire() #获取线程锁
|
|
293
|
+
fcntl.flock(ser.fileno(), fcntl.LOCK_EX) # 进程锁,阻塞其他进程
|
|
294
294
|
write_data(READ_NAME_H, READ_NAME_L)
|
|
295
295
|
start_time = time.time()
|
|
296
296
|
while True:
|
|
@@ -311,8 +311,8 @@ def read_device_name() -> Optional[bytes]:
|
|
|
311
311
|
|
|
312
312
|
"""设置设备名称"""
|
|
313
313
|
def write_device_name(send_data: str) -> Optional[bytes]:
|
|
314
|
-
fcntl.flock(ser.fileno(), fcntl.LOCK_EX) # 进程锁,阻塞其他进程
|
|
315
314
|
serial_lock.acquire() #获取线程锁
|
|
315
|
+
fcntl.flock(ser.fileno(), fcntl.LOCK_EX) # 进程锁,阻塞其他进程
|
|
316
316
|
data_bytes = send_data.encode('utf-8')
|
|
317
317
|
write_data(WRITE_NAME_H, WRITE_NAME_L, data_bytes)
|
|
318
318
|
start_time = time.time()
|
|
@@ -334,8 +334,8 @@ def write_device_name(send_data: str) -> Optional[bytes]:
|
|
|
334
334
|
|
|
335
335
|
"""读取连接方式"""
|
|
336
336
|
def read_connected() -> Optional[bytes]:
|
|
337
|
-
fcntl.flock(ser.fileno(), fcntl.LOCK_EX) # 进程锁,阻塞其他进程
|
|
338
337
|
serial_lock.acquire() #获取线程锁
|
|
338
|
+
fcntl.flock(ser.fileno(), fcntl.LOCK_EX) # 进程锁,阻塞其他进程
|
|
339
339
|
write_data(READ_CONNECT_H, READ_CONNECT_L)
|
|
340
340
|
start_time = time.time()
|
|
341
341
|
while True:
|
|
@@ -464,8 +464,8 @@ def read_battery() -> Optional[bytes]:
|
|
|
464
464
|
|
|
465
465
|
"""读取外设连接情况"""
|
|
466
466
|
def read_peripheral() -> Optional[bytes]:
|
|
467
|
-
fcntl.flock(ser.fileno(), fcntl.LOCK_EX) # 进程锁,阻塞其他进程
|
|
468
467
|
serial_lock.acquire() #获取线程锁
|
|
468
|
+
fcntl.flock(ser.fileno(), fcntl.LOCK_EX) # 进程锁,阻塞其他进程
|
|
469
469
|
write_data(READ_PERIPH_H, READ_PERIPH_L)
|
|
470
470
|
start_time = time.time()
|
|
471
471
|
while True:
|
|
@@ -487,9 +487,9 @@ def read_peripheral() -> Optional[bytes]:
|
|
|
487
487
|
return None
|
|
488
488
|
|
|
489
489
|
"""单次操作外设"""
|
|
490
|
-
def single_operate_sensor(op_struct: bytes) -> Optional[bytes]:
|
|
491
|
-
fcntl.flock(ser.fileno(), fcntl.LOCK_EX) # 进程锁,阻塞其他进程
|
|
490
|
+
def single_operate_sensor(op_struct: bytes) -> Optional[bytes]:
|
|
492
491
|
serial_lock.acquire() #获取线程锁
|
|
492
|
+
fcntl.flock(ser.fileno(), fcntl.LOCK_EX) # 进程锁,阻塞其他进程
|
|
493
493
|
write_data(SINGLE_OP_H, SINGLE_OP_L, op_struct)
|
|
494
494
|
start_time = time.time()
|
|
495
495
|
while True:
|
|
@@ -522,8 +522,8 @@ def P_port_init(port:bytes) -> Optional[bytes]:
|
|
|
522
522
|
|
|
523
523
|
"""从机模式转换"""
|
|
524
524
|
def mode_change(send_data: str) -> Optional[bytes]:
|
|
525
|
-
|
|
526
|
-
|
|
525
|
+
serial_lock.acquire() #获取线程锁
|
|
526
|
+
fcntl.flock(ser.fileno(), fcntl.LOCK_EX) # 进程锁,阻塞其他进程
|
|
527
527
|
write_data(MODE_CHANGE_H, MODE_CHANGE_L, send_data)
|
|
528
528
|
start_time = time.time()
|
|
529
529
|
while True:
|
|
@@ -546,8 +546,8 @@ def mode_change(send_data: str) -> Optional[bytes]:
|
|
|
546
546
|
|
|
547
547
|
"""智能模式发送周期"""
|
|
548
548
|
def mode_change(send_data: str) -> Optional[bytes]:
|
|
549
|
-
|
|
550
|
-
|
|
549
|
+
serial_lock.acquire() #获取线程锁
|
|
550
|
+
fcntl.flock(ser.fileno(), fcntl.LOCK_EX) # 进程锁,阻塞其他进程
|
|
551
551
|
write_data(SEND_CYCLE_H, SEND_CYCLE_L, send_data)
|
|
552
552
|
start_time = time.time()
|
|
553
553
|
while True:
|
|
@@ -569,16 +569,16 @@ def mode_change(send_data: str) -> Optional[bytes]:
|
|
|
569
569
|
return None
|
|
570
570
|
|
|
571
571
|
def shut_down():
|
|
572
|
-
fcntl.flock(ser.fileno(), fcntl.LOCK_EX) # 进程锁,阻塞其他进程
|
|
573
572
|
serial_lock.acquire() #获取线程锁
|
|
573
|
+
fcntl.flock(ser.fileno(), fcntl.LOCK_EX) # 进程锁,阻塞其他进程
|
|
574
574
|
write_data(0XFF, 0XFE)
|
|
575
575
|
serial_lock.release() #释放线程锁
|
|
576
576
|
fcntl.flock(ser.fileno(), fcntl.LOCK_UN) # 释放进程锁
|
|
577
577
|
time.sleep(0.5)
|
|
578
578
|
|
|
579
579
|
def shut_down_state() -> bool:
|
|
580
|
-
fcntl.flock(ser.fileno(), fcntl.LOCK_EX) # 进程锁,阻塞其他进程
|
|
581
580
|
serial_lock.acquire() #获取线程锁
|
|
581
|
+
fcntl.flock(ser.fileno(), fcntl.LOCK_EX) # 进程锁,阻塞其他进程
|
|
582
582
|
response =process_received_data()
|
|
583
583
|
if response:
|
|
584
584
|
receive_data = response[4:-3]
|
|
@@ -599,10 +599,13 @@ def shut_down_state() -> bool:
|
|
|
599
599
|
def smartpi_init():
|
|
600
600
|
|
|
601
601
|
if is_lock_locked(serial_lock):
|
|
602
|
-
serial_lock.release()
|
|
602
|
+
serial_lock.release() #释放线程锁
|
|
603
603
|
|
|
604
|
-
|
|
604
|
+
fcntl.flock(ser.fileno(), fcntl.LOCK_UN) # 释放进程锁
|
|
605
|
+
serial_lock.acquire() #获取线程锁
|
|
606
|
+
fcntl.flock(ser.fileno(), fcntl.LOCK_EX) # 进程锁,阻塞其他进程
|
|
605
607
|
uart3_init()
|
|
608
|
+
fcntl.flock(ser.fileno(), fcntl.LOCK_UN) # 释放进程锁
|
|
606
609
|
P_port_init(1)
|
|
607
610
|
P_port_init(2)
|
|
608
611
|
P_port_init(3)
|
|
@@ -635,6 +638,6 @@ def smartpi_init():
|
|
|
635
638
|
motor.reset_motor_encoder(6)
|
|
636
639
|
time.sleep(0.1)
|
|
637
640
|
gui.init()
|
|
638
|
-
serial_lock.release()
|
|
641
|
+
serial_lock.release()
|
|
639
642
|
time.sleep(0.1)
|
|
640
643
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
smartpi/__init__.py,sha256=
|
|
2
|
-
smartpi/base_driver.py,sha256=
|
|
1
|
+
smartpi/__init__.py,sha256=XC4FyX6UBONemsJEdIZzMvIkF4pscJ5XGVvK8jgVCdA,55
|
|
2
|
+
smartpi/base_driver.py,sha256=DV-jh7j4X7ak9zFSqgwjHrj1X18SDqUjCqewLovxDVU,24096
|
|
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
|
|
@@ -14,7 +14,7 @@ smartpi/temperature.py,sha256=px2YeqgG63nPkyhJA1wDg3dwYx_oOCYuhMjtsVm_YO0,460
|
|
|
14
14
|
smartpi/touch_sensor.py,sha256=F6IIQGewNRhC9U1RbHpVzuGYqb8H41lpeQ1Ejwsc_T8,438
|
|
15
15
|
smartpi/trace.py,sha256=dtZQAkUUIsq578hycwrfR9GJUsIUCbHCF4ZvJv9GLrs,984
|
|
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.19.dist-info/METADATA,sha256=kViF6wYE4k68vEkBr0T8XPnoZGIN3gmP0d7sAulJItg,311
|
|
18
|
+
smartpi-0.1.19.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
|
|
19
|
+
smartpi-0.1.19.dist-info/top_level.txt,sha256=PoLhUCmWAiQUg5UeN2fS-Y1iQyBbF2rdUlizXtpHGRQ,8
|
|
20
|
+
smartpi-0.1.19.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|