Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 59a5ba452f | |||
| 6dc2b131f7 | |||
| 902b18d038 |
@@ -16,6 +16,8 @@ void msgPrintControlKey::format(char *buffer, size_t bufferSize) {
|
|||||||
|
|
||||||
// =============================================================================
|
// =============================================================================
|
||||||
|
|
||||||
|
msgPrintControl::msgPrintControl() : map_(), suffix_{} {}
|
||||||
|
|
||||||
msgPrintControl::~msgPrintControl() = default;
|
msgPrintControl::~msgPrintControl() = default;
|
||||||
|
|
||||||
bool msgPrintControl::shouldBePrinted(msgPrintControlKey &key, bool wantToPrint,
|
bool msgPrintControl::shouldBePrinted(msgPrintControlKey &key, bool wantToPrint,
|
||||||
|
|||||||
@@ -5,8 +5,15 @@
|
|||||||
|
|
||||||
#define DefaultMaxRepetitions 4
|
#define DefaultMaxRepetitions 4
|
||||||
|
|
||||||
#include <asynDriver.h>
|
// The EPICS libaries do not follow -Weffc++
|
||||||
#include <macros.h>
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic ignored "-Weffc++"
|
||||||
|
|
||||||
|
#include "asynDriver.h"
|
||||||
|
#include "macros.h"
|
||||||
|
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
@@ -18,6 +25,17 @@
|
|||||||
*/
|
*/
|
||||||
class HIDDEN msgPrintControlKey {
|
class HIDDEN msgPrintControlKey {
|
||||||
public:
|
public:
|
||||||
|
msgPrintControlKey(char *controller_, int axisNo, const char *fileName,
|
||||||
|
int line, size_t maxRepetitions = DefaultMaxRepetitions);
|
||||||
|
|
||||||
|
bool operator==(const msgPrintControlKey &other) const {
|
||||||
|
return axisNo_ == other.axisNo_ && line_ == other.line_ &&
|
||||||
|
functionName_ == other.functionName_ &&
|
||||||
|
controller_ == other.controller_;
|
||||||
|
}
|
||||||
|
|
||||||
|
void format(char *buffer, size_t bufferSize);
|
||||||
|
|
||||||
std::string controller_;
|
std::string controller_;
|
||||||
|
|
||||||
// -1 indicates a non-axis specific message
|
// -1 indicates a non-axis specific message
|
||||||
@@ -32,17 +50,6 @@ class HIDDEN msgPrintControlKey {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
size_t maxRepetitions_;
|
size_t maxRepetitions_;
|
||||||
|
|
||||||
msgPrintControlKey(char *controller_, int axisNo, const char *fileName,
|
|
||||||
int line, size_t maxRepetitions = DefaultMaxRepetitions);
|
|
||||||
|
|
||||||
bool operator==(const msgPrintControlKey &other) const {
|
|
||||||
return axisNo_ == other.axisNo_ && line_ == other.line_ &&
|
|
||||||
functionName_ == other.functionName_ &&
|
|
||||||
controller_ == other.controller_;
|
|
||||||
}
|
|
||||||
|
|
||||||
void format(char *buffer, size_t bufferSize);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -85,6 +92,12 @@ template <> struct hash<msgPrintControlKey> {
|
|||||||
*/
|
*/
|
||||||
class HIDDEN msgPrintControl {
|
class HIDDEN msgPrintControl {
|
||||||
public:
|
public:
|
||||||
|
/**
|
||||||
|
* @brief Construct a new msgPrintControl object
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
msgPrintControl();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Destroy the msgPrintControl object
|
* @brief Destroy the msgPrintControl object
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -1,12 +1,19 @@
|
|||||||
// SPDX-License-Identifier: GPL-3.0-only
|
// 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 "epicsExport.h"
|
||||||
#include "iocsh.h"
|
#include "iocsh.h"
|
||||||
#include "msgPrintControl.h"
|
|
||||||
#include "sinqController.h"
|
|
||||||
#include <epicsTime.h>
|
#include <epicsTime.h>
|
||||||
#include <errlog.h>
|
#include <errlog.h>
|
||||||
|
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
|
|
||||||
|
#include "msgPrintControl.h"
|
||||||
|
#include "sinqAxis.h"
|
||||||
|
#include "sinqController.h"
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
@@ -31,21 +38,22 @@ struct sinqAxisImpl {
|
|||||||
};
|
};
|
||||||
|
|
||||||
sinqAxis::sinqAxis(class sinqController *pC, int axisNo)
|
sinqAxis::sinqAxis(class sinqController *pC, int axisNo)
|
||||||
: asynMotorAxis((asynMotorController *)pC, axisNo), pC_(pC) {
|
: asynMotorAxis((asynMotorController *)pC, axisNo), pC_(pC), pSinqA_([] {
|
||||||
|
epicsTimeStamp lastPollTime;
|
||||||
|
epicsTimeGetCurrent(&lastPollTime);
|
||||||
|
return std::make_unique<sinqAxisImpl>(sinqAxisImpl{
|
||||||
|
.expectedArrivalTime = 0,
|
||||||
|
.offsetMovTimeout = 30,
|
||||||
|
.scaleMovTimeout = 2.0,
|
||||||
|
.watchdogMovActive = false,
|
||||||
|
.targetPosition = 0.0,
|
||||||
|
.wasMoving = false,
|
||||||
|
.lastPollTime = lastPollTime,
|
||||||
|
});
|
||||||
|
}()) {
|
||||||
|
|
||||||
asynStatus status = asynSuccess;
|
asynStatus status = asynSuccess;
|
||||||
|
|
||||||
epicsTimeStamp lastPollTime;
|
|
||||||
epicsTimeGetCurrent(&lastPollTime);
|
|
||||||
|
|
||||||
pSinqA_ = std::make_unique<sinqAxisImpl>(
|
|
||||||
(sinqAxisImpl){.expectedArrivalTime = 0,
|
|
||||||
.offsetMovTimeout = 30,
|
|
||||||
.scaleMovTimeout = 2.0,
|
|
||||||
.watchdogMovActive = false,
|
|
||||||
.targetPosition = 0.0,
|
|
||||||
.wasMoving = false,
|
|
||||||
.lastPollTime = lastPollTime});
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
This check is also done in asynMotorAxis, but there the IOC continues
|
This check is also done in asynMotorAxis, but there the IOC continues
|
||||||
running even though the configuration is incorrect. When failing this check,
|
running even though the configuration is incorrect. When failing this check,
|
||||||
|
|||||||
@@ -8,8 +8,16 @@ Stefan Mathis, November 2024
|
|||||||
|
|
||||||
#ifndef sinqAxis_H
|
#ifndef sinqAxis_H
|
||||||
#define 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 "asynMotorAxis.h"
|
||||||
#include <macros.h>
|
#include "macros.h"
|
||||||
|
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
|
|
||||||
@@ -442,8 +450,10 @@ class HIDDEN sinqAxis : public asynMotorAxis {
|
|||||||
void setTargetPosition(double targetPosition);
|
void setTargetPosition(double targetPosition);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::unique_ptr<sinqAxisImpl> pSinqA_;
|
// Ordering matters because pC_ is initialized before pSinqA_ in the
|
||||||
|
// constructor
|
||||||
sinqController *pC_;
|
sinqController *pC_;
|
||||||
|
std::unique_ptr<sinqAxisImpl> pSinqA_;
|
||||||
};
|
};
|
||||||
|
|
||||||
// =============================================================================
|
// =============================================================================
|
||||||
|
|||||||
@@ -1,15 +1,22 @@
|
|||||||
// SPDX-License-Identifier: GPL-3.0-only
|
// 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 "asynMotorController.h"
|
||||||
#include "asynOctetSyncIO.h"
|
#include "asynOctetSyncIO.h"
|
||||||
#include "epicsExport.h"
|
#include "epicsExport.h"
|
||||||
#include "iocsh.h"
|
#include "iocsh.h"
|
||||||
#include "msgPrintControl.h"
|
|
||||||
#include "sinqAxis.h"
|
|
||||||
#include <deque>
|
|
||||||
#include <errlog.h>
|
#include <errlog.h>
|
||||||
#include <initHooks.h>
|
#include <initHooks.h>
|
||||||
|
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
|
|
||||||
|
#include "msgPrintControl.h"
|
||||||
|
#include "sinqAxis.h"
|
||||||
|
#include "sinqController.h"
|
||||||
|
#include <deque>
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
@@ -112,43 +119,40 @@ sinqController::sinqController(const char *portName,
|
|||||||
0, // No additional interfaces beyond those in base class
|
0, // No additional interfaces beyond those in base class
|
||||||
0, // No additional callback interfaces beyond those in base class
|
0, // No additional callback interfaces beyond those in base class
|
||||||
ASYN_CANBLOCK | ASYN_MULTIDEVICE,
|
ASYN_CANBLOCK | ASYN_MULTIDEVICE,
|
||||||
1, // autoconnect
|
1, // autoconnect
|
||||||
0, 0) // Default priority and stack size
|
0, 0), // Default priority and stack size
|
||||||
{
|
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,
|
||||||
|
})) {
|
||||||
|
|
||||||
asynStatus status = asynSuccess;
|
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,
|
|
||||||
.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
|
// Store the poll period information. The poller itself will be started
|
||||||
// later (after the IOC is running in epicsInithookFunction)
|
// later (after the IOC is running in epicsInithookFunction)
|
||||||
movingPollPeriod_ = movingPollPeriod;
|
movingPollPeriod_ = movingPollPeriod;
|
||||||
|
|||||||
@@ -9,10 +9,18 @@ Stefan Mathis, November 2024
|
|||||||
|
|
||||||
#ifndef sinqController_H
|
#ifndef sinqController_H
|
||||||
#define 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 "asynMotorController.h"
|
||||||
#include "msgPrintControl.h"
|
#include "msgPrintControl.h"
|
||||||
#include <initHooks.h>
|
#include <initHooks.h>
|
||||||
#include <macros.h>
|
#include <macros.h>
|
||||||
|
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
#define motorMessageIsFromDriverString "MOTOR_MESSAGE_DRIVER"
|
#define motorMessageIsFromDriverString "MOTOR_MESSAGE_DRIVER"
|
||||||
|
|||||||
Reference in New Issue
Block a user