Addes instructions how to use sinqMotor as static dependency.

This commit is contained in:
2025-05-12 16:41:33 +02:00
parent 4d1c21fd74
commit 9792697d03
3 changed files with 51 additions and 22 deletions

View File

@ -260,7 +260,7 @@ The versioning is done via git tags. Git tags are recognized by the PSI build sy
All existing tags can be listed with `git tag` in the sinqMotor directory. Detailed information (author, data, commit number, commit message) regarding a specific tag can be shown with `git show x.x.x`, where `x.x.x` is the name of your version. To create a new tag, use `git tag x.x.x`. If the tag `x.x.x` is already used by another commit, git will show a corresponding error. All existing tags can be listed with `git tag` in the sinqMotor directory. Detailed information (author, data, commit number, commit message) regarding a specific tag can be shown with `git show x.x.x`, where `x.x.x` is the name of your version. To create a new tag, use `git tag x.x.x`. If the tag `x.x.x` is already used by another commit, git will show a corresponding error.
### How to build it ### Dependencies
This library is based on the PSI version of the EPICS motor record, which can be found here: `https://git.psi.ch/epics_driver_modules/motorBase`. We use a branch with a bugfix which is currently not merged into master due to resistance of the PSI userbase: `https://git.psi.ch/epics_driver_modules/motorBase/-/tree/pick_fix-lockup-VAL-HOMF-VAL`. This library can be build with the following steps, assuming GCC and make are available: This library is based on the PSI version of the EPICS motor record, which can be found here: `https://git.psi.ch/epics_driver_modules/motorBase`. We use a branch with a bugfix which is currently not merged into master due to resistance of the PSI userbase: `https://git.psi.ch/epics_driver_modules/motorBase/-/tree/pick_fix-lockup-VAL-HOMF-VAL`. This library can be build with the following steps, assuming GCC and make are available:
- `git clone https://git.psi.ch/epics_driver_modules/motorBase/-/tree/pick_fix-lockup-VAL-HOMF-VAL` - `git clone https://git.psi.ch/epics_driver_modules/motorBase/-/tree/pick_fix-lockup-VAL-HOMF-VAL`
@ -268,6 +268,26 @@ This library is based on the PSI version of the EPICS motor record, which can be
- `git tag 7.2.2`. The latest version on master is currently 7.2.1, hence we increment the bugfix version counter by one - `git tag 7.2.2`. The latest version on master is currently 7.2.1, hence we increment the bugfix version counter by one
- `make install` - `make install`
To build sinqMotor itself, the makefile in the top directory includes all necessary steps for compiling a shared library together with the header files into `/ioc/modules` (using the PSI EPICS build system). Therefore it is sufficient to clone this repository to a suitable location (`git clone https://git.psi.ch/sinq-epics-modules/sinqmotor/-/tree/main`). Afterwards, switch to the directory (`cd sinqmotor`) and run `make install`. ### Usage as dynamic dependency
The makefile in the top directory includes all necessary steps for compiling a shared library of sinqMotor together with the header files into `/ioc/modules` (using the PSI EPICS build system). Therefore it is sufficient to clone this repository to a suitable location (`git clone https://git.psi.ch/sinq-epics-modules/sinqmotor/-/tree/main`). Afterwards, switch to the directory (`cd sinqmotor`) and run `make install`.
To use the library when writing a concrete motor driver, include it in the makefile of your application / library the same way as other libraries such as e.g. `asynMotor` by adding `REQUIRED+=sinqMotor` to your Makefile. The version can be specified with `sinqMotor_VERSION=x.x.x.` To use the library when writing a concrete motor driver, include it in the makefile of your application / library the same way as other libraries such as e.g. `asynMotor` by adding `REQUIRED+=sinqMotor` to your Makefile. The version can be specified with `sinqMotor_VERSION=x.x.x.`
### Usage as static dependency
This repository is included as a git submodule in some of the driver repositories depending upon sinqMotor. When installing via a Makefile (`make install`) using the PSI build system, the following git command is executed within `/ioc/tools/driver.makefile`:
`git submodule update --init --recursive`
This forces each submodule to be checked out at the latest commit hash stored in the remote repository. However, this is usually unwanted behaviour, since the higher-level drivers are usually designed to be compiled against a specific version of sinqMotor. In order to set the submodule to a specific version, the following steps need to be done BEFORE calling `make install`:
- `cd sinqMotor`
- `git checkout 0.1`
- `cd ..`
Then, the fixation of the version to 0.1 needs to be committed in the parent repository:
- `git commit -m "Update sinqMotor to 0.1"`
After this commit, running `make install` will use the correct driver version for compilation.

View File

@ -61,8 +61,7 @@ asynStatus setAxisParam<const char *>(sinqAxis *axis, const char *indexName,
template <> template <>
asynStatus getAxisParam<int>(sinqAxis *axis, const char *indexName, asynStatus getAxisParam<int>(sinqAxis *axis, const char *indexName,
int (sinqController::*func)(), int *readValue, int (sinqController::*func)(), int *readValue,
const char *callerFunctionName, int lineNumber, const char *callerFunctionName, int lineNumber) {
int maxChars) {
int indexValue = (axis->pController()->*func)(); int indexValue = (axis->pController()->*func)();
asynStatus status = axis->pController()->getIntegerParam( asynStatus status = axis->pController()->getIntegerParam(
axis->axisNo(), indexValue, readValue); axis->axisNo(), indexValue, readValue);
@ -76,18 +75,16 @@ asynStatus getAxisParam<int>(sinqAxis *axis, const char *indexName,
template <> template <>
asynStatus getAxisParam<bool>(sinqAxis *axis, const char *indexName, asynStatus getAxisParam<bool>(sinqAxis *axis, const char *indexName,
int (sinqController::*func)(), bool *readValue, int (sinqController::*func)(), bool *readValue,
const char *callerFunctionName, int lineNumber, const char *callerFunctionName, int lineNumber) {
int maxChars) {
return getAxisParam(axis, indexName, func, (int *)readValue, return getAxisParam(axis, indexName, func, (int *)readValue,
callerFunctionName, lineNumber); callerFunctionName, lineNumber);
} }
template <> template <>
asynStatus getAxisParam<double>(sinqAxis *axis, const char *indexName, asynStatus
int (sinqController::*func)(), getAxisParam<double>(sinqAxis *axis, const char *indexName,
double *readValue, int (sinqController::*func)(), double *readValue,
const char *callerFunctionName, int lineNumber, const char *callerFunctionName, int lineNumber) {
int maxChars) {
int indexValue = (axis->pController()->*func)(); int indexValue = (axis->pController()->*func)();
asynStatus status = axis->pController()->getDoubleParam( asynStatus status = axis->pController()->getDoubleParam(
axis->axisNo(), indexValue, readValue); axis->axisNo(), indexValue, readValue);
@ -101,8 +98,10 @@ asynStatus getAxisParam<double>(sinqAxis *axis, const char *indexName,
template <> template <>
asynStatus getAxisParam<char>(sinqAxis *axis, const char *indexName, asynStatus getAxisParam<char>(sinqAxis *axis, const char *indexName,
int (sinqController::*func)(), char *readValue, int (sinqController::*func)(), char *readValue,
const char *callerFunctionName, int lineNumber, const char *callerFunctionName, int lineNumber) {
int maxChars) {
int maxChars = 190;
int indexValue = (axis->pController()->*func)(); int indexValue = (axis->pController()->*func)();
asynStatus status = axis->pController()->getStringParam( asynStatus status = axis->pController()->getStringParam(
axis->axisNo(), indexValue, maxChars, readValue); axis->axisNo(), indexValue, maxChars, readValue);
@ -114,11 +113,10 @@ asynStatus getAxisParam<char>(sinqAxis *axis, const char *indexName,
} }
template <> template <>
asynStatus getAxisParam<std::string>(sinqAxis *axis, const char *indexName, asynStatus
int (sinqController::*func)(), getAxisParam<std::string>(sinqAxis *axis, const char *indexName,
std::string *readValue, int (sinqController::*func)(), std::string *readValue,
const char *callerFunctionName, const char *callerFunctionName, int lineNumber) {
int lineNumber, int maxChars) {
int indexValue = (axis->pController()->*func)(); int indexValue = (axis->pController()->*func)();
// Convert the pointer to a reference, since getStringParam expects the // Convert the pointer to a reference, since getStringParam expects the

View File

@ -474,8 +474,7 @@ asynStatus setAxisParam(sinqAxis *axis, const char *indexName,
template <typename T> template <typename T>
asynStatus getAxisParam(sinqAxis *axis, const char *indexName, asynStatus getAxisParam(sinqAxis *axis, const char *indexName,
int (sinqController::*func)(), T *readValue, int (sinqController::*func)(), T *readValue,
const char *callerFunctionName, int lineNumber, const char *callerFunctionName, int lineNumber);
int maxChars = 0);
/** /**
* @brief Macro to get an paramLib parameter and error checking the return value * @brief Macro to get an paramLib parameter and error checking the return value
@ -523,13 +522,25 @@ asynStatus getAxisParam(sinqAxis *axis, const char *indexName,
* ``` * ```
* ============================================================================= * =============================================================================
*/ */
#define getAxisParamChecked(axis, indexGetterFunction, readValue, ...) \ // #define getAxisParamChecked(axis, indexGetterFunction, readValue, ...) \
// { \
// asynStatus getStatus = getAxisParam( \
// axis, #indexGetterFunction, \
// &std::remove_pointer< \
// decltype(axis->pController())>::type::indexGetterFunction, \
// readValue, __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__); \
// if (getStatus != asynSuccess) { \
// return getStatus; \
// } \
// }
#define getAxisParamChecked(axis, indexGetterFunction, readValue) \
{ \ { \
asynStatus getStatus = getAxisParam( \ asynStatus getStatus = getAxisParam( \
axis, #indexGetterFunction, \ axis, #indexGetterFunction, \
&std::remove_pointer< \ &std::remove_pointer< \
decltype(axis->pController())>::type::indexGetterFunction, \ decltype(axis->pController())>::type::indexGetterFunction, \
readValue, __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__); \ readValue, __PRETTY_FUNCTION__, __LINE__); \
if (getStatus != asynSuccess) { \ if (getStatus != asynSuccess) { \
return getStatus; \ return getStatus; \
} \ } \