This commit is contained in:
2024-03-04 11:59:13 +01:00
3 changed files with 31 additions and 36 deletions

View File

@@ -25,6 +25,7 @@ DB_DIR = $(BASE_DIR)/Db
SOURCES += $(SRC_DIR)/ecmcDAQDataArray.cpp
SOURCES += $(SRC_DIR)/ecmcDAQDataChannel.cpp
SOURCES += $(SRC_DIR)/ecmcDAQWrap.cpp
SOURCES += $(SRC_DIR)/ecmcPluginDAQ.c
TEMPLATES += $(wildcard $(DB_DIR)/*.template)
SCRIPTS += ./startup.cmd

View File

@@ -39,13 +39,13 @@ static int alreadyLoaded = 0;
int daqConstruct(char *configStr)
{
if(alreadyLoaded) {
printf("Error: Plugin ecmc_plugin_daq already loaded and can only be loaded once.")
printf("Error: Plugin ecmc_plugin_daq already loaded and can only be loaded once.");
return -1;
}
// create FFT object and register data callback
lastConfStr = strdup(configStr);
return 0 //createDAQ(configStr); //create from iocsh commands instead
return 0; //createDAQ(configStr); //create from iocsh commands instead
}
/** Optional function.
@@ -92,9 +92,9 @@ int daqExitRT(void){
// }
// Plc function for enable
double daq_enable(double index, double enable) {
return (double)enableDAQ((int)index, (int)enable);
}
//double daq_enable(double index, double enable) {
// return 0; //(double)enableDAQ((int)index, (int)enable);
//}
// // Plc function for trigg new measurement (will clear buffers)
// double daq_trigg(double index) {
@@ -110,13 +110,7 @@ struct ecmcPluginData pluginDataDef = {
// Description
.desc = "DAQ plugin for use with ecmc.",
// Option description
.optionDesc = "\n "ECMC_PLUGIN_DBG_PRINT_OPTION_CMD"<1/0> : Enables/disables printouts from plugin, default = disabled.\n"
" "ECMC_PLUGIN_SOURCE_OPTION_CMD"<source> : Ec source variable (example: ec0.s1.mm.CH1_ARRAY).\n"
" "ECMC_PLUGIN_RESULT_ELEMENTS_OPTION_CMD"<Result buffer size> : Data points to collect, default = 4096.\n"
" "ECMC_PLUGIN_SOURCE_NEXTTIME_OPTION_CMD"<nexttime> : Ec next sync time for source (example: ec0.s1.NEXTTIME)\n"
" "ECMC_PLUGIN_TRIGG_OPTION_CMD"<trigger> : Ec trigg time (example: ec0.s2.LATCH_POS).\n"
" "ECMC_PLUGIN_ENABLE_OPTION_CMD"<1/0> : Enable data acq, defaults to enabled.\n"
,
.optionDesc = "\n "ECMC_PLUGIN_DBG_PRINT_OPTION_CMD"<1/0> : Enables/disables printouts from plugin, default = disabled.\n",
// Plugin version
.version = ECMC_EXAMPLE_PLUGIN_VERSION,
// Optional construct func, called once at load. NULL if not definded.
@@ -130,29 +124,29 @@ struct ecmcPluginData pluginDataDef = {
// Optional func that will be called once just before exit realtime mode
.realtimeExitFnc = daqExitRT,
// PLC funcs
.funcs[0] =
{ /*----fft_clear----*/
// Function name (this is the name you use in ecmc plc-code)
.funcName = "daq_enable",
// Function description
.funcDesc = "daq_enable(index,enable) : Enable/disaable daq[index].",
/**
* 12 different prototypes allowed (only doubles since reg in plc).
* Only funcArg${argCount} func shall be assigned the rest set to NULL.
**/
.funcArg0 = NULL,
.funcArg1 = NULL,
.funcArg2 = daq_enable,
.funcArg3 = NULL,
.funcArg4 = NULL,
.funcArg5 = NULL,
.funcArg6 = NULL,
.funcArg7 = NULL,
.funcArg8 = NULL,
.funcArg9 = NULL,
.funcArg10 = NULL,
.funcGenericObj = NULL,
},
.funcs[0] = {0},
// { /*----fft_clear----*/
// // Function name (this is the name you use in ecmc plc-code)
// .funcName = "daq_enable",
// // Function description
// .funcDesc = "daq_enable(index,enable) : Enable/disaable daq[index].",
// /**
// * 12 different prototypes allowed (only doubles since reg in plc).
// * Only funcArg${argCount} func shall be assigned the rest set to NULL.
// **/
// .funcArg0 = NULL,
// .funcArg1 = NULL,
// .funcArg2 = daq_enable,
// .funcArg3 = NULL,
// .funcArg4 = NULL,
// .funcArg5 = NULL,
// .funcArg6 = NULL,
// .funcArg7 = NULL,
// .funcArg8 = NULL,
// .funcArg9 = NULL,
// .funcArg10 = NULL,
// .funcGenericObj = NULL,
// },
.consts[0] = {0}, // last element set all to zero..
};

View File

@@ -17,4 +17,4 @@
#- Load plugin:
epicsEnvSet(ECMC_PLUGIN_FILNAME,"$(ecmc_plugin_daq_DIR)/lib/${EPICS_HOST_ARCH=linux-x86_64}/libecmc_plugin_daq.so")
epicsEnvSet(ECMC_PLUGIN_CONFIG,"DBG_PRINT=1;")
ecmcConfigOrDie "Cfg.LoadPlugin(${PLUGIN_ID},${ECMC_PLUGIN_FILNAME},${ECMC_PLUGIN_CONFIG=""})"
ecmcConfigOrDie "Cfg.LoadPlugin(${PLUGIN_ID}${ECMC_PLUGIN_FILNAME},${ECMC_PLUGIN_CONFIG=""},1)"