in callback function check for ca disconnect and return (access to cafeCache is forbidden)
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -10,3 +10,4 @@ src/*.*+*
|
||||
pyrcc5/*.*~
|
||||
pyrcc5/*.*-*
|
||||
pyrcc5/*.*+*
|
||||
hush_devl.sh
|
||||
|
||||
46
src/gui.py
46
src/gui.py
@@ -332,20 +332,20 @@ class AppGui(QWidget):
|
||||
|
||||
def receive_sec_state(handle, pv, pvdata):
|
||||
pvsplit = pv.split("-")
|
||||
#secsplit = pvsplit[0].split("P")
|
||||
#sec = secsplit[1]
|
||||
sec=pvsplit[0][1:]
|
||||
|
||||
if pvdata.status == self.cyca.ICAFE_CA_OP_CONN_DOWN:
|
||||
return
|
||||
|
||||
def already_in_standby():
|
||||
|
||||
devices = self.settings.data[sec]["iocDevice"]
|
||||
pv_list = []
|
||||
standby_value_list = []
|
||||
print("sector", sec, flush=True)
|
||||
|
||||
for magnet in devices:
|
||||
pv = magnet + ":SOL:2"
|
||||
pv_list.append(pv)
|
||||
pv_magnet = magnet + ":SOL:2"
|
||||
pv_list.append(pv_magnet)
|
||||
#get standby values
|
||||
idx = self.settings.data[sec]["device"].index(magnet)
|
||||
standby_value = self.settings.data[sec]["standby"][idx]
|
||||
standby_value_list.append(standby_value)
|
||||
@@ -354,25 +354,27 @@ class AppGui(QWidget):
|
||||
print("standby ist==>", standby_value_list, flush=True)
|
||||
|
||||
QApplication.processEvents()
|
||||
#value_list, status, status_list = self.cafe.getScalarList(
|
||||
# pv_list, cacheFlag=True)
|
||||
value_list, status, status_list = self.cafe.getScalarList(
|
||||
pv_list, cacheFlag=True)
|
||||
|
||||
'''
|
||||
value_list = []
|
||||
for pv in pv_list:
|
||||
value_list.append(self.cafe.getCache(pv))
|
||||
|
||||
print("isConnected===>", flush=True)
|
||||
is_conn = self.cafe.isConnected(pv)
|
||||
print("isConnected===>", is_conn, flush=True)
|
||||
|
||||
for pv in pv_list:
|
||||
val = self.cafe.getCache(pv)
|
||||
if val is not None:
|
||||
value_list.append(val)
|
||||
'''
|
||||
#print("status", status, status_list, flush=True)
|
||||
print("valuelist==>", pv_list, value_list, flush=True)
|
||||
#if status != self.cyca.ICAFE_NORMAL:
|
||||
# self.check_status_list(_pymodule, "getScalarListCache",
|
||||
# pv_list, status_list, _line())
|
||||
#get standby values
|
||||
'''
|
||||
standby_value_list = []
|
||||
for magnet in devices:
|
||||
idx = self.settings.data[sec]["device"].index(magnet)
|
||||
standby_value = self.settings.data[sec]["standby"][idx]
|
||||
standby_value_list.append(standby_value)
|
||||
'''
|
||||
if status != self.cyca.ICAFE_NORMAL:
|
||||
self.check_status_list(_pymodule, "getScalarListCache",
|
||||
pv_list, status_list, _line())
|
||||
#check standby values
|
||||
in_standby = True
|
||||
for value, standby in zip(value_list, standby_value_list):
|
||||
if abs(value) < abs(standby)*0.8 or abs(value) > abs(
|
||||
@@ -382,7 +384,7 @@ class AppGui(QWidget):
|
||||
print("is_standby", in_standby, flush=True)
|
||||
return in_standby
|
||||
|
||||
if pvdata.value[0] == 'ON': # and not already_in_standby():
|
||||
if pvdata.value[0] == 'ON' and not already_in_standby():
|
||||
print("pv, sec-ON", pv, sec, flush=True)
|
||||
self.table_sol_dict[sec].init_value_button.setEnabled(True)
|
||||
self.table_pwr_dict[sec].init_value_button.setEnabled(True)
|
||||
|
||||
Reference in New Issue
Block a user