|
@@ -17,7 +17,7 @@ class Sink:
|
17
|
17
|
Parameters:
|
18
|
18
|
sp: A serial.tools.list_ports.ListPortInfo object
|
19
|
19
|
"""
|
20
|
|
- self.port = serial.Serial(sp.device, baudrate=115200, timeout=0.01)
|
|
20
|
+ self.port = serial.Serial(sp.device, baudrate=115200)
|
21
|
21
|
|
22
|
22
|
def send_command(self, cmd):
|
23
|
23
|
"""Send a command to the PD Buddy Sink, returning the result
|
|
@@ -30,11 +30,14 @@ class Sink:
|
30
|
30
|
as a response to the command.
|
31
|
31
|
"""
|
32
|
32
|
# Send the command
|
33
|
|
- self.port.write(bytes(cmd, 'utf-8') + b'\r\n')
|
|
33
|
+ self.port.write(bytes(cmd, "utf-8") + b"\r\n")
|
34
|
34
|
self.port.flush()
|
35
|
35
|
|
36
|
36
|
# Read the result
|
37
|
|
- answer = self.port.readlines()
|
|
37
|
+ answer = b""
|
|
38
|
+ while not answer.endswith(b"PDBS) "):
|
|
39
|
+ answer += self.port.read(1)
|
|
40
|
+ answer = answer.split(b"\r\n")
|
38
|
41
|
|
39
|
42
|
# Remove the echoed command and prompt
|
40
|
43
|
answer = answer[1:-1]
|