New info message added to the firmware. The python script was modified to print out more detaild messages of its activity.
This commit is contained in:
parent
a6dc38f81a
commit
a0f06d4fb7
3 changed files with 32 additions and 5 deletions
|
@ -47,6 +47,9 @@ void setup()
|
|||
si5351.output_enable(SI5351_CLK0, 1); // enable clock output 0
|
||||
si5351.drive_strength(SI5351_CLK0, SI5351_DRIVE_2MA); // 2 4 6 8ma
|
||||
*/
|
||||
delay(500);
|
||||
|
||||
Serial.println("SWR Meter firmware v0.1 by Kai Lauterbach (me@klaute.de)");
|
||||
}
|
||||
|
||||
void loop()
|
||||
|
|
|
@ -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,18 +292,37 @@ def openSerialDevice(d):
|
|||
|
||||
# Why 115200? Because the host defines the baudrate for the USB serial connection.
|
||||
try:
|
||||
ser = serial.Serial(d, 115200, timeout=0)
|
||||
#ser = serial.Serial(d, 115200, timeout=0)
|
||||
ser = serial.Serial(
|
||||
port=d,\
|
||||
baudrate=115200,\
|
||||
parity=serial.PARITY_NONE,\
|
||||
stopbits=serial.STOPBITS_ONE,\
|
||||
bytesize=serial.EIGHTBITS,\
|
||||
timeout=0)
|
||||
except:
|
||||
print "ERROR: Can't open the serial device " + device
|
||||
exit(1)
|
||||
|
||||
#time.sleep(2)
|
||||
time.sleep(2)
|
||||
|
||||
#ser.write(bytearray([0x00]))
|
||||
#ser.write(bytearray([0x00]))
|
||||
#ser.write(bytearray([0x00]))
|
||||
#ser.write(bytearray([0x00]))
|
||||
#ser.write(bytearray([0x00]))
|
||||
|
||||
ser.flush()
|
||||
ser.read(1000)
|
||||
|
||||
#####
|
||||
def closeSerialDevice():
|
||||
|
||||
global ser
|
||||
|
||||
ser.flush()
|
||||
ser.read(1000)
|
||||
|
||||
ser.close()
|
||||
|
||||
#####
|
||||
|
@ -345,6 +364,7 @@ if __name__ == "__main__":
|
|||
dataSend = dataSend + 1
|
||||
|
||||
if args.start_freq != None:
|
||||
print "Send: SET_START_FREQ"
|
||||
sendSerialData([CC_CMD_SET_START_FREQ,
|
||||
(args.start_freq & 0xff000000) >> 24,
|
||||
(args.start_freq & 0x00ff0000) >> 16,
|
||||
|
@ -353,6 +373,7 @@ if __name__ == "__main__":
|
|||
dataSend = dataSend + 1
|
||||
|
||||
if args.end_freq != None:
|
||||
print "Send: SET_END_FREQ"
|
||||
sendSerialData([CC_CMD_SET_END_FREQ,
|
||||
(args.end_freq & 0xff000000) >> 24,
|
||||
(args.end_freq & 0x00ff0000) >> 16,
|
||||
|
@ -361,6 +382,7 @@ if __name__ == "__main__":
|
|||
dataSend = dataSend + 1
|
||||
|
||||
if args.step_freq != None:
|
||||
print "Send: SET_FREQ_STEP"
|
||||
sendSerialData([CC_CMD_SET_FREQ_STEP,
|
||||
(args.step_freq & 0xff000000) >> 24,
|
||||
(args.step_freq & 0x00ff0000) >> 16,
|
||||
|
@ -369,17 +391,20 @@ if __name__ == "__main__":
|
|||
dataSend = dataSend + 1
|
||||
|
||||
if args.intervall != None:
|
||||
print "Send: SET_INTERVALL"
|
||||
sendSerialData([CC_CMD_SET_INTERVALL,
|
||||
(args.intervall & 0x0000ff00) >> 8,
|
||||
(args.intervall & 0x000000ff)])
|
||||
dataSend = dataSend + 1
|
||||
|
||||
if args.drive_str != None:
|
||||
print "Send: SET_DRIVE_STRENGTH"
|
||||
sendSerialData([CC_CMD_SET_DRIVE_STRENGTH,
|
||||
args.drive_str])
|
||||
dataSend = dataSend + 1
|
||||
|
||||
if args.start_meas == True:
|
||||
print "Send: START_MEASUREMENT"
|
||||
sendSerialData([CC_CMD_START_MEASUREMENT])
|
||||
dataSend = dataSend + 1
|
||||
|
||||
|
@ -387,7 +412,6 @@ if __name__ == "__main__":
|
|||
while dataSend > 0 and timeout < TIMEOUT_CNT_MAX:
|
||||
|
||||
thread_lock.acquire()
|
||||
#ser.write("9") # TODO
|
||||
tmp_messages = copy.deepcopy(cc_received_messages)
|
||||
thread_lock.release()
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import serial, sys
|
||||
port = "/dev/ttyUSB0"
|
||||
baudrate = 57600
|
||||
baudrate = 115200
|
||||
ser = serial.Serial(port,baudrate,timeout=0.001)
|
||||
while True:
|
||||
ser.write(bytearray([0x3c, 0x3e, 0x10, 0x0d, 0x0a]))
|
||||
|
|
Loading…
Reference in a new issue