Skip to content

Commit 1fbe959

Browse files
author
Myles Metzler
committed
Add get_prgm_counter
1 parent 23d1bbe commit 1fbe959

File tree

4 files changed

+48
-1
lines changed

4 files changed

+48
-1
lines changed

chamberconnectlibrary/controllerinterface.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
from threading import RLock
1010
import traceback
1111
import time
12+
import inspect
1213

1314
class ControllerInterfaceError(Exception):
1415
'''Exception that is thrown when a there is a problem communicating with a controller'''
@@ -330,7 +331,8 @@ def get_operation(self, pgm=None):
330331
'time_remaining':self.get_prgm_time(pgm, exclusive=False),
331332
'step_time_remaining':self.get_prgm_cstime(exclusive=False),
332333
'name':self.get_prgm_name(pnum, exclusive=False),
333-
'steps':self.get_prgm_steps(pnum, exclusive=False)
334+
'steps':self.get_prgm_steps(pnum, exclusive=False),
335+
'cycles':self.get_prgm_counter(exclusive=False)
334336
}
335337
else:
336338
ret['program'] = None
@@ -888,6 +890,16 @@ def prgm_next_step(self):
888890
'''
889891
pass
890892

893+
@abstractmethod
894+
def get_prgm_counter(self):
895+
'''
896+
Get the status of the jump step/counter
897+
898+
Returns:
899+
[{'name':str, 'start':int, 'end':int, 'cycles':int, 'remaining':int}]
900+
'''
901+
pass
902+
891903
@abstractmethod
892904
def get_prgm_cur(self):
893905
'''

chamberconnectlibrary/espec.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -526,6 +526,19 @@ def prgm_resume(self):
526526
def prgm_next_step(self):
527527
self.client.write_prgm_advance()
528528

529+
@exclusive
530+
def get_prgm_counter(self):
531+
prgm_set = self.client.read_prgm_set()
532+
prgm_data = self.client.read_prgm_data(prgm_set['number'])
533+
prgm_mon = self.client.read_prgm_mon()
534+
ret = [
535+
{'name':'A', 'remaining': prgm_mon['counter_a']},
536+
{'name':'B', 'remaining': prgm_mon['counter_b']},
537+
]
538+
ret[0].update(prgm_data['counter_a'])
539+
ret[1].update(prgm_data['counter_b'])
540+
return ret
541+
529542
@exclusive
530543
def get_prgm_cur(self):
531544
return self.cached(self.client.read_prgm_set)['number']

chamberconnectlibrary/watlowf4.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -589,6 +589,24 @@ def prgm_pause(self):
589589
def prgm_resume(self):
590590
self.client.write_holding(1209, 1)
591591

592+
@exclusive
593+
def get_prgm_counter(self):
594+
status = self.client.read_holding(4126, 3) #count, profile, step
595+
if status[1] > 0:
596+
return []
597+
else:
598+
self.client.write_holding(4000, status[1:])
599+
prof = self.client.read_holding(4050, 3)
600+
return [
601+
{
602+
'name':str(status[0]),
603+
'start':prof[1],
604+
'end':status[2],
605+
'cycles':int,
606+
'remaining':prof[2]-status[0]
607+
}
608+
]
609+
592610
@exclusive
593611
def prgm_next_step(self):
594612
program = self.get_prgm_cur(exclusive=False)

chamberconnectlibrary/watlowf4t.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -616,6 +616,10 @@ def prgm_next_step(self):
616616
time.sleep(1)
617617
self.prgm_start(program, nextstep, exclusive=False)
618618

619+
@exclusive
620+
def get_prgm_counter(self):
621+
return []
622+
619623
@exclusive
620624
def get_prgm_cur(self):
621625
return self.client.read_holding(16588, 1)[0]

0 commit comments

Comments
 (0)