Changeset 10099
- Timestamp:
- 01/11/11 14:44:34 (14 years ago)
- Location:
- fact/FADctrl
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
fact/FADctrl/FAD.cc
r10098 r10099 57 57 MainThread = pthread_self(); 58 58 Mode = idle; 59 EventUpdateDelay = atof(GetConfig("EventUpdateDelay", "0.5").c_str()) *1e6;59 EventUpdateDelay = atof(GetConfig("EventUpdateDelay", "0.5").c_str()); 60 60 61 61 // DIM console service used in PrintMessage() … … 70 70 // Construct boards 71 71 BoardList = Tokenize(GetConfig("BoardList","129.217.160.119")); 72 72 BoardList = Tokenize("192.33.99.225"); 73 printf("%s ", BoardList[0].c_str()); 73 74 for (unsigned int i=0; i<BoardList.size(); i++) { 74 75 Boards.push_back(new class FADBoard(BoardList[i], 5000, this, i)); … … 649 650 vector<struct FADBoard::BoardStatus> Status; 650 651 vector<unsigned short> ROICmd; 651 unsigned short DACCmd[] = {htons(CMD_Write | (BADDR_DAC + 2)), 0};652 unsigned short DACCmd[] = {htons(CMD_Write | (BADDR_DAC + 1)), 0, htons(CMD_Write | (BADDR_DAC + 2)), 0, htons(CMD_Write | (BADDR_DAC + 3)), 0}; 652 653 653 654 /* Procedure … … 683 684 // Set DAC first value 684 685 DACCmd[1] = htons(0); 686 DACCmd[3] = htons(0); 687 DACCmd[5] = htons(0); 685 688 Boards[Brd]->Send(DACCmd, sizeof(DACCmd)); 686 689 … … 715 718 // Set second DAC value 716 719 DACCmd[1] = htons(50000); 720 DACCmd[3] = htons(50000); 721 DACCmd[5] = htons(50000); 717 722 Boards[Brd]->Send(DACCmd, sizeof(DACCmd)); 718 723 … … 754 759 Boards[Brd]->Send(&ROICmd[0], ROICmd.size()*sizeof(unsigned short)); 755 760 756 DACCmd[1] = htons(Status[Brd].DAC[2]); 761 DACCmd[1] = htons(Status[Brd].DAC[1]); 762 DACCmd[3] = htons(Status[Brd].DAC[2]); 763 DACCmd[5] = htons(Status[Brd].DAC[3]); 757 764 Boards[Brd]->Send(DACCmd, sizeof(DACCmd)); 758 765 … … 842 849 // Update loop 843 850 while (!ExitRequest) { 844 usleep(EventUpdateDelay );851 usleep(EventUpdateDelay*1e6); 845 852 846 853 // Update run and event header with current time -
fact/FADctrl/FADBoard.cc
r10080 r10099 182 182 183 183 static char Buffer[READ_BUFFER_SIZE]; 184 static unsigned int Pos = 0 ;184 static unsigned int Pos = 0, Temp; 185 185 const PEVNT_HEADER *Header = (PEVNT_HEADER *) Buffer; 186 186 ssize_t Result; … … 218 218 } 219 219 220 // Check if full event available in buffer 221 if (Pos < sizeof(PEVNT_HEADER) || ntohs(Header->start_package_flag) != 0xfb01) continue; 220 // Check if buffer starts with start_package_flag, remove data if not 221 Temp = 0; 222 while (ntohs(Header->start_package_flag) != 0xfb01 && Pos > 0) { 223 memmove(Buffer, Buffer+1, Pos-1); 224 Pos--; 225 Temp++; 226 } 227 if (Temp != 0) { 228 printf("Removed %d bytes because of start_package_flag not found\n", Temp); 229 continue; 230 } 231 232 // Wait until the buffer contains at least enough bytes to potentially hold a PEVNT_HEADER 233 if (Pos < sizeof(PEVNT_HEADER)) continue; 222 234 223 235 unsigned int Length = ntohs(Header->package_length)*2*sizeof(char); -
fact/FADctrl/FADctrl.cc
r10095 r10099 116 116 117 117 //ETHZ 118 //static char Hostname[] = "192.33.99.225";118 static char Hostname[] = "192.33.99.225"; 119 119 //TUDO 120 static char Hostname[] = "129.217.160.119";120 //static char Hostname[] = "129.217.160.119"; 121 121 int List[] = {5001, 5002, 5003, 5004, 5005, 5006, 5007}; 122 122 int Socket[sizeof(List)/sizeof(int)], MaxSocketNum=0, Ret;
Note:
See TracChangeset
for help on using the changeset viewer.