import Pass as p if __name__ == '__main__': # Note that A2L filename needs to be a raw string if it contains backslash p.loadA2lFile("ecu", "C:\Repos\sumac\Test\G001_1_GTT_SinX3\G001_1_GTT_stripped_Ascii_2dArray.a2l") # If we want to attach to a specific device by name then # we can list all available devices and parse out the one we need # # Note! It is still possible to omit the device string. # In that case we get the first found CAN dongle. # # xcp_device = "" # for dev in p.getAvailableDevicesCanClassic(): # if dev.startswith("Kvaser Leaf"): # xcp_device = dev # break print("Connecting to ECU...") p.connectToXcpSlaveCanClassic('') # Empty string => Use first found physical device # Scalar variable = "ecu.T_SinA_AmpMapXAxisInput" value = 3.141592 p.downloadCalibration(variable, value) print(p.uploadCalibration(variable)) # Ascii variable = "ecu.T_TestAscii" value = "Hej" p.downloadCalibration(variable, value) print(p.uploadCalibration(variable)) # 1-D Array variable = "ecu.T_SinC_FreqCurveXAxisAsArray" value = [4,3,2,1] p.downloadCalibration(variable, value) print(p.uploadCalibration(variable)) # 2-D Array 4 rows, 5 columns variable = "ecu.T_2DArray" value = [[4,3,2,1,0], [4,3,2,1,0], [4,3,2,1,0], [4,3,2,1,0]] p.downloadCalibration(variable, value) print(p.uploadCalibration(variable)) p.disconnectFromXcpSlave()