mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2026-02-13 23:18:40 +01:00
merge fix from developer
This commit is contained in:
@@ -10700,6 +10700,68 @@ std::string Caller::rx_dbitoffset(int action) {
|
||||
return os.str();
|
||||
}
|
||||
|
||||
std::string Caller::rx_dbitreorder(int action) {
|
||||
|
||||
std::ostringstream os;
|
||||
// print help
|
||||
if (action == slsDetectorDefs::HELP_ACTION) {
|
||||
os << R"V0G0N([0, 1]
|
||||
[Ctb] Reorder digital data such that it groups each signal (0-63) from all the different samples together . Default is 1. Setting to 0 means 'do not reorder' and to keep what the board spits out, which is that all signals in a sample are grouped together. )V0G0N"
|
||||
<< std::endl;
|
||||
return os.str();
|
||||
}
|
||||
|
||||
// check if action and arguments are valid
|
||||
if (action == slsDetectorDefs::GET_ACTION) {
|
||||
if (1 && args.size() != 0) {
|
||||
throw RuntimeError("Wrong number of arguments for action GET");
|
||||
}
|
||||
|
||||
if (args.size() == 0) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
else if (action == slsDetectorDefs::PUT_ACTION) {
|
||||
if (1 && args.size() != 1) {
|
||||
throw RuntimeError("Wrong number of arguments for action PUT");
|
||||
}
|
||||
|
||||
if (args.size() == 1) {
|
||||
try {
|
||||
StringTo<bool>(args[0]);
|
||||
} catch (...) {
|
||||
throw RuntimeError("Could not convert argument 0 to bool");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
else {
|
||||
|
||||
throw RuntimeError("INTERNAL ERROR: Invalid action: supported actions "
|
||||
"are ['GET', 'PUT']");
|
||||
}
|
||||
|
||||
// generate code for each action
|
||||
if (action == slsDetectorDefs::GET_ACTION) {
|
||||
if (args.size() == 0) {
|
||||
auto t = det->getRxDbitReorder(std::vector<int>{det_id});
|
||||
os << OutString(t) << '\n';
|
||||
}
|
||||
}
|
||||
|
||||
if (action == slsDetectorDefs::PUT_ACTION) {
|
||||
if (args.size() == 1) {
|
||||
auto arg0 = StringTo<bool>(args[0]);
|
||||
det->setRxDbitReorder(arg0, std::vector<int>{det_id});
|
||||
os << args.front() << '\n';
|
||||
}
|
||||
}
|
||||
|
||||
return os.str();
|
||||
}
|
||||
|
||||
std::string Caller::rx_discardpolicy(int action) {
|
||||
|
||||
std::ostringstream os;
|
||||
|
||||
@@ -236,6 +236,7 @@ class Caller {
|
||||
std::string rx_clearroi(int action);
|
||||
std::string rx_dbitlist(int action);
|
||||
std::string rx_dbitoffset(int action);
|
||||
std::string rx_dbitreorder(int action);
|
||||
std::string rx_discardpolicy(int action);
|
||||
std::string rx_fifodepth(int action);
|
||||
std::string rx_frameindex(int action);
|
||||
@@ -582,6 +583,7 @@ class Caller {
|
||||
{"rx_clearroi", &Caller::rx_clearroi},
|
||||
{"rx_dbitlist", &Caller::rx_dbitlist},
|
||||
{"rx_dbitoffset", &Caller::rx_dbitoffset},
|
||||
{"rx_dbitreorder", &Caller::rx_dbitreorder},
|
||||
{"rx_discardpolicy", &Caller::rx_discardpolicy},
|
||||
{"rx_fifodepth", &Caller::rx_fifodepth},
|
||||
{"rx_frameindex", &Caller::rx_frameindex},
|
||||
|
||||
@@ -2277,6 +2277,14 @@ void Detector::setRxDbitOffset(int value, Positions pos) {
|
||||
pimpl->Parallel(&Module::setReceiverDbitOffset, pos, value);
|
||||
}
|
||||
|
||||
Result<bool> Detector::getRxDbitReorder(Positions pos) const {
|
||||
return pimpl->Parallel(&Module::getReceiverDbitReorder, pos);
|
||||
}
|
||||
|
||||
void Detector::setRxDbitReorder(bool reorder, Positions pos) {
|
||||
pimpl->Parallel(&Module::setReceiverDbitReorder, pos, reorder);
|
||||
}
|
||||
|
||||
void Detector::setDigitalIODelay(uint64_t pinMask, int delay, Positions pos) {
|
||||
pimpl->Parallel(&Module::setDigitalIODelay, pos, pinMask, delay);
|
||||
}
|
||||
|
||||
@@ -2509,6 +2509,15 @@ void Module::setReceiverDbitOffset(int value) {
|
||||
sendToReceiver(F_SET_RECEIVER_DBIT_OFFSET, value, nullptr);
|
||||
}
|
||||
|
||||
bool Module::getReceiverDbitReorder() const {
|
||||
return sendToReceiver<int>(F_GET_RECEIVER_DBIT_REORDER);
|
||||
}
|
||||
|
||||
void Module::setReceiverDbitReorder(bool reorder) {
|
||||
sendToReceiver(F_SET_RECEIVER_DBIT_REORDER, static_cast<int>(reorder),
|
||||
nullptr);
|
||||
}
|
||||
|
||||
void Module::setDigitalIODelay(uint64_t pinMask, int delay) {
|
||||
uint64_t args[]{pinMask, static_cast<uint64_t>(delay)};
|
||||
sendToDetector(F_DIGITAL_IO_DELAY, args, nullptr);
|
||||
|
||||
@@ -510,6 +510,8 @@ class Module : public virtual slsDetectorDefs {
|
||||
void setReceiverDbitList(std::vector<int> list);
|
||||
int getReceiverDbitOffset() const;
|
||||
void setReceiverDbitOffset(int value);
|
||||
bool getReceiverDbitReorder() const;
|
||||
void setReceiverDbitReorder(bool value);
|
||||
void setDigitalIODelay(uint64_t pinMask, int delay);
|
||||
bool getLEDEnable() const;
|
||||
void setLEDEnable(bool enable);
|
||||
|
||||
@@ -2568,6 +2568,22 @@ int InferAction::rx_dbitoffset() {
|
||||
}
|
||||
}
|
||||
|
||||
int InferAction::rx_dbitreorder() {
|
||||
|
||||
if (args.size() == 0) {
|
||||
return slsDetectorDefs::GET_ACTION;
|
||||
}
|
||||
|
||||
if (args.size() == 1) {
|
||||
return slsDetectorDefs::PUT_ACTION;
|
||||
}
|
||||
|
||||
else {
|
||||
|
||||
throw RuntimeError("Could not infer action: Wrong number of arguments");
|
||||
}
|
||||
}
|
||||
|
||||
int InferAction::rx_discardpolicy() {
|
||||
|
||||
if (args.size() == 0) {
|
||||
|
||||
@@ -193,6 +193,7 @@ class InferAction {
|
||||
int rx_clearroi();
|
||||
int rx_dbitlist();
|
||||
int rx_dbitoffset();
|
||||
int rx_dbitreorder();
|
||||
int rx_discardpolicy();
|
||||
int rx_fifodepth();
|
||||
int rx_frameindex();
|
||||
@@ -527,6 +528,7 @@ class InferAction {
|
||||
{"rx_clearroi", &InferAction::rx_clearroi},
|
||||
{"rx_dbitlist", &InferAction::rx_dbitlist},
|
||||
{"rx_dbitoffset", &InferAction::rx_dbitoffset},
|
||||
{"rx_dbitreorder", &InferAction::rx_dbitreorder},
|
||||
{"rx_discardpolicy", &InferAction::rx_discardpolicy},
|
||||
{"rx_fifodepth", &InferAction::rx_fifodepth},
|
||||
{"rx_frameindex", &InferAction::rx_frameindex},
|
||||
|
||||
Reference in New Issue
Block a user