mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-21 17:18:00 +02:00
2. Dev/add jf pedestal feature (#807)
This commit is contained in:
@ -58,6 +58,9 @@ std::ostream &operator<<(std::ostream &os,
|
||||
std::string ToString(const slsDetectorDefs::currentSrcParameters &r);
|
||||
std::ostream &operator<<(std::ostream &os,
|
||||
const slsDetectorDefs::currentSrcParameters &r);
|
||||
std::string ToString(const slsDetectorDefs::pedestalParameters &r);
|
||||
std::ostream &operator<<(std::ostream &os,
|
||||
const slsDetectorDefs::pedestalParameters &r);
|
||||
const std::string &ToString(const std::string &s);
|
||||
|
||||
/** Convert std::chrono::duration with specified output unit */
|
||||
@ -316,6 +319,7 @@ template <> defs::vetoAlgorithm StringTo(const std::string &s);
|
||||
template <> defs::gainMode StringTo(const std::string &s);
|
||||
template <> defs::polarity StringTo(const std::string &s);
|
||||
|
||||
template <> uint8_t StringTo(const std::string &s);
|
||||
template <> uint16_t StringTo(const std::string &s);
|
||||
template <> uint32_t StringTo(const std::string &s);
|
||||
template <> uint64_t StringTo(const std::string &s);
|
||||
|
@ -547,6 +547,29 @@ enum streamingInterface {
|
||||
}
|
||||
} __attribute__((packed));
|
||||
|
||||
struct pedestalParameters {
|
||||
int enable;
|
||||
uint8_t frames;
|
||||
uint16_t loops;
|
||||
|
||||
/** [Jungfrau] disable */
|
||||
pedestalParameters() : enable(0), frames(0), loops(0) {}
|
||||
|
||||
/** [Jungfrau] enable */
|
||||
pedestalParameters(uint8_t pedestalFrames, uint16_t pedestalLoops)
|
||||
: enable(1), frames(pedestalFrames), loops(pedestalLoops) {
|
||||
if (frames == 0 || loops == 0) {
|
||||
throw sls::RuntimeError(
|
||||
"Pedestal frames or loops cannot be 0.");
|
||||
}
|
||||
}
|
||||
|
||||
bool operator==(const pedestalParameters &other) const {
|
||||
return ((enable == other.enable) && (frames == other.frames) &&
|
||||
(loops == other.loops));
|
||||
}
|
||||
} __attribute__((packed));
|
||||
|
||||
/**
|
||||
* structure to udpate receiver
|
||||
*/
|
||||
|
@ -290,6 +290,8 @@ enum detFuncs {
|
||||
F_SET_ROW,
|
||||
F_GET_COLUMN,
|
||||
F_SET_COLUMN,
|
||||
F_GET_PEDESTAL_MODE,
|
||||
F_SET_PEDESTAL_MODE,
|
||||
|
||||
NUM_DET_FUNCTIONS,
|
||||
RECEIVER_ENUM_START = 512, /**< detector function should not exceed this
|
||||
@ -687,6 +689,8 @@ const char* getFunctionNameFromEnum(enum detFuncs func) {
|
||||
case F_SET_ROW: return "F_SET_ROW";
|
||||
case F_GET_COLUMN: return "F_GET_COLUMN";
|
||||
case F_SET_COLUMN: return "F_SET_COLUMN";
|
||||
case F_GET_PEDESTAL_MODE: return "F_GET_PEDESTAL_MODE";
|
||||
case F_SET_PEDESTAL_MODE: return "F_SET_PEDESTAL_MODE";
|
||||
|
||||
case NUM_DET_FUNCTIONS: return "NUM_DET_FUNCTIONS";
|
||||
case RECEIVER_ENUM_START: return "RECEIVER_ENUM_START";
|
||||
|
@ -4,10 +4,10 @@
|
||||
#define RELEASE "developer"
|
||||
#define APILIB "developer 0x230224"
|
||||
#define APIRECEIVER "developer 0x230224"
|
||||
#define APICTB "developer 0x230922"
|
||||
#define APIGOTTHARD "developer 0x230922"
|
||||
#define APICTB "developer 0x230922"
|
||||
#define APIGOTTHARD "developer 0x230922"
|
||||
#define APIGOTTHARD2 "developer 0x230922"
|
||||
#define APIJUNGFRAU "developer 0x230922"
|
||||
#define APIMYTHEN3 "developer 0x230922"
|
||||
#define APIMOENCH "developer 0x230922"
|
||||
#define APIEIGER "developer 0x230922"
|
||||
#define APIMYTHEN3 "developer 0x230922"
|
||||
#define APIMOENCH "developer 0x230922"
|
||||
#define APIEIGER "developer 0x230922"
|
||||
#define APIJUNGFRAU "developer 0x230928"
|
||||
|
@ -155,6 +155,23 @@ std::ostream &operator<<(std::ostream &os,
|
||||
return os << ToString(r);
|
||||
}
|
||||
|
||||
std::string ToString(const slsDetectorDefs::pedestalParameters &r) {
|
||||
std::ostringstream oss;
|
||||
oss << '[';
|
||||
if (r.enable)
|
||||
oss << "enabled, " << std::to_string(r.frames) << ", " << r.loops;
|
||||
else
|
||||
oss << "disabled";
|
||||
|
||||
oss << ']';
|
||||
return oss.str();
|
||||
}
|
||||
|
||||
std::ostream &operator<<(std::ostream &os,
|
||||
const slsDetectorDefs::pedestalParameters &r) {
|
||||
return os << ToString(r);
|
||||
}
|
||||
|
||||
std::string ToString(const defs::runStatus s) {
|
||||
switch (s) {
|
||||
case defs::ERROR:
|
||||
@ -1083,6 +1100,17 @@ template <> defs::polarity StringTo(const std::string &s) {
|
||||
throw RuntimeError("Unknown polarity mode " + s);
|
||||
}
|
||||
|
||||
template <> uint8_t StringTo(const std::string &s) {
|
||||
int base = s.find("0x") != std::string::npos ? 16 : 10;
|
||||
int value = std::stoi(s, nullptr, base);
|
||||
if (value < std::numeric_limits<uint8_t>::min() ||
|
||||
value > std::numeric_limits<uint8_t>::max()) {
|
||||
throw RuntimeError("Cannot scan uint8_t from string '" + s +
|
||||
"'. Value must be in range 0 - 255.");
|
||||
}
|
||||
return static_cast<uint8_t>(value);
|
||||
}
|
||||
|
||||
template <> uint16_t StringTo(const std::string &s) {
|
||||
int base = s.find("0x") != std::string::npos ? 16 : 10;
|
||||
int value = std::stoi(s, nullptr, base);
|
||||
|
Reference in New Issue
Block a user