Little code improvements done.
This commit is contained in:
parent
8a56cbb111
commit
5038269c24
1 changed files with 19 additions and 15 deletions
|
@ -369,12 +369,12 @@ if __name__ == "__main__":
|
|||
|
||||
# 3. get and process the commandline arguments/parameter
|
||||
#if args.get_config == True and args.start_meas == False:
|
||||
# print "Send: GET_CONFIG"
|
||||
# print "sent: GET_CONFIG"
|
||||
# sendSerialData([CC_CMD_GET_CONFIG])
|
||||
# dataSend = dataSend + 1
|
||||
|
||||
if args.start_freq != None:
|
||||
print "Send: SET_START_FREQ"
|
||||
print "sent: SET_START_FREQ"
|
||||
sendSerialData([CC_CMD_SET_START_FREQ,
|
||||
(args.start_freq & 0xff000000) >> 24,
|
||||
(args.start_freq & 0x00ff0000) >> 16,
|
||||
|
@ -383,7 +383,7 @@ if __name__ == "__main__":
|
|||
dataSend = dataSend + 1
|
||||
|
||||
if args.end_freq != None:
|
||||
print "Send: SET_END_FREQ"
|
||||
print "sent: SET_END_FREQ"
|
||||
sendSerialData([CC_CMD_SET_END_FREQ,
|
||||
(args.end_freq & 0xff000000) >> 24,
|
||||
(args.end_freq & 0x00ff0000) >> 16,
|
||||
|
@ -392,7 +392,7 @@ if __name__ == "__main__":
|
|||
dataSend = dataSend + 1
|
||||
|
||||
if args.step_freq != None:
|
||||
print "Send: SET_FREQ_STEP"
|
||||
print "sent: SET_FREQ_STEP"
|
||||
sendSerialData([CC_CMD_SET_FREQ_STEP,
|
||||
(args.step_freq & 0xff000000) >> 24,
|
||||
(args.step_freq & 0x00ff0000) >> 16,
|
||||
|
@ -401,20 +401,20 @@ if __name__ == "__main__":
|
|||
dataSend = dataSend + 1
|
||||
|
||||
if args.intervall != None:
|
||||
print "Send: SET_INTERVALL"
|
||||
print "sent: 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"
|
||||
print "sent: SET_DRIVE_STRENGTH"
|
||||
sendSerialData([CC_CMD_SET_DRIVE_STRENGTH,
|
||||
args.drive_str])
|
||||
dataSend = dataSend + 1
|
||||
|
||||
if args.start_meas == True:
|
||||
print "Send: START_MEASUREMENT"
|
||||
print "sent: START_MEASUREMENT"
|
||||
sendSerialData([CC_CMD_START_MEASUREMENT])
|
||||
dataSend = dataSend + 1
|
||||
|
||||
|
@ -483,14 +483,12 @@ if __name__ == "__main__":
|
|||
elif e[1] == MSG_TYPE_MEAS_END_INFO:
|
||||
print "recv: END INFO"
|
||||
|
||||
if args.output_file != None:
|
||||
pass # TODO impl
|
||||
if args.show_graph == True:
|
||||
meas_freq = []
|
||||
meas_ratio = []
|
||||
meas_r = []
|
||||
meas_p = []
|
||||
meas_freq = []
|
||||
meas_ratio = []
|
||||
meas_r = []
|
||||
meas_p = []
|
||||
|
||||
if args.output_file != None or args.output_file != None:
|
||||
for m in meas_data:
|
||||
|
||||
meas_freq.append(m[0])
|
||||
|
@ -498,7 +496,7 @@ if __name__ == "__main__":
|
|||
if m[1] > m[2]:
|
||||
meas_ratio.append(m[1] / m[2])
|
||||
elif m[1] < m[2]:
|
||||
meas_ratio.append(m[1] / m[2])
|
||||
meas_ratio.append(m[2] / m[1])
|
||||
else:
|
||||
meas_ratio.append(1)
|
||||
|
||||
|
@ -512,9 +510,15 @@ if __name__ == "__main__":
|
|||
else:
|
||||
meas_p.append(0)
|
||||
|
||||
if args.output_file != None:
|
||||
pass # TODO impl
|
||||
|
||||
if args.show_graph == True:
|
||||
plt.plot(meas_freq, meas_ratio)
|
||||
plt.plot(meas_freq, meas_r)
|
||||
plt.plot(meas_freq, meas_p)
|
||||
|
||||
print "Please close the mathplot window to exit..."
|
||||
plt.show()
|
||||
|
||||
else:
|
||||
|
|
Loading…
Reference in a new issue