add D command
This commit is contained in:
@@ -37,7 +37,7 @@ def perform_hpos_test(repeat_no, solution, df):
|
|||||||
# print(data.split('\r'))
|
# print(data.split('\r'))
|
||||||
# if 'SNE' in data:
|
# if 'SNE' in data:
|
||||||
# ser.write(b'B')
|
# ser.write(b'B')
|
||||||
if 'BC' in data:
|
if '#BC' in data:
|
||||||
ser.write(b'P')
|
ser.write(b'P')
|
||||||
if 'REND' in data:
|
if 'REND' in data:
|
||||||
# print(data)
|
# print(data)
|
||||||
@@ -102,7 +102,7 @@ def perform_auto_dac(df):
|
|||||||
while True:
|
while True:
|
||||||
data += ser.readline().decode("utf-8")
|
data += ser.readline().decode("utf-8")
|
||||||
# print(data.split('\r'))
|
# print(data.split('\r'))
|
||||||
if 'CC' in data:
|
if '#CC' in data:
|
||||||
# print(data)
|
# print(data)
|
||||||
pattern = re.compile(r'LED(\d+)_DAC: (\d+)')
|
pattern = re.compile(r'LED(\d+)_DAC: (\d+)')
|
||||||
|
|
||||||
@@ -217,14 +217,50 @@ def buffer_process():
|
|||||||
df_autodac.to_excel(writer, sheet_name = autodac_sheet_name, index=False)
|
df_autodac.to_excel(writer, sheet_name = autodac_sheet_name, index=False)
|
||||||
writer.close()
|
writer.close()
|
||||||
|
|
||||||
def analysis_process():
|
def diagnostics_process():
|
||||||
df = df.tail(5)
|
try:
|
||||||
|
port = sys.argv[1]
|
||||||
|
baud_rate = 9600
|
||||||
|
deviceId = 'QC'
|
||||||
|
data = ""
|
||||||
|
data_list = []
|
||||||
|
|
||||||
|
if not os.path.exists(port):
|
||||||
|
raise FileNotFoundError(f"Port {port} not found.")
|
||||||
|
|
||||||
|
with serial.Serial(port, baud_rate, timeout=1, parity=serial.PARITY_NONE) as ser:
|
||||||
|
x = ser.read()
|
||||||
|
s = ser.read(10)
|
||||||
|
line = ser.readline()
|
||||||
|
|
||||||
|
ser.write(b'D')
|
||||||
|
while True:
|
||||||
|
data += ser.readline().decode("utf-8")
|
||||||
|
# print(data.split('\r'))
|
||||||
|
if '#DC' in data:
|
||||||
|
print(data)
|
||||||
|
print("D_CMD process completed")
|
||||||
|
return
|
||||||
|
return
|
||||||
|
|
||||||
|
except serial.serialutil.SerialException:
|
||||||
|
print("Device is not connected or resource busy!")
|
||||||
|
raise
|
||||||
|
except FileNotFoundError as e:
|
||||||
|
print(e)
|
||||||
|
raise
|
||||||
|
except Exception as err:
|
||||||
|
print("Error:", err)
|
||||||
|
raise
|
||||||
|
finally:
|
||||||
|
if ser is not None:
|
||||||
|
ser.close()
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
# device = Device(0.01, 0.001, '/dev/cu.usbserial-23APB124', 9600)
|
# device = Device(0.01, 0.001, '/dev/cu.usbserial-23APB124', 9600)
|
||||||
|
|
||||||
|
diagnostics_process()
|
||||||
|
|
||||||
autodac_process()
|
autodac_process()
|
||||||
|
|
||||||
buffer_process()
|
buffer_process()
|
||||||
|
|
||||||
analysis_process()
|
|
||||||
Reference in New Issue
Block a user