forgot to map down from 10bit
This commit is contained in:
@@ -444,13 +444,13 @@ asynStatus asynStreamGeneratorDriver::writeInt32(asynUser *pasynUser,
|
||||
} else if (function == P_EnableElectronics) {
|
||||
if (value) {
|
||||
setIntegerParam(function, 1);
|
||||
CommandHeader ch(start);
|
||||
CommandHeader ch(CommandId::start);
|
||||
std::size_t written;
|
||||
pasynOctetSyncIO->write(pasynUDPUser, (char *)&ch, sizeof(ch), 1,
|
||||
&written);
|
||||
} else {
|
||||
setIntegerParam(function, 0);
|
||||
CommandHeader ch(stop);
|
||||
CommandHeader ch(CommandId::stop);
|
||||
std::size_t written;
|
||||
pasynOctetSyncIO->write(pasynUDPUser, (char *)&ch, sizeof(ch), 1,
|
||||
&written);
|
||||
@@ -566,6 +566,8 @@ void asynStreamGeneratorDriver::normaliseUDP() {
|
||||
|
||||
lastBufferNumber[header->McpdID] = header->BufferNumber;
|
||||
|
||||
// TODO I think monitor and detector events aren't mixed, so we
|
||||
// could do the check once
|
||||
for (std::size_t i = 0; i < total_events; ++i) {
|
||||
char *event = (buffer + 21 * 2 + i * 6);
|
||||
const bool isMonitorEvent = event[5] & 0x80;
|
||||
|
||||
@@ -12,7 +12,12 @@
|
||||
/*******************************************************************************
|
||||
* UDP Packet Definitions
|
||||
*/
|
||||
enum CommandId : std::int16_t { reset = 0, start = 1, stop = 2, cont = 3 };
|
||||
enum class CommandId : std::uint16_t {
|
||||
reset = 0,
|
||||
start = 1,
|
||||
stop = 2,
|
||||
cont = 3
|
||||
};
|
||||
|
||||
struct __attribute__((__packed__)) CommandHeader {
|
||||
uint16_t BufferLength;
|
||||
@@ -29,8 +34,11 @@ struct __attribute__((__packed__)) CommandHeader {
|
||||
|
||||
CommandHeader(const CommandId commandId)
|
||||
: BufferLength(10), BufferType(0x8000), HeaderLength(10),
|
||||
BufferNumber(0), Command(commandId), McpdIdStatus(0), TimeStampLo(0),
|
||||
TimeStampMid(0), TimeStampHigh(0), Checksum(0), Finalizer(0xffff) {
|
||||
BufferNumber(0),
|
||||
Command(
|
||||
static_cast<std::underlying_type<CommandId>::type>(commandId)),
|
||||
McpdIdStatus(0), TimeStampLo(0), TimeStampMid(0), TimeStampHigh(0),
|
||||
Checksum(0), Finalizer(0xffff) {
|
||||
|
||||
Checksum = BufferLength ^ BufferType ^ HeaderLength ^ BufferNumber ^
|
||||
Command ^ McpdIdStatus ^ TimeStampLo ^ TimeStampMid ^
|
||||
@@ -66,11 +74,12 @@ struct __attribute__((__packed__)) DetectorEvent {
|
||||
uint16_t Amplitude : 8;
|
||||
uint16_t Id : 1;
|
||||
inline uint32_t nanosecs() const { return TimeStamp * 100; }
|
||||
inline uint64_t pixelId(uint32_t mpcdId) const {
|
||||
inline uint32_t pixelId(uint32_t mpcdId) const {
|
||||
const uint32_t x_pixels = 128;
|
||||
const uint32_t y_pixels = 128;
|
||||
return (mpcdId - 1) * x_pixels * y_pixels +
|
||||
x_pixels * (uint32_t)this->XPosition + (uint32_t)this->YPosition;
|
||||
x_pixels * (uint32_t)(this->XPosition >> 3) +
|
||||
(uint32_t)(this->YPosition >> 3);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user