Compare commits
24 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 902b18d038 | |||
| 0e10bcf69d | |||
| cb4adb068c | |||
| d7c9d009ee | |||
| 3ab40a8bf5 | |||
| 0478854007 | |||
| 9a32532c22 | |||
| cff64f5ecf | |||
| 7a0de4e9d9 | |||
| 566728c57c | |||
| 8689c79f19 | |||
| 7ed054d075 | |||
| 7965dd3b2e | |||
| c19e4845e4 | |||
| 4d27783062 | |||
| 5273feef6c | |||
| cccfc79860 | |||
| c65a8de5dd | |||
| 1910eda0b1 | |||
| 977016bdb4 | |||
| ed77125378 | |||
| 4a0c09bd7f | |||
| 1fe21ec192 | |||
| 2fd4851313 |
23
.gitea/workflows/action.yaml
Normal file
23
.gitea/workflows/action.yaml
Normal file
@@ -0,0 +1,23 @@
|
||||
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 src/*.cpp
|
||||
- name: formatting
|
||||
run: clang-format --style=file --Werror --dry-run src/*.cpp
|
||||
Build:
|
||||
runs-on: linepics
|
||||
steps:
|
||||
- name: checkout repo
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: 'true'
|
||||
- run: |
|
||||
sed -i 's/ARCH_FILTER=.*/ARCH_FILTER=linux%/' Makefile
|
||||
make install
|
||||
@@ -1,41 +0,0 @@
|
||||
default:
|
||||
image: docker.psi.ch:5000/sinqdev/sinqepics:latest
|
||||
|
||||
stages:
|
||||
- lint
|
||||
- build
|
||||
- test
|
||||
|
||||
cppcheck:
|
||||
stage: lint
|
||||
script:
|
||||
- cppcheck --std=c++17 --addon=cert --addon=misc --error-exitcode=1 src/*.cpp
|
||||
artifacts:
|
||||
expire_in: 1 week
|
||||
tags:
|
||||
- sinq
|
||||
|
||||
formatting:
|
||||
stage: lint
|
||||
script:
|
||||
- clang-format --style=file --Werror --dry-run src/*.cpp
|
||||
artifacts:
|
||||
expire_in: 1 week
|
||||
tags:
|
||||
- sinq
|
||||
|
||||
build_module:
|
||||
stage: build
|
||||
script:
|
||||
- sed -i 's/ARCH_FILTER=.*/ARCH_FILTER=linux%/' Makefile
|
||||
- echo "LIBVERSION=${CI_COMMIT_TAG:-0.0.1}" >> Makefile
|
||||
- make install
|
||||
- cp -rT "/ioc/modules/sinqMotor/$(ls -U /ioc/modules/sinqMotor/ | head -1)" "./sinqMotor-${CI_COMMIT_TAG:-$CI_COMMIT_SHORT_SHA}"
|
||||
artifacts:
|
||||
name: "sinqMotor-${CI_COMMIT_TAG:-$CI_COMMIT_SHORT_SHA}"
|
||||
paths:
|
||||
- "sinqMotor-${CI_COMMIT_TAG:-$CI_COMMIT_SHORT_SHA}/*"
|
||||
expire_in: 1 week
|
||||
when: always
|
||||
tags:
|
||||
- sinq
|
||||
3
Makefile
3
Makefile
@@ -26,6 +26,7 @@ TEMPLATES += db/sinqMotor.db
|
||||
# This file registers the motor-specific functions in the IOC shell.
|
||||
DBDS += src/sinqMotor.dbd
|
||||
|
||||
USR_CFLAGS += -Wall -Wextra -Weffc++ -Wunused-result # -Werror
|
||||
USR_CFLAGS += -Wall -Wextra -Wunused-result # -Werror
|
||||
USR_CXXFLAGS += -Wall -Wextra -Wunused-result
|
||||
|
||||
# MISCS would be the place to keep the stream device template files
|
||||
|
||||
75
README.md
75
README.md
@@ -62,30 +62,28 @@ To find out which version of sinqMotor is needed by a driver, refer to its Makef
|
||||
|
||||
### IOC startup script
|
||||
|
||||
An EPICS IOC for motor control at SINQ is started by executing a script with the IOC shell. In its simplest form, an IOC for two controllers is a file looking like this:
|
||||
An EPICS IOC for motor control at SINQ is started by executing a script with the IOC shell. In its simplest form, an IOC for two controllers run by "exampleDriver" is a file looking like this:
|
||||
```
|
||||
#!/usr/local/bin/iocsh
|
||||
|
||||
# Load libraries needed for the IOC
|
||||
require sinqMotor, 1.0.0
|
||||
require actualDriver, 1.2.0
|
||||
require exampleDriver, 1.0.0
|
||||
|
||||
# Define environment variables used later to parametrize the individual controllers
|
||||
epicsEnvSet("TOP","/ioc/sinq-ioc/sinqtest-ioc/")
|
||||
epicsEnvSet("INSTR","SQ:SINQTEST:")
|
||||
|
||||
# Include other scripts for the controllers 1 and 2
|
||||
< actualDriver.cmd
|
||||
< actualDriver.cmd
|
||||
< exampleDriver1.cmd
|
||||
< exampleDriver2.cmd
|
||||
|
||||
iocInit()
|
||||
```
|
||||
The first line is a so-called shebang which instructs Linux to execute the file with the executable located at the given path - the IOC shell in this case. The controller script "mcu1.cmd" looks like this:
|
||||
The script for controller 1 ("turboPmac1.cmd") for a Turbo PMAC (see https://git.psi.ch/sinq-epics-modules/turboPmac) has the following structure. The scripts for other controller types can be found in the README.md of their respective repositories.
|
||||
The first line is a so-called shebang which instructs Linux to execute the file with the executable located at the given path - the IOC shell in this case. The files `exampleDriver1.cmd` or `exampleDriver2` then look like this:
|
||||
|
||||
```
|
||||
# Define the name of the controller and the corresponding port
|
||||
epicsEnvSet("DRIVER_PORT","actualDriver1")
|
||||
epicsEnvSet("DRIVER_PORT","exampleDriver1")
|
||||
epicsEnvSet("IP_PORT","p$(DRIVER_PORT)")
|
||||
|
||||
# Create the TCP/IP socket used to talk with the controller. The socket can be adressed from within the IOC shell via the port name
|
||||
@@ -116,17 +114,17 @@ setForcedFastPolls("$(DRIVER_PORT)", 10);
|
||||
setThresholdComTimeout("$(DRIVER_PORT)", 300, 10);
|
||||
|
||||
# Parametrize the EPICS record database with the substitution file named after the motor controller.
|
||||
epicsEnvSet("SINQDBPATH","$(sinqMotor_DB)/sinqMotor.db")
|
||||
epicsEnvSet("SINQDBPATH","$(exampleDriver_DB)/sinqMotor.db")
|
||||
dbLoadTemplate("$(TOP)/$(DRIVER_PORT).substitutions", "INSTR=$(INSTR)$(DRIVER_PORT):,CONTROLLER=$(DRIVER_PORT)")
|
||||
epicsEnvSet("SINQDBPATH","$(actualDriver_DB)/turboPmac.db")
|
||||
epicsEnvSet("SINQDBPATH","$(exampleDriver_DB)/turboPmac.db")
|
||||
dbLoadTemplate("$(TOP)/$(DRIVER_PORT).substitutions", "INSTR=$(INSTR)$(DRIVER_PORT):,CONTROLLER=$(DRIVER_PORT)")
|
||||
dbLoadRecords("$(sinqMotor_DB)/asynRecord.db","P=$(INSTR)$(DRIVER_PORT),PORT=$(IP_PORT)")
|
||||
dbLoadRecords("$(exampleDriver_DB)/asynRecord.db","P=$(INSTR)$(DRIVER_PORT),PORT=$(IP_PORT)")
|
||||
```
|
||||
|
||||
### Substitution file
|
||||
|
||||
The substitution file is a table containing axis-specific information which is used to create the axis-specific PVs.
|
||||
To work with sinqMotor, "mcu1.substitutions" needs to look like this (the order of columns does not matter):
|
||||
To work with sinqMotor, `exampleDriver1.substitutions` needs to look like this (the order of columns does not matter):
|
||||
```
|
||||
file "$(SINQDBPATH)"
|
||||
{
|
||||
@@ -206,9 +204,11 @@ transferred to (motor_record_pv_name).MRES or to
|
||||
|
||||
## Developer guide
|
||||
|
||||
### Base classes
|
||||
### File structure
|
||||
|
||||
sinqMotor offers a variety of additional methods for children classes to standardize certain patterns (e.g. writing messages to the IOC shell and the motor message PV). For a detailed description, please see the respective function documentation in the .h-files. All of these functions can be overwritten manually if e.g. a completely different implementation of `poll` is required. Some functions are marked as virtual, because they are called from other functions of sinqMotor and therefore need runtime polymorphism. Functions without that marker are not called anywhere in sinqMotor.
|
||||
sinqMotor offers a variety of additional methods for children classes to standardize certain patterns (e.g. writing messages to the IOC shell and the motor message PV). For a detailed description, please see the respective function documentation in the .h-files. All of these functions can be overwritten manually if e.g. a completely different implementation of `poll` is required. Some functions are marked as virtual, because they are called from other functions of sinqMotor and therefore need runtime polymorphism. Functions without that marker are not called anywhere in sinqMotor (except for `forcedPoll`, which is called in `poll`).
|
||||
|
||||
Adding new virtual methods breaks the ABI and therefore warrants a new major version number!
|
||||
|
||||
#### sinqController.h
|
||||
- `couldNotParseResponse`: Write a standardized message if parsing a device response failed.
|
||||
@@ -230,7 +230,15 @@ It calls `doReset` and performs some fast polls after `doReset` returns.
|
||||
- `doMove`: This is an empty function which should be overwritten by concrete driver implementations.
|
||||
- `home`: This function sets the internal status flags for the homing process and then calls doHome.
|
||||
- `doHome`: This is an empty function which should be overwritten by concrete driver implementations.
|
||||
- `poll`: This is a wrapper around `doPoll` which performs some bookkeeping tasks before and after calling `doPoll`:
|
||||
- `poll`: This is a wrapper around `forcedPoll` which does the following checks before calling `forcedPoll`:
|
||||
- Are there any outstanding fast polls (method `outstandingForcedFastPolls` of the controller returns a value greater zero)?
|
||||
- Was the axis moving last time its status was polled?
|
||||
- Is adaptive polling disabled?
|
||||
- Did an idle period pass since the last poll?
|
||||
If all of these conditions are false, no poll is performed. Otherwise, the `forcedPoll` method is called.
|
||||
This method should not be called in the driver code itself if a poll is needed - use `forcedPoll` instead!
|
||||
|
||||
- `forcedPoll`: This is a wrapper around `doPoll` which performs some bookkeeping tasks before and after calling `doPoll`:
|
||||
|
||||
Before calling `doPoll`:
|
||||
- Check if the paramLib already contains an old error message. If so, put it into a temporary bufffer
|
||||
@@ -249,12 +257,27 @@ It calls `doReset` and performs some fast polls after `doReset` returns.
|
||||
- `startMovTimeoutWatchdog`: Starts a watchdog for the movement time. This watchdog compares the actual time spent in a movement operation with an expected time, which is calculated based on the distance of the current and the target position.
|
||||
- `checkMovTimeoutWatchdog`: Check if the watchdog timed out.
|
||||
- `setWatchdogEnabled`: Enables / disables the watchdog. This function is also available in the IOC shell.
|
||||
- `setOffsetMovTimeout`: Set a linear offset for the expected movement time. This function is also available in the IOC shell.
|
||||
- `setOffsetMovTimeout`: Set a constant offset for the expected movement time. This function is also available in the IOC shell.
|
||||
- `setScaleMovTimeout`: Set a scaling factor for the expected movement time. This function is also available in the IOC shell.
|
||||
|
||||
#### msgPrintControl.h
|
||||
In addition to the two extension classes this library also includes a mechanism which prevents excessive repetitions of the same error message to the IOC shell via the classes `msgPrintControl` and `msgPrintControlKey`. A detailed description of the mechanism can be found in the docstring of `msgPrintControl`. The implementation of the `poll` function of `sinqAxis` also contains an example how to use it. Using this feature in derived drivers is entirely optional.
|
||||
|
||||
#### macros.h
|
||||
Contains macros used in `sinqMotor` and derived drivers:
|
||||
|
||||
- **HIDDEN**
|
||||
|
||||
By default, the symbols of classes and functions are hidden to avoid symbol clashes when loading
|
||||
multiple shared libraries which use `sinqMotor`. In order to compile this library with exported
|
||||
symbols, specifiy `-DHIDDEN= ` as a compiler flag (if using the given Makefile, this
|
||||
needs to be added to the `USR_CFLAGS`).
|
||||
|
||||
Derived libraries can use the same mechanism via the macro `HIDDEN` (defined in `macros.h`):
|
||||
```
|
||||
class HIDDEN turboPmacController : public sinqController
|
||||
```
|
||||
|
||||
### Versioning
|
||||
|
||||
The versioning is done via git tags. Git tags are recognized by the PSI build system: If you tag a version as 1.0, it will be built into the directory /ioc/modules/sinqMotor/1.0. The tag is directly coupled to a commit so that it is always clear which source code was used to build which binary.
|
||||
@@ -277,18 +300,28 @@ To use the library when writing a concrete motor driver, include it in the makef
|
||||
|
||||
### 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`:
|
||||
This repository is included as a git submodule in 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`
|
||||
- `git checkout 1.0`
|
||||
- `cd ..`
|
||||
|
||||
Then, the fixation of the version to 0.1 needs to be committed in the parent repository:
|
||||
Then, the fixation of the version to 1.0 needs to be committed in the parent repository:
|
||||
|
||||
- `git commit -m "Update sinqMotor to 0.1"`
|
||||
- `git commit -m "Update sinqMotor to 1.0"`
|
||||
|
||||
After this commit, running `make install` will use the correct driver version for compilation.
|
||||
After this commit, running `make install` will use the correct driver version for compilation.
|
||||
|
||||
If your driver uses another driver as a static dependency via git submodule which in turn includes a sinqMotor submodule, it is not necessary to specify the version of sinqMotor. Instead, specify the desired commit of the direct dependency, commit this change and then update all submodules:
|
||||
|
||||
- `cd turboPmac`
|
||||
- `git checkout 1.0`
|
||||
- `cd ..`
|
||||
- `git commit -m "Update turboPmac to 1.0"`
|
||||
- `git submodule update --init --recursive`
|
||||
|
||||
This will update sinqMotor to the version specified in the 1.0 commit of turboPmac.
|
||||
|
||||
@@ -41,6 +41,7 @@ record(motor,"$(INSTR)$(M)")
|
||||
field(PINI,"NO")
|
||||
field(DHLM, "$(DHLM=0)")
|
||||
field(DLLM, "$(DLLM=0)")
|
||||
field(SPDB, "$(SPDB=0)")
|
||||
field(TWV,"1")
|
||||
field(RTRY,"0")
|
||||
field(RDBD, "$(RDBD=10e300)") # Suppress retries and overshoot stop commands
|
||||
@@ -238,6 +239,27 @@ record(ao, "$(INSTR)$(M):PushDLLM2Field") {
|
||||
field(PINI, "NO")
|
||||
}
|
||||
|
||||
# This record pair reads the parameter library value for "motorPositionDeadband"
|
||||
# and pushes it to the motor record field "SPDP". This can be used to the position
|
||||
# deadband from the hardware
|
||||
# The implementation strategy is taken from https://epics.anl.gov/tech-talk/2022/msg00464.php.
|
||||
# This record is coupled to the parameter library via motorPositionDeadband -> MOTOR_POSITION_DEADBAND.
|
||||
record(ai, "$(INSTR)$(M):SPDB_RBV")
|
||||
{
|
||||
field(DTYP, "asynFloat64")
|
||||
field(VAL, "$(SPDP=0)")
|
||||
field(INP, "@asyn($(CONTROLLER),$(AXIS)) MOTOR_POSITION_DEADBAND")
|
||||
field(SCAN, "I/O Intr")
|
||||
field(FLNK, "$(INSTR)$(M):PushSPDB2Field")
|
||||
field(PINI, "NO")
|
||||
}
|
||||
record(ao, "$(INSTR)$(M):PushSPDB2Field") {
|
||||
field(DOL, "$(INSTR)$(M):SPDB_RBV NPP")
|
||||
field(OUT, "$(INSTR)$(M).SPDB")
|
||||
field(OMSL, "closed_loop")
|
||||
field(PINI, "NO")
|
||||
}
|
||||
|
||||
# This record pair reads the parameter library value for "motorVeloFromDriver_"
|
||||
# and pushes it to the motor record field "VELO". This can be used to read the speed value
|
||||
# from the hardware and correspondingly update the motor record from the driver.
|
||||
|
||||
22
src/macros.h
Normal file
22
src/macros.h
Normal file
@@ -0,0 +1,22 @@
|
||||
// Collection of macros used in sinqMotor and derived classes
|
||||
|
||||
#ifndef macros_H
|
||||
#define macros_H
|
||||
|
||||
/*
|
||||
The macro "HIDDEN" hides the symbol of the annotated class / function. This is
|
||||
useful to avoid symbol clashes when loading multiple shared libraries in a
|
||||
single IOC. To override the hiding, add `-DHIDDEN= ` to your compiler
|
||||
flags (in this case, the symbols will be exported with their default
|
||||
visibility).
|
||||
*/
|
||||
#ifndef HIDDEN
|
||||
#if defined(_WIN32) || defined(__CYGWIN__)
|
||||
#define HIDDEN
|
||||
#else
|
||||
#define HIDDEN __attribute__((visibility("hidden")))
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// macros_H
|
||||
#endif
|
||||
@@ -5,17 +5,13 @@
|
||||
|
||||
msgPrintControlKey::msgPrintControlKey(char *controller, int axisNo,
|
||||
const char *functionName, int line,
|
||||
size_t maxRepetitions) {
|
||||
controller_ = controller;
|
||||
axisNo_ = axisNo;
|
||||
line_ = line;
|
||||
functionName_ = functionName;
|
||||
maxRepetitions_ = maxRepetitions;
|
||||
}
|
||||
size_t maxRepetitions)
|
||||
: controller_(controller), axisNo_(axisNo), functionName_(functionName),
|
||||
line_(line), maxRepetitions_(maxRepetitions) {}
|
||||
|
||||
void msgPrintControlKey::format(char *buffer, size_t bufferSize) {
|
||||
snprintf(buffer, bufferSize, "controller %s, axis %d, function %s, line %d",
|
||||
controller_.c_str(), axisNo_, functionName_, line_);
|
||||
controller_.c_str(), axisNo_, functionName_.c_str(), line_);
|
||||
}
|
||||
|
||||
// =============================================================================
|
||||
@@ -78,8 +74,8 @@ bool msgPrintControl::shouldBePrinted(msgPrintControlKey &key, bool wantToPrint,
|
||||
pasynUser, ASYN_TRACE_ERROR,
|
||||
"Controller \"%s\", axis %d => %s, line %d\nError "
|
||||
"associated with key \"%s\" has been resolved.\n",
|
||||
key.controller_.c_str(), key.axisNo_, key.functionName_,
|
||||
key.line_, formattedKey);
|
||||
key.controller_.c_str(), key.axisNo_,
|
||||
key.functionName_.c_str(), key.line_, formattedKey);
|
||||
}
|
||||
map_[key] = 0;
|
||||
}
|
||||
@@ -92,8 +88,8 @@ bool msgPrintControl::shouldBePrinted(char *portName, int axisNo,
|
||||
const char *functionName, int line,
|
||||
bool wantToPrint, asynUser *pasynUser,
|
||||
size_t maxRepetitions) {
|
||||
msgPrintControlKey key =
|
||||
msgPrintControlKey(portName, axisNo, functionName, __LINE__);
|
||||
msgPrintControlKey key = msgPrintControlKey(portName, axisNo, functionName,
|
||||
line, maxRepetitions);
|
||||
return shouldBePrinted(key, wantToPrint, pasynUser);
|
||||
}
|
||||
|
||||
@@ -107,7 +103,7 @@ void msgPrintControl::resetCount(msgPrintControlKey &key, asynUser *pasynUser) {
|
||||
"Controller \"%s\", axis %d => %s, line %d\nError "
|
||||
"associated with key \"%s\" has been resolved.\n",
|
||||
key.controller_.c_str(), key.axisNo_,
|
||||
key.functionName_, key.line_, formattedKey);
|
||||
key.functionName_.c_str(), key.line_, formattedKey);
|
||||
}
|
||||
map_[key] = 0;
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#define DefaultMaxRepetitions 4
|
||||
|
||||
#include <asynDriver.h>
|
||||
#include <macros.h>
|
||||
#include <string.h>
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
@@ -15,14 +16,14 @@
|
||||
* `msgPrintControl` on how to use this key.
|
||||
*
|
||||
*/
|
||||
class msgPrintControlKey {
|
||||
class HIDDEN msgPrintControlKey {
|
||||
public:
|
||||
std::string controller_;
|
||||
|
||||
// -1 indicates a non-axis specific message
|
||||
int axisNo_;
|
||||
|
||||
const char *functionName_;
|
||||
std::string functionName_;
|
||||
int line_;
|
||||
|
||||
/**
|
||||
@@ -37,7 +38,7 @@ class msgPrintControlKey {
|
||||
|
||||
bool operator==(const msgPrintControlKey &other) const {
|
||||
return axisNo_ == other.axisNo_ && line_ == other.line_ &&
|
||||
strcmp(functionName_, other.functionName_) == 0 &&
|
||||
functionName_ == other.functionName_ &&
|
||||
controller_ == other.controller_;
|
||||
}
|
||||
|
||||
@@ -54,7 +55,7 @@ template <> struct hash<msgPrintControlKey> {
|
||||
// Combine the hashes of the members (x and y)
|
||||
size_t h1 = std::hash<std::string>{}(obj.controller_);
|
||||
size_t h2 = hash<int>{}(obj.axisNo_);
|
||||
size_t h3 = std::hash<const char *>{}(obj.functionName_);
|
||||
size_t h3 = std::hash<std::string>{}(obj.functionName_);
|
||||
size_t h4 = hash<int>{}(obj.line_);
|
||||
// Combine the hashes (simple XOR and shifting technique)
|
||||
return h1 ^ (h2 << 1) ^ (h3 << 2) ^ (h4 << 3);
|
||||
@@ -82,7 +83,7 @@ template <> struct hash<msgPrintControlKey> {
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
class msgPrintControl {
|
||||
class HIDDEN msgPrintControl {
|
||||
public:
|
||||
/**
|
||||
* @brief Destroy the msgPrintControl object
|
||||
|
||||
115
src/sinqAxis.cpp
115
src/sinqAxis.cpp
@@ -1,12 +1,20 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
|
||||
#include "sinqAxis.h"
|
||||
// The EPICS libaries do not follow -Weffc++
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Weffc++"
|
||||
|
||||
#include "epicsExport.h"
|
||||
#include "iocsh.h"
|
||||
#include "msgPrintControl.h"
|
||||
#include "sinqController.h"
|
||||
#include <epicsTime.h>
|
||||
#include <errlog.h>
|
||||
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
#include "sinqAxis.h"
|
||||
|
||||
#include "msgPrintControl.h"
|
||||
#include "sinqController.h"
|
||||
#include <math.h>
|
||||
#include <unistd.h>
|
||||
|
||||
@@ -171,14 +179,7 @@ sinqAxis::sinqAxis(class sinqController *pC, int axisNo)
|
||||
sinqAxis::~sinqAxis() = default;
|
||||
|
||||
asynStatus sinqAxis::poll(bool *moving) {
|
||||
|
||||
// Local variable declaration
|
||||
asynStatus pl_status = asynSuccess;
|
||||
asynStatus poll_status = asynSuccess;
|
||||
int homing = 0;
|
||||
int adaptivePolling = 0;
|
||||
char waitingMessage[pC_->MAXBUF_] = {0};
|
||||
char newMessage[pC_->MAXBUF_] = {0};
|
||||
|
||||
/*
|
||||
If adaptive polling is enabled:
|
||||
@@ -201,22 +202,33 @@ asynStatus sinqAxis::poll(bool *moving) {
|
||||
Check if both adaptive polling is enabled and no forced fast polls are still
|
||||
required.
|
||||
*/
|
||||
if (adaptivePolling != 0 && pC_->outstandingForcedFastPolls() == 0) {
|
||||
// Motor wasn't moving during the last poll
|
||||
if (!pSinqA_->wasMoving) {
|
||||
if (adaptivePolling != 0 && pC_->outstandingForcedFastPolls() == 0 &&
|
||||
!pSinqA_->wasMoving) {
|
||||
|
||||
// Add the idle poll period
|
||||
epicsTimeStamp earliestTimeNextPoll = pSinqA_->lastPollTime;
|
||||
epicsTimeAddSeconds(&earliestTimeNextPoll, pC_->idlePollPeriod());
|
||||
// Add the idle poll period
|
||||
epicsTimeStamp earliestTimeNextPoll = pSinqA_->lastPollTime;
|
||||
epicsTimeAddSeconds(&earliestTimeNextPoll, pC_->idlePollPeriod());
|
||||
|
||||
if (epicsTimeLessThanEqual(&earliestTimeNextPoll, &ts) == 0) {
|
||||
*moving = false;
|
||||
return asynSuccess;
|
||||
}
|
||||
if (epicsTimeLessThanEqual(&earliestTimeNextPoll, &ts) == 0) {
|
||||
*moving = false;
|
||||
return asynSuccess;
|
||||
}
|
||||
}
|
||||
return forcedPoll(moving);
|
||||
}
|
||||
|
||||
asynStatus sinqAxis::forcedPoll(bool *moving) {
|
||||
|
||||
// Local variable declaration
|
||||
asynStatus pl_status = asynSuccess;
|
||||
asynStatus poll_status = asynSuccess;
|
||||
int homing = 0;
|
||||
char waitingMessage[pC_->MAXBUF_] = {0};
|
||||
char newMessage[pC_->MAXBUF_] = {0};
|
||||
|
||||
// Update the start time of the last poll
|
||||
epicsTimeStamp ts;
|
||||
epicsTimeGetCurrent(&ts);
|
||||
pSinqA_->lastPollTime = ts;
|
||||
|
||||
/*
|
||||
@@ -279,9 +291,12 @@ asynStatus sinqAxis::poll(bool *moving) {
|
||||
pSinqA_->wasMoving = *moving;
|
||||
}
|
||||
|
||||
// Check and update the watchdog
|
||||
if (checkMovTimeoutWatchdog(*moving) != asynSuccess) {
|
||||
return asynError;
|
||||
// Check and update the watchdog as well as the general poll status IF the
|
||||
// poll did not fail already.
|
||||
if (poll_status == asynSuccess) {
|
||||
if (checkMovTimeoutWatchdog(*moving) != asynSuccess) {
|
||||
poll_status = asynError;
|
||||
}
|
||||
}
|
||||
|
||||
// According to the function documentation of asynMotorAxis::poll, this
|
||||
@@ -311,7 +326,12 @@ asynStatus sinqAxis::poll(bool *moving) {
|
||||
return poll_status;
|
||||
}
|
||||
|
||||
asynStatus sinqAxis::doPoll(bool *moving) { return asynSuccess; }
|
||||
asynStatus sinqAxis::doPoll(bool *moving) {
|
||||
// Suppress unused variable warning - this is just a default fallback
|
||||
// function.
|
||||
(void)moving;
|
||||
return asynSuccess;
|
||||
}
|
||||
|
||||
asynStatus sinqAxis::move(double position, int relative, double minVelocity,
|
||||
double maxVelocity, double acceleration) {
|
||||
@@ -349,6 +369,13 @@ asynStatus sinqAxis::move(double position, int relative, double minVelocity,
|
||||
|
||||
asynStatus sinqAxis::doMove(double position, int relative, double minVelocity,
|
||||
double maxVelocity, double acceleration) {
|
||||
// Suppress unused variable warning - this is just a default fallback
|
||||
// function.
|
||||
(void)position;
|
||||
(void)relative;
|
||||
(void)minVelocity;
|
||||
(void)maxVelocity;
|
||||
(void)acceleration;
|
||||
return asynSuccess;
|
||||
}
|
||||
|
||||
@@ -392,6 +419,12 @@ asynStatus sinqAxis::home(double minVelocity, double maxVelocity,
|
||||
|
||||
asynStatus sinqAxis::doHome(double minVelocity, double maxVelocity,
|
||||
double acceleration, int forwards) {
|
||||
// Suppress unused variable warning - this is just a default fallback
|
||||
// function.
|
||||
(void)minVelocity;
|
||||
(void)maxVelocity;
|
||||
(void)acceleration;
|
||||
(void)forwards;
|
||||
return asynSuccess;
|
||||
}
|
||||
|
||||
@@ -413,7 +446,12 @@ asynStatus sinqAxis::reset() {
|
||||
|
||||
asynStatus sinqAxis::doReset() { return asynError; }
|
||||
|
||||
asynStatus sinqAxis::enable(bool on) { return asynSuccess; }
|
||||
asynStatus sinqAxis::enable(bool on) {
|
||||
// Suppress unused variable warning - this is just a default fallback
|
||||
// function.
|
||||
(void)on;
|
||||
return asynSuccess;
|
||||
}
|
||||
|
||||
asynStatus sinqAxis::motorPosition(double *motorPos) {
|
||||
asynStatus status = asynSuccess;
|
||||
@@ -475,9 +513,9 @@ asynStatus sinqAxis::setVeloFields(double velo, double vbas, double vmax) {
|
||||
"vmax=%lf.\n",
|
||||
pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__,
|
||||
vbas, vmax);
|
||||
setAxisParamChecked(
|
||||
this, motorMessageText,
|
||||
"Lower speed limit must not be smaller than upper speed limit");
|
||||
setAxisParamChecked(this, motorMessageText,
|
||||
"Lower speed limit must not be smaller than "
|
||||
"upper speed limit. Please call the support.");
|
||||
return asynError;
|
||||
}
|
||||
if (velo < vbas || velo > vmax) {
|
||||
@@ -488,8 +526,10 @@ asynStatus sinqAxis::setVeloFields(double velo, double vbas, double vmax) {
|
||||
pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__,
|
||||
velo, vbas, vmax);
|
||||
|
||||
setAxisParamChecked(this, motorMessageText,
|
||||
"Speed is not inside limits");
|
||||
setAxisParamChecked(
|
||||
this, motorMessageText,
|
||||
"Speed is not inside limits. Set a new valid speed and try "
|
||||
"to move the motor. Otherwise, please call the support.");
|
||||
return asynError;
|
||||
}
|
||||
|
||||
@@ -702,8 +742,9 @@ static const iocshArg setWatchdogEnabledArg2 = {
|
||||
"Enabling / disabling the watchdog", iocshArgInt};
|
||||
static const iocshArg *const setWatchdogEnabledArgs[] = {
|
||||
&setWatchdogEnabledArg0, &setWatchdogEnabledArg1, &setWatchdogEnabledArg2};
|
||||
static const iocshFuncDef setWatchdogEnabledDef = {"setWatchdogEnabled", 3,
|
||||
setWatchdogEnabledArgs};
|
||||
static const iocshFuncDef setWatchdogEnabledDef = {
|
||||
"setWatchdogEnabled", 3, setWatchdogEnabledArgs,
|
||||
"Set to 0 to disable the watchdog and to any other value to enable it."};
|
||||
|
||||
static void setWatchdogEnabledCallFunc(const iocshArgBuf *args) {
|
||||
setWatchdogEnabled(args[0].sval, args[1].ival, args[2].ival);
|
||||
@@ -749,8 +790,9 @@ static const iocshArg setOffsetMovTimeoutArg2 = {"Offset timeout for movement",
|
||||
static const iocshArg *const setOffsetMovTimeoutArgs[] = {
|
||||
&setOffsetMovTimeoutArg0, &setOffsetMovTimeoutArg1,
|
||||
&setOffsetMovTimeoutArg2};
|
||||
static const iocshFuncDef setOffsetMovTimeoutDef = {"setOffsetMovTimeout", 3,
|
||||
setOffsetMovTimeoutArgs};
|
||||
static const iocshFuncDef setOffsetMovTimeoutDef = {
|
||||
"setOffsetMovTimeout", 3, setOffsetMovTimeoutArgs,
|
||||
"Specify an offset (in seconds) for the movement timeout watchdog"};
|
||||
|
||||
static void setOffsetMovTimeoutCallFunc(const iocshArgBuf *args) {
|
||||
setOffsetMovTimeout(args[0].sval, args[1].ival, args[2].dval);
|
||||
@@ -796,8 +838,9 @@ static const iocshArg setScaleMovTimeoutArg2 = {
|
||||
"Multiplier for calculated move time", iocshArgDouble};
|
||||
static const iocshArg *const setScaleMovTimeoutArgs[] = {
|
||||
&setScaleMovTimeoutArg0, &setScaleMovTimeoutArg1, &setScaleMovTimeoutArg2};
|
||||
static const iocshFuncDef setScaleMovTimeoutDef = {"setScaleMovTimeout", 3,
|
||||
setScaleMovTimeoutArgs};
|
||||
static const iocshFuncDef setScaleMovTimeoutDef = {
|
||||
"setScaleMovTimeout", 3, setScaleMovTimeoutArgs,
|
||||
"Set a scaling factor for the maximum expected movement time."};
|
||||
|
||||
static void setScaleMovTimeoutCallFunc(const iocshArgBuf *args) {
|
||||
setScaleMovTimeout(args[0].sval, args[1].ival, args[2].dval);
|
||||
|
||||
@@ -8,13 +8,22 @@ Stefan Mathis, November 2024
|
||||
|
||||
#ifndef sinqAxis_H
|
||||
#define sinqAxis_H
|
||||
|
||||
// The EPICS libaries do not follow -Weffc++
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Weffc++"
|
||||
|
||||
#include "asynMotorAxis.h"
|
||||
#include "macros.h"
|
||||
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
#include <memory>
|
||||
#include <type_traits>
|
||||
|
||||
struct sinqAxisImpl;
|
||||
|
||||
class epicsShareClass sinqAxis : public asynMotorAxis {
|
||||
class HIDDEN sinqAxis : public asynMotorAxis {
|
||||
public:
|
||||
/**
|
||||
* @brief Construct a new sinqAxis object
|
||||
@@ -31,6 +40,34 @@ class epicsShareClass sinqAxis : public asynMotorAxis {
|
||||
*/
|
||||
~sinqAxis();
|
||||
|
||||
/**
|
||||
* @brief Delete the copy and copy assignment constructors, because this
|
||||
* class should not be copied (it is tied to hardware!)
|
||||
*/
|
||||
sinqAxis(const sinqAxis &) = delete;
|
||||
sinqAxis &operator=(const sinqAxis &) = delete;
|
||||
|
||||
/**
|
||||
* @brief Check if a poll should be performed. If yes, call `forcedPoll`.
|
||||
*
|
||||
This is a wrapper around `forcedPoll` which does the following checks before
|
||||
calling `forcedPoll`:
|
||||
- Are there any outstanding fast polls (method `outstandingForcedFastPolls`
|
||||
of the controller returns a value greater zero)?
|
||||
- Was the axis moving last time its status was polled?
|
||||
- Is adaptive polling disabled?
|
||||
- Did an idle period pass since the last poll?
|
||||
If all of these conditions are false, no poll is performed. Otherwise, the
|
||||
`forcedPoll` method is called. This method should not be called in the
|
||||
driver code itself if a poll is needed - use `forcedPoll` instead!
|
||||
*
|
||||
* @param moving Forwarded to `forcedPoll` or set to false
|
||||
(depending on whether `forcedPoll was called`).
|
||||
* @return asynStatus Forward the status of `forcedPoll` or set to
|
||||
asynSuccess (depending on whether `forcedPoll was called`).
|
||||
*/
|
||||
virtual asynStatus poll(bool *moving);
|
||||
|
||||
/**
|
||||
* @brief Perform some standardized operations before and after the concrete
|
||||
`doPoll` implementation.
|
||||
@@ -46,7 +83,7 @@ class epicsShareClass sinqAxis : public asynMotorAxis {
|
||||
|
||||
- The flags `motorStatusHome_`, `motorStatusHomed_` and
|
||||
`motorStatusAtHome_` are set to their idle values (0, 1 and 1 respectively)
|
||||
in the `poll()` method once the homing procedure is finished. See the
|
||||
in the `forcedPoll()` method once the homing procedure is finished. See the
|
||||
documentation of the `home()` method for more details.
|
||||
|
||||
- Run `callParamCallbacks()`
|
||||
@@ -56,9 +93,9 @@ class epicsShareClass sinqAxis : public asynMotorAxis {
|
||||
* @param moving Forwarded to `doPoll`.
|
||||
* @return asynStatus Forward the status of `doPoll`, unless one of
|
||||
the parameter library operation fails (in that case, returns the status of
|
||||
the failed operation.
|
||||
the failed operation).
|
||||
*/
|
||||
virtual asynStatus poll(bool *moving);
|
||||
asynStatus forcedPoll(bool *moving);
|
||||
|
||||
/**
|
||||
* @brief Implementation of the "proper", device-specific poll method. This
|
||||
@@ -142,7 +179,7 @@ class epicsShareClass sinqAxis : public asynMotorAxis {
|
||||
*
|
||||
* The flags `motorStatusHome_`, `motorStatusHomed_` and
|
||||
`motorStatusAtHome_` are set to their idle values (0, 1 and 1 respectively)
|
||||
in the `poll()` method once the homing procedure is finished.
|
||||
in the `forcedPoll())` method once the homing procedure is finished.
|
||||
*
|
||||
* @param minVelocity Forwarded to `doHome`.
|
||||
* @param maxVelocity Forwarded to `doHome`.
|
||||
@@ -584,7 +621,7 @@ template <typename A, typename C>
|
||||
asynStatus getAxisParamImpl(A *axis, C *controller, const char *indexName,
|
||||
int (C::*func)(), int *readValue,
|
||||
const char *callerFunctionName, int lineNumber,
|
||||
size_t msgSize, TypeTag<int>) {
|
||||
size_t /*msgSize*/, TypeTag<int>) {
|
||||
int indexValue = (controller->*func)();
|
||||
asynStatus status =
|
||||
controller->getIntegerParam(axis->axisNo(), indexValue, readValue);
|
||||
@@ -612,7 +649,7 @@ template <typename A, typename C>
|
||||
asynStatus getAxisParamImpl(A *axis, C *controller, const char *indexName,
|
||||
int (C::*func)(), double *readValue,
|
||||
const char *callerFunctionName, int lineNumber,
|
||||
size_t msgSize, TypeTag<double>) {
|
||||
size_t /*msgSize*/, TypeTag<double>) {
|
||||
int indexValue = (controller->*func)();
|
||||
asynStatus status =
|
||||
controller->getDoubleParam(axis->axisNo(), indexValue, readValue);
|
||||
@@ -643,7 +680,7 @@ template <typename A, typename C>
|
||||
asynStatus getAxisParamImpl(A *axis, C *controller, const char *indexName,
|
||||
int (C::*func)(), std::string *readValue,
|
||||
const char *callerFunctionName, int lineNumber,
|
||||
size_t msgSize, TypeTag<std::string>) {
|
||||
size_t /*msgSize*/, TypeTag<std::string>) {
|
||||
int indexValue = (controller->*func)();
|
||||
|
||||
// Convert the pointer to a reference, since getStringParam expects the
|
||||
|
||||
@@ -1,15 +1,22 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
|
||||
#include "sinqController.h"
|
||||
// The EPICS libaries do not follow -Weffc++
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Weffc++"
|
||||
|
||||
#include "asynMotorController.h"
|
||||
#include "asynOctetSyncIO.h"
|
||||
#include "epicsExport.h"
|
||||
#include "iocsh.h"
|
||||
#include "msgPrintControl.h"
|
||||
#include "sinqAxis.h"
|
||||
#include <deque>
|
||||
#include <errlog.h>
|
||||
#include <initHooks.h>
|
||||
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
#include "msgPrintControl.h"
|
||||
#include "sinqAxis.h"
|
||||
#include "sinqController.h"
|
||||
#include <deque>
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
|
||||
@@ -92,6 +99,7 @@ struct sinqControllerImpl {
|
||||
int motorAcclFromDriver;
|
||||
int motorHighLimitFromDriver;
|
||||
int motorLowLimitFromDriver;
|
||||
int motorPositionDeadband;
|
||||
int adaptivePolling;
|
||||
int encoderType;
|
||||
};
|
||||
@@ -118,15 +126,35 @@ sinqController::sinqController(const char *portName,
|
||||
asynStatus status = asynSuccess;
|
||||
|
||||
// The paramLib indices are populated with the calls to createParam
|
||||
pSinqC_ = std::make_unique<sinqControllerImpl>(
|
||||
(sinqControllerImpl){.outstandingForcedFastPolls = 0,
|
||||
.pasynOctetSyncIOipPort = nullptr,
|
||||
.msgPrintC = msgPrintControl(),
|
||||
.comTimeoutWindow = 3600,
|
||||
.maxNumberTimeouts = 60,
|
||||
.timeoutEvents = {},
|
||||
.maxSubsequentTimeouts = 10,
|
||||
.maxSubsequentTimeoutsExceeded = false});
|
||||
pSinqC_ = std::make_unique<sinqControllerImpl>((sinqControllerImpl){
|
||||
.outstandingForcedFastPolls = 0,
|
||||
.pasynOctetSyncIOipPort = nullptr,
|
||||
.msgPrintC = msgPrintControl(),
|
||||
.comTimeoutWindow = 3600,
|
||||
.maxNumberTimeouts = 60,
|
||||
.timeoutEvents = {},
|
||||
.maxSubsequentTimeouts = 10,
|
||||
.maxSubsequentTimeoutsExceeded = false,
|
||||
.motorMessageText = 0,
|
||||
.motorReset = 0,
|
||||
.motorEnable = 0,
|
||||
.motorEnableRBV = 0,
|
||||
.motorCanDisable = 0,
|
||||
.motorEnableMovWatchdog = 0,
|
||||
.motorCanSetSpeed = 0,
|
||||
.motorLimitsOffset = 0,
|
||||
.motorForceStop = 0,
|
||||
.motorConnected = 0,
|
||||
.motorVeloFromDriver = 0,
|
||||
.motorVbasFromDriver = 0,
|
||||
.motorVmaxFromDriver = 0,
|
||||
.motorAcclFromDriver = 0,
|
||||
.motorHighLimitFromDriver = 0,
|
||||
.motorLowLimitFromDriver = 0,
|
||||
.motorPositionDeadband = 0,
|
||||
.adaptivePolling = 0,
|
||||
.encoderType = 0,
|
||||
});
|
||||
|
||||
// Store the poll period information. The poller itself will be started
|
||||
// later (after the IOC is running in epicsInithookFunction)
|
||||
@@ -267,6 +295,17 @@ sinqController::sinqController(const char *portName,
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
status = createParam("MOTOR_POSITION_DEADBAND", asynParamFloat64,
|
||||
&pSinqC_->motorPositionDeadband);
|
||||
if (status != asynSuccess) {
|
||||
asynPrint(this->pasynUser(), ASYN_TRACE_ERROR,
|
||||
"Controller \"%s\" => %s, line %d\nFATAL ERROR (creating a "
|
||||
"parameter failed with %s).\nTerminating IOC",
|
||||
portName, __PRETTY_FUNCTION__, __LINE__,
|
||||
stringifyAsynStatus(status));
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
status = createParam("MOTOR_ENABLE_MOV_WATCHDOG", asynParamInt32,
|
||||
&pSinqC_->motorEnableMovWatchdog);
|
||||
if (status != asynSuccess) {
|
||||
@@ -699,6 +738,9 @@ int sinqController::motorHighLimitFromDriver() {
|
||||
int sinqController::motorLowLimitFromDriver() {
|
||||
return pSinqC_->motorLowLimitFromDriver;
|
||||
}
|
||||
int sinqController::motorPositionDeadband() {
|
||||
return pSinqC_->motorPositionDeadband;
|
||||
}
|
||||
int sinqController::adaptivePolling() { return pSinqC_->adaptivePolling; }
|
||||
int sinqController::encoderType() { return pSinqC_->encoderType; }
|
||||
|
||||
@@ -809,7 +851,8 @@ static const iocshArg *const setThresholdComTimeoutArgs[] = {
|
||||
&setThresholdComTimeoutArg0, &setThresholdComTimeoutArg1,
|
||||
&setThresholdComTimeoutArg2};
|
||||
static const iocshFuncDef setThresholdComTimeoutDef = {
|
||||
"setThresholdComTimeout", 3, setThresholdComTimeoutArgs};
|
||||
"setThresholdComTimeout", 3, setThresholdComTimeoutArgs,
|
||||
"Set the communication timeout threshold in seconds"};
|
||||
|
||||
static void setThresholdComTimeoutCallFunc(const iocshArgBuf *args) {
|
||||
setThresholdComTimeout(args[0].sval, args[1].ival, args[2].ival);
|
||||
@@ -870,7 +913,9 @@ static const iocshArg SetMaxSubsequentTimeoutsArg1 = {
|
||||
static const iocshArg *const SetMaxSubsequentTimeoutsArgs[] = {
|
||||
&SetMaxSubsequentTimeoutsArg0, &SetMaxSubsequentTimeoutsArg1};
|
||||
static const iocshFuncDef setMaxSubsequentTimeoutsDef = {
|
||||
"setMaxSubsequentTimeouts", 2, SetMaxSubsequentTimeoutsArgs};
|
||||
"setMaxSubsequentTimeouts", 2, SetMaxSubsequentTimeoutsArgs,
|
||||
"Set the maximum number of subsequent timeouts before the user receives an "
|
||||
"error message"};
|
||||
static void setMaxSubsequentTimeoutsCallFunc(const iocshArgBuf *args) {
|
||||
setMaxSubsequentTimeouts(args[0].sval, args[1].ival);
|
||||
}
|
||||
@@ -924,13 +969,15 @@ asynStatus setForcedFastPolls(const char *portName, int forcedFastPolls) {
|
||||
static const iocshArg SetForcedFastPollsArg0 = {"Controller name (e.g. mcu1)",
|
||||
iocshArgString};
|
||||
static const iocshArg SetForcedFastPollsArg1 = {
|
||||
"Number of fast polls after \"waking\" the poller (e.g. after issueing a "
|
||||
"Number of fast polls after \"waking\" the poller (e.g. after issuing a "
|
||||
"move command).",
|
||||
iocshArgInt};
|
||||
static const iocshArg *const SetForcedFastPollsArgs[] = {
|
||||
&SetForcedFastPollsArg0, &SetForcedFastPollsArg1};
|
||||
static const iocshFuncDef setForcedFastPollsDef = {"setForcedFastPolls", 2,
|
||||
SetForcedFastPollsArgs};
|
||||
static const iocshFuncDef setForcedFastPollsDef = {
|
||||
"setForcedFastPolls", 2, SetForcedFastPollsArgs,
|
||||
"Set the number of fast polls after \"waking\" the poller (e.g. after "
|
||||
"issuing a move command)."};
|
||||
static void setForcedFastPollsCallFunc(const iocshArgBuf *args) {
|
||||
setForcedFastPolls(args[0].sval, args[1].ival);
|
||||
}
|
||||
|
||||
@@ -9,9 +9,18 @@ Stefan Mathis, November 2024
|
||||
|
||||
#ifndef sinqController_H
|
||||
#define sinqController_H
|
||||
|
||||
// The EPICS libaries do not follow -Weffc++
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Weffc++"
|
||||
|
||||
#include "asynMotorController.h"
|
||||
#include "msgPrintControl.h"
|
||||
#include <initHooks.h>
|
||||
#include <macros.h>
|
||||
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
#include <memory>
|
||||
|
||||
#define motorMessageIsFromDriverString "MOTOR_MESSAGE_DRIVER"
|
||||
@@ -20,9 +29,9 @@ Stefan Mathis, November 2024
|
||||
#define AbsoluteEncoder "absolute"
|
||||
#define NoEncoder "none"
|
||||
|
||||
struct sinqControllerImpl;
|
||||
struct HIDDEN sinqControllerImpl;
|
||||
|
||||
class epicsShareClass sinqController : public asynMotorController {
|
||||
class HIDDEN sinqController : public asynMotorController {
|
||||
public:
|
||||
/**
|
||||
* @brief Construct a new sinqController object
|
||||
@@ -57,6 +66,13 @@ class epicsShareClass sinqController : public asynMotorController {
|
||||
*/
|
||||
virtual ~sinqController(void);
|
||||
|
||||
/**
|
||||
* @brief Delete the copy and copy assignment constructors, because this
|
||||
* class should not be copied (it is tied to hardware!)
|
||||
*/
|
||||
sinqController(const sinqController &) = delete;
|
||||
sinqController &operator=(const sinqController &) = delete;
|
||||
|
||||
/**
|
||||
* @brief Overloaded function of asynMotorController
|
||||
*
|
||||
@@ -314,6 +330,7 @@ class epicsShareClass sinqController : public asynMotorController {
|
||||
int motorAcclFromDriver();
|
||||
int motorHighLimitFromDriver();
|
||||
int motorLowLimitFromDriver();
|
||||
int motorPositionDeadband();
|
||||
int adaptivePolling();
|
||||
int encoderType();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user