Got IOC running via ioc/startioc

This commit is contained in:
2025-07-23 09:06:04 +02:00
parent 4afa6a35e2
commit 962f9bcebf
4 changed files with 10 additions and 17 deletions

View File

@@ -61,7 +61,7 @@ class Axis:
self.write('.' + self.fields[fieldname], value)
def read(self, suffix):
return read(self.pv + suffix)
return read(self.pv + suffix).data
def read_field(self, fieldname):
return self.read('.' + self.fields[fieldname])

View File

@@ -10,7 +10,7 @@ require masterMacs, $(MASTERMACS_VERSION)
# Motors
# Initialize the motors itself
#< motors/turboPmac1.cmd
< motors/turboPmac1.cmd
#< motors/masterMacs1.cmd
# Create the test record which is used to detect if the IOC is running

View File

@@ -13,18 +13,18 @@ from pathlib import Path
def startioc():
root_dir = os.path.dirname(__file__) + '/../'
root_dir = Path(__file__).resolve().parent.parent
with open(root_dir + "config.yaml", "r") as f:
with open(root_dir / "config.yaml", "r") as f:
config = yaml.safe_load(f)
with open(root_dir + 'ioc/config.cmd', "w") as out:
with open(root_dir / 'ioc/config.cmd', "w") as out:
# General configuration
out.write(
f'epicsEnvSet("PVPREFIX", "{config["pvprefix"]}")\n')
out.write(
f'epicsEnvSet("IOCDIR", "{root_dir + "ioc"}" )\n')
f'epicsEnvSet("IOCDIR", "{root_dir / "ioc"}" )\n')
# Motor configuration
out.write(
@@ -44,17 +44,10 @@ def startioc():
os.environ["EPICS_BASE"] = "/usr/local/epics/base-7.0.7"
os.environ["EPICS_HOST_ARCH"] = "RHEL8-x86_64"
# Get the full directory path of the script
script_dir = Path(__file__).resolve().parent
# Change working directory so st.cmd can find other .cmd files
os.chdir(script_dir)
print("Current working directory:", os.getcwd())
print("Script directory:", script_dir)
print("Files in directory:", os.listdir())
# Run the IOC shell script
os.chdir(root_dir / 'ioc')
# Run the IOC shell script
try:
subprocess.run(["/usr/local/bin/iocsh", "st.cmd"], check=True)
except subprocess.CalledProcessError as e:

View File

@@ -8,7 +8,7 @@ def reread_limits_from_hw(motor):
after the next poll at latest
"""
(high_limit, low_limit) = motor.limits()
motor.write_field('dialhighlimit', high_limit-+10)
motor.write_field('dialhighlimit', high_limit+10)
motor.write_field('diallowlimit', low_limit-10)
# After two seconds, at least one poll has been done