Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions fastFeedbackApp/src/framework/Commands.cc
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,14 @@ void IocshRegister::registerHelp() {
command.second += " Turns STATE=OFF to all loops. This releases all Fcom\n";
command.second += " and ChannelAccess connections.\n";
helpMap->insert(command);

command.first = "ffPatternGenMode";
command.second = "Usage: ffPatternMode <mode>\n";
command.second += " Sets the pattern generator mode.\n";
command.second += " Mode:\n";
command.second += " 0 - Disabled\n";
command.second += " 1 - Enabled\n";
helpMap->insert(command);
}

/** ffReboot ******************************************************************/
Expand Down Expand Up @@ -537,6 +545,19 @@ static void LoopShowEvents(const iocshArgBuf *args) {
EventLogger::getInstance().dump();
}

/** ffPatternGenMode *************************************************************/
static const iocshArg ffPatternGenMode_Arg0 = {"Mode (0-Disabled, 1-Enabled)", iocshArgInt};
static const iocshArg * const ffPatternGenMode_Args[1] = {&ffPatternGenMode_Arg0};
static const iocshFuncDef ffPatternGenMode_FuncDef = {"ffPatternGenMode", 1, ffPatternGenMode_Args};

static void ExecThreadSetPatternGenMode(const iocshArgBuf *args) {

std::cout << "Setting Pattern Gen Mode to Specified\n";
bool patternGenMode = args[0].ival;

ExecThread::getInstance().setPatternGenMode(patternGenMode);
}


/** Register all commands */
IocshRegister::IocshRegister() {
Expand Down Expand Up @@ -584,6 +605,8 @@ IocshRegister::IocshRegister() {

iocshRegister(&ffShowDevices_FuncDef, LoopShowDevices);
iocshRegister(&ffsd_FuncDef, LoopShowDevices);

iocshRegister(&ffPatternGenMode_FuncDef, ExecThreadSetPatternGenMode);

iocshRegister(&ffHelp_FuncDef, Help);
}
Expand Down
6 changes: 3 additions & 3 deletions fastFeedbackApp/src/framework/ExecConfiguration.cc
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ _s29AsumPv("S29_ASUM") {
} else {
Log::getInstance() << "ERROR: Failed to register algorithms." << Log::flush;
}

_hasPatternGenerator = false;
// Use Pattern Generator for now.
//_hasPatternGenerator = false;

std::cout << ">> ExecConfiguration instance created." << std::endl;
};
Expand Down Expand Up @@ -83,7 +83,7 @@ int ExecConfiguration::initialize() {
// differences.

// Use the pattern generator for now
_hasPatternGenerator = true;
//_hasPatternGenerator = true;

return 0;
}
Expand Down
4 changes: 2 additions & 2 deletions fastFeedbackApp/src/framework/ExecConfiguration.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class ExecConfiguration {
static ExecConfiguration &getInstance();
int getLoopIndex(std::string loopName);
int getSlotNames(std::vector<std::string> &slotNames);

//void setPatternGenMode(bool patternGenMode);
/**
* Map containing the feedback loop configurations, keyed by the
* loop (slot) name
Expand Down Expand Up @@ -93,7 +93,7 @@ class ExecConfiguration {
PvData<double> _s29AsumPv;

/** Set to true if PatternGenerator is configured. Used for testing only. */
bool _hasPatternGenerator;
//bool _hasPatternGenerator;
};

FF_NAMESPACE_END
Expand Down
20 changes: 18 additions & 2 deletions fastFeedbackApp/src/framework/ExecThread.cc
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ int ExecThread::preRun() {
// If the ExecConfiguration::_hasPatternGenerator is true, then start
// Generating patterns -> This must be called here, after the ca_context
// is created!
if (ExecConfiguration::getInstance()._hasPatternGenerator) {
if (_hasPatternGenerator) {
std::cout << "--- Starting PatternGenerator ... ";
PatternGenerator::getInstance().start();
std::cout << "done." << std::endl;
Expand Down Expand Up @@ -212,7 +212,7 @@ int ExecThread::stop() {

// If the ExecConfiguration::_hasPatternGenerator is true, then start
// Generating patterns
if (ExecConfiguration::getInstance()._hasPatternGenerator) {
if (_hasPatternGenerator) {
PatternGenerator::getInstance().stop();
}

Expand Down Expand Up @@ -438,3 +438,19 @@ void ExecThread::showLoopConfig(std::string loopName) {
std::cerr << "showLoopConfig command ERROR: " << e.what() << std::endl;
}
}

/**
* This method sets the mode for the pattern generation.
*
* @param patternGenMode:
* 0 - Disabled
* 1 - Enabled
* @author K.Leleux
*/

void ExecThread::setPatternGenMode(bool patternGenMode = false) {
//Set the _hasPatternGenMode
std::cout << "Setting Pattern Gen Mode\n";
_hasPatternGenerator = patternGenMode;
}

3 changes: 3 additions & 0 deletions fastFeedbackApp/src/framework/ExecThread.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ class ExecThread : public Thread {
int disconnectDevices();

static ExecThread &getInstance();
void setPatternGenMode(bool patternGenMode);

friend class ExecThreadTest;

Expand All @@ -97,6 +98,8 @@ class ExecThread : public Thread {

/** Flags that iocInit() can proceed -> used at statup time only */
bool _proceedWithIocInit;

bool _hasPatternGenerator;
};

FF_NAMESPACE_END
Expand Down