Baudrate set to 115200 again, the serial flush call has fixed the serial sending problem.
This commit is contained in:
parent
744a746b7f
commit
a6dc38f81a
2 changed files with 8 additions and 4 deletions
|
@ -22,7 +22,7 @@ void setup()
|
|||
pinMode(A1, INPUT);
|
||||
|
||||
// Init the serial connection
|
||||
Serial.begin(57600);
|
||||
Serial.begin(115200);
|
||||
|
||||
// initialize the command control module
|
||||
cc_init();
|
||||
|
|
|
@ -157,7 +157,7 @@ def cc_dataReceiverThread():
|
|||
#print bytesToRead # TODO
|
||||
incoming = list(ser.read(64))
|
||||
|
||||
print incoming # TODO
|
||||
#print incoming # TODO
|
||||
|
||||
# 2. process the received data
|
||||
for c in incoming:
|
||||
|
@ -292,11 +292,13 @@ def openSerialDevice(d):
|
|||
|
||||
# Why 115200? Because the host defines the baudrate for the USB serial connection.
|
||||
try:
|
||||
ser = serial.Serial(d, 57600, timeout=0)
|
||||
ser = serial.Serial(d, 115200, timeout=0)
|
||||
except:
|
||||
print "ERROR: Can't open the serial device " + device
|
||||
exit(1)
|
||||
|
||||
#time.sleep(2)
|
||||
|
||||
#####
|
||||
def closeSerialDevice():
|
||||
|
||||
|
@ -313,6 +315,8 @@ def sendSerialData(data):
|
|||
ser.write(bytearray(data))
|
||||
ser.write(bytearray([ MSG_EOD1, MSG_EOD2 ]))
|
||||
|
||||
ser.flush()
|
||||
|
||||
###############################################################################
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
@ -398,7 +402,7 @@ if __name__ == "__main__":
|
|||
elif e[1] == MSG_TYPE_ANSWER_NOK:
|
||||
print "recv: NOT OK"
|
||||
|
||||
elif e[1] == MSG_TYPE_MEAS_FREQ_INFO_:
|
||||
elif e[1] == MSG_TYPE_MEAS_FREQ_INFO:
|
||||
print "recv: FREQ INFO"
|
||||
freq = e[3][0] << 24
|
||||
freq += e[3][1] << 16
|
||||
|
|
Loading…
Reference in a new issue