added save pattern, printout of some of the pattern for command line

This commit is contained in:
2019-08-27 16:41:38 +02:00
parent 7abb18e5c8
commit f123a280bb
5 changed files with 85 additions and 15 deletions

View File

@ -3282,6 +3282,45 @@ void multiSlsDetector::setPattern(const std::string &fname, int detPos) {
parallelCall(&slsDetector::setPattern, fname);
}
void multiSlsDetector::savePattern(const std::string &fname) {
std::ofstream outfile;
outfile.open(fname.c_str(), std::ios_base::out);
if (!outfile.is_open()) {
throw RuntimeError("Could not create file to save pattern");
}
// get pattern limits
auto r = getPatternLoops(-1);
// pattern words
for (int i = r[0]; i <= r[1]; ++i) {
std::ostringstream os;
os << "patword 0x" << std::hex << i;
std::string cmd = os.str();
multiSlsDetectorClient(cmd, GET_ACTION, this, outfile);
}
// rest of pattern file
const std::vector<std::string> commands{
"patioctrl",
"patclkctrl",
"patlimits",
"patloop0",
"patnloop0",
"patloop1",
"patnloop1",
"patloop2",
"patnloop2",
"patwait0",
"patwaittime0",
"patwait1",
"patwaittime1",
"patwait2",
"patwaittime2",
"patmask",
"patsetbit",
};
for (const auto &cmd : commands)
multiSlsDetectorClient(cmd, GET_ACTION, this, outfile);
}
uint64_t multiSlsDetector::setPatternIOControl(uint64_t word, int detPos) {
// single
if (detPos >= 0) {