smartpi 0.1.20__py3-none-any.whl → 0.1.22__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 +3 -3
- smartpi/color_sensor.py +1 -1
- smartpi/flash.py +1 -1
- smartpi/humidity.py +1 -1
- smartpi/led.py +1 -1
- smartpi/light_sensor.py +4 -4
- smartpi/motor.py +23 -14
- smartpi/move.py +9 -9
- smartpi/servo.py +21 -10
- smartpi/temperature.py +1 -1
- smartpi/touch_sensor.py +1 -1
- smartpi/trace.py +5 -5
- smartpi/ultrasonic.py +1 -1
- {smartpi-0.1.20.dist-info → smartpi-0.1.22.dist-info}/METADATA +1 -1
- smartpi-0.1.22.dist-info/RECORD +20 -0
- smartpi-0.1.20.dist-info/RECORD +0 -20
- {smartpi-0.1.20.dist-info → smartpi-0.1.22.dist-info}/WHEEL +0 -0
- {smartpi-0.1.20.dist-info → smartpi-0.1.22.dist-info}/top_level.txt +0 -0
smartpi/__init__.py
CHANGED
smartpi/base_driver.py
CHANGED
|
@@ -487,7 +487,7 @@ def read_peripheral() -> Optional[bytes]:
|
|
|
487
487
|
return None
|
|
488
488
|
|
|
489
489
|
"""单次操作外设"""
|
|
490
|
-
def single_operate_sensor(op_struct: bytes) -> Optional[bytes]:
|
|
490
|
+
def single_operate_sensor(op_struct: bytes, block_time: float) -> Optional[bytes]:
|
|
491
491
|
serial_lock.acquire() #获取线程锁
|
|
492
492
|
fcntl.flock(ser.fileno(), fcntl.LOCK_EX) # 进程锁,阻塞其他进程
|
|
493
493
|
write_data(SINGLE_OP_H, SINGLE_OP_L, op_struct)
|
|
@@ -503,7 +503,7 @@ def single_operate_sensor(op_struct: bytes) -> Optional[bytes]:
|
|
|
503
503
|
# print("\n")
|
|
504
504
|
return display_data
|
|
505
505
|
else:
|
|
506
|
-
if time.time() - start_time > 2:
|
|
506
|
+
if time.time() - start_time > 2+block_time:
|
|
507
507
|
print("读取超时")
|
|
508
508
|
buffer.clear()
|
|
509
509
|
serial_lock.release() #释放线程锁
|
|
@@ -514,7 +514,7 @@ def single_operate_sensor(op_struct: bytes) -> Optional[bytes]:
|
|
|
514
514
|
def P_port_init(port:bytes) -> Optional[bytes]:
|
|
515
515
|
servo_str=[0xA0, 0x0F, 0x00, 0xBE]
|
|
516
516
|
servo_str[0]=0XA0+port
|
|
517
|
-
response = single_operate_sensor(servo_str)
|
|
517
|
+
response = single_operate_sensor(servo_str,0)
|
|
518
518
|
if response:
|
|
519
519
|
return 0
|
|
520
520
|
else:
|
smartpi/color_sensor.py
CHANGED
|
@@ -8,7 +8,7 @@ def get_value(port:bytes) -> Optional[bytes]:
|
|
|
8
8
|
color_str=[0xA0, 0x04, 0x00, 0xBE]
|
|
9
9
|
color_str[0]=0XA0+port
|
|
10
10
|
color_str[2]=1
|
|
11
|
-
response = base_driver.single_operate_sensor(color_str)
|
|
11
|
+
response = base_driver.single_operate_sensor(color_str,0)
|
|
12
12
|
if response == None:
|
|
13
13
|
return None
|
|
14
14
|
else:
|
smartpi/flash.py
CHANGED
|
@@ -7,7 +7,7 @@ FLASH_FILE = os.path.join(os.path.dirname(os.path.abspath(__file__)), "/home/Int
|
|
|
7
7
|
FLASH_FILE_2 = os.path.join(os.path.dirname(os.path.abspath(__file__)), "/home/Interface/flash/flash_2.bin")
|
|
8
8
|
|
|
9
9
|
DATA_SIZE = 2 # 每个数据2字节
|
|
10
|
-
TOTAL_SLOTS =
|
|
10
|
+
TOTAL_SLOTS = 120 # 100个数据槽
|
|
11
11
|
|
|
12
12
|
def _init_flash_file():
|
|
13
13
|
"""初始化存储文件"""
|
smartpi/humidity.py
CHANGED
|
@@ -9,7 +9,7 @@ def get_value(port:bytes) -> Optional[bytes]:
|
|
|
9
9
|
humi_str=[0XA0, 0X0C, 0X01, 0X71, 0X00, 0XBE]
|
|
10
10
|
humi_str[0]=0XA0+port
|
|
11
11
|
humi_str[4]=0X01
|
|
12
|
-
response = base_driver.single_operate_sensor(humi_str)
|
|
12
|
+
response = base_driver.single_operate_sensor(humi_str,0)
|
|
13
13
|
if response == None:
|
|
14
14
|
return None
|
|
15
15
|
else:
|
smartpi/led.py
CHANGED
|
@@ -9,7 +9,7 @@ def set_color(port:bytes,command:bytes) -> Optional[bytes]:
|
|
|
9
9
|
color_lamp_str=[0xA0, 0x05, 0x00, 0xBE]
|
|
10
10
|
color_lamp_str[0]=0XA0+port
|
|
11
11
|
color_lamp_str[2]=command
|
|
12
|
-
response = base_driver.single_operate_sensor(color_lamp_str)
|
|
12
|
+
response = base_driver.single_operate_sensor(color_lamp_str,0)
|
|
13
13
|
if response == None:
|
|
14
14
|
return None
|
|
15
15
|
else:
|
smartpi/light_sensor.py
CHANGED
|
@@ -8,7 +8,7 @@ def get_value(port:bytes) -> Optional[bytes]:
|
|
|
8
8
|
light_str=[0xA0, 0x02, 0x00, 0xBE]
|
|
9
9
|
light_str[0]=0XA0+port
|
|
10
10
|
light_str[2]=0x01
|
|
11
|
-
response = base_driver.single_operate_sensor(light_str)
|
|
11
|
+
response = base_driver.single_operate_sensor(light_str,0)
|
|
12
12
|
if response == None:
|
|
13
13
|
return None
|
|
14
14
|
else:
|
|
@@ -23,7 +23,7 @@ def set_threshold(port:bytes,threshold:int) -> Optional[bytes]:
|
|
|
23
23
|
light_str[2]=0x04
|
|
24
24
|
light_str[4]=threshold//256
|
|
25
25
|
light_str[5]=threshold%256
|
|
26
|
-
response = base_driver.single_operate_sensor(light_str)
|
|
26
|
+
response = base_driver.single_operate_sensor(light_str,0)
|
|
27
27
|
if response == None:
|
|
28
28
|
return None
|
|
29
29
|
else:
|
|
@@ -34,7 +34,7 @@ def get_threshold(port:bytes) -> Optional[bytes]:
|
|
|
34
34
|
light_str=[0xA0, 0x02, 0x00, 0xBE]
|
|
35
35
|
light_str[0]=0XA0+port
|
|
36
36
|
light_str[2]=0x05
|
|
37
|
-
response = base_driver.single_operate_sensor(light_str)
|
|
37
|
+
response = base_driver.single_operate_sensor(light_str,0)
|
|
38
38
|
if response == None:
|
|
39
39
|
return None
|
|
40
40
|
else:
|
|
@@ -47,7 +47,7 @@ def get_bool_data(port:bytes) -> Optional[bytes]:
|
|
|
47
47
|
light_str=[0xA0, 0x02, 0x00, 0xBE]
|
|
48
48
|
light_str[0]=0XA0+port
|
|
49
49
|
light_str[2]=0x06
|
|
50
|
-
response = base_driver.single_operate_sensor(light_str)
|
|
50
|
+
response = base_driver.single_operate_sensor(light_str,0)
|
|
51
51
|
if response == None:
|
|
52
52
|
return None
|
|
53
53
|
else:
|
smartpi/motor.py
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
# coding=utf-8
|
|
2
2
|
import time
|
|
3
|
+
import struct
|
|
3
4
|
from typing import List, Optional
|
|
4
5
|
from smartpi import base_driver
|
|
5
6
|
|
|
6
|
-
|
|
7
|
+
|
|
7
8
|
#��������ȡ port:����M�˿ڣ�
|
|
8
9
|
def get_motor_encoder(port:bytes) -> Optional[bytes]:
|
|
9
10
|
motor_str=[0xA0, 0x01, 0x01, 0xBE]
|
|
10
11
|
motor_str[0]=0XA0+port
|
|
11
|
-
response = base_driver.single_operate_sensor(motor_str)
|
|
12
|
+
response = base_driver.single_operate_sensor(motor_str,0)
|
|
12
13
|
if response == None:
|
|
13
14
|
return None
|
|
14
15
|
else:
|
|
@@ -20,7 +21,7 @@ def get_motor_encoder(port:bytes) -> Optional[bytes]:
|
|
|
20
21
|
def reset_motor_encoder(port:bytes) -> Optional[bytes]:
|
|
21
22
|
motor_str=[0xA0, 0x01, 0x03, 0xBE]
|
|
22
23
|
motor_str[0]=0XA0+port
|
|
23
|
-
response = base_driver.single_operate_sensor(motor_str)
|
|
24
|
+
response = base_driver.single_operate_sensor(motor_str,0)
|
|
24
25
|
if response == None:
|
|
25
26
|
return None
|
|
26
27
|
else:
|
|
@@ -31,7 +32,7 @@ def set_motor_direction(port:bytes,direc:bytes) -> Optional[bytes]:
|
|
|
31
32
|
motor_str=[0xA0, 0x01, 0x06, 0x71, 0x00, 0xBE]
|
|
32
33
|
motor_str[0]=0XA0+port
|
|
33
34
|
motor_str[4]=direc
|
|
34
|
-
response = base_driver.single_operate_sensor(motor_str)
|
|
35
|
+
response = base_driver.single_operate_sensor(motor_str,0)
|
|
35
36
|
if response == None:
|
|
36
37
|
return None
|
|
37
38
|
else:
|
|
@@ -52,7 +53,7 @@ def set_motor(port:bytes,speed:int) -> Optional[bytes]:
|
|
|
52
53
|
|
|
53
54
|
motor_str[4]=m_par
|
|
54
55
|
|
|
55
|
-
response = base_driver.single_operate_sensor(motor_str)
|
|
56
|
+
response = base_driver.single_operate_sensor(motor_str,0)
|
|
56
57
|
if response == None:
|
|
57
58
|
return None
|
|
58
59
|
else:
|
|
@@ -62,7 +63,7 @@ def set_motor(port:bytes,speed:int) -> Optional[bytes]:
|
|
|
62
63
|
def set_motor_stop(port:bytes) -> Optional[bytes]:
|
|
63
64
|
motor_str=[0xA0, 0x01, 0x0B, 0xBE]
|
|
64
65
|
motor_str[0]=0XA0+port
|
|
65
|
-
response = base_driver.single_operate_sensor(motor_str)
|
|
66
|
+
response = base_driver.single_operate_sensor(motor_str,0)
|
|
66
67
|
if response == None:
|
|
67
68
|
return None
|
|
68
69
|
else:
|
|
@@ -85,15 +86,15 @@ def set_motor_angle(port:bytes,speed:int,degree:int) -> Optional[bytes]:
|
|
|
85
86
|
motor_str[4]=m_par
|
|
86
87
|
motor_str[6]=degree//256
|
|
87
88
|
motor_str[7]=degree%256
|
|
88
|
-
response = base_driver.single_operate_sensor(motor_str)
|
|
89
|
+
response = base_driver.single_operate_sensor(motor_str,0)
|
|
89
90
|
if response == None:
|
|
90
91
|
return None
|
|
91
92
|
else:
|
|
92
93
|
return 0
|
|
93
94
|
|
|
94
95
|
#���ﶨʱת�� port:����M�˿ڣ�speed:-100~100��second:1~256
|
|
95
|
-
def set_motor_second(port:bytes,speed:int,second:
|
|
96
|
-
motor_str=[0xA0, 0x01, 0x08, 0x81, 0x00,
|
|
96
|
+
def set_motor_second(port:bytes,speed:int,second:float) -> Optional[bytes]:
|
|
97
|
+
motor_str=[0xA0, 0x01, 0x08, 0x81, 0x00, 0x82, 0x00, 0x00, 0x00, 0x00, 0xBE]
|
|
97
98
|
motor_str[0]=0XA0+port
|
|
98
99
|
|
|
99
100
|
if speed>100:
|
|
@@ -105,9 +106,17 @@ def set_motor_second(port:bytes,speed:int,second:bytes) -> Optional[bytes]:
|
|
|
105
106
|
elif speed<=0 and speed>=-100:
|
|
106
107
|
m_par=256+speed
|
|
107
108
|
|
|
108
|
-
motor_str[4]=m_par
|
|
109
|
-
|
|
110
|
-
|
|
109
|
+
motor_str[4]=m_par
|
|
110
|
+
|
|
111
|
+
byte_data = struct.pack('f', second)
|
|
112
|
+
byte_array = list(byte_data)
|
|
113
|
+
|
|
114
|
+
motor_str[6]=byte_array[0]
|
|
115
|
+
motor_str[7]=byte_array[1]
|
|
116
|
+
motor_str[8]=byte_array[2]
|
|
117
|
+
motor_str[9]=byte_array[3]
|
|
118
|
+
|
|
119
|
+
response = base_driver.single_operate_sensor(motor_str,second)
|
|
111
120
|
if response == None:
|
|
112
121
|
return None
|
|
113
122
|
else:
|
|
@@ -129,7 +138,7 @@ def set_motor_constspeed(port:bytes,speed:int) -> Optional[bytes]:
|
|
|
129
138
|
|
|
130
139
|
motor_str[4]=m_par
|
|
131
140
|
|
|
132
|
-
response = base_driver.single_operate_sensor(motor_str)
|
|
141
|
+
response = base_driver.single_operate_sensor(motor_str,0)
|
|
133
142
|
if response == None:
|
|
134
143
|
return None
|
|
135
144
|
else:
|
|
@@ -139,7 +148,7 @@ def set_motor_constspeed(port:bytes,speed:int) -> Optional[bytes]:
|
|
|
139
148
|
def get_motor_speed(port:bytes) -> Optional[bytes]:
|
|
140
149
|
motor_str=[0xA0, 0x01, 0x10, 0xBE]
|
|
141
150
|
motor_str[0]=0XA0+port
|
|
142
|
-
response = base_driver.single_operate_sensor(motor_str)
|
|
151
|
+
response = base_driver.single_operate_sensor(motor_str,0)
|
|
143
152
|
if response == None:
|
|
144
153
|
return None
|
|
145
154
|
else:
|
smartpi/move.py
CHANGED
|
@@ -20,7 +20,7 @@ def run_second(dir:bytes,speed:bytes,second:bytes) -> Optional[bytes]:
|
|
|
20
20
|
move_str[6]=speed
|
|
21
21
|
move_str[8]=second
|
|
22
22
|
|
|
23
|
-
response = base_driver.single_operate_sensor(move_str)
|
|
23
|
+
response = base_driver.single_operate_sensor(move_str,0)
|
|
24
24
|
if response == None:
|
|
25
25
|
return None
|
|
26
26
|
else:
|
|
@@ -43,7 +43,7 @@ def run_angle(dir:bytes,speed:bytes,angle:int) -> Optional[bytes]:
|
|
|
43
43
|
move_str[8]=angle//256
|
|
44
44
|
move_str[9]=angle%256
|
|
45
45
|
|
|
46
|
-
response = base_driver.single_operate_sensor(move_str)
|
|
46
|
+
response = base_driver.single_operate_sensor(move_str,0)
|
|
47
47
|
if response == None:
|
|
48
48
|
return None
|
|
49
49
|
else:
|
|
@@ -64,7 +64,7 @@ def run(dir:bytes,speed:bytes) -> Optional[bytes]:
|
|
|
64
64
|
|
|
65
65
|
move_str[6]=speed
|
|
66
66
|
|
|
67
|
-
response = base_driver.single_operate_sensor(move_str)
|
|
67
|
+
response = base_driver.single_operate_sensor(move_str,0)
|
|
68
68
|
if response == None:
|
|
69
69
|
return None
|
|
70
70
|
else:
|
|
@@ -98,7 +98,7 @@ def run_speed_second(Lspeed:int,Rspeed:int,second:bytes) -> Optional[bytes]:
|
|
|
98
98
|
|
|
99
99
|
move_str[8]=second
|
|
100
100
|
|
|
101
|
-
response = base_driver.single_operate_sensor(move_str)
|
|
101
|
+
response = base_driver.single_operate_sensor(move_str,0)
|
|
102
102
|
if response == None:
|
|
103
103
|
return None
|
|
104
104
|
else:
|
|
@@ -130,7 +130,7 @@ def run_speed(Lspeed:int,Rspeed:int) -> Optional[bytes]:
|
|
|
130
130
|
|
|
131
131
|
move_str[4]=m_par
|
|
132
132
|
|
|
133
|
-
response = base_driver.single_operate_sensor(move_str)
|
|
133
|
+
response = base_driver.single_operate_sensor(move_str,0)
|
|
134
134
|
if response == None:
|
|
135
135
|
return None
|
|
136
136
|
else:
|
|
@@ -143,7 +143,7 @@ def run_power(Lpower:bytes,Rpower:bytes) -> Optional[bytes]:
|
|
|
143
143
|
move_str[4]=Rpower
|
|
144
144
|
move_str[6]=Lpower
|
|
145
145
|
|
|
146
|
-
response = base_driver.single_operate_sensor(move_str)
|
|
146
|
+
response = base_driver.single_operate_sensor(move_str,0)
|
|
147
147
|
if response == None:
|
|
148
148
|
return None
|
|
149
149
|
else:
|
|
@@ -160,7 +160,7 @@ def set_maxpower(M1:bytes,M2:bytes,M3:bytes,M4:bytes,M5:bytes,M6:bytes) -> Optio
|
|
|
160
160
|
move_str[12]=M5
|
|
161
161
|
move_str[14]=M6
|
|
162
162
|
|
|
163
|
-
response = base_driver.single_operate_sensor(move_str)
|
|
163
|
+
response = base_driver.single_operate_sensor(move_str,0)
|
|
164
164
|
if response == None:
|
|
165
165
|
return None
|
|
166
166
|
else:
|
|
@@ -170,7 +170,7 @@ def set_maxpower(M1:bytes,M2:bytes,M3:bytes,M4:bytes,M5:bytes,M6:bytes) -> Optio
|
|
|
170
170
|
def stop() -> Optional[bytes]:
|
|
171
171
|
move_str=[0xA0, 0x01, 0x0A, 0xBE]
|
|
172
172
|
|
|
173
|
-
response = base_driver.single_operate_sensor(move_str)
|
|
173
|
+
response = base_driver.single_operate_sensor(move_str,0)
|
|
174
174
|
if response == None:
|
|
175
175
|
return None
|
|
176
176
|
else:
|
|
@@ -192,7 +192,7 @@ def set_move_init(Lmotor:bytes,Rmotor:bytes,state:bytes) -> Optional[bytes]:
|
|
|
192
192
|
move_str[6]=Rmotor
|
|
193
193
|
move_str[8]=Lmotor
|
|
194
194
|
|
|
195
|
-
response = base_driver.single_operate_sensor(move_str)
|
|
195
|
+
response = base_driver.single_operate_sensor(move_str,0)
|
|
196
196
|
if response == None:
|
|
197
197
|
return None
|
|
198
198
|
else:
|
smartpi/servo.py
CHANGED
|
@@ -9,7 +9,7 @@ def steer_angle(port:bytes,angle:bytes) -> Optional[bytes]:
|
|
|
9
9
|
servo_str=[0xA0, 0x0E, 0x01, 0x71, 0x00, 0xBE]
|
|
10
10
|
servo_str[0]=0XA0+port
|
|
11
11
|
servo_str[4]=angle
|
|
12
|
-
response = base_driver.single_operate_sensor(servo_str)
|
|
12
|
+
response = base_driver.single_operate_sensor(servo_str,0)
|
|
13
13
|
if response == None:
|
|
14
14
|
return None
|
|
15
15
|
else:
|
|
@@ -22,7 +22,18 @@ def steer_angle_delay(port:bytes,angle:bytes,second:bytes) -> Optional[bytes]:
|
|
|
22
22
|
servo_str[4]=angle//256
|
|
23
23
|
servo_str[5]=angle%256
|
|
24
24
|
servo_str[7]=second
|
|
25
|
-
response = base_driver.single_operate_sensor(servo_str)
|
|
25
|
+
response = base_driver.single_operate_sensor(servo_str,0)
|
|
26
|
+
if response == None:
|
|
27
|
+
return None
|
|
28
|
+
else:
|
|
29
|
+
return 0
|
|
30
|
+
|
|
31
|
+
#���ֶ������ת������(���ԽǶ�) port:����P�˿ڣ�dir:0:����Խ0��;1:��̾�����ת;2:˳ʱ����ת;3:��ʱ����ת
|
|
32
|
+
def set_dir(port:bytes,dir:bytes) -> Optional[bytes]:
|
|
33
|
+
servo_str=[0xA0, 0x24, 0x01, 0x71, 0x00, 0xBE]
|
|
34
|
+
servo_str[0]=0XA0+port
|
|
35
|
+
servo_str[4]=dir
|
|
36
|
+
response = base_driver.single_operate_sensor(servo_str,0)
|
|
26
37
|
if response == None:
|
|
27
38
|
return None
|
|
28
39
|
else:
|
|
@@ -35,7 +46,7 @@ def set_angle_speed(port:bytes,angle:bytes,speed:bytes) -> Optional[bytes]:
|
|
|
35
46
|
servo_str[4]=angle//256
|
|
36
47
|
servo_str[5]=angle%256
|
|
37
48
|
servo_str[7]=speed
|
|
38
|
-
response = base_driver.single_operate_sensor(servo_str)
|
|
49
|
+
response = base_driver.single_operate_sensor(servo_str,0)
|
|
39
50
|
if response == None:
|
|
40
51
|
return None
|
|
41
52
|
else:
|
|
@@ -49,7 +60,7 @@ def set_angle_ms(port:bytes,angle:bytes,ms:int) -> Optional[bytes]:
|
|
|
49
60
|
servo_str[5]=angle%256
|
|
50
61
|
servo_str[7]=ms//256
|
|
51
62
|
servo_str[8]=ms%256
|
|
52
|
-
response = base_driver.single_operate_sensor(servo_str)
|
|
63
|
+
response = base_driver.single_operate_sensor(servo_str,0)
|
|
53
64
|
if response == None:
|
|
54
65
|
return None
|
|
55
66
|
else:
|
|
@@ -59,7 +70,7 @@ def set_angle_ms(port:bytes,angle:bytes,ms:int) -> Optional[bytes]:
|
|
|
59
70
|
def set_init(port:bytes) -> Optional[bytes]:
|
|
60
71
|
servo_str=[0xA0, 0x12, 0x01, 0xBE]
|
|
61
72
|
servo_str[0]=0XA0+port
|
|
62
|
-
response = base_driver.single_operate_sensor(servo_str)
|
|
73
|
+
response = base_driver.single_operate_sensor(servo_str,0)
|
|
63
74
|
if response == None:
|
|
64
75
|
return None
|
|
65
76
|
else:
|
|
@@ -69,7 +80,7 @@ def set_init(port:bytes) -> Optional[bytes]:
|
|
|
69
80
|
def get_angle(port:bytes) -> Optional[bytes]:
|
|
70
81
|
servo_str=[0xA0, 0x13, 0x01, 0xBE]
|
|
71
82
|
servo_str[0]=0XA0+port
|
|
72
|
-
response = base_driver.single_operate_sensor(servo_str)
|
|
83
|
+
response = base_driver.single_operate_sensor(servo_str,0)
|
|
73
84
|
if response == None:
|
|
74
85
|
return None
|
|
75
86
|
else:
|
|
@@ -91,7 +102,7 @@ def set_speed(port:bytes,speed:int) -> Optional[bytes]:
|
|
|
91
102
|
m_par=256+speed
|
|
92
103
|
|
|
93
104
|
servo_str[4]=m_par
|
|
94
|
-
response = base_driver.single_operate_sensor(servo_str)
|
|
105
|
+
response = base_driver.single_operate_sensor(servo_str,0)
|
|
95
106
|
if response == None:
|
|
96
107
|
return None
|
|
97
108
|
else:
|
|
@@ -115,7 +126,7 @@ def set_code_speed(port:bytes,code:int,speed:int) -> Optional[bytes]:
|
|
|
115
126
|
m_par=256+speed
|
|
116
127
|
servo_str[7]=m_par
|
|
117
128
|
|
|
118
|
-
response = base_driver.single_operate_sensor(servo_str)
|
|
129
|
+
response = base_driver.single_operate_sensor(servo_str,0)
|
|
119
130
|
if response == None:
|
|
120
131
|
return None
|
|
121
132
|
else:
|
|
@@ -125,7 +136,7 @@ def set_code_speed(port:bytes,code:int,speed:int) -> Optional[bytes]:
|
|
|
125
136
|
def reset_encode(port:bytes) -> Optional[bytes]:
|
|
126
137
|
servo_str=[0xA0, 0x16, 0x01, 0xBE]
|
|
127
138
|
servo_str[0]=0XA0+port
|
|
128
|
-
response = base_driver.single_operate_sensor(servo_str)
|
|
139
|
+
response = base_driver.single_operate_sensor(servo_str,0)
|
|
129
140
|
if response == None:
|
|
130
141
|
return None
|
|
131
142
|
else:
|
|
@@ -135,7 +146,7 @@ def reset_encode(port:bytes) -> Optional[bytes]:
|
|
|
135
146
|
def get_encoder(port:bytes) -> Optional[bytes]:
|
|
136
147
|
servo_str=[0xA0, 0x17, 0x01, 0xBE]
|
|
137
148
|
servo_str[0]=0XA0+port
|
|
138
|
-
response = base_driver.single_operate_sensor(servo_str)
|
|
149
|
+
response = base_driver.single_operate_sensor(servo_str,0)
|
|
139
150
|
if response == None:
|
|
140
151
|
return None
|
|
141
152
|
else:
|
smartpi/temperature.py
CHANGED
|
@@ -9,7 +9,7 @@ def get_value(port:bytes) -> Optional[bytes]:
|
|
|
9
9
|
temp_str=[0XA0, 0X0C, 0X01, 0X71, 0X00, 0XBE]
|
|
10
10
|
temp_str[0]=0XA0+port
|
|
11
11
|
temp_str[4]=0
|
|
12
|
-
response = base_driver.single_operate_sensor(temp_str)
|
|
12
|
+
response = base_driver.single_operate_sensor(temp_str,0)
|
|
13
13
|
if response == None:
|
|
14
14
|
return None
|
|
15
15
|
else:
|
smartpi/touch_sensor.py
CHANGED
|
@@ -7,7 +7,7 @@ from smartpi import base_driver
|
|
|
7
7
|
def get_value(port:bytes) -> Optional[bytes]:
|
|
8
8
|
read_sw_str=[0xA0, 0x03, 0x01, 0xBE]
|
|
9
9
|
read_sw_str[0]=0XA0+port
|
|
10
|
-
response = base_driver.single_operate_sensor(read_sw_str)
|
|
10
|
+
response = base_driver.single_operate_sensor(read_sw_str,0)
|
|
11
11
|
if response == None:
|
|
12
12
|
return None
|
|
13
13
|
else:
|
smartpi/trace.py
CHANGED
|
@@ -27,7 +27,7 @@ def get_chn_data(port:bytes, chn:bytes) -> Optional[bytes]:
|
|
|
27
27
|
trace_str=[0xA0, 0x18, 0x01, 0x71, 0x00, 0xBE]
|
|
28
28
|
trace_str[0]=0XA0+port
|
|
29
29
|
trace_str[4]=chn
|
|
30
|
-
response = base_driver.single_operate_sensor(trace_str)
|
|
30
|
+
response = base_driver.single_operate_sensor(trace_str,0)
|
|
31
31
|
if response == None:
|
|
32
32
|
return None
|
|
33
33
|
else:
|
|
@@ -44,7 +44,7 @@ def set_chn_color(port:bytes, color1:bytes, color2:bytes, color3:bytes, color4:b
|
|
|
44
44
|
trace_str[12]=color5
|
|
45
45
|
trace_str[14]=color6
|
|
46
46
|
trace_str[16]=color7
|
|
47
|
-
response = base_driver.single_operate_sensor(trace_str)
|
|
47
|
+
response = base_driver.single_operate_sensor(trace_str,0)
|
|
48
48
|
if response == None:
|
|
49
49
|
return None
|
|
50
50
|
else:
|
|
@@ -55,7 +55,7 @@ def set_color(port:bytes, color:bytes) -> Optional[bytes]:
|
|
|
55
55
|
trace_str=[0xA0, 0x20, 0x01, 0x71, 0x00, 0xBE]
|
|
56
56
|
trace_str[0]=0XA0+port
|
|
57
57
|
trace_str[4]=color
|
|
58
|
-
response = base_driver.single_operate_sensor(trace_str)
|
|
58
|
+
response = base_driver.single_operate_sensor(trace_str,0)
|
|
59
59
|
if response == None:
|
|
60
60
|
return None
|
|
61
61
|
else:
|
|
@@ -66,7 +66,7 @@ def get_analog(port:bytes, chn:bytes) -> Optional[bytes]:
|
|
|
66
66
|
trace_str=[0xA0, 0x21, 0x01, 0x71, 0x00, 0xBE]
|
|
67
67
|
trace_str[0]=0XA0+port
|
|
68
68
|
trace_str[4]=20+chn
|
|
69
|
-
response = base_driver.single_operate_sensor(trace_str)
|
|
69
|
+
response = base_driver.single_operate_sensor(trace_str,0)
|
|
70
70
|
if response == None:
|
|
71
71
|
return None
|
|
72
72
|
else:
|
|
@@ -78,7 +78,7 @@ def get_line_state(port:bytes, state:bytes) -> Optional[bytes]:
|
|
|
78
78
|
trace_str=[0xA0, 0x22, 0x01, 0x71, 0x00, 0xBE]
|
|
79
79
|
trace_str[0]=0XA0+port
|
|
80
80
|
trace_str[4]=state
|
|
81
|
-
response = base_driver.single_operate_sensor(trace_str)
|
|
81
|
+
response = base_driver.single_operate_sensor(trace_str,0)
|
|
82
82
|
if response == None:
|
|
83
83
|
return None
|
|
84
84
|
else:
|
smartpi/ultrasonic.py
CHANGED
|
@@ -8,7 +8,7 @@ def get_value(port:bytes) -> Optional[bytes]:
|
|
|
8
8
|
ultrasonic_str=[0xA0, 0x06, 0x00, 0xBE]
|
|
9
9
|
ultrasonic_str[0]=0XA0+port
|
|
10
10
|
ultrasonic_str[2]=1
|
|
11
|
-
response = base_driver.single_operate_sensor(ultrasonic_str)
|
|
11
|
+
response = base_driver.single_operate_sensor(ultrasonic_str,0)
|
|
12
12
|
|
|
13
13
|
if response == None:
|
|
14
14
|
return None
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
smartpi/__init__.py,sha256=dbeSgtxUXUnzBRBUqAF0gP2AbNr9dwL8WvaeDNMTegY,55
|
|
2
|
+
smartpi/base_driver.py,sha256=dhdmWK0_ff2GduYtGXiZ3W4ICRMf-gIROYgRhXYjZok,24204
|
|
3
|
+
smartpi/color_sensor.py,sha256=YXJjknYjp7teTZsHYZRAWgi73CH0MhBp1go9y0Inxyo,498
|
|
4
|
+
smartpi/cw2015.py,sha256=1lAF-pi_ye_ya1AZQS1sjbgsDf7MThO5IAskKsNGBzA,5695
|
|
5
|
+
smartpi/flash.py,sha256=-pUqg6FSVoBiLFKqrG9B4dFqn8lICnQsSPJr_MtZLIU,4132
|
|
6
|
+
smartpi/gui.py,sha256=E98_soyWbEf_dwYhXZgMSXrgY5QuYoDTuFCPK63flIQ,2102
|
|
7
|
+
smartpi/humidity.py,sha256=nZwiBtMWKNipVM83ymajZACPHxkC2vUJjDMmCOPN9lw,499
|
|
8
|
+
smartpi/led.py,sha256=flvN7EJfP6VDTSiC93w1uR8pRxcZD9w2vLXA1GbJTo8,538
|
|
9
|
+
smartpi/light_sensor.py,sha256=MayyVikWcXQfjeZrtYRnwYgHBDzu2g-mfJLpdd29EG8,1852
|
|
10
|
+
smartpi/motor.py,sha256=CS-a1AxKeLFQNxsBpfThWE7lI3ZC27OZthXPfgk8vro,4792
|
|
11
|
+
smartpi/move.py,sha256=mYw5li1qQe97845cqclMksuaKOL9n_0E0n9652EIMcI,6046
|
|
12
|
+
smartpi/servo.py,sha256=SN4Md57MNDBBlu2vCrzby04IDQiLNqdwgvS4dCh0q8E,5057
|
|
13
|
+
smartpi/temperature.py,sha256=VT79CYA41q1d_4AM-Y0eIMeIw7AtCkSXjWVws6Yx5yE,462
|
|
14
|
+
smartpi/touch_sensor.py,sha256=P57RRQlqY0KexpMi-ydqwF5albOKCBOGb0Rb6zeVTqk,440
|
|
15
|
+
smartpi/trace.py,sha256=tut7BMbq87ShaR5eNuv7PZtAEz9DS5_BDf0_muIZ-tQ,4577
|
|
16
|
+
smartpi/ultrasonic.py,sha256=kmVpUfvE1oHoqgv92ZU6Fi-sO6DSwm10ssKsImNeOkY,624
|
|
17
|
+
smartpi-0.1.22.dist-info/METADATA,sha256=znbfoZEXR-TzNdaUl9258HXSkWdCQAlj_aOfY2EZ4C0,311
|
|
18
|
+
smartpi-0.1.22.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
|
|
19
|
+
smartpi-0.1.22.dist-info/top_level.txt,sha256=PoLhUCmWAiQUg5UeN2fS-Y1iQyBbF2rdUlizXtpHGRQ,8
|
|
20
|
+
smartpi-0.1.22.dist-info/RECORD,,
|
smartpi-0.1.20.dist-info/RECORD
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
smartpi/__init__.py,sha256=eXDn9vmrk3l7U0NFTdKpBbQyKKA1oPV1uTs_UkaNtOE,55
|
|
2
|
-
smartpi/base_driver.py,sha256=n_KIkdfk2BLzaPZpOj-hH30QuyiGwHSMQuosxj2YnOU,24172
|
|
3
|
-
smartpi/color_sensor.py,sha256=sTqD3jApjmc6qHMrDyEy2UjaRt8vhJZNR88vzgUiLKs,496
|
|
4
|
-
smartpi/cw2015.py,sha256=1lAF-pi_ye_ya1AZQS1sjbgsDf7MThO5IAskKsNGBzA,5695
|
|
5
|
-
smartpi/flash.py,sha256=Luz0TjinQSkx31uVknqfSWkiAiVrqIE2Iba7lk3AOzM,4132
|
|
6
|
-
smartpi/gui.py,sha256=E98_soyWbEf_dwYhXZgMSXrgY5QuYoDTuFCPK63flIQ,2102
|
|
7
|
-
smartpi/humidity.py,sha256=xtALQ_IlcwR2RCYvopCSmeNajB45kQU_ckk6FZ0rqko,497
|
|
8
|
-
smartpi/led.py,sha256=n3_k1jGcQptfGXhezDLaYzH6UptgluP4Ze6qP_Y4WmU,536
|
|
9
|
-
smartpi/light_sensor.py,sha256=glDa4O0wW0kamb-tI3qf509qM7zA8UUjVXbA9si3TXM,1844
|
|
10
|
-
smartpi/motor.py,sha256=uvuAwt2j5LjdLaMfNisXqaGh1ro3fZDvHU8IXd2fn9Q,4527
|
|
11
|
-
smartpi/move.py,sha256=3qzrJCGA-qbsLXBpklY2DErtw0jlzMELzozjhEvRzKs,6028
|
|
12
|
-
smartpi/servo.py,sha256=B6X3yCoEz82qqpUIE5MSO0Eg9YZJ5zDzJEcRpioZpUo,4625
|
|
13
|
-
smartpi/temperature.py,sha256=px2YeqgG63nPkyhJA1wDg3dwYx_oOCYuhMjtsVm_YO0,460
|
|
14
|
-
smartpi/touch_sensor.py,sha256=F6IIQGewNRhC9U1RbHpVzuGYqb8H41lpeQ1Ejwsc_T8,438
|
|
15
|
-
smartpi/trace.py,sha256=ntk3UwVATOV_eViGQhFi3lyil9xFmzeZZ_MBvQTq3UQ,4567
|
|
16
|
-
smartpi/ultrasonic.py,sha256=0meczFKXFLUt92kLxipeEc37vb5duvJjPs4kgtlpO8M,622
|
|
17
|
-
smartpi-0.1.20.dist-info/METADATA,sha256=3WlrHNedbYaRx4tWEm8ZTa9hqPwTPwxO3HuefgnoP3M,311
|
|
18
|
-
smartpi-0.1.20.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
|
|
19
|
-
smartpi-0.1.20.dist-info/top_level.txt,sha256=PoLhUCmWAiQUg5UeN2fS-Y1iQyBbF2rdUlizXtpHGRQ,8
|
|
20
|
-
smartpi-0.1.20.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|