Skip to content
This repository has been archived by the owner on Apr 19, 2024. It is now read-only.

Commit

Permalink
MNT #494 per #490, verify external handles exit OK
Browse files Browse the repository at this point in the history
  • Loading branch information
prjemian committed Jan 22, 2022
1 parent 509cfa5 commit 2f72e51
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions profile_bluesky/startup/usaxs_support/heater_profile_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
os.chdir(path)
logger = stdlogpj.standard_logging_setup("process_logger")
logger.info(__file__)
pulsing = False


from user.heater_profile import planHeaterProcess
Expand Down Expand Up @@ -100,7 +101,7 @@ def start10HzPulse():
"""
logger.info("Starting the 10 Hz pulse...")
tPulse = time.time()
while True:
while pulsing:
if time.time() >= tPulse:
tPulse = time.time() + 0.1
process_control.linkam_pulse.put(
Expand All @@ -110,6 +111,7 @@ def start10HzPulse():


def main():
global pulsing
process_control.wait_for_connection()
process_control.linkam_exit.put(False)
process_control.linkam_ready.put(False)
Expand All @@ -120,7 +122,7 @@ def main():
raise ValueError(
f"Cannot start since {nproc} such process(es) already running."
)

pulsing = True
start10HzPulse()

print(f"{__file__} starting ...")
Expand All @@ -130,10 +132,12 @@ def main():
if process_control.linkam_exit.get():
# TODO: how to break infinite loop in user's plan?
# Use the terminating suspender?
# Raise a custom Exception subclass and catch it here.
# or Use another bit PV
process_control.linkam_exit.put(False)
process_control.linkam_ready.put(False)
logger.info("Exit signal received from EPICS.")
break
continue
elif process_control.linkam_trigger.get():
logger.debug("Calling user heater plan")
process_control.linkam_ready.put(False)
Expand Down

0 comments on commit 2f72e51

Please sign in to comment.