Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 308747b747 | |||
| 3339f5a3a3 | |||
| 683fa2138f | |||
| 354e9d90fb | |||
| deea821e3f |
@@ -0,0 +1,21 @@
|
||||
name: Test And Build
|
||||
on: [push]
|
||||
|
||||
jobs:
|
||||
Lint:
|
||||
runs-on: linepics
|
||||
steps:
|
||||
- name: checkout repo
|
||||
uses: actions/checkout@v4
|
||||
- name: cppcheck
|
||||
run: cppcheck --std=c++17 --addon=cert --addon=misc --error-exitcode=1 sinqEPICSApp/src/*.cpp
|
||||
- name: formatting
|
||||
run: clang-format --style=file --Werror --dry-run sinqEPICSApp/src/*.cpp sinqEPICSApp/src/*.c sinqEPICSApp/src/*.h
|
||||
Build:
|
||||
runs-on: linepics
|
||||
steps:
|
||||
- name: checkout repo
|
||||
uses: actions/checkout@v4
|
||||
- run: |
|
||||
sed -i 's/ARCH_FILTER=.*/ARCH_FILTER=linux%/' Makefile.RHEL8
|
||||
make -f Makefile.RHEL8 install
|
||||
@@ -1,51 +0,0 @@
|
||||
default:
|
||||
image: docker.psi.ch:5000/wall_e/sinqepics:latest
|
||||
|
||||
stages:
|
||||
- test
|
||||
- build
|
||||
|
||||
cppcheck:
|
||||
stage: test
|
||||
script:
|
||||
- cppcheck --std=c++17 --addon=cert --addon=misc --error-exitcode=1 sinqEPICSApp/
|
||||
allow_failure: true # Long term this needs to be removed
|
||||
artifacts:
|
||||
expire_in: 1 week
|
||||
tags:
|
||||
- docker
|
||||
|
||||
formatting:
|
||||
stage: test
|
||||
script:
|
||||
- clang-format --style=file --Werror --dry-run sinqEPICSApp/src/*.cpp sinqEPICSApp/src/*.c sinqEPICSApp/src/*.h
|
||||
allow_failure: true # Long term this needs to be removed
|
||||
artifacts:
|
||||
expire_in: 1 week
|
||||
tags:
|
||||
- docker
|
||||
|
||||
# clangtidy:
|
||||
# stage: test
|
||||
# script:
|
||||
# - curl https://docker.psi.ch:5000/v2/_catalog
|
||||
# # - dnf update -y
|
||||
# # - dnf install -y clang-tools-extra
|
||||
# # - clang-tidy sinqEPICSApp/src/*.cpp sinqEPICSApp/src/*.c sinqEPICSApp/src/*.h -checks=cppcoreguidelines-*,cert-*
|
||||
# # tags:
|
||||
# # - docker
|
||||
|
||||
build_module:
|
||||
stage: build
|
||||
script:
|
||||
- sed -i 's/ARCH_FILTER=.*/ARCH_FILTER=linux%/' Makefile.RHEL8
|
||||
- make -f Makefile.RHEL8 install
|
||||
- cp -rT "/ioc/modules/sinq/$(ls -U /ioc/modules/sinq/ | head -1)" "./sinq-${CI_COMMIT_SHORT_SHA}"
|
||||
artifacts:
|
||||
name: "sinq-${CI_COMMIT_SHORT_SHA}"
|
||||
paths:
|
||||
- "sinq-${CI_COMMIT_SHORT_SHA}/*"
|
||||
expire_in: 1 week
|
||||
when: always
|
||||
tags:
|
||||
- docker
|
||||
@@ -21,6 +21,9 @@ TEMPLATES += sinqEPICSApp/Db/el734.db
|
||||
# DBD files to include in the release
|
||||
DBDS += sinqEPICSApp/src/sinq.dbd
|
||||
|
||||
# Release version
|
||||
LIBVERSION=2026
|
||||
|
||||
# Source files to build
|
||||
SOURCES += sinqEPICSApp/src/devScalerEL737.c
|
||||
SOURCES += sinqEPICSApp/src/SINQController.cpp
|
||||
|
||||
@@ -505,7 +505,10 @@ asynStatus EL734Axis::poll(bool *moving)
|
||||
// errlogPrintf("Axis %d, reply %s, msr %d, oredmsr = %d, position = %lf\n",
|
||||
// axisNo_, reply, msr, oredMSR, position);
|
||||
|
||||
oredMSR |= msr;
|
||||
// Reset the error during each poll. This is necessary because some errors
|
||||
// apparently don't get cleared by the controller (especially "lower / higher
|
||||
// limit hit").
|
||||
oredMSR = msr;
|
||||
if ((msr & 0x1) == 0)
|
||||
{
|
||||
// done: check for trouble
|
||||
|
||||
@@ -250,6 +250,8 @@ PhytronAxis::PhytronAxis(PhytronController *pC, int axisNo, int enc)
|
||||
haveBrake = 0;
|
||||
brakeIO = -1;
|
||||
next_poll = -1;
|
||||
homing = 0;
|
||||
homing_direction = 0;
|
||||
}
|
||||
|
||||
int PhytronAxis::setBrake(int brakeNO)
|
||||
|
||||
Executable
+162
@@ -0,0 +1,162 @@
|
||||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
IFS=$'\n\t'
|
||||
|
||||
################################################################################
|
||||
# This converts the hex form of a wireshark analysis follow to something
|
||||
# more human readable.
|
||||
#
|
||||
# It is only partially implemented!
|
||||
################################################################################
|
||||
|
||||
f_name="${1}"
|
||||
|
||||
if [ "$#" -eq 2 ]; then
|
||||
filt="${2}"
|
||||
fi
|
||||
|
||||
|
||||
declare -A POSITION_MODE
|
||||
POSITION_MODE[1]="RELATIVE"
|
||||
POSITION_MODE[2]="ABSOLUTE"
|
||||
POSITION_MODE[3]="INTERNAL_REFERANCE"
|
||||
POSITION_MODE[4]="EXTERNAL_REFERANCE"
|
||||
|
||||
|
||||
declare -A COMMANDS
|
||||
|
||||
function to_ord() {
|
||||
printf "%x" "'$1"
|
||||
}
|
||||
|
||||
function add_char() {
|
||||
COMMANDS["$(to_ord "$1")"]="$2"
|
||||
}
|
||||
|
||||
function add_ord() {
|
||||
COMMANDS["$1"]="$2"
|
||||
}
|
||||
|
||||
add_char A Start_Movement
|
||||
add_char C Get_Position
|
||||
add_char D Set_Position_And_Clear_Error
|
||||
add_char d Set_Direction
|
||||
add_char p Set_Position_Mode
|
||||
add_char '$' Get_Status
|
||||
add_char 0 0
|
||||
add_char 1 1
|
||||
add_char 2 2
|
||||
add_char 3 3
|
||||
add_char 4 4
|
||||
add_char 5 5
|
||||
add_char 6 6
|
||||
add_char 7 7
|
||||
add_char 8 8
|
||||
add_char 9 9
|
||||
add_char '#' '#'
|
||||
add_ord 00 ''
|
||||
add_ord 0d '' # '\r'
|
||||
add_ord 2b '+'
|
||||
add_ord 2d '-'
|
||||
|
||||
while read -r line; do
|
||||
fields="$( echo "${line}" | sed -e 's/^ *//' -e 's/ /:/' -e 's/ /:/' | tr -s ' ' )"
|
||||
IFS=' ' bytes=($( echo "${fields}" | cut -d':' -f2))
|
||||
string="$( echo "${fields}" | cut -d':' -f3)"
|
||||
|
||||
parsing_number=-1
|
||||
num_len=0
|
||||
is_negative=0
|
||||
human_readable=()
|
||||
for byte in "${bytes[@]}"; do
|
||||
if [[ -v COMMANDS["${byte}"] ]]; then
|
||||
|
||||
if [[ "${COMMANDS["${byte}"]}" == Get_Status ]] || [[ "${COMMANDS["${byte}"]}" == Get_Position ]] || [[ "${COMMANDS["${byte}"]}" == Set_Position_Mode ]] || [[ "${COMMANDS["${byte}"]}" == Set_Position_And_Clear_Error ]]; then
|
||||
parsing_number=0
|
||||
numlen=0
|
||||
is_negative=0
|
||||
elif [[ "${parsing_number}" -ge 0 ]] && ( [[ "${byte}" == 00 ]] || [[ "${byte}" == 0d ]] ); then
|
||||
if [[ "${num_len}" -ge 1 ]]; then
|
||||
|
||||
if [[ "${human_readable[${#human_readable[@]}-1]}" == Get_Status ]]; then
|
||||
if [[ "$(( parsing_number & 2#0001 ))" -eq 1 ]]; then
|
||||
human_readable=("${human_readable[@]}" "READY")
|
||||
fi
|
||||
|
||||
if [[ "$(( parsing_number & 2#0010 ))" -eq 1 ]]; then
|
||||
human_readable=("${human_readable[@]}" "ZERO-POS_REACHED")
|
||||
fi
|
||||
|
||||
if [[ "$(( parsing_number & 2#0100 ))" -eq 1 ]]; then
|
||||
human_readable=("${human_readable[@]}" "POSITIONING_ERROR")
|
||||
fi
|
||||
|
||||
if [[ "$(( parsing_number & 2#1000 ))" -eq 1 ]]; then
|
||||
human_readable=("${human_readable[@]}" "SOMETHING?")
|
||||
fi
|
||||
|
||||
elif [[ "${human_readable[${#human_readable[@]}-1]}" == Set_Position_Mode ]]; then
|
||||
human_readable=("${human_readable[@]}" "${POSITION_MODE[${parsing_number}]}")
|
||||
|
||||
else
|
||||
if [[ "${is_negative}" -eq 1 ]]; then
|
||||
human_readable=("${human_readable[@]}" "$(( parsing_number * -1))")
|
||||
else
|
||||
human_readable=("${human_readable[@]}" "${parsing_number}")
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
parsing_number=-1
|
||||
continue
|
||||
elif [ "${parsing_number}" -ge 0 ]; then
|
||||
if [[ "${COMMANDS["${byte}"]}" == '-' ]]; then
|
||||
is_negative=1
|
||||
elif [[ "${COMMANDS["${byte}"]}" == '+' ]]; then
|
||||
is_negative=0
|
||||
else
|
||||
parsing_number="$(( parsing_number * 10 + "${COMMANDS["${byte}"]}" ))"
|
||||
fi
|
||||
|
||||
num_len=$(( num_len + 1 ))
|
||||
continue
|
||||
fi
|
||||
|
||||
if [ "${#human_readable[@]}" -gt 0 ]; then
|
||||
human_readable=("${human_readable[@]}" "${COMMANDS["${byte}"]}")
|
||||
else
|
||||
human_readable=("${COMMANDS["${byte}"]}")
|
||||
fi
|
||||
else
|
||||
if [ "${#human_readable[@]}" -gt 0 ]; then
|
||||
human_readable=("${human_readable[@]}" "${byte}(unknown)")
|
||||
else
|
||||
human_readable=("${byte}(unknown)")
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
if [[ "${human_readable[0]}" == '#' ]]; then
|
||||
if [[ -z "${filt+x}" ]]; then
|
||||
echo "Sent: ${human_readable[@]}"
|
||||
else
|
||||
if [[ "${human_readable[1]}" == "${filt}" ]]; then
|
||||
echo "Sent: ${human_readable[@]}"
|
||||
fi
|
||||
fi
|
||||
else
|
||||
# Some commands prefix the response with two 0's (I assume there can be
|
||||
# more axes)
|
||||
if [[ "${human_readable[0]}" == 0 ]] && [[ "${human_readable[1]}" == 0 ]]; then
|
||||
IFS=' ' human_readable=("${human_readable[@]:2}")
|
||||
fi
|
||||
|
||||
if [[ -z "${filt+x}" ]]; then
|
||||
echo "Received: ${human_readable[@]}"
|
||||
else
|
||||
if [[ "${human_readable[0]}" == "${filt}" ]]; then
|
||||
echo "Received: ${human_readable[@]}"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
done < "${f_name}"
|
||||
Reference in New Issue
Block a user