diff --git a/README.md b/README.md index da2c7ed..9db5ed6 100644 --- a/README.md +++ b/README.md @@ -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. -### 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: - `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 - `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.` + +### 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. \ No newline at end of file diff --git a/src/sinqAxis.cpp b/src/sinqAxis.cpp index d480773..3b4310d 100644 --- a/src/sinqAxis.cpp +++ b/src/sinqAxis.cpp @@ -61,8 +61,7 @@ asynStatus setAxisParam(sinqAxis *axis, const char *indexName, template <> asynStatus getAxisParam(sinqAxis *axis, const char *indexName, int (sinqController::*func)(), int *readValue, - const char *callerFunctionName, int lineNumber, - int maxChars) { + const char *callerFunctionName, int lineNumber) { int indexValue = (axis->pController()->*func)(); asynStatus status = axis->pController()->getIntegerParam( axis->axisNo(), indexValue, readValue); @@ -76,18 +75,16 @@ asynStatus getAxisParam(sinqAxis *axis, const char *indexName, template <> asynStatus getAxisParam(sinqAxis *axis, const char *indexName, int (sinqController::*func)(), bool *readValue, - const char *callerFunctionName, int lineNumber, - int maxChars) { + const char *callerFunctionName, int lineNumber) { return getAxisParam(axis, indexName, func, (int *)readValue, callerFunctionName, lineNumber); } template <> -asynStatus getAxisParam(sinqAxis *axis, const char *indexName, - int (sinqController::*func)(), - double *readValue, - const char *callerFunctionName, int lineNumber, - int maxChars) { +asynStatus +getAxisParam(sinqAxis *axis, const char *indexName, + int (sinqController::*func)(), double *readValue, + const char *callerFunctionName, int lineNumber) { int indexValue = (axis->pController()->*func)(); asynStatus status = axis->pController()->getDoubleParam( axis->axisNo(), indexValue, readValue); @@ -101,8 +98,10 @@ asynStatus getAxisParam(sinqAxis *axis, const char *indexName, template <> asynStatus getAxisParam(sinqAxis *axis, const char *indexName, int (sinqController::*func)(), char *readValue, - const char *callerFunctionName, int lineNumber, - int maxChars) { + const char *callerFunctionName, int lineNumber) { + + int maxChars = 190; + int indexValue = (axis->pController()->*func)(); asynStatus status = axis->pController()->getStringParam( axis->axisNo(), indexValue, maxChars, readValue); @@ -114,11 +113,10 @@ asynStatus getAxisParam(sinqAxis *axis, const char *indexName, } template <> -asynStatus getAxisParam(sinqAxis *axis, const char *indexName, - int (sinqController::*func)(), - std::string *readValue, - const char *callerFunctionName, - int lineNumber, int maxChars) { +asynStatus +getAxisParam(sinqAxis *axis, const char *indexName, + int (sinqController::*func)(), std::string *readValue, + const char *callerFunctionName, int lineNumber) { int indexValue = (axis->pController()->*func)(); // Convert the pointer to a reference, since getStringParam expects the diff --git a/src/sinqAxis.h b/src/sinqAxis.h index cfce4c0..b13d72c 100644 --- a/src/sinqAxis.h +++ b/src/sinqAxis.h @@ -474,8 +474,7 @@ asynStatus setAxisParam(sinqAxis *axis, const char *indexName, template asynStatus getAxisParam(sinqAxis *axis, const char *indexName, int (sinqController::*func)(), T *readValue, - const char *callerFunctionName, int lineNumber, - int maxChars = 0); + const char *callerFunctionName, int lineNumber); /** * @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( \ axis, #indexGetterFunction, \ &std::remove_pointer< \ decltype(axis->pController())>::type::indexGetterFunction, \ - readValue, __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__); \ + readValue, __PRETTY_FUNCTION__, __LINE__); \ if (getStatus != asynSuccess) { \ return getStatus; \ } \