injectchannel WIP

This commit is contained in:
2019-11-13 15:11:11 +01:00
parent 5ee3f5cf4c
commit 28a5aa8342
13 changed files with 185 additions and 4 deletions

View File

@ -1017,7 +1017,33 @@ std::string CmdProxy::ClearROI(int action) {
return os.str();
}
/* Gotthard2 Specific */
std::string CmdProxy::InjectChannel(int action) {
std::ostringstream os;
os << cmd << ' ';
if (action == defs::HELP_ACTION) {
os << "[offset] [increment]\n\t[Gotthard2] Inject channels with current source for calibration. Offset is starting channel that is injected, increment determines succeeding channels to be injected." << '\n';
} else if (action == defs::GET_ACTION) {
if (args.size() != 0) {
WrongNumberOfParameters(0);
}
auto t = det->getInjectChannel({det_id});
os << OutString(t) << '\n';
} else if (action == defs::PUT_ACTION) {
if (args.size() != 2) {
WrongNumberOfParameters(2);
}
det->setInjectChannel(std::stoi(args[0]), std::stoi(args[1]),{det_id});
os << sls::ToString(args) << '\n';
} else {
throw sls::RuntimeError("Unknown action");
}
return os.str();
}
/* CTB Specific */
std::string CmdProxy::Samples(int action) {

View File

@ -1086,6 +1086,16 @@ void Detector::setImageTestMode(int value, Positions pos) {
pimpl->Parallel(&slsDetector::setImageTestMode, pos, value);
}
// Gotthard2 Specific
Result<std::array<int, 2>> Detector::getInjectChannel(Positions pos) {
return pimpl->Parallel(&slsDetector::getInjectChannel, pos);
}
void Detector::setInjectChannel(int offsetChannel, int incrementChannel, Positions pos) {
pimpl->Parallel(&slsDetector::setInjectChannel, pos, offsetChannel, incrementChannel);
}
// CTB Specific
Result<int> Detector::getNumberOfAnalogSamples(Positions pos) const {

View File

@ -2345,6 +2345,19 @@ void slsDetector::setImageTestMode(const int value) {
sendToDetector(F_SET_IMAGE_TEST_MODE, value, nullptr);
}
std::array<int, 2> slsDetector::getInjectChannel() {
std::array<int, 2> retvals{};
sendToDetector(F_GET_INJECT_CHANNEL, nullptr, retvals);
FILE_LOG(logDEBUG1) << "Inject Channel: [offset: " << retvals[0] << ", increment: " << retvals[1] << ']';
return retvals;
}
void slsDetector::setInjectChannel(int offsetChannel, int incrementChannel) {
int args[]{offsetChannel, incrementChannel};
FILE_LOG(logDEBUG1) << "Setting inject channels [offset: " << offsetChannel << ", increment: " << incrementChannel << ']';
sendToDetector(F_SET_INJECT_CHANNEL, args, nullptr);
}
int slsDetector::setCounterBit(int cb) {
int retval = -1;
FILE_LOG(logDEBUG1) << "Sending counter bit " << cb;