smartpi 0.1.30__py3-none-any.whl → 0.1.31__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 +5 -118
- {smartpi-0.1.30.dist-info → smartpi-0.1.31.dist-info}/METADATA +7 -1
- {smartpi-0.1.30.dist-info → smartpi-0.1.31.dist-info}/RECORD +6 -6
- {smartpi-0.1.30.dist-info → smartpi-0.1.31.dist-info}/WHEEL +0 -0
- {smartpi-0.1.30.dist-info → smartpi-0.1.31.dist-info}/top_level.txt +0 -0
smartpi/__init__.py
CHANGED
smartpi/base_driver.py
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# coding=utf-8
|
|
2
|
-
import serial,time,struct,threading,fcntl
|
|
2
|
+
import serial,time,struct,threading,fcntl,os
|
|
3
3
|
from typing import List, Optional
|
|
4
4
|
from collections import deque
|
|
5
5
|
from . import servo,motor,cw2015
|
|
@@ -267,25 +267,10 @@ def read_factory_data() -> Optional[bytes]:
|
|
|
267
267
|
|
|
268
268
|
"""读取硬件ID"""
|
|
269
269
|
def read_hardware_ID() -> Optional[bytes]:
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
while True:
|
|
275
|
-
response =process_received_data()
|
|
276
|
-
if response:
|
|
277
|
-
serial_lock.release() #释放线程锁
|
|
278
|
-
fcntl.flock(ser.fileno(), fcntl.LOCK_UN) # 释放进程锁
|
|
279
|
-
display_data = response[6:-3].decode(errors="ignore")
|
|
280
|
-
# print(f"硬件ID: {display_data}")
|
|
281
|
-
return display_data
|
|
282
|
-
else:
|
|
283
|
-
if time.time() - start_time > 3:
|
|
284
|
-
print("读取超时")
|
|
285
|
-
buffer.clear()
|
|
286
|
-
serial_lock.release() #释放线程锁
|
|
287
|
-
fcntl.flock(ser.fileno(), fcntl.LOCK_UN) # 释放进程锁
|
|
288
|
-
return None
|
|
270
|
+
result = os.popen("cat /proc/cpuinfo | grep Serial").read().strip()
|
|
271
|
+
if ":" in result:
|
|
272
|
+
return result.split(":")[1].strip()
|
|
273
|
+
return None
|
|
289
274
|
|
|
290
275
|
"""读取设备名称"""
|
|
291
276
|
def read_device_name() -> Optional[bytes]:
|
|
@@ -361,104 +346,6 @@ def read_battery() -> Optional[bytes]:
|
|
|
361
346
|
return sensor.get_soc(0)
|
|
362
347
|
else:
|
|
363
348
|
return None
|
|
364
|
-
|
|
365
|
-
###############################################################################固件升级
|
|
366
|
-
|
|
367
|
-
#"""下载更新请求"""
|
|
368
|
-
#def update_request() -> Optional[bytes]:
|
|
369
|
-
# write_data(UPDATE_REQUEST_H, UPDATE_REQUEST_L)
|
|
370
|
-
# start_time = time.time()
|
|
371
|
-
# while True:
|
|
372
|
-
# response =process_received_data()
|
|
373
|
-
# if response:
|
|
374
|
-
# display_data = response[6:-3].decode(errors="ignore")
|
|
375
|
-
# print(f"从机响应: {display_data}")
|
|
376
|
-
# return display_data
|
|
377
|
-
# else:
|
|
378
|
-
# if time.time() - start_time > 3:
|
|
379
|
-
# print("读取超时")
|
|
380
|
-
# buffer.clear()
|
|
381
|
-
# return None
|
|
382
|
-
#
|
|
383
|
-
#"""查询最大通讯长度"""
|
|
384
|
-
#def read_max_com_len() -> Optional[bytes]:
|
|
385
|
-
# write_data(MAX_COM_LEN_H, MAX_COM_LEN_L)
|
|
386
|
-
# start_time = time.time()
|
|
387
|
-
# while True:
|
|
388
|
-
# response =process_received_data()
|
|
389
|
-
# if response:
|
|
390
|
-
# display_data = response[6:-3].decode(errors="ignore")
|
|
391
|
-
# print(f"从机响应: {display_data}")
|
|
392
|
-
# return display_data
|
|
393
|
-
# else:
|
|
394
|
-
# if time.time() - start_time > 3:
|
|
395
|
-
# print("读取超时")
|
|
396
|
-
# buffer.clear()
|
|
397
|
-
# return None
|
|
398
|
-
#
|
|
399
|
-
#"""下载文件的信息"""
|
|
400
|
-
#def download_massage() -> Optional[bytes]:
|
|
401
|
-
# write_data(DL_MESSAGE_H, DL_MESSAGE_L, file_data)#文件信息来源从哪获取?
|
|
402
|
-
# start_time = time.time()
|
|
403
|
-
# while True:
|
|
404
|
-
# response =process_received_data()
|
|
405
|
-
# if response:
|
|
406
|
-
# display_data = response[6:-3].decode(errors="ignore")
|
|
407
|
-
# print(f"从机响应: {display_data}")
|
|
408
|
-
# return display_data
|
|
409
|
-
# else:
|
|
410
|
-
# if time.time() - start_time > 3:
|
|
411
|
-
# print("读取超时")
|
|
412
|
-
# buffer.clear()
|
|
413
|
-
# return None
|
|
414
|
-
#
|
|
415
|
-
#"""查询设备状态"""
|
|
416
|
-
#def read_device_status() -> Optional[bytes]:
|
|
417
|
-
# write_data(READ_STATUS_H, READ_STATUS_L)
|
|
418
|
-
# start_time = time.time()
|
|
419
|
-
# while True:
|
|
420
|
-
# response =process_received_data()
|
|
421
|
-
# if response:
|
|
422
|
-
# display_data = response[6:-3].decode(errors="ignore")
|
|
423
|
-
# print(f"从机响应: {display_data}")
|
|
424
|
-
# return display_data
|
|
425
|
-
# else:
|
|
426
|
-
# if time.time() - start_time > 3:
|
|
427
|
-
# print("读取超时")
|
|
428
|
-
# buffer.clear()
|
|
429
|
-
# return None
|
|
430
|
-
#
|
|
431
|
-
#"""发送页校验码"""
|
|
432
|
-
#def write_page_check() -> Optional[bytes]:
|
|
433
|
-
# write_data(PAGE_CHECK_H, PAGE_CHECK_L, page_check_data)
|
|
434
|
-
# start_time = time.time()
|
|
435
|
-
# while True:
|
|
436
|
-
# response =process_received_data()
|
|
437
|
-
# if response:
|
|
438
|
-
# display_data = response[6:-3].decode(errors="ignore")
|
|
439
|
-
# print(f"从机响应: {display_data}")
|
|
440
|
-
# return display_data
|
|
441
|
-
# else:
|
|
442
|
-
# if time.time() - start_time > 3:
|
|
443
|
-
# print("读取超时")
|
|
444
|
-
# buffer.clear()
|
|
445
|
-
# return None
|
|
446
|
-
#
|
|
447
|
-
#"""发送页数据"""
|
|
448
|
-
#def write_page_check() -> Optional[bytes]:
|
|
449
|
-
# write_data(PAGE_SEND_H, PAGE_SEND_L, page_send_data)
|
|
450
|
-
# start_time = time.time()
|
|
451
|
-
# while True:
|
|
452
|
-
# response =process_received_data()
|
|
453
|
-
# if response:
|
|
454
|
-
# display_data = response[6:-3].decode(errors="ignore")
|
|
455
|
-
# print(f"从机响应: {display_data}")
|
|
456
|
-
# return display_data
|
|
457
|
-
# else:
|
|
458
|
-
# if time.time() - start_time > 3:
|
|
459
|
-
# print("读取超时")
|
|
460
|
-
# buffer.clear()
|
|
461
|
-
# return None
|
|
462
349
|
|
|
463
350
|
###############################################################################读取传感器信息
|
|
464
351
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: smartpi
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.31
|
|
4
4
|
Summary: A library use for H2-RCU
|
|
5
5
|
Author: ZMROBO
|
|
6
6
|
Classifier: Programming Language :: Python :: 3
|
|
@@ -9,3 +9,9 @@ Classifier: Operating System :: OS Independent
|
|
|
9
9
|
Requires-Python: >=3.7
|
|
10
10
|
Description-Content-Type: text/markdown
|
|
11
11
|
|
|
12
|
+
灵芯派函数库
|
|
13
|
+
SmartPi library
|
|
14
|
+
|
|
15
|
+
V0.1.31
|
|
16
|
+
1、更新了设备硬件ID读取函数;
|
|
17
|
+
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
smartpi/__init__.py,sha256=
|
|
1
|
+
smartpi/__init__.py,sha256=Mx0R3q6LJmVf3XdhWEIDW7hj_vsJq0V5t3jS2XeErj8,199
|
|
2
2
|
smartpi/_gui.py,sha256=ij-6HZAEIwdy_hvU7f0NkyQjx_-eephijlKbGUhf8Uo,2177
|
|
3
|
-
smartpi/base_driver.py,sha256=
|
|
3
|
+
smartpi/base_driver.py,sha256=P029DleVPCTYTWi0ckwTwdfBNzzRrb13mGFdxIWCSYQ,20131
|
|
4
4
|
smartpi/color_sensor.py,sha256=YXJjknYjp7teTZsHYZRAWgi73CH0MhBp1go9y0Inxyo,498
|
|
5
5
|
smartpi/cw2015.py,sha256=1lAF-pi_ye_ya1AZQS1sjbgsDf7MThO5IAskKsNGBzA,5695
|
|
6
6
|
smartpi/flash.py,sha256=-pUqg6FSVoBiLFKqrG9B4dFqn8lICnQsSPJr_MtZLIU,4132
|
|
@@ -14,7 +14,7 @@ smartpi/temperature.py,sha256=VT79CYA41q1d_4AM-Y0eIMeIw7AtCkSXjWVws6Yx5yE,462
|
|
|
14
14
|
smartpi/touch_sensor.py,sha256=P57RRQlqY0KexpMi-ydqwF5albOKCBOGb0Rb6zeVTqk,440
|
|
15
15
|
smartpi/trace.py,sha256=tut7BMbq87ShaR5eNuv7PZtAEz9DS5_BDf0_muIZ-tQ,4577
|
|
16
16
|
smartpi/ultrasonic.py,sha256=kmVpUfvE1oHoqgv92ZU6Fi-sO6DSwm10ssKsImNeOkY,624
|
|
17
|
-
smartpi-0.1.
|
|
18
|
-
smartpi-0.1.
|
|
19
|
-
smartpi-0.1.
|
|
20
|
-
smartpi-0.1.
|
|
17
|
+
smartpi-0.1.31.dist-info/METADATA,sha256=cWc5QT8cfatmdvFj6TYtDRYZf41lR7NlktAgu9Z-DM0,399
|
|
18
|
+
smartpi-0.1.31.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
|
|
19
|
+
smartpi-0.1.31.dist-info/top_level.txt,sha256=PoLhUCmWAiQUg5UeN2fS-Y1iQyBbF2rdUlizXtpHGRQ,8
|
|
20
|
+
smartpi-0.1.31.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|