Skip to content

Commit

Permalink
Fix #4: Basic profile monitor UI (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
e-carlin authored Jan 2, 2025
1 parent 948d760 commit 5a7a79f
Show file tree
Hide file tree
Showing 30 changed files with 2,140 additions and 0 deletions.
152 changes: 152 additions & 0 deletions etc/epics-install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
#!/bin/bash
#
# Install epics, asyn, medm, and synaps
#
set -eou pipefail
shopt -s nullglob

_asyn_version=R4-45
_epics_version=7.0.8.1
_medm_version=MEDM3_1_21
_synapps_version=R6-3

_curl_untar() {
declare url=$1
declare base=$2
declare tgt=$3
curl -L -s -S "$url" | tar xzf -
mv "$base" "$tgt"
cd "$tgt"
}

_build_base_and_asyn() {
sudo dnf -y install re2c
declare d=$(dirname "$EPICS_BASE")
mkdir -p "$d"
cd "$d"
b=base-"$_epics_version"
_curl_untar https://epics-controls.org/download/base/"$b".tar.gz "$b" "$EPICS_BASE"
cd "$EPICS_BASE"
cd modules
_curl_untar https://github.com/epics-modules/asyn/archive/refs/tags/"$_asyn_version".tar.gz "asyn-$_asyn_version" asyn
perl -pi -e 's/^# (?=TIRPC)//' configure/CONFIG_SITE
cd ..
echo 'SUBMODULES += asyn' > Makefile.local
cd ..
# parallel make does not work
make
}

_build_medm() {
_curl_untar https://github.com/epics-extensions/medm/archive/refs/tags/"$_medm_version".tar.gz "medm-$_medm_version" medm
perl -pi -e 's/^(?=USR_INCLUDES|SHARED_LIBRARIES|USR_LIBS)/#/' printUtils/Makefile
perl -pi -e 's/^(?=SHARED_LIBRARIES|USR_LIBS_DEFAULT)/#/; /USR_LIBS_DEFAULT/ && ($_ .= "USR_LDFLAGS_Linux = -lXm -lXt -lXmu -lXext -lX11\n")' xc/Makefile
perl -pi -e 's/^#(?=SCIPLOT)//; s/^(?=USR_LIBS)/#/; /USR_LIBS_DEFAULT/ && ($_ .= "USR_LDFLAGS_Linux = -lXm -lXt -lXp -lXmu -lXext -lX11\n")' medm/Makefile
grep USR_LDFLAGS_Linux medm/Makefile
grep USR_LDFLAGS_Linux xc/Makefile
# Not sure if parallel make works
make -j 4
cd - >& /dev/null
}

_build_synapps() {
declare d=synApps
# Must be absolute or fails silently
declare f=$PWD/$d.modules
cat <<'EOF' > "$f"
AREA_DETECTOR=R3-12-1
AUTOSAVE=R5-11
BUSY=R1-7-4
CALC=R3-7-5
DEVIOCSTATS=3.1.16
SNCSEQ=R2-2-9
SSCAN=R2-11-6
EOF
curl -s -S -L https://github.com/EPICS-synApps/assemble_synApps/releases/download/"$_synapps_version"/assemble_synApps \
| perl - --base="$EPICS_BASE" --dir="$d" --config="$f"
rm "$f"
cd "$d"/support
# otherwise gets a version conflict; This is the version that's installed already
# synApps does not install ASYN.
perl -pi -e 's/asyn-.*/asyn-4-42/' busy-R1-7-4/configure/RELEASE
make -j 4
cd - >& /dev/null
}

_err() {
_msg "$@"
return 1
}

_err_epics_base() {
_err 'update your ~/.post_bivio_bashrc
export EPICS_BASE=$HOME/.local/epics
# $EPICS_BASE/startup/EpicsHostArch outputs linux-x86_64; no need to be dynamic here
export EPICS_HOST_ARCH=linux-x86_64
bivio_path_insert "$EPICS_BASE/bin/$EPICS_HOST_ARCH"
# EPICS_PVA list needs to be dynamic or will not find
export EPICS_CA_AUTO_ADDR_LIST=$EPICS_PVA_AUTO_ADDR_LIST
export EPICS_CA_ADDR_LIST=$EPICS_PVA_ADDR_LIST
export EPICS_PCAS_ROOT=$EPICS_BASE
f=$EPICS_BASE/extensions/synApps/support/areaDetector-R3-12-1
export EPICS_DISPLAY_PATH=.:$f/ADSimDetector/simDetectorApp/op/adl:$f/ADCore/ADApp/op/adl:$f/ADUVC/uvcApp/op/adl:$EPICS_BASE/modules/asyn/asyn-R4-45/opi/medm
and then:
source ~/.post_bivio_bashrc
EpicsHostArch will not be found
'
}

_log() {
_msg $(date +%H%M%S) "$@"
}

_main() {
if [[ ! ${EPICS_BASE:-} ]]; then
_err_epics_base
fi
if [[ -d $EPICS_BASE ]]; then
_err "please remove:
rm -rf '$EPICS_BASE'
"
fi
_source_bashrc
bivio_path_remove "$EPICS_BASE"/bin
_build_base_and_asyn
# Add epics to the path
_source_bashrc
cd "$EPICS_BASE"
mkdir -p extensions
cd extensions
_build_medm
_build_synapps
_msg_run
}

_msg() {
echo "$*" 1>&2
}

_msg_run() {
_msg 'Run:
cd "$EPICS_BASE"/extensions/synApps/support/areaDetector-R3-12-1/ADSimDetector/iocs/simDetectorIOC/iocBoot/iocSimDetector
# In one window
../../bin/linux-x86_64/simDetectorApp st.cmd
# In another
medm -x -macro "P=13SIM1:, R=cam1:" ../../../../simDetectorApp/op/adl/simDetector.adl
# expect "Connected" in green in upper box; if blank boxes then it did not connnect
# In a third
caget 13SIM1:cam1:Dimensions
# ouptut: 13SIM1:cam1:Dimensions 10 0 0 0 0 0 0 0 0 0 0
'
}

_source_bashrc() {
set +eou pipefail
shopt -u nullglob
source $HOME/.bashrc
set -eou pipefail
shopt -s nullglob
}

_main "$@"
76 changes: 76 additions & 0 deletions etc/epics-install.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
dnf install re2c

get epics-base/epics-base from github (7.0 branch)
git submodule update --init --recursive

in epics-base/epics-base/modules
git clone https://github.com/epics-modules/asyn.git
echo "SUBMODULES += asyn" > Makefile.local
update asyn/configure/CONFIG_SITE
TIRPC=YES

in epics-base
make

in epics-base/extensions (new dir)
git clone https://github.com/epics-extensions/medm.git
edit medm/Makefile
SCIPLOT = YES
#USR_LIBS_Linux = Xm Xt Xp Xmu X11 Xext
USR_LDFLAGS_Linux = -lXm -lXt -lXp -lXmu -lXext -lX11
edit printUtils/Makefile
#USR_INCLUDES = -I$(X11_INC)
make

in /home/vagrant/src/EPICS-synApps/support
# probably not needed for areadetector
# edit motorApp/MotorSrc/motordrvCom.h and add:
# #include <shareLib.h>
edit assemble_synApps.sh
EPICS_BASE=/home/vagrant/src/epics-base/epics-base
edit configure/RELEASE
EPICS_BASE=/home/vagrant/src/epics-base/epics-base
SUPPORT=/home/vagrant/src/EPICS-synApps/support/synApps/support
bash assemble_synApps.sh

in /home/vagrant/src/EPICS-synApps/support/synApps/support/areaDetector-R3-11
make

Update sim detector
in /home/vagrant/src/EPICS-synApps/support/synApps/support/areaDetector-R3-11/ADSimDetector/iocs/simDetectorIOC/iocBoot/iocSimDetector
st.cmd.linux: (replace file contents)
#!../../bin/linux-x86_64/simDetectorApp
< ./envPaths
< ./st_base.cmd
st_base.cmd: (add lines after set_requestfile_path)
NDPvaConfigure("PVA1", $(QSIZE), 0, "$(PORT)", 0, $(PREFIX)Pva1:Image, 0, 0, 0)
dbLoadRecords("NDPva.template", "P=$(PREFIX),R=Pva1:, PORT=PVA1,ADDR=0,TIMEOUT=1,NDARRAY_PORT=$(PORT)")
# Must start PVA server if this is enabled
startPVAServer
chmod +x st.cmd.linux


And in my .post_bivio_bash_rc:

# EPICS
export EPICS_BASE="/home/vagrant/src/epics-base/epics-base/"
export EPICS_HOST_ARCH=$(${EPICS_BASE}/startup/EpicsHostArch)
export PATH=${EPICS_BASE}/bin/${EPICS_HOST_ARCH}:${PATH}
export EPICS_PCAS_ROOT=${EPICS_BASE}
export EPICS_DISPLAY_PATH=.:/home/vagrant/src/EPICS-synApps/support/synApps/support/areaDetector-R3-11/ADSimDetector/simDetectorApp/op/adl:/home/vagrant/src/EPICS-synApps/support/synApps/support/areaDetector-R3-11/ADCore/ADApp/op/adl:/home/vagrant/src/EPICS-synApps/support/synApps/support/areaDetector-R3-11/ADUVC/uvcApp/op/adl:/home/vagrant/src/EPICS-synApps/support/synApps/support/asyn-R4-42/opi/medm

#export EPICS_PVA_AUTO_ADDR_LIST=NO
#export EPICS_PVA_ADDR_LIST=10.0.2.15

#export EPICS_CA_AUTO_ADDR_LIST=NO
#export EPICS_CA_ADDR_LIST=10.0.2.15

# [py3;@v iocSimDetector]$ ./st.cmd.linux
# medm -x -macro "P=13SIM1:, R=cam1:" ../../../../simDetectorApp/op/adl/simDetector.adl

# 13SIM1:cam1:Dimensions
# P=13SIM1: R=cam1

# caget XF:10IDC-BI{UVC-Cam:1}cam1:Dimensions
# XF:10IDC-BI{UVC-Cam:1}cam1:Dimensions
# P=XF:10IDC-BI{UVC-Cam:1}, cam=cam1
16 changes: 16 additions & 0 deletions ui/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Editor configuration, see https://editorconfig.org
root = true

[*]
charset = utf-8
indent_style = space
indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true

[*.ts]
quote_type = single

[*.md]
max_line_length = off
trim_trailing_whitespace = false
44 changes: 44 additions & 0 deletions ui/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# See http://help.github.com/ignore-files/ for more about ignoring files.

# Compiled output
/dist
/tmp
/out-tsc
/bazel-out

# Node
/node_modules
npm-debug.log
yarn-error.log

# IDEs and editors
.idea/
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace

# Visual Studio Code
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
.history/*

# Miscellaneous
/.angular/cache
.sass-cache/
/connect.lock
/coverage
/libpeerconnection.log
testem.log
/typings

# System files
.DS_Store
Thumbs.db

package-lock.json
31 changes: 31 additions & 0 deletions ui/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Screen

This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 16.2.16.

## First time

npm install

## Development server

Run `ng serve --port 8080` for a dev server. Navigate to `http://localhost:8080/`. The application will automatically reload if you change any of the source files.

## Code scaffolding

Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`.

## Build

Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory.

## Running unit tests

Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io).

## Running end-to-end tests

Run `ng e2e` to execute the end-to-end tests via a platform of your choice. To use this command, you need to first add a package that implements end-to-end testing capabilities.

## Further help

To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page.
Loading

0 comments on commit 5a7a79f

Please sign in to comment.