def getACRConfig(ser): # GET ACR CONFIGURATION # prepare packet as a byte array and send through COM packet = nf_header.getACRConfig() ser.write(packet) print("Sent packet: ", packet) # read and print response from COM # response has 687 bytes # each ACR line has {ACR_OnOff (1), ACR_LeadTime (4), Ch1~8 params ((1+4+4+1)*8)} -> 85 bytes # total bytes = 85 bytes per ACR line * 8 ACR lines + (1 byte extra) + 6 bytes from preamble, etc. = 687 bytes nf_header.getACRConfig_resp(ser)
# read and print response from COM # response has 86 bytes # (1+4+4+1) bytes per channel * 8 channels + 6 bytes from header, etc. nf_header.getFilterConfig_resp(nf) elif (cmd == 8): # SET ACR CONFIGURATION # prepare packet as a byte array and send through COM packet = nf_header.setACRConfig() nf.write(packet) print("Sent packet: ", packet) # read and print response from COM # response has 687 bytes # each ACR line has {ACR_OnOff (1), ACR_LeadTime (4), Ch1~8 params ((1+4+4+1)*8)} -> 85 bytes # total bytes = 85 bytes per ACR line * 8 ACR lines + (1 byte extra) + 6 bytes from preamble, etc. = 687 bytes nf_header.getACRConfig_resp(nf) elif (cmd == 9): # GET ACR CONFIGURATION # prepare packet as a byte array and send through COM packet = nf_header.getACRConfig() nf.write(packet) print("Sent packet: ", packet) # read and print response from COM # response has 687 bytes # each ACR line has {ACR_OnOff (1), ACR_LeadTime (4), Ch1~8 params ((1+4+4+1)*8)} -> 85 bytes # total bytes = 85 bytes per ACR line * 8 ACR lines + (1 byte extra) + 6 bytes from preamble, etc. = 687 bytes nf_header.getACRConfig_resp(nf) elif (cmd == 10): # PLAY ACR OPERATION # prepare packet as a byte array and send through COM