Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
drandyhaas committed May 13, 2021
2 parents f422197 + 484f2be commit b6f7859
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 12 deletions.
13 changes: 9 additions & 4 deletions software/HaasoscopeLibQt.py
Original file line number Diff line number Diff line change
Expand Up @@ -1213,22 +1213,27 @@ def makeusbsermap(self): # figure out which board is connected to which USB 2 co
if len(self.usbser)>1:
for usb in np.arange(num_board): self.usbser[usb].timeout=.1 # lower the timeout on the connections, temporarily
foundusbs=[]
self.ser.write(bytearray([100])) # prime the trigger (for all boards)
for bn in np.arange(num_board):
self.ser.write(bytearray([100])) # prime the trigger
if self.minfirmwareversion>=17:
self.ser.write(bytearray([51,bn]))
else:
self.ser.write(bytearray([10+bn]))
foundit=False
for usb in np.arange(len(self.usbser)):
if not usb in foundusbs: # it's not already known that this usb connection is assigned to a board
rslt = self.usbser[usb].read(self.num_bytes) # try to get data from the board
if len(rslt)==self.num_bytes:
#print " got the right nbytes for board",bn,"from usb",usb
print(" got the right nbytes for board",bn,"from usb",usb)
self.usbsermap[bn]=usb
foundusbs.append(usb) # remember that we already have figured out which board this usb connection is for, so we don't bother trying again for another board
foundit=True
break # already found which board this usb connection is used for, so bail out
#else: print " got the wrong nbytes for board",bn,"from usb",usb
#else: print " already know what usb",usb,"is for"
#else: print(" got the wrong nbytes for board",bn,"from usb",usb)
#else: print(" already know what usb",usb,"is for")
if not foundit:
print("could not find usb2 connection for board",bn)
return False
for usb in np.arange(num_board): self.usbser[usb].timeout=self.sertimeout # put back the timeout on the connections
print("usbsermap is",self.usbsermap)
return True
Expand Down
15 changes: 8 additions & 7 deletions software/HaasoscopeQt.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

serialdelaytimerwait=100
ram_width=9
num_board=1
num_boardss=1
trigboardport=""
manserport="" # the name of the serial port on your computer, connected to Haasoscope, like /dev/ttyUSB0 or COM8, leave blank to detect automatically!
print ('Number of arguments:', len(sys.argv), 'arguments.')
Expand All @@ -30,8 +30,8 @@
ram_width=int(a[2:])
print("ram_width set to",ram_width)
if a[1]=="b":
num_board=int(a[2:])
print("num_board set to",num_board)
num_boardss=int(a[2:])
print("num_board set to",num_boardss)
if a[1]=="p":
manserport=a[2:]
print("serial port manually set to",manserport)
Expand All @@ -40,7 +40,7 @@
print("trigboardport set to",trigboardport)

#Some pre-options
HaasoscopeLibQt.num_board = num_board # Number of Haasoscope boards to read out (default is 1)
HaasoscopeLibQt.num_board = num_boardss # Number of Haasoscope boards to read out (default is 1)
HaasoscopeLibQt.ram_width = ram_width # width in bits of sample ram to use (e.g. 9==512 samples (default), 12(max)==4096 samples) (min is 2)
#HaasoscopeLibQt.max10adcchans = [(0,110),(0,118)] #[(0,110),(0,118),(1,110),(1,118)] #max10adc channels to draw (board, channel on board), channels: 110=ain1, 111=pin6, ..., 118=pin14, 119=temp # default is none, []

Expand Down Expand Up @@ -311,7 +311,7 @@ def keyPressEvent(self, event):
modifiers = QtWidgets.QApplication.keyboardModifiers()
if event.key()==QtCore.Qt.Key_I:
if not modifiers == QtCore.Qt.ShiftModifier:
theboard = num_board - 1 - int(d.selectedchannel / HaasoscopeLibQt.num_chan_per_board)
theboard = HaasoscopeLibQt.num_board - 1 - int(d.selectedchannel / HaasoscopeLibQt.num_chan_per_board)
d.increment_clk_phase(theboard)
else:
if trigboardport!="": trigboard.increment_trig_board_clock_phase()
Expand Down Expand Up @@ -774,8 +774,9 @@ def drawtext(self): # happens once per second
delaycounters = trigboard.get_delaycounters()
self.ui.textBrowser.append("delaycounters: "+str(delaycounters))
self.ui.textBrowser.append(trigboard.get_histos())
if not delaycounters[0]:
d.increment_clk_phase(0,30) # increment clk of that board by 30*100ps=3ns
for b in range(HaasoscopeLibQt.num_board):
if not delaycounters[b]:
d.increment_clk_phase(b,30) # increment clk of that board by 30*100ps=3ns

try:
win = MainWindow()
Expand Down
2 changes: 1 addition & 1 deletion software/HaasoscopeTrigLibQt.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
class HaasoscopeTrig:

def construct(self,port):
self.ser=Serial(port,115200,timeout=1.0)
self.ser=Serial(port,115200,timeout=0.2)
self.extclock=0
self.histostosend=-1

Expand Down

0 comments on commit b6f7859

Please sign in to comment.