mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-13 05:17:13 +02:00
Fixpositions (#436)
* fix positions on server side * wip * numports wip * wip * jungfrau top inner interface row increment * x, y detpos, wip * removed eiger row indices flipping in gui (bottom flipping maintained) * wip * wip, jungfrau numinterfaces2 * jungfrau virtual works * eiger, jungfrau, g2 virtual server works * eiger positions fix, wip * binaries in * minor printout * binaries in * pointer bug * comment to define test_mod_geometry define
This commit is contained in:
Binary file not shown.
@ -2060,8 +2060,8 @@ void *start_timer(void *arg) {
|
||||
header->frameNumber = frameNr + iframes;
|
||||
header->packetNumber = i;
|
||||
header->modId = 0;
|
||||
header->row = detPos[X];
|
||||
header->column = detPos[Y];
|
||||
header->row = detPos[Y];
|
||||
header->column = detPos[X];
|
||||
|
||||
// fill data
|
||||
memcpy(packetData + sizeof(sls_detector_header),
|
||||
|
@ -1095,19 +1095,19 @@ int *Beb_GetDetectorPosition() { return Beb_positions; }
|
||||
int Beb_SetDetectorPosition(int pos[]) {
|
||||
if (!Beb_activated)
|
||||
return OK;
|
||||
LOG(logINFO, ("Got Position values %d %d...\n", pos[0], pos[1]));
|
||||
LOG(logINFO, ("Setting Position: (%d, %d)\n", pos[X], pos[Y]));
|
||||
|
||||
// save positions
|
||||
Beb_positions[0] = pos[0];
|
||||
Beb_positions[1] = pos[1];
|
||||
Beb_positions[Y] = pos[Y];
|
||||
Beb_positions[X] = pos[X];
|
||||
|
||||
// get left and right
|
||||
int posLeft[2] = {pos[0], Beb_top ? pos[1] : pos[1] + 1};
|
||||
int posRight[2] = {pos[0], Beb_top ? pos[1] + 1 : pos[1]};
|
||||
int posLeft[2] = {Beb_top ? pos[X] : pos[X] + 1, pos[Y]};
|
||||
int posRight[2] = {Beb_top ? pos[X] + 1 : pos[X], pos[Y]};
|
||||
|
||||
if (Beb_quadEnable) {
|
||||
posRight[0] = 1; // right is next row
|
||||
posRight[1] = 0; // right same first column
|
||||
posRight[Y] = 1; // right is next row
|
||||
posRight[X] = 0; // right same first column
|
||||
}
|
||||
|
||||
int ret = FAIL;
|
||||
@ -1122,7 +1122,7 @@ int Beb_SetDetectorPosition(int pos[]) {
|
||||
uint32_t value = 0;
|
||||
ret = OK;
|
||||
// x left
|
||||
int posval = Beb_swap_uint16(posLeft[0]);
|
||||
int posval = Beb_swap_uint16(posLeft[Y]);
|
||||
value = Beb_Read32(csp0base, UDP_HEADER_A_LEFT_OFST);
|
||||
value &= UDP_HEADER_ID_MSK; // to keep previous id value
|
||||
Beb_Write32(csp0base, UDP_HEADER_A_LEFT_OFST,
|
||||
@ -1134,7 +1134,7 @@ int Beb_SetDetectorPosition(int pos[]) {
|
||||
ret = FAIL;
|
||||
}
|
||||
// x right
|
||||
posval = Beb_swap_uint16(posRight[0]);
|
||||
posval = Beb_swap_uint16(posRight[Y]);
|
||||
value = Beb_Read32(csp0base, UDP_HEADER_A_RIGHT_OFST);
|
||||
value &= UDP_HEADER_ID_MSK; // to keep previous id value
|
||||
Beb_Write32(csp0base, UDP_HEADER_A_RIGHT_OFST,
|
||||
@ -1147,7 +1147,7 @@ int Beb_SetDetectorPosition(int pos[]) {
|
||||
}
|
||||
|
||||
// y left (column)
|
||||
posval = Beb_swap_uint16(posLeft[1]);
|
||||
posval = Beb_swap_uint16(posLeft[X]);
|
||||
value = Beb_Read32(csp0base, UDP_HEADER_B_LEFT_OFST);
|
||||
value &= UDP_HEADER_Z_MSK; // to keep previous z value
|
||||
Beb_Write32(csp0base, UDP_HEADER_B_LEFT_OFST,
|
||||
@ -1160,7 +1160,7 @@ int Beb_SetDetectorPosition(int pos[]) {
|
||||
}
|
||||
|
||||
// y right
|
||||
posval = Beb_swap_uint16(posRight[1]);
|
||||
posval = Beb_swap_uint16(posRight[X]);
|
||||
value = Beb_Read32(csp0base, UDP_HEADER_B_RIGHT_OFST);
|
||||
value &= UDP_HEADER_Z_MSK; // to keep previous z value
|
||||
Beb_Write32(csp0base, UDP_HEADER_B_RIGHT_OFST,
|
||||
@ -1176,10 +1176,10 @@ int Beb_SetDetectorPosition(int pos[]) {
|
||||
Beb_close(fd, csp0base);
|
||||
}
|
||||
if (ret == OK) {
|
||||
LOG(logINFO, ("Position set to...\n"
|
||||
LOG(logINFO, ("Position set to (col, row):\n"
|
||||
"\tLeft: [%d, %d]\n"
|
||||
"\tRight:[%d, %d]\n",
|
||||
posLeft[0], posLeft[1], posRight[0], posRight[1]));
|
||||
posLeft[X], posLeft[Y], posRight[X], posRight[Y]));
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
Binary file not shown.
@ -19,7 +19,7 @@
|
||||
#include <pthread.h>
|
||||
#include <time.h>
|
||||
#endif
|
||||
|
||||
extern int portno;
|
||||
// Global variable from slsDetectorServer_funcs
|
||||
extern int debugflag;
|
||||
extern int updateFlag;
|
||||
@ -2473,9 +2473,9 @@ void *start_timer(void *arg) {
|
||||
int maxPacketsPerFrame = (tgEnable ? 4 : 16) * dr;
|
||||
int npixelsx = 256 * 2 * bytesPerPixel;
|
||||
int databytes = 256 * 256 * 2 * bytesPerPixel;
|
||||
int row = eiger_virtual_detPos[0];
|
||||
int colLeft = top ? eiger_virtual_detPos[1] : eiger_virtual_detPos[1] + 1;
|
||||
int colRight = top ? eiger_virtual_detPos[1] + 1 : eiger_virtual_detPos[1];
|
||||
int row = eiger_virtual_detPos[Y];
|
||||
int colLeft = top ? eiger_virtual_detPos[X] : eiger_virtual_detPos[X] + 1;
|
||||
int colRight = top ? eiger_virtual_detPos[X] + 1 : eiger_virtual_detPos[X];
|
||||
|
||||
int readNRows = getReadNRows();
|
||||
if (readNRows == -1) {
|
||||
@ -2548,8 +2548,20 @@ void *start_timer(void *arg) {
|
||||
}
|
||||
break;
|
||||
case 16:
|
||||
// to debug multi module geometry (row, column) in virtual servers (all pixels
|
||||
// in a module set to particular value)
|
||||
#ifdef TEST_MOD_GEOMETRY
|
||||
if ((i % 1024) < 512) {
|
||||
*((uint16_t *)(imageData + i * sizeof(uint16_t))) =
|
||||
top ? (portno % 1900) : ((portno % 1900) + 1);
|
||||
} else {
|
||||
*((uint16_t *)(imageData + i * sizeof(uint16_t))) =
|
||||
top ? ((portno % 1900) + 1) : (portno % 1900);
|
||||
}
|
||||
#else
|
||||
*((uint16_t *)(imageData + i * sizeof(uint16_t))) =
|
||||
eiger_virtual_test_mode ? 0xFFE : (uint16_t)pixelVal;
|
||||
#endif
|
||||
break;
|
||||
case 32:
|
||||
*((uint32_t *)(imageData + i * sizeof(uint32_t))) =
|
||||
|
Binary file not shown.
@ -1917,7 +1917,7 @@ int setDetectorPosition(int pos[]) {
|
||||
int ret = OK;
|
||||
|
||||
// row
|
||||
value = detPos[X];
|
||||
value = detPos[Y];
|
||||
bus_w(addr, (bus_r(addr) & ~COORD_ROW_MSK) |
|
||||
((value << COORD_ROW_OFST) & COORD_ROW_MSK));
|
||||
valueRead = ((bus_r(addr) & COORD_ROW_MSK) >> COORD_ROW_OFST);
|
||||
@ -1928,7 +1928,7 @@ int setDetectorPosition(int pos[]) {
|
||||
}
|
||||
|
||||
// col
|
||||
value = detPos[Y];
|
||||
value = detPos[X];
|
||||
bus_w(addr, (bus_r(addr) & ~COORD_COL_MSK) |
|
||||
((value << COORD_COL_OFST) & COORD_COL_MSK));
|
||||
valueRead = ((bus_r(addr) & COORD_COL_MSK) >> COORD_COL_OFST);
|
||||
@ -1939,7 +1939,8 @@ int setDetectorPosition(int pos[]) {
|
||||
}
|
||||
|
||||
if (ret == OK) {
|
||||
LOG(logINFO, ("\tPosition set to [%d, %d]\n", detPos[X], detPos[Y]));
|
||||
LOG(logINFO,
|
||||
("\tPosition set to [%d, %d] #(col, row)\n", detPos[X], detPos[Y]));
|
||||
}
|
||||
|
||||
return ret;
|
||||
@ -3095,8 +3096,8 @@ void *start_timer(void *arg) {
|
||||
header->frameNumber = virtual_currentFrameNumber;
|
||||
header->packetNumber = 0;
|
||||
header->modId = virtual_moduleid;
|
||||
header->row = detPos[X];
|
||||
header->column = detPos[Y];
|
||||
header->row = detPos[Y];
|
||||
header->column = detPos[X];
|
||||
// fill data
|
||||
memcpy(packetData + sizeof(sls_detector_header), imageData,
|
||||
datasize);
|
||||
|
Binary file not shown.
Binary file not shown.
@ -21,7 +21,7 @@
|
||||
#include <pthread.h>
|
||||
#include <time.h>
|
||||
#endif
|
||||
|
||||
extern int portno;
|
||||
// Global variable from slsDetectorServer_funcs
|
||||
extern int debugflag;
|
||||
extern int updateFlag;
|
||||
@ -1621,6 +1621,7 @@ int configureMAC() {
|
||||
|
||||
int setDetectorPosition(int pos[]) {
|
||||
int ret = OK;
|
||||
// row, col
|
||||
uint32_t innerPos[2] = {pos[X], pos[Y]};
|
||||
uint32_t outerPos[2] = {pos[X], pos[Y]};
|
||||
int selInterface = getPrimaryInterface();
|
||||
@ -1630,15 +1631,16 @@ int setDetectorPosition(int pos[]) {
|
||||
("Setting detector position: 1 Interface %s \n(%d, %d)\n",
|
||||
(selInterface ? "Inner" : "Outer"), innerPos[X], innerPos[Y]));
|
||||
} else {
|
||||
++outerPos[X];
|
||||
// top has row incremented by 1
|
||||
++innerPos[Y];
|
||||
LOG(logDEBUG, ("Setting detector position: 2 Interfaces \n"
|
||||
" inner top(%d, %d), outer bottom(%d, %d)\n",
|
||||
innerPos[X], innerPos[Y], outerPos[X], outerPos[Y]));
|
||||
}
|
||||
detPos[0] = innerPos[0];
|
||||
detPos[1] = innerPos[1];
|
||||
detPos[2] = outerPos[0];
|
||||
detPos[3] = outerPos[1];
|
||||
detPos[0] = innerPos[X];
|
||||
detPos[1] = innerPos[Y];
|
||||
detPos[2] = outerPos[X];
|
||||
detPos[3] = outerPos[Y];
|
||||
|
||||
// row
|
||||
// outer
|
||||
@ -1676,8 +1678,8 @@ int setDetectorPosition(int pos[]) {
|
||||
|
||||
if (ret == OK) {
|
||||
if (getNumberofUDPInterfaces() == 1) {
|
||||
LOG(logINFOBLUE,
|
||||
("Position set to [%d, %d]\n", innerPos[X], innerPos[Y]));
|
||||
LOG(logINFOBLUE, ("Position set to [%d, %d] #(col, row)\n",
|
||||
innerPos[X], innerPos[Y]));
|
||||
} else {
|
||||
LOG(logINFOBLUE, (" Inner (top) position set to [%d, %d]\n",
|
||||
innerPos[X], innerPos[Y]));
|
||||
@ -2531,8 +2533,16 @@ void *start_timer(void *arg) {
|
||||
if (i > 0 && i % pixelsPerPacket == 0) {
|
||||
++pixelVal;
|
||||
}
|
||||
// to debug multi module geometry (row, column) in virtual servers (all pixels
|
||||
// in a module set to particular value)
|
||||
#ifdef TEST_MOD_GEOMETRY
|
||||
*((uint16_t *)(imageData + i * sizeof(uint16_t))) =
|
||||
portno % 1900 + (i >= npixels / 2 ? 1 : 0);
|
||||
#else
|
||||
*((uint16_t *)(imageData + i * sizeof(uint16_t))) =
|
||||
virtual_image_test_mode ? 0x0FFE : (uint16_t)pixelVal;
|
||||
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@ -2557,6 +2567,10 @@ void *start_timer(void *arg) {
|
||||
|
||||
int srcOffset = 0;
|
||||
int srcOffset2 = DATA_BYTES / 2;
|
||||
int row0 = (numInterfaces == 1 ? detPos[1] : detPos[3]);
|
||||
int col0 = (numInterfaces == 1 ? detPos[0] : detPos[2]);
|
||||
int row1 = detPos[1];
|
||||
int col1 = detPos[0];
|
||||
// loop packet (128 packets)
|
||||
for (int i = 0; i != maxPacketsPerFrame; ++i) {
|
||||
|
||||
@ -2576,8 +2590,8 @@ void *start_timer(void *arg) {
|
||||
header->frameNumber = frameNr + iframes;
|
||||
header->packetNumber = pnum;
|
||||
header->modId = 0;
|
||||
header->row = detPos[0];
|
||||
header->column = detPos[1];
|
||||
header->row = row0;
|
||||
header->column = col0;
|
||||
|
||||
// fill data
|
||||
memcpy(packetData + sizeof(sls_detector_header),
|
||||
@ -2603,8 +2617,8 @@ void *start_timer(void *arg) {
|
||||
header->frameNumber = frameNr + iframes;
|
||||
header->packetNumber = pnum;
|
||||
header->modId = 0;
|
||||
header->row = detPos[2];
|
||||
header->column = detPos[3];
|
||||
header->row = row1;
|
||||
header->column = col1;
|
||||
|
||||
// fill data
|
||||
memcpy(packetData2 + sizeof(sls_detector_header),
|
||||
|
Binary file not shown.
@ -1731,8 +1731,8 @@ void *start_timer(void *arg) {
|
||||
header->frameNumber = frameNr + iframes;
|
||||
header->packetNumber = i;
|
||||
header->modId = 0;
|
||||
header->row = detPos[X];
|
||||
header->column = detPos[Y];
|
||||
header->row = detPos[Y];
|
||||
header->column = detPos[X];
|
||||
|
||||
// fill data
|
||||
memcpy(packetData + sizeof(sls_detector_header),
|
||||
|
Binary file not shown.
@ -1941,7 +1941,7 @@ int setDetectorPosition(int pos[]) {
|
||||
int ret = OK;
|
||||
|
||||
// row
|
||||
value = detPos[X];
|
||||
value = detPos[Y];
|
||||
bus_w(addr, (bus_r(addr) & ~COORD_ROW_MSK) |
|
||||
((value << COORD_ROW_OFST) & COORD_ROW_MSK));
|
||||
valueRead = ((bus_r(addr) & COORD_ROW_MSK) >> COORD_ROW_OFST);
|
||||
@ -1952,7 +1952,7 @@ int setDetectorPosition(int pos[]) {
|
||||
}
|
||||
|
||||
// col
|
||||
value = detPos[Y];
|
||||
value = detPos[X];
|
||||
bus_w(addr, (bus_r(addr) & ~COORD_COL_MSK) |
|
||||
((value << COORD_COL_OFST) & COORD_COL_MSK));
|
||||
valueRead = ((bus_r(addr) & COORD_COL_MSK) >> COORD_COL_OFST);
|
||||
@ -1963,7 +1963,8 @@ int setDetectorPosition(int pos[]) {
|
||||
}
|
||||
|
||||
if (ret == OK) {
|
||||
LOG(logINFO, ("\tPosition set to [%d, %d]\n", detPos[X], detPos[Y]));
|
||||
LOG(logINFO,
|
||||
("\tPosition set to [%d, %d] #(col, row)\n", detPos[X], detPos[Y]));
|
||||
}
|
||||
|
||||
return ret;
|
||||
@ -2385,8 +2386,8 @@ void *start_timer(void *arg) {
|
||||
header->frameNumber = virtual_currentFrameNumber;
|
||||
header->packetNumber = i;
|
||||
header->modId = virtual_moduleid;
|
||||
header->row = detPos[X];
|
||||
header->column = detPos[Y];
|
||||
header->row = detPos[Y];
|
||||
header->column = detPos[X];
|
||||
|
||||
// fill data
|
||||
memcpy(packetData + sizeof(sls_detector_header),
|
||||
|
@ -39,6 +39,7 @@ extern int masterCommandLine;
|
||||
#ifdef EIGERD
|
||||
extern int topCommandLine;
|
||||
#endif
|
||||
int portno = DEFAULT_PORTNO;
|
||||
|
||||
void error(char *msg) { perror(msg); }
|
||||
|
||||
@ -50,7 +51,6 @@ void sigInterruptHandler(int p) {
|
||||
int main(int argc, char *argv[]) {
|
||||
|
||||
// options
|
||||
int portno = DEFAULT_PORTNO;
|
||||
isControlServer = 1;
|
||||
debugflag = 0;
|
||||
updateFlag = 0;
|
||||
|
@ -62,8 +62,8 @@ int firstUDPDestination = 0;
|
||||
|
||||
int configured = FAIL;
|
||||
char configureMessage[MAX_STR_LENGTH] = "udp parameters not configured yet";
|
||||
int maxydet = -1;
|
||||
int detectorId = -1;
|
||||
int maxYMods = -1;
|
||||
int moduleIndex = -1;
|
||||
|
||||
// Local variables
|
||||
int (*flist[NUM_DET_FUNCTIONS])(int);
|
||||
@ -81,27 +81,14 @@ char scanErrMessage[MAX_STR_LENGTH] = "";
|
||||
/* initialization functions */
|
||||
|
||||
int updateModeAllowedFunction(int file_des) {
|
||||
enum detFuncs allowedFuncs[] = {F_EXEC_COMMAND,
|
||||
F_GET_DETECTOR_TYPE,
|
||||
F_GET_FIRMWARE_VERSION,
|
||||
F_GET_SERVER_VERSION,
|
||||
F_GET_SERIAL_NUMBER,
|
||||
F_WRITE_REGISTER,
|
||||
F_READ_REGISTER,
|
||||
F_LOCK_SERVER,
|
||||
F_GET_LAST_CLIENT_IP,
|
||||
F_PROGRAM_FPGA,
|
||||
F_RESET_FPGA,
|
||||
F_CHECK_VERSION,
|
||||
F_REBOOT_CONTROLLER,
|
||||
F_GET_KERNEL_VERSION,
|
||||
F_UPDATE_KERNEL,
|
||||
F_UPDATE_DETECTOR_SERVER,
|
||||
F_GET_UPDATE_MODE,
|
||||
F_SET_UPDATE_MODE,
|
||||
F_GET_NUM_CHANNELS,
|
||||
F_GET_NUM_INTERFACES,
|
||||
F_ACTIVATE};
|
||||
enum detFuncs allowedFuncs[] = {
|
||||
F_EXEC_COMMAND, F_GET_DETECTOR_TYPE, F_GET_FIRMWARE_VERSION,
|
||||
F_GET_SERVER_VERSION, F_GET_SERIAL_NUMBER, F_WRITE_REGISTER,
|
||||
F_READ_REGISTER, F_LOCK_SERVER, F_GET_LAST_CLIENT_IP,
|
||||
F_PROGRAM_FPGA, F_RESET_FPGA, F_CHECK_VERSION,
|
||||
F_REBOOT_CONTROLLER, F_GET_KERNEL_VERSION, F_UPDATE_KERNEL,
|
||||
F_UPDATE_DETECTOR_SERVER, F_GET_UPDATE_MODE, F_SET_UPDATE_MODE,
|
||||
F_GET_NUM_CHANNELS, F_GET_NUM_INTERFACES, F_ACTIVATE};
|
||||
size_t allowedFuncsSize = sizeof(allowedFuncs) / sizeof(enum detFuncs);
|
||||
|
||||
for (unsigned int i = 0; i < allowedFuncsSize; ++i) {
|
||||
@ -129,6 +116,7 @@ void init_detector() {
|
||||
#ifdef VIRTUAL
|
||||
LOG(logINFO, ("This is a VIRTUAL detector\n"));
|
||||
udpDetails[0].srcip = LOCALHOSTIP_INT;
|
||||
udpDetails[0].srcip2 = LOCALHOSTIP_INT;
|
||||
#endif
|
||||
udpDetails[0].srcport = DEFAULT_UDP_SRC_PORTNO;
|
||||
udpDetails[0].dstport = DEFAULT_UDP_DST_PORTNO;
|
||||
@ -4700,7 +4688,7 @@ int get_read_n_rows(int file_des) {
|
||||
}
|
||||
|
||||
void calculate_and_set_position() {
|
||||
if (maxydet == -1 || detectorId == -1) {
|
||||
if (maxYMods == -1 || moduleIndex == -1) {
|
||||
ret = FAIL;
|
||||
sprintf(mess,
|
||||
"Could not set detector position (did not get multi size).\n");
|
||||
@ -4709,21 +4697,20 @@ void calculate_and_set_position() {
|
||||
}
|
||||
|
||||
// calculating new position
|
||||
int modulePorts[2] = {1, 1};
|
||||
int pos[2] = {0, 0};
|
||||
|
||||
int portGeometry[2] = {1, 1};
|
||||
// position does change for eiger and jungfrau (2 interfaces)
|
||||
#if defined(EIGERD)
|
||||
modulePorts[1] = getNumberofUDPInterfaces(); // horz
|
||||
portGeometry[X] = getNumberofUDPInterfaces(); // horz
|
||||
#elif defined(JUNGFRAUD)
|
||||
modulePorts[0] = getNumberofUDPInterfaces(); // vert
|
||||
portGeometry[Y] = getNumberofUDPInterfaces(); // vert
|
||||
#endif
|
||||
int maxy = maxydet * modulePorts[0];
|
||||
int pos[2] = {0, 0};
|
||||
// row
|
||||
pos[0] = (detectorId % maxy);
|
||||
// col for horiz. udp ports
|
||||
pos[1] = (detectorId / maxy) * modulePorts[1];
|
||||
|
||||
LOG(logDEBUG, ("Setting Positions (%d,%d)\n", pos[0], pos[1]));
|
||||
LOG(logDEBUG1, ("moduleIndex:%d maxymods:%d portGeo.x:%d portgeo.y:%d\n",
|
||||
moduleIndex, maxYMods, portGeometry[X], portGeometry[Y]));
|
||||
pos[Y] = (moduleIndex % maxYMods) * portGeometry[Y];
|
||||
pos[X] = (moduleIndex / maxYMods) * portGeometry[X];
|
||||
LOG(logINFO, ("Setting Positions (%d,%d) #(col, row)\n", pos[X], pos[Y]));
|
||||
if (setDetectorPosition(pos) == FAIL) {
|
||||
ret = FAIL;
|
||||
sprintf(mess, "Could not set detector position.\n");
|
||||
@ -4735,8 +4722,8 @@ void calculate_and_set_position() {
|
||||
if (udpDetails[0].srcmac == 0) {
|
||||
char dmac[MAC_ADDRESS_SIZE];
|
||||
memset(dmac, 0, MAC_ADDRESS_SIZE);
|
||||
sprintf(dmac, "aa:bb:cc:dd:%02x:%02x", pos[0] & 0xFF,
|
||||
pos[1] & 0xFF);
|
||||
sprintf(dmac, "aa:bb:cc:dd:%02x:%02x", pos[X] & 0xFF,
|
||||
pos[Y] & 0xFF);
|
||||
LOG(logINFO, ("Udp source mac address created: %s\n", dmac));
|
||||
unsigned char a[6];
|
||||
sscanf(dmac, "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx", &a[0], &a[1], &a[2],
|
||||
@ -4755,8 +4742,8 @@ void calculate_and_set_position() {
|
||||
if (udpDetails[0].srcmac2 == 0) {
|
||||
char dmac2[MAC_ADDRESS_SIZE];
|
||||
memset(dmac2, 0, MAC_ADDRESS_SIZE);
|
||||
sprintf(dmac2, "aa:bb:cc:dd:%02x:%02x", (pos[0] + 1) & 0xFF,
|
||||
pos[1] & 0xFF);
|
||||
sprintf(dmac2, "aa:bb:cc:dd:%02x:%02x", (pos[X] + 1) & 0xFF,
|
||||
pos[Y] & 0xFF);
|
||||
LOG(logINFO, ("Udp source mac address2 created: %s\n", dmac2));
|
||||
unsigned char a[6];
|
||||
sscanf(dmac2, "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx", &a[0], &a[1],
|
||||
@ -4784,15 +4771,16 @@ int set_detector_position(int file_des) {
|
||||
|
||||
if (receiveData(file_des, args, sizeof(args), INT32) < 0)
|
||||
return printSocketReadError();
|
||||
LOG(logINFO, ("Setting detector positions: [%u, %u]\n", args[0], args[1]));
|
||||
LOG(logDEBUG, ("Setting detector positions: [maxy:%u, modIndex:%u]\n",
|
||||
args[0], args[1]));
|
||||
|
||||
// only set
|
||||
if (Server_VerifyLock() == OK) {
|
||||
// if in update mode, there is no need to do this (also detector not set
|
||||
// up)
|
||||
if (!updateFlag && check_detector_idle("configure mac") == OK) {
|
||||
maxydet = args[0];
|
||||
detectorId = args[1];
|
||||
maxYMods = args[0];
|
||||
moduleIndex = args[1];
|
||||
calculate_and_set_position();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user