Commit ba235e10 authored by David Cussans's avatar David Cussans

Converting from Python 2 to 3

parent 7cd338b5
......@@ -14,72 +14,69 @@ hw = manager.getDevice("tlu")
# hw.getNode("A").write(255)
reg = hw.getNode("version").read()
hw.dispatch()
print "CHECK REG= ", hex(reg)
print("CHECK REG= ", hex(reg))
# #First I2C core
print ("Instantiating master I2C core:")
master_I2C= I2CCore(hw, 10, 5, "i2c_master", None)
print("Instantiating master I2C core:")
master_I2C = I2CCore(hw, 10, 5, "i2c_master", None)
master_I2C.state()
#
# #######################################
enableCore= False #Only need to run this once, after power-up
enableCore = False # Only need to run this once, after power-up
if (enableCore):
mystop=True
print " Write RegDir to set I/O[7] to output:"
myslave= 0x21
mycmd= [0x01, 0x7F]
nwords= 1
master_I2C.write(myslave, mycmd, mystop)
mystop = True
print(" Write RegDir to set I/O[7] to output:")
myslave = 0x21
mycmd = [0x01, 0x7F]
nwords = 1
master_I2C.write(myslave, mycmd, mystop)
mystop=False
mycmd= [0x01]
master_I2C.write(myslave, mycmd, mystop)
res= master_I2C.read( myslave, nwords)
print "\tPost RegDir: ", res
mystop = False
mycmd = [0x01]
master_I2C.write(myslave, mycmd, mystop)
res = master_I2C.read(myslave, nwords)
print("\tPost RegDir: ", res)
#DAC CONFIGURATION BEGIN
# DAC CONFIGURATION BEGIN
if (False):
zeDAC1=AD5665R(master_I2C, 0x1C)
zeDAC1.setIntRef(intRef= False, verbose= True)
zeDAC1.writeDAC(0x0, 7, verbose= True)#7626
zeDAC1 = AD5665R(master_I2C, 0x1C)
zeDAC1.setIntRef(intRef=False, verbose=True)
zeDAC1.writeDAC(0x0, 7, verbose=True) # 7626
if (True):
# #I2C EXPANDER CONFIGURATION BEGIN
IC6=PCA9539PW(master_I2C, 0x76)
#BANK 0
IC6.setInvertReg(0, 0x00)# 0= normal
IC6.setIOReg(0, 0x00)# 0= output <<<<<<<<<<<<<<<<<<<
IC6.setOutputs(0, 0x00)
res= IC6.getInputs(0)
print "IC6 read back bank 0: 0x%X" % res[0]
#
#BANK 1
IC6.setInvertReg(1, 0x00)# 0= normal
IC6.setIOReg(1, 0x00)# 0= output <<<<<<<<<<<<<<<<<<<
IC6.setOutputs(1, 0x00)
res= IC6.getInputs(1)
print "IC6 read back bank 1: 0x%X" % res[0]
# # #
IC7=PCA9539PW(master_I2C, 0x77)
#BANK 0
IC7.setInvertReg(0, 0x00)# 0= normal
IC7.setIOReg(0, 0x00)# 0= output <<<<<<<<<<<<<<<<<<<
IC7.setOutputs(0, 0x00)
res= IC7.getInputs(0)
print "IC7 read back bank 0: 0x%X" % res[0]
#
#BANK 1
IC7.setInvertReg(1, 0x00)# 0= normal
IC7.setIOReg(1, 0x00)# 0= output <<<<<<<<<<<<<<<<<<<
IC7.setOutputs(1, 0x00)
res= IC7.getInputs(1)
print "IC7 read back bank 1: 0x%X" % res[0]
# #I2C EXPANDER CONFIGURATION END
# #I2C EXPANDER CONFIGURATION BEGIN
IC6 = PCA9539PW(master_I2C, 0x76)
# BANK 0
IC6.setInvertReg(0, 0x00) # 0= normal
IC6.setIOReg(0, 0x00) # 0= output <<<<<<<<<<<<<<<<<<<
IC6.setOutputs(0, 0x00)
res = IC6.getInputs(0)
print("IC6 read back bank 0: 0x%X" % res[0])
#
# BANK 1
IC6.setInvertReg(1, 0x00) # 0= normal
IC6.setIOReg(1, 0x00) # 0= output <<<<<<<<<<<<<<<<<<<
IC6.setOutputs(1, 0x00)
res = IC6.getInputs(1)
print("IC6 read back bank 1: 0x%X" % res[0])
# # #
IC7 = PCA9539PW(master_I2C, 0x77)
# BANK 0
IC7.setInvertReg(0, 0x00) # 0= normal
IC7.setIOReg(0, 0x00) # 0= output <<<<<<<<<<<<<<<<<<<
IC7.setOutputs(0, 0x00)
res = IC7.getInputs(0)
print("IC7 read back bank 0: 0x%X" % res[0])
#
# BANK 1
IC7.setInvertReg(1, 0x00) # 0= normal
IC7.setIOReg(1, 0x00) # 0= output <<<<<<<<<<<<<<<<<<<
IC7.setOutputs(1, 0x00)
res = IC7.getInputs(1)
print("IC7 read back bank 1: 0x%X" % res[0])
# #I2C EXPANDER CONFIGURATION END
......@@ -7,7 +7,7 @@ from si5345 import si5345
from AD5665R import AD5665R
from PCA9539PW import PCA9539PW
from E24AA025E48T import E24AA025E48T
from I2CDISP import LCD_ada #Library for display
from I2CDISP import LCD_ada # Library for display
manager = uhal.ConnectionManager("file://./TLUconnection.xml")
hw = manager.getDevice("tlu")
......@@ -15,34 +15,31 @@ hw = manager.getDevice("tlu")
# hw.getNode("A").write(255)
reg = hw.getNode("version").read()
hw.dispatch()
print "CHECK REG= ", hex(reg)
print("CHECK REG= ", hex(reg))
# #First I2C core
print ("Instantiating master I2C core:")
master_I2C= I2CCore(hw, 10, 5, "i2c_master", None)
print("Instantiating master I2C core:")
master_I2C = I2CCore(hw, 10, 5, "i2c_master", None)
master_I2C.state()
#
# #######################################
enableCore= True #Only need to run this once, after power-up
enableCore = True # Only need to run this once, after power-up
if (enableCore):
mystop=True
print " Write RegDir to set I/O[7] to output:"
myslave= 0x21
mycmd= [0x01, 0x7F]
nwords= 1
master_I2C.write(myslave, mycmd, mystop)
mystop=False
mycmd= [0x01]
master_I2C.write(myslave, mycmd, mystop)
res= master_I2C.read( myslave, nwords)
print "\tPost RegDir: ", res
mystop = True
print(" Write RegDir to set I/O[7] to output:")
myslave = 0x21
mycmd = [0x01, 0x7F]
nwords = 1
master_I2C.write(myslave, mycmd, mystop)
mystop = False
mycmd = [0x01]
master_I2C.write(myslave, mycmd, mystop)
res = master_I2C.read(myslave, nwords)
print("\tPost RegDir: ", res)
# #######################################
#
# time.sleep(0.1)
......@@ -62,10 +59,10 @@ if (enableCore):
# #######################################
#Second I2C core
# Second I2C core
#print ("Instantiating SFP I2C core:")
#clock_I2C= I2CCore(hw, 10, 5, "i2c_sfp", None)
#clock_I2C.state()
# clock_I2C.state()
# #Third I2C core
# print ("Instantiating clock I2C core:")
......@@ -90,104 +87,104 @@ if (enableCore):
#
#CLOCK CONFIGURATION BEGIN
zeClock=si5345(master_I2C, 0x68)
res= zeClock.getDeviceVersion()
# CLOCK CONFIGURATION BEGIN
zeClock = si5345(master_I2C, 0x68)
res = zeClock.getDeviceVersion()
zeClock.checkDesignID()
#zeClock.setPage(0, True)
#zeClock.getPage(True)
doClock= False
# zeClock.getPage(True)
doClock = False
if (doClock):
clkRegList= zeClock.parse_clk("./../../bitFiles/TLU_CLK_Config_v1e.txt")
zeClock.writeConfiguration(clkRegList)######
zeClock.writeRegister(0x0536, [0x0A]) #Configures manual switch of inputs
zeClock.writeRegister(0x0949, [0x0F]) #Enable all inputs
zeClock.writeRegister(0x052A, [0x05]) #Configures source of input
iopower= zeClock.readRegister(0x0949, 1)
print " Clock IO power: 0x%X" % iopower[0]
lol= zeClock.readRegister(0x000E, 1)
print " Clock LOL (0x000E): 0x%X" % lol[0]
los= zeClock.readRegister(0x000D, 1)
print " Clock LOS (0x000D): 0x%X" % los[0]
#CLOCK CONFIGURATION END
#DAC CONFIGURATION BEGIN
zeDAC1=AD5665R(master_I2C, 0x13)
zeDAC1.setIntRef(intRef= False, verbose= True)
zeDAC1.writeDAC(0x0, 7, verbose= True)#7626
zeDAC2=AD5665R(master_I2C, 0x1F)
zeDAC2.setIntRef(intRef= False, verbose= True)
zeDAC2.writeDAC(0x2fff, 3, verbose= True)
#DAC CONFIGURATION END
#EEPROM BEGIN
zeEEPROM= E24AA025E48T(master_I2C, 0x50)
res=zeEEPROM.readEEPROM(0xfa, 6)
result=" EEPROM ID:\n\t"
clkRegList = zeClock.parse_clk("./../../bitFiles/TLU_CLK_Config_v1e.txt")
zeClock.writeConfiguration(clkRegList)
zeClock.writeRegister(0x0536, [0x0A]) # Configures manual switch of inputs
zeClock.writeRegister(0x0949, [0x0F]) # Enable all inputs
zeClock.writeRegister(0x052A, [0x05]) # Configures source of input
iopower = zeClock.readRegister(0x0949, 1)
print(" Clock IO power: 0x%X" % iopower[0])
lol = zeClock.readRegister(0x000E, 1)
print(" Clock LOL (0x000E): 0x%X" % lol[0])
los = zeClock.readRegister(0x000D, 1)
print(" Clock LOS (0x000D): 0x%X" % los[0])
# CLOCK CONFIGURATION END
# DAC CONFIGURATION BEGIN
zeDAC1 = AD5665R(master_I2C, 0x13)
zeDAC1.setIntRef(intRef=False, verbose=True)
zeDAC1.writeDAC(0x0, 7, verbose=True) # 7626
zeDAC2 = AD5665R(master_I2C, 0x1F)
zeDAC2.setIntRef(intRef=False, verbose=True)
zeDAC2.writeDAC(0x2fff, 3, verbose=True)
# DAC CONFIGURATION END
# EEPROM BEGIN
zeEEPROM = E24AA025E48T(master_I2C, 0x50)
res = zeEEPROM.readEEPROM(0xfa, 6)
result = " EEPROM ID:\n\t"
for iaddr in res:
result+="%02x "%(iaddr)
print result
#EEPROM END
result += "%02x " % (iaddr)
print(result)
# EEPROM END
# #I2C EXPANDER CONFIGURATION BEGIN
IC6=PCA9539PW(master_I2C, 0x74)
#BANK 0
IC6.setInvertReg(0, 0x00)# 0= normal
IC6.setIOReg(0, 0x00)# 0= output <<<<<<<<<<<<<<<<<<<
IC6.setOutputs(0, 0x77)#77
res= IC6.getInputs(0)
print "\tIC6 read back bank 0: 0x%X" % res[0]
IC6 = PCA9539PW(master_I2C, 0x74)
# BANK 0
IC6.setInvertReg(0, 0x00) # 0= normal
IC6.setIOReg(0, 0x00) # 0= output <<<<<<<<<<<<<<<<<<<
IC6.setOutputs(0, 0x77) # 77
res = IC6.getInputs(0)
print("\tIC6 read back bank 0: 0x%X" % res[0])
#
#BANK 1
IC6.setInvertReg(1, 0x00)# 0= normal
IC6.setIOReg(1, 0x00)# 0= output <<<<<<<<<<<<<<<<<<<
IC6.setOutputs(1, 0x77)#77
res= IC6.getInputs(1)
print "\tIC6 read back bank 1: 0x%X" % res[0]
# BANK 1
IC6.setInvertReg(1, 0x00) # 0= normal
IC6.setIOReg(1, 0x00) # 0= output <<<<<<<<<<<<<<<<<<<
IC6.setOutputs(1, 0x77) # 77
res = IC6.getInputs(1)
print("\tIC6 read back bank 1: 0x%X" % res[0])
# # #
IC7=PCA9539PW(master_I2C, 0x75)
#BANK 0
IC7.setInvertReg(0, 0x00)# 0= normal
IC7.setIOReg(0, 0x00)# 0= output <<<<<<<<<<<<<<<<<<<
IC7 = PCA9539PW(master_I2C, 0x75)
# BANK 0
IC7.setInvertReg(0, 0x00) # 0= normal
IC7.setIOReg(0, 0x00) # 0= output <<<<<<<<<<<<<<<<<<<
IC7.setOutputs(0, 0xF0)
res= IC7.getInputs(0)
print "\tIC7 read back bank 0: 0x%X" % res[0]
res = IC7.getInputs(0)
print("\tIC7 read back bank 0: 0x%X" % res[0])
#
#BANK 1
IC7.setInvertReg(1, 0x00)# 0= normal
IC7.setIOReg(1, 0x00)# 0= output <<<<<<<<<<<<<<<<<<<
# BANK 1
IC7.setInvertReg(1, 0x00) # 0= normal
IC7.setIOReg(1, 0x00) # 0= output <<<<<<<<<<<<<<<<<<<
IC7.setOutputs(1, 0xAF)
res= IC7.getInputs(1)
print "\tIC7 read back bank 1: 0x%X" % res[0]
res = IC7.getInputs(1)
print("\tIC7 read back bank 1: 0x%X" % res[0])
# #I2C EXPANDER CONFIGURATION END
#Instantiate Display
doDisplaytest= False
# Instantiate Display
doDisplaytest = False
if doDisplaytest:
DISP=LCD_ada(master_I2C, 0x20) #3A
#self.DISP.clear()
DISP.test()
DISP = LCD_ada(master_I2C, 0x20) # 3A
# self.DISP.clear()
DISP.test()
# #Reset counters
#cmd = int("0x0", 16) #write 0x2 to reset
#hw.getNode("triggerInputs.SerdesRstW").write(cmd)
# cmd = int("0x0", 16) #write 0x2 to reset
# hw.getNode("triggerInputs.SerdesRstW").write(cmd)
#restatus= hw.getNode("triggerInputs.SerdesRstR").read()
#hw.dispatch()
#print "Trigger Reset: 0x%X" % restatus
## #Read trigger inputs
# hw.dispatch()
# print "Trigger Reset: 0x%X" % restatus
# Read trigger inputs
#myreg= [-1, -1, -1, -1, -1, -1]
#for inputN in range(0, 6):
# for inputN in range(0, 6):
# regString= "triggerInputs.ThrCount%dR" % inputN
# myreg[inputN]= hw.getNode(regString).read()
# hw.dispatch()
# print regString, myreg[inputN]
## Read ev formatter
# Read ev formatter
#cmd = int("0x0", 16) #
##hw.getNode("Event_Formatter.Enable_Record_Data").write(cmd)
# hw.getNode("Event_Formatter.Enable_Record_Data").write(cmd)
#efstatus= hw.getNode("Event_Formatter.CurrentTimestampLR").read()
#hw.dispatch()
#print "Event Formatter Record: 0x%X" % efstatus
# hw.dispatch()
# print "Event Formatter Record: 0x%X" % efstatus
This diff is collapsed.
<?xml version="1.0" encoding="UTF-8"?>
<connections>
<connection id="tlu" uri="ipbusudp-2.0://192.168.200.30:50001"
<!--connection id="tlu" uri="ipbusudp-2.0://192.168.200.30:50001"-->
<connection id="tlu" uri="chtcp-2.0://localhost:10203?target=192.168.200.30:50001"
address_table="file://./TLUaddrmap.xml" />
</connections>
This diff is collapsed.
[Producer.fmctlu]
verbose= 2
confid= 20170626
confid= 20221005
delayStart= 1000
# HDMI pin direction:
# 4-bits to determine direction of HDMI pins
# 1-bit for the clock pair
# 0= pins are not driving signals, 1 pins drive signals (outputs)
# 0 = clock pins are not driving signals,
# 1 = clock pins drive signals from FPGA
# 2 = clock pins drive signals from si5345 clock generator
HDMI1_set= 0x7
HDMI2_set= 0x7
HDMI3_set= 0x7
HDMI4_set= 0x7
HDMI1_clk = 0
HDMI2_clk = 0
HDMI3_clk = 0
HDMI4_clk = 0
HDMI1_clk = 2
HDMI2_clk = 2
HDMI3_clk = 2
HDMI4_clk = 2
# Control voltages for the PMTs
PMT1_V= 0.5
......@@ -51,21 +53,22 @@ DACThreshold4 = -0.12
DACThreshold5 = -0.12
# Define which DUTs are ON
DUTMask = 0x1
DUTMask = 0xF
# Define mode of DUT (00 EUDET, 11 AIDA)
DUTMaskMode= 0xFC
DUTMaskMode= 0xFF
# Allow asynchronous veto
DUTMaskModeModifier= 0x0
# Ignore busy from a specific DUT
DUTIgnoreBusy = 0x0
DUTIgnoreBusy = 0xF
# Ignore the SHUTTER veto on a specific DUT
DUTIgnoreShutterVeto = 0x0
# Generate internal triggers (in Hz, 0= no triggers)
#InternalTriggerFreq = 10
InternalTriggerFreq = 0
......
......@@ -17,7 +17,7 @@ from TLU_v1e import TLU
import cmd
# Use to have config file parser
import ConfigParser
import configparser
# Use root
from ROOT import TFile, TTree, gROOT, AddressOf
......@@ -25,7 +25,7 @@ from ROOT import *
import numpy as numpy
## Define class that creates the command user inteface
# Define class that creates the command user inteface
class MyPrompt(cmd.Cmd):
# def do_initialise(self, args):
......@@ -44,32 +44,31 @@ class MyPrompt(cmd.Cmd):
# print "\t Could not retrieve INI data."
# return
def do_configure(self, args):
"""Processes the CONF file and writes its values to the TLU. To use a specific file type:\n
parseIni path/to/filename.conf\n
(without quotation marks)"""
print "==== COMMAND RECEIVED: PARSE CONFIG"
#self.testme()
parsed_cfg= self.open_cfg_file(args, "./localConf.conf")
print("==== COMMAND RECEIVED: PARSE CONFIG")
# self.testme()
parsed_cfg = self.open_cfg_file(args, "./localConf.conf")
try:
theID = parsed_cfg.getint("Producer.fmctlu", "confid")
print "\t", theID
print("\t", theID)
TLU.configure(parsed_cfg)
except IOError:
print "\t Could not retrieve CONF data."
print("\t Could not retrieve CONF data.")
return
def do_i2c(self, args):
arglist = args.split()
arglist = args.split()
if len(arglist) == 0:
print "\tno command specified"
print("\tno command specified")
else:
i2ccmd= arglist[0]
i2ccmd = arglist[0]
results = list(map(int, arglist))
TLU.DISP.writeSomething(results)
print "Sending i2c command to display"
return
TLU.DISP.writeSomething(results)
print("Sending i2c command to display")
return
def do_id(self, args):
"""Interrogates the TLU and prints it unique ID on screen"""
......@@ -85,40 +84,41 @@ class MyPrompt(cmd.Cmd):
def do_startRun(self, args):
"""Starts the TLU run. If a number is specified, this number will be appended to the file name as Run_#"""
print "==== COMMAND RECEIVED: STARTING TLU RUN"
#startTLU( uhalDevice = self.hw, pychipsBoard = self.board, writeTimestamps = ( options.writeTimestamps == "True" ) )
print("==== COMMAND RECEIVED: STARTING TLU RUN")
#startTLU( uhalDevice = self.hw, pychipsBoard = self.board, writeTimestamps = ( options.writeTimestamps == "True" ) )
arglist = args.split()
if len(arglist) == 0:
print "\tno run# specified, using 1"
runN= 1
print("\tno run# specified, using 1")
runN = 1
else:
runN= arglist[0]
runN = arglist[0]
logdata= True
logdata = True
#TLU.start(logdata)
if (TLU.isRunning): #Prevent double start
print " Run already in progress"
# TLU.start(logdata)
if (TLU.isRunning): # Prevent double start
print(" Run already in progress")
return
else:
now = datetime.now().strftime('%Y%m%d_%H%M%S')
default_filename = "./datafiles/"+ now + "_tluData_" + str(runN) + ".root"
rootFname= default_filename
print "OPENING ROOT FILE:", rootFname
self.root_file = TFile( rootFname, 'RECREATE' )
default_filename = "./datafiles/" + \
now + "_tluData_" + str(runN) + ".root"
rootFname = default_filename
print("OPENING ROOT FILE:", rootFname)
self.root_file = TFile(rootFname, 'RECREATE')
# Create a root "tree"
root_tree = TTree( 'T', 'TLU Data' )
root_tree = TTree('T', 'TLU Data')
#highWord =0
#lowWord =0
#evtNumber=0
#timeStamp=0
#evtType=0
#trigsFired=0
# evtNumber=0
# timeStamp=0
# evtType=0
# trigsFired=0
#bufPos = 0
#https://root-forum.cern.ch/t/long-integer/1961/2
# https://root-forum.cern.ch/t/long-integer/1961/2
gROOT.ProcessLine(
"struct MyStruct {\
"struct MyStruct {\
UInt_t raw0;\
UInt_t raw1;\
UInt_t raw2;\
......@@ -129,13 +129,13 @@ class MyPrompt(cmd.Cmd):
ULong64_t tluTimeStamp;\
UChar_t tluEvtType;\
UChar_t tluTrigFired;\
};" );
mystruct= MyStruct()
};")
mystruct = MyStruct()
# Create a branch for each piece of data
root_tree.Branch('EVENTS', mystruct, 'raw0/i:raw1/i:raw2/i:raw3/i:raw4/i:raw5/i:evtNumber/i:tluTimeStamp/l:tluEvtType/b:tluTrigFired/b' )
root_tree.Branch(
'EVENTS', mystruct, 'raw0/i:raw1/i:raw2/i:raw3/i:raw4/i:raw5/i:evtNumber/i:tluTimeStamp/l:tluEvtType/b:tluTrigFired/b')
# root_tree.Branch( 'tluHighWord' , highWord , "HighWord/l")
# root_tree.Branch( 'tluLowWord' , lowWord , "LowWord/l")
# root_tree.Branch( 'tluExtWord' , extWord , "ExtWord/l")
......@@ -144,36 +144,36 @@ class MyPrompt(cmd.Cmd):
# root_tree.Branch( 'tluEvtNumber' , evtNumber , "EvtNumber/i")
# root_tree.Branch( 'tluEvtType' , evtType , "EvtType/b")
# root_tree.Branch( 'tluTrigFired' , trigsFired, "TrigsFired/b")
#self.root_file.Write()
# self.root_file.Write()
daq_thread= threading.Thread(target = TLU.start, args=(logdata, runN, mystruct, root_tree))
daq_thread = threading.Thread(
target=TLU.start, args=(logdata, runN, mystruct, root_tree))
daq_thread.start()
def do_endRun(self, args):
"""Stops the TLU run"""
print "==== COMMAND RECEIVED: STOP TLU RUN"
"""Stops the TLU run"""
print("==== COMMAND RECEIVED: STOP TLU RUN")
if TLU.isRunning:
TLU.isRunning= False
TLU.isRunning = False
TLU.stop(False, False)
self.root_file.Write()
self.root_file.Close()
else:
print " No run to stop"
print(" No run to stop")
def do_quit(self, args):
"""Quits the program."""
print "==== COMMAND RECEIVED: QUITTING TLU CONSOLE"
print("==== COMMAND RECEIVED: QUITTING TLU CONSOLE")
if TLU.isRunning:
TLU.isRunning= False
TLU.isRunning = False
TLU.stop(False, False)
self.root_file.Write()
self.root_file.Close()
print "Terminating run"
return True
print("Terminating run")
return True
def testme(self):
print "This is a test"
print("This is a test")
def open_cfg_file(self, args, default_file):
# Parse the user arguments, attempts to opent the file and performs a (minimal)
......@@ -181,22 +181,22 @@ class MyPrompt(cmd.Cmd):
arglist = args.split()
if len(arglist) == 0:
print "\tno file specified, using default"
fileName= default_file
print "\t", fileName
print("\tno file specified, using default")
fileName = default_file
print("\t", fileName)
else:
fileName= arglist[0]
fileName = arglist[0]
if len(arglist) > 1:
print "\tinvalid: too many arguments. Max 1."
print("\tinvalid: too many arguments. Max 1.")
return
parsed_file = ConfigParser.RawConfigParser()
parsed_file = configparser.RawConfigParser()
try:
with open(fileName) as f:
parsed_file.readfp(f)
print "\t", parsed_file.sections()
print("\t", parsed_file.sections())
except IOError:
print "\t Error while parsing the specified file."
print("\t Error while parsing the specified file.")
return
return parsed_file
......@@ -226,21 +226,21 @@ class MyPrompt(cmd.Cmd):
#################################################
if __name__ == "__main__":
print "TLU v1E MAIN"
print("TLU v1E MAIN")
prompt = MyPrompt()
prompt.prompt = '>> '
parsed_ini= prompt.open_cfg_file("", "./localIni.ini")
TLU= TLU("tlu", "file://./TLUconnection.xml", parsed_ini)
parsed_ini = prompt.open_cfg_file("", "./localIni.ini")
TLU = TLU("tlu", "file://./TLUconnection.xml", parsed_ini)
###TLU.configure(parsed_cfg)
# TLU.configure(parsed_cfg)
###logdata= True
###TLU.start(logdata)
###time.sleep(5)
# TLU.start(logdata)
# time.sleep(5)
###TLU.stop(False, False)
# Start interactive prompt
print "===================================================================="
print "==========================TLU TEST CONSOLE=========================="
print "===================================================================="
print("====================================================================")
print("==========================TLU TEST CONSOLE==========================")
print("====================================================================")
prompt.cmdloop("Type 'help' for a list of commands.")