14 Commits
0.1.0 ... 1.4.1

17 changed files with 186 additions and 31 deletions

View File

@@ -2,7 +2,6 @@
record(waveform,"$(P)DAQ-${Name}-DataAct"){
info(asyn:FIFO, "1000")
field(DESC, "Data")
field(PINI, "1")
field(DTYP, "asynFloat64ArrayIn")
field(INP, "@asyn(${PORT},$(ADDR=0),$(TIMEOUT=1000))plugin.daq.${Name}.data")
field(FTVL, "DOUBLE")

View File

@@ -0,0 +1,4 @@
record(stringin,"$(P)DAQ-${Name}-CH${CH}-${ITEM}-Info") {
field(DESC, "${DESC=empty}")
field(VAL, "${VAL=empty}")
}

View File

@@ -0,0 +1,4 @@
record(ai,"$(P)DAQ-${Name}-CH${CH}-Type") {
field(DESC, "${DESC=}")
field(VAL, "${TYPE=0}")
}

View File

@@ -16,7 +16,7 @@ OPT_CXXFLAGS_YES = -O3
# dependencies
ECmasterECMC_VERSION = v1.1.0
ecmc_VERSION = 9.1.0
ecmc_VERSION = 9.5.0
BASE_DIR = .
SRC_DIR = $(BASE_DIR)/src

View File

@@ -60,7 +60,7 @@ ${SCRIPTEXEC} ${ecmc_plugin_daq_DIR}ecmcDAQAddChannel.cmd, "TYPE=1234"
### Adding a data item the a channel
Add a channel to the last created array with ecmcDAQAddDataItem.cmd. The command takes two parameters:
Add a channel to the last created array with ecmcDAQAddDataItem.cmd. The command takes three parameters:
1. PARAM : Parameter name to specify the data to read from ecmc, ec0.s1.analogInput01, ax1.poserr,...
2. FORMAT : Optional formatting of data:
```
@@ -71,6 +71,9 @@ Add a channel to the last created array with ecmcDAQAddDataItem.cmd. The command
The calculated time then would correspond to the first data in the array recived.
3 = time_ns_minus_period : Time: Raw value minus one period.
```
3. SEND_OLD : Optional to send old data (for scalars from previosu cycle, for arrays just one element shift)
### Finalizing a array
When the configurations for an array is finalized then the ecmcDAQFinalizeArray.cmd must be called.
The command will read the total array size (header plus data) from the plugin and then load the database with the waveform record (with correct NELM). The command takes the array name as a parameter ("NAME").
@@ -168,4 +171,15 @@ Array data "Testing2":
```
caget -t c6025a:DAQ-Testing2-DataAct
14:21:22.652988 c6025a:DAQ-Testing2-Data-Act 2 2092191543 1234 10 6 -1 4321 16 5 -1 4293967 0 0 0 0 0 4293967 0 0 0 0
```
```
# Some data
```
camon -t c6025a:DAQ-ToEdwin-DataAct
16:54:32.812939 c6025a:DAQ-ToEdwin-DataAct 6 4194379137 1 26 1 -1 2 27 1 -1 3 28 1 -1 1100 29 102 -1 4 131 2 -1 1050 133 52 -1 0 0 0 4194377117 4194378117 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4194376067 4194377067 -316 -285 -499 -578 -400 -414 -313 -390 -365 -408 -545 -448 -188 -482 -445 -364 -398 -261 -310 -450 -229 -227 -563 -319 -335 -326 -490 -240 -307 -513 -448 -435 -582 -394 -298 -242 -539 -449 -492 -443 -377 -143 -299 -484 -515 -370 -422 -636 -547 -288
16:54:32.813945 c6025a:DAQ-ToEdwin-DataAct 6 4194380144 1 26 1 -1 2 27 1 -1 3 28 1 -1 1100 29 102 -1 4 131 2 -1 1050 133 52 -1 0 0 0 4194378117 4194379117 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4194377067 4194378067 -344 -364 -685 -532 -328 -527 -483 -386 -346 -528 -340 -437 -323 -453 -382 -525 -629 -475 -466 -577 -516 -550 -451 -326 -273 -308 -535 -269 -413 -465 -297 -340 -480 -443 -280 -469 -523 -555 -630 -412 -350 -411 -591 -548 -580 -466 -238 -265 -321 -394
16:54:32.814938 c6025a:DAQ-ToEdwin-DataAct 6 4194381137 1 26 1 -1 2 27 1 -1 3 28 1 -1 1100 29 102 -1 4 131 2 -1 1050 133 52 -1 0 0 0 4194379117 4194380117 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4194378067 4194379067 -417 -219 -286 -338 -338 -270 -214 -409 -481 -423 -488 -565 -359 -544 -423 -190 -236 -487 -633 -488 -468 -336 -556 -505 -232 -257 -463 -464 -382 -480 -215 -420 -548 -467 -335 -330 -406 -337 -278 -361 -511 -509 -588 -376 -315 -399 -448 -512 -602 -778
16:54:32.815937 c6025a:DAQ-ToEdwin-DataAct 6 4194382136 1 26 1 -1 2 27 1 -1 3 28 1 -1 1100 29 102 -1 4 131 2 -1 1050 133 52 -1 0 0 0 4194380117 4194381117 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4194379067 4194380067 -586 -383 -404 -641 -533 -296 -208 -416 -525 -314 -379 -362 -468 -491 -483 -503 -471 -513 -462 -482 -690 -483 -368 -294 -400 -452 -452 -456 -246 -371 -353 -395 -330 -554 -317 -204 -375 -361 -545 -580 -396 -493 -415 -349 -484 -252 -311 -573 -432 -289
16:54:32.816939 c6025a:DAQ-ToEdwin-DataAct 6 4194383137 1 26 1 -1 2 27 1 -1 3 28 1 -1 1100 29 102 -1 4 131 2 -1 1050 133 52 -1 0 0 0 4194381117 4194382117 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4194380067 4194381067 -358 -237 -197 -450 -430 -279 -448 -518 -490 -213 -202 -248 -300 -418 -344 -595 -658 -525 -302 -262 -353 -328 -401 -360 -478 -460 -364 -549 -522 -342 -410 -472 -444 -459 -338 -321 -344 -313 -423 -445 -427 -560 -470 -298 -341 -190 -339 -374 -536 -494
```

99
iocsh/edwin_test.script Normal file
View File

@@ -0,0 +1,99 @@
##############################################################################
## test config for ecmc_plugin_daq
##
epicsEnvSet(IOC,c6025a)
require ecmccfg "ENG_MODE=1"
##############################################################################
## Configure hardware
#- 0 0:0 PREOP + EK1100 EtherCAT-Koppler (2A E-Bus)
#- 1 0:1 PREOP + EL5021 1Ch. Sin/Cos Encoder
#- 2 0:2 PREOP + EL5112 2Ch. Inc. Encoder 5V (2xAB or 1xABC RS422,TTL)
#- 3 0:3 PREOP + EL5042 2Ch. BiSS-C Encoder
#- 4 0:4 PREOP + EL5101-0011 1K. Inc. Encoder 5V (20 Mio. Inkremente/s, oversamp
#- 5 0:5 PREOP + EL9505 Netzteilklemme 5V
#- 6 0:6 PREOP + EL1252-0050 2K. Fast Dig. Eingang 5V, 1<>s, DC Latch
#- 7 0:7 PREOP + ELM3602-0002 2Ch. IEPE Sensor, 24 bit, high precision
require ecmccomp
${SCRIPTEXEC} ${ecmccfg_DIR}addSlave.cmd, "HW_DESC=EK1100"
${SCRIPTEXEC} ${ecmccfg_DIR}addSlave.cmd, "HW_DESC=EL5021"
${SCRIPTEXEC} ${ecmccfg_DIR}addSlave.cmd, "HW_DESC=EL5112_ABC_DC64"
${SCRIPTEXEC} ${ecmccfg_DIR}addSlave.cmd, "HW_DESC=EL5042"
${SCRIPTEXEC} ${ecmccomp_DIR}applyComponent.cmd "COMP=Encoder-RLS-LA11-26bit-BISS-C,CH_ID=1"
${SCRIPTEXEC} ${ecmccomp_DIR}applyComponent.cmd "COMP=Encoder-RLS-LA11-26bit-SSI,CH_ID=2"
${SCRIPTEXEC} ${ecmccfg_DIR}addSlave.cmd, "HW_DESC=EL5101-0011,NELM=100"
${SCRIPTEXEC} ${ecmccfg_DIR}addSlave.cmd, "HW_DESC=EL9505"
${SCRIPTEXEC} ${ecmccfg_DIR}addSlave.cmd, "HW_DESC=EL1252"
${SCRIPTEXEC} ${ecmccfg_DIR}addSlave.cmd, "HW_DESC=ELM3602-0002,NELM=50"
#- Ch1 +-10v
ecmcConfigOrDie "Cfg.EcAddSdo(${ECMC_EC_SLAVE_NUM},0x8000,0x1,97,2)"
#- Ch2 +-10v
ecmcConfigOrDie "Cfg.EcAddSdo(${ECMC_EC_SLAVE_NUM},0x8010,0x1,97,2)"
#Apply hardware configuration
ecmcConfigOrDie "Cfg.EcApplyConfig(1)"
##############################################################################
## Load and configure daq plugin
require ecmc_plugin_daq "PLUGIN_ID=0"
epicsEnvSet(NAME,ToEdwin) # PREFIX:DAQ-ToEdwin-DataAct
${SCRIPTEXEC} ${ecmc_plugin_daq_DIR}ecmcDAQAddArray.cmd, "NAME=${NAME}"
#- EL5021: Incremental sin/cos 1vpp
${SCRIPTEXEC} ${ecmc_plugin_daq_DIR}ecmcDAQAddChannel.cmd, "TYPE=10,DESC='Sin/Cos 1VPP'"
${SCRIPTEXEC} ${ecmc_plugin_daq_DIR}ecmcDAQAddDataItem.cmd, "PARAM=ec0.s1.positionActual01"
#- EL5112: Incremental (treat as array, but same timestamp twice, the second actualy not used)
${SCRIPTEXEC} ${ecmc_plugin_daq_DIR}ecmcDAQAddChannel.cmd, "TYPE=1001,DESC='Incremental'"
${SCRIPTEXEC} ${ecmc_plugin_daq_DIR}ecmcDAQAddDataItem.cmd, "PARAM=ec0.s2.timestamp01, FORMAT=1"
${SCRIPTEXEC} ${ecmc_plugin_daq_DIR}ecmcDAQAddDataItem.cmd, "PARAM=ec0.s2.timestamp01, FORMAT=1, SEND_OLD=1"
${SCRIPTEXEC} ${ecmc_plugin_daq_DIR}ecmcDAQAddDataItem.cmd, "PARAM=ec0.s2.positionActual01"
${SCRIPTEXEC} ${ecmc_plugin_daq_DIR}ecmcDAQAddChannel.cmd, "TYPE=11,DESC='Incremental'"
${SCRIPTEXEC} ${ecmc_plugin_daq_DIR}ecmcDAQAddDataItem.cmd, "PARAM=ec0.s2.positionActual01"
#- EL5042: BISS-C ch 01
${SCRIPTEXEC} ${ecmc_plugin_daq_DIR}ecmcDAQAddChannel.cmd, "TYPE=12,DESC='BISS-C'"
${SCRIPTEXEC} ${ecmc_plugin_daq_DIR}ecmcDAQAddDataItem.cmd, "PARAM=ec0.s3.positionActual01"
#- EL5101-0011: Incremental oversampling
${SCRIPTEXEC} ${ecmc_plugin_daq_DIR}ecmcDAQAddChannel.cmd, "TYPE=1000,DESC='Incremental Oversampling'"
${SCRIPTEXEC} ${ecmc_plugin_daq_DIR}ecmcDAQAddDataItem.cmd, "PARAM=ec0.s4.nextSyncTime, FORMAT=2"
${SCRIPTEXEC} ${ecmc_plugin_daq_DIR}ecmcDAQAddDataItem.cmd, "PARAM=ec0.s4.nextSyncTime, FORMAT=1"
${SCRIPTEXEC} ${ecmc_plugin_daq_DIR}ecmcDAQAddDataItem.cmd, "PARAM=ec0.s4.mm.positionActualArray01"
#- EL1252-0050: timestamped input ch 01
${SCRIPTEXEC} ${ecmc_plugin_daq_DIR}ecmcDAQAddChannel.cmd, "TYPE=1,DESC='Timestamped input 5V'"
${SCRIPTEXEC} ${ecmc_plugin_daq_DIR}ecmcDAQAddDataItem.cmd, "PARAM=ec0.s6.timestampLatchPositive01 ,FORMAT=1"
${SCRIPTEXEC} ${ecmc_plugin_daq_DIR}ecmcDAQAddDataItem.cmd, "PARAM=ec0.s6.timestampLatchNegative01 ,FORMAT=1"
#- ELM3602-0002: Analog input ch 01
${SCRIPTEXEC} ${ecmc_plugin_daq_DIR}ecmcDAQAddChannel.cmd, "TYPE=1000,DESC='Analog input +-10V'"
${SCRIPTEXEC} ${ecmc_plugin_daq_DIR}ecmcDAQAddDataItem.cmd, "PARAM=ec0.s7.timestamp01, FORMAT=2"
${SCRIPTEXEC} ${ecmc_plugin_daq_DIR}ecmcDAQAddDataItem.cmd, "PARAM=ec0.s7.timestamp01, FORMAT=1"
${SCRIPTEXEC} ${ecmc_plugin_daq_DIR}ecmcDAQAddDataItem.cmd, "PARAM=ec0.s7.mm.analogInputArray01"
${SCRIPTEXEC} ${ecmc_plugin_daq_DIR}ecmcDAQFinalizeArray.cmd "NAME=${NAME}"
#- To check result use camon -t c6025a:DAQ-ToEdwin-DataAct
##############################################################################
## Configure diagnostics:
#
ecmcConfigOrDie "Cfg.EcSetDiagnostics(1)"
ecmcConfigOrDie "Cfg.EcEnablePrintouts(0)"
ecmcConfigOrDie "Cfg.EcSetDomainFailedCyclesLimit(100)"
##############################################################################
## go active
#
$(SCRIPTEXEC) ($(ecmccfg_DIR)setAppMode.cmd)

View File

@@ -17,3 +17,4 @@
#- Name , Asyn port name
ecmcDAQAddArray(${NAME},ECMC.PLUGIN.DAQ.${NAME})
epicsEnvSet(ECMC_DAQ_CURR_CH,-1)

View File

@@ -12,7 +12,12 @@
#-
#- Arguments
#- TYPE : Type (number of data type)
#- NAME : Name of DAQ array object
#- DESC : Optional description of channel
#-
#-################################################################################
ecmcDAQAddChannel(${TYPE})
epicsEnvSet(ECMC_DAQ_CURR_ITM,-1)
ecmcEpicsEnvSetCalc("ECMC_DAQ_CURR_CH" ,${ECMC_DAQ_CURR_CH=-1}+1,"%02d")
dbLoadRecords(ecmcPluginDAQ_chX.template,"P=${ECMC_PREFIX},Name=${NAME},PORT=ECMC.PLUGIN.DAQ.${NAME},CH=${ECMC_DAQ_CURR_CH=00},TYPE=${TYPE=0},DESC=${DESC=}")

View File

@@ -19,7 +19,11 @@
#- Useful for oversampling slaves where normally the nextsync time is available.\n");
#- The calculated time then would correspond to the first data in the array recived.\n");
#- 3 = time_ns_minus_period : Time: Raw value minus one period.\n");
#- SEND_OLD : 1 = Send one element old data (for scalars from last cycle, for arrays shift one element), defaults to 0 (send fresh data)
#- NAME : Name of DAQ array object
#-
#-################################################################################
ecmcDAQAddItem(${PARAM},${FORMAT=0})
ecmcDAQAddItem(${PARAM},${FORMAT=0},${SEND_OLD=0})
ecmcEpicsEnvSetCalc("ECMC_DAQ_CURR_ITM" ,${ECMC_DAQ_CURR_ITM=-1}+1,"%02d")
dbLoadRecords(ecmcPluginDAQ_chX-itmX.template,"P=${ECMC_PREFIX},Name=${NAME},PORT=ECMC.PLUGIN.DAQ.${NAME},CH=${ECMC_DAQ_CURR_CH=00},ITEM=${ECMC_DAQ_CURR_ITM=00},VAL=${PARAM=empty},DESC='FORMAT=${FORMAT=0},SEND_OLD=${SEND_OLD=0}'")

View File

@@ -26,3 +26,5 @@ ecmcEndIf()
dbLoadRecords(ecmcPluginDAQ.template,"P=${ECMC_PREFIX},Name=${NAME},NELM=${DAQ_NELM},PORT=ECMC.PLUGIN.DAQ.${NAME}")
epicsEnvUnset(DAQ_NELM)
epicsEnvUnset(ECMC_DAQ_CURR_CH)
epicsEnvUnset(ECMC_DAQ_CURR_ITM)

View File

@@ -35,16 +35,19 @@ enum class ecmcDAQDataFormat { raw = 0,
* Useful for oversampling slaves where normally the nextsync time is available.
* The calculated time then would correspond to the first data in the array recived.
* 3=time_ns_minus_period : Time: Raw value minus one period.
* sendOneCycleOldData : Send data from previous cycle (or for arrays elements are shifted one index). To be used by Edwin to trigger on timechange for incremntal timestamped cards..
*/
class ecmcDAQChannelItem {
public:
ecmcDAQChannelItem(const char* name, ecmcDAQDataFormat format) {
ecmcDAQChannelItem(const char* name, ecmcDAQDataFormat format, int sendOneCycleOldData) {
dataItem_ = NULL;
dataItemInfo_ = NULL;
name_ = name;
cstrName_ = strdup(name);
format_ = format; // micro s in int32
sendOneCycleOldData_ = sendOneCycleOldData; // Will only work for scalars (if arrays the elements are shifted once)
sampleTimeCompensation_ = 0;
dataIndexToReturn_ = 0;
dataElementCount_ = 0;
@@ -60,6 +63,7 @@ class ecmcDAQChannelItem {
float32Ptr_ = NULL;
float64Ptr_ = NULL;
dataType_ = ECMC_EC_NONE;
dataOld_ = 0;
printf("ecmcDAQChannelItem: Created new item %s, format %d\n",name,(int)format);
}
@@ -204,13 +208,21 @@ class ecmcDAQChannelItem {
break;
}
//if(dataIndexToReturn_>0) {
// printf("%s[%zu] data = %lf\n",cstrName_,dataIndexToReturn_,data);
//}
dataIndexToReturn_++;
return formatData(data,time);
double freshData = formatData(data,time);
double dataToSend = 0;
if(sendOneCycleOldData_) {
dataToSend = dataOld_;
} else {
dataToSend = freshData;
}
// Store the fresh data here
dataOld_ = freshData;
return dataToSend;
}
double formatData(double data, uint64_t time){
@@ -274,6 +286,8 @@ class ecmcDAQChannelItem {
uint64_t *uint64Ptr_;
float *float32Ptr_;
double *float64Ptr_;
int sendOneCycleOldData_;
double dataOld_;
};
#endif /* ECMC_DAQ_CHANNEL_ITEM_H_ */

View File

@@ -62,9 +62,9 @@ void ecmcDAQDataArray::addChannel(int type) {
channelCounter_++;
}
void ecmcDAQDataArray::addDataItemToChannel(const char* name, int format) {
void ecmcDAQDataArray::addDataItemToChannel(const char* name, int format, int oldData) {
// Always add to last added channel
dataChannels_.back()->addDataItem(name, format);
dataChannels_.back()->addDataItem(name, format, oldData);
}
void ecmcDAQDataArray::connectToDataSources() {

View File

@@ -28,7 +28,7 @@ class ecmcDAQDataArray : public asynPortDriver {
void connectToDataSources();
void execute();
void addChannel(int type);
void addDataItemToChannel(const char* name, int format); // Always add to last added channel
void addDataItemToChannel(const char* name, int format, int oldData); // Always add to last added channel
void setEnable(int enable);
size_t getArraySize();
int validate();

View File

@@ -29,8 +29,8 @@ ecmcDAQDataChannel::ecmcDAQDataChannel(int type){
ecmcDAQDataChannel::~ecmcDAQDataChannel() {
}
void ecmcDAQDataChannel::addDataItem(const char* name, int format) {
dataItems_.push_back(new ecmcDAQChannelItem(name, (ecmcDAQDataFormat)format));
void ecmcDAQDataChannel::addDataItem(const char* name, int format,int oldData) {
dataItems_.push_back(new ecmcDAQChannelItem(name, (ecmcDAQDataFormat)format, oldData));
itemCounter_++;
}

View File

@@ -23,7 +23,7 @@ class ecmcDAQDataChannel {
ecmcDAQDataChannel(int type);
~ecmcDAQDataChannel();
void connectToDataSources();
void addDataItem(const char* name, int format);
void addDataItem(const char* name, int format, int oldData);
size_t getDataElementCount();
double getData(int first);
bool empty();

View File

@@ -91,9 +91,9 @@ int createDAQChannel(int type) {
return 0;
}
int createDAQItem(const char* name, int type) {
int createDAQItem(const char* name, int type, int oldData) {
try {
arrays.back()->addDataItemToChannel(name,type);
arrays.back()->addDataItemToChannel(name,type,oldData);
}
catch(std::exception& e) {
printf("Exception: %s. Plugin will unload.\n",e.what());
@@ -104,6 +104,9 @@ int createDAQItem(const char* name, int type) {
}
void deleteAllDAQs() {
return; // The delete process results in seg fault.. need to investigate..
for(std::vector<ecmcDAQDataArray*>::iterator pDAQArray = arrays.begin(); pDAQArray != arrays.end(); ++pDAQArray) {
if(*pDAQArray) {
delete (*pDAQArray);
@@ -258,7 +261,7 @@ static void initCallFunc_1(const iocshArgBuf *args) {
*/
void ecmcAddDAQItemHelp() {
printf("\n");
printf(" Use ecmcAddDAQItem(<dataitem_name>, <format>)\n");
printf(" Use ecmcAddDAQItem(<dataitem_name>, <format>,<send_one_cycle_old_data>)\n");
printf(" <dataitem_name> : Data item name ex: 'ec0.s11.analogInput01' .\n");
printf(" <format> : Optional format conversion of data:.\n");
printf(" 0 = raw : Take raw value (do not apply special format)\n");
@@ -267,17 +270,18 @@ void ecmcAddDAQItemHelp() {
printf(" Useful for oversampling slaves where normally the nextsync time is available.\n");
printf(" The calculated time then would correspond to the first data in the array recived.\n");
printf(" 3 = time_ns_minus_period : Time: Raw value minus one period.\n");
printf(" <send_one_cycle_old_data> : Send data from the previous cycle (for scalars). If waveform the elemtes will be shifted one index");
printf("\n");
}
int ecmcAddDAQItem(const char* name, int format) {
int ecmcAddDAQItem(const char* name, int format, int oldData) {
if(strcmp(name,"-h") == 0 || strcmp(name,"--help") == 0 ) {
ecmcAddDAQItemHelp();
return asynSuccess;
}
try {
return createDAQItem(name,format);
return createDAQItem(name,format, oldData);
}
catch(std::exception& e) {
printf("Exception: %s. Create DAQ item failed.\n",e.what());
@@ -293,12 +297,16 @@ static const iocshArg initArg0_2 =
static const iocshArg initArg1_2 =
{ "Type", iocshArgInt };
static const iocshArg *const initArgs_2[] = { &initArg0_2,
&initArg1_2};
static const iocshArg initArg2_2 =
{ "Old value", iocshArgInt };
static const iocshFuncDef initFuncDef_2 = { "ecmcDAQAddItem", 2, initArgs_2};
static const iocshArg *const initArgs_2[] = { &initArg0_2,
&initArg1_2,
&initArg2_2};
static const iocshFuncDef initFuncDef_2 = { "ecmcDAQAddItem", 3, initArgs_2};
static void initCallFunc_2(const iocshArgBuf *args) {
ecmcAddDAQItem(args[0].sval,args[1].ival);
ecmcAddDAQItem(args[0].sval, args[1].ival, args[2].ival);
}

View File

@@ -53,10 +53,11 @@ int daqConstruct(char *configStr)
**/
void daqDestruct(void)
{
deleteAllDAQs();
if(lastConfStr){
free(lastConfStr);
}
// Segfaults here during destruction?! need to check..
//deleteAllDAQs();
//if(lastConfStr){
// free(lastConfStr);
//}
}
/** Optional function.