This commit is contained in:
2022-08-17 20:01:56 +02:00
parent 22fcad62c1
commit c4cdf15bad
4 changed files with 116 additions and 83 deletions

View File

@@ -300,7 +300,7 @@ class Main(QMainWindow, Ui_MainWindow):
self.create_helical_widgets() #ZAC: orig. code
self.center_piece_update(0) # start camera updater
curzoom = app._zoom.get()
curzoom = app._zoom.get_sp()
_log.debug(f"starting app with zoom at {curzoom}")
self.zoom_changed_cb(curzoom)
self._tabs_daq_methods.currentChanged.connect(self.switch_task)
@@ -442,7 +442,7 @@ class Main(QMainWindow, Ui_MainWindow):
QtCore.QTimer.singleShot(delay, self.new_frame_sim_cb)
def new_frame_pv_cb(self, **kwargs):
_log.debug('new_frame_pv_cb count {}'.format(kwargs['count']))
#_log.debug('new_frame_pv_cb count {}'.format(kwargs['count']))
app=QApplication.instance()
sz=app._camera._sz
if kwargs['count']==sz[0]*sz[1]:
@@ -1022,7 +1022,9 @@ class Main(QMainWindow, Ui_MainWindow):
print(s)
res=QMessageBox.question(self, "calibration", f"use calibration\n{s} ? ")
if res==QMessageBox.Yes:
app._geometry.update_pix2pos(app._raw_pix2pos)
geo=app._geometry
geo.update_pix2pos(app._raw_pix2pos)
app._cfg.setValue(AppCfg.GEO_PIX2POS, geo._lut_pix2pos)
del app._raw_pix2pos
def update_opt_ctr(self, calib):
@@ -1035,7 +1037,12 @@ class Main(QMainWindow, Ui_MainWindow):
print(s)
res=QMessageBox.question(self, "calibration", f"use calibration\n{s} ? ")
if res==QMessageBox.Yes:
app._geometry.update_optical_center(app._raw_opt_ctr)
geo=app._geometry
geo.update_optical_center(app._raw_opt_ctr)
app._cfg.setValue(AppCfg.GEO_OPT_CTR, geo._opt_ctr)
go=self._goOptCtr
oc_sz=go.size()
go.setPos(-geo._opt_ctr-oc_sz/2)
del app._raw_opt_ctr
return
@@ -1067,8 +1074,10 @@ class Main(QMainWindow, Ui_MainWindow):
# state = (zoom, fx, fy) (created at first call of self.track_objects() )
app=QApplication.instance()
geo=app._geometry
zoom = app._zoom.get()
zoom = app._zoom.get_sp()
fast_x=self.tweakers["fast_x"];fast_y=self.tweakers["fast_y"]
# TODO: get_position() is delayed as it is the RBV. do same as for the zoom
# TODO: and return the last set_point
fx=fast_x.get_position()
fy=fast_y.get_position()
try:
@@ -1109,7 +1118,7 @@ class Main(QMainWindow, Ui_MainWindow):
if fx_old!=fx or fy_old!=fy:
p1=geo.pos2pix((fx_old,fy_old))
p2=geo.pos2pix((fx,fy))
d=p2-p1
d=p1-p2
for o in tracked['objLst']:
pos=o.pos()
@@ -1167,7 +1176,7 @@ class Main(QMainWindow, Ui_MainWindow):
self._mouse_pos = pos
task = self.active_task()
xy = self._goImg.mapFromScene(pos)
z = app._zoom.get()
z = app._zoom.get_sp()
#_log.debug('mouse_pos:{} scene_pos:{} zoom:{}'.format(pos,xy,z))
#TODO: implement mouse handling
# if self._ppm_toolbox._force_ppm > 0:
@@ -1277,8 +1286,8 @@ class Main(QMainWindow, Ui_MainWindow):
#dy=-(y-by)/ppm
#fx+=dx
#fy+=dy
fx_motor.move_relative(mm[0])
fy_motor.move_relative(mm[1])
fx_motor.move_relative(-mm[0])
fy_motor.move_relative(-mm[1])
#self.fast_dx_position.emit(dx)
#self.fast_dy_position.emit(dy)
pass
@@ -3436,9 +3445,9 @@ def main():
hostname=socket.gethostname()
if hostname=='ganymede':
#use EPICS locally
os.environ['EPICS_CA_ADDR_LIST']='localhost'
#os.environ['EPICS_CA_ADDR_LIST']='localhost'
#use EPICS if connected to ESC network
# os.environ['EPICS_CA_ADDR_LIST'] ='129.129.244.255 sf-saresc-cagw.psi.ch:5062 sf-saresc-cagw.psi.ch:5066'
os.environ['EPICS_CA_ADDR_LIST'] ='129.129.244.255 sf-saresc-cagw.psi.ch:5062 sf-saresc-cagw.psi.ch:5066'