Changeset 11980 for trunk/FACT++
- Timestamp:
- 09/06/11 09:36:59 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/biasctrl.cc
r11973 r11980 61 61 bool fWaitingForAnswer; 62 62 63 vector<uint64_t> fCounter; 64 63 65 protected: 64 66 vector<uint16_t> fVolt; // Current voltage in DAC units (12bit = 90V) … … 320 322 // Cancel sending of the next 0 321 323 fSyncTimer.cancel(); 324 fCounter[0]++; 322 325 323 326 // Start continous reading of all channels … … 335 338 336 339 337 // Take action depending on what is going on 338 if (command==kCmdReset) 339 Message("Reset command successfully answered."); 340 340 // Check if new values have been received 341 341 if (cmd==kCmdRead || cmd==kCmdChannelSet || cmd==kExpertChannelSet) 342 342 { … … 345 345 } 346 346 347 if (cmd==kCmdReset || command==kResetChannels) 348 { 347 // ----- Take action depending on what is going on ----- 348 349 if (command==kCmdReset) 350 { 351 Message("Reset command successfully answered... restarting automatic readout."); 352 353 fCounter[1]++; 354 349 355 // Re-start cyclic reading of values after a short time 350 // to allow the currents to become stable 356 // to allow the currents to become stable. This ensures that 357 // we get an update soon but wait long enough to get reasonable 358 // values 351 359 fUpdateTimer.cancel(); 352 360 ScheduleUpdate(100); 353 361 } 354 362 363 if (command==kResetChannels) 364 { 365 ExpertReset(false); 366 fCounter[5]++; 367 } 368 355 369 if (command==kUpdate) 370 { 356 371 ScheduleUpdate(fUpdateTime); 372 fCounter[2]++; 373 } 357 374 358 375 // If we are ramping, schedule a new ramp step … … 360 377 { 361 378 ScheduleRampStep(); 362 return; 363 } 379 fCounter[3]++; 380 } 381 382 if (command==kCmdRead) 383 fCounter[4]++; 384 385 if ((command&0xff)==kExpertChannelSet) 386 fCounter[6]++; 387 388 if (command==kCmdGlobalSet) 389 fCounter[7]++; 390 364 391 } 365 392 … … 424 451 case kResetChannels: 425 452 case kCmdRead: 453 fWaitingForAnswer = false; 426 454 HandleReceivedData(fBuffer, bytes_received, command, send_counter); 427 fWaitingForAnswer = false;428 455 return; 429 456 … … 687 714 fIsRamping(false), 688 715 fWaitingForAnswer(false), 716 fCounter(8), 689 717 fVolt(kNumChannels), 690 718 fVoltRef(kNumChannels), … … 806 834 if (fVoltRef[ch]+dac[ch]>kMaxDac) 807 835 { 808 ostringstream msg; 809 msg << "AddDac - New voltage reference of " << fVoltRef[ch]*90./4096 << "V + " << dac[ch]*90./4096. << "V for channel " << ch << " out of range."; 810 Error(msg); 836 Error("AddDac - New voltage reference out of range."); 811 837 return false; 812 838 } … … 916 942 if (fVoltGapd[ch]+dac>kMaxDac) 917 943 { 918 ostringstream msg; 919 msg << "SetGapdVoltage - New voltage reference of " << fVoltGapd[ch] << "V + " << dac << "V for channel " << ch << " out of range."; 920 Error(msg); 944 Error("SetGapdVoltage - New voltage reference out of range."); 921 945 return false; 922 946 } … … 991 1015 // ------------------------------------------------------------------- 992 1016 993 void ExpertReset( )1017 void ExpertReset(bool expert_mode=true) 994 1018 { 995 1019 if (fWaitingForAnswer) … … 999 1023 } 1000 1024 1001 Warn("EXPERT MODE: Sending reset."); 1025 if (expert_mode) 1026 Warn("EXPERT MODE: Sending reset."); 1027 1002 1028 PostMessage(GetCmd(kCmdReset)); 1003 1029 AsyncRead(ba::buffer(fBuffer, 3), kCmdReset, ++fSendCounter); … … 1075 1101 { 1076 1102 fIsVerbose = b; 1103 } 1104 1105 void PrintInfo() 1106 { 1107 Out() << endl << kBold << dec << '\n'; 1108 Out() << "fWrapCounter = " << fWrapCounter << '\n'; 1109 Out() << "fSendCounter = " << fSendCounter%8 << " (" << fSendCounter << ")" << '\n'; 1110 Out() << "fIsInitializing = " << fIsInitializing << '\n'; 1111 Out() << "fIsRamping = " << fIsRamping << '\n'; 1112 Out() << "Answer counter:" << '\n'; 1113 Out() << " - Synchronization: " << fCounter[0] << '\n'; 1114 Out() << " - Reset: " << fCounter[1] << '\n'; 1115 Out() << " - Request update: " << fCounter[2] << '\n'; 1116 Out() << " - Ramp step: " << fCounter[3] << '\n'; 1117 Out() << " - Read: " << fCounter[4] << '\n'; 1118 Out() << " - Reset channels: " << fCounter[5] << '\n'; 1119 Out() << " - Global set: " << fCounter[7] << '\n'; 1120 Out() << " - Channel set: " << fCounter[6] << '\n' << endl; 1077 1121 } 1078 1122 … … 1711 1755 1712 1756 1757 T::AddEvent("PRINT_INFO") 1758 (Wrapper(bind(&ConnectionBias::PrintInfo, &fBias))) 1759 ("Print a table with all current read back with the last request operation"); 1713 1760 T::AddEvent("PRINT_CURRENTS") 1714 1761 (Wrapper(bind(&ConnectionBias::PrintA, &fBias))) … … 1727 1774 1728 1775 T::AddEvent("EXPERT_RESET", kExpertMode) 1729 (Wrapper(bind(&ConnectionBias::ExpertReset, &fBias )))1776 (Wrapper(bind(&ConnectionBias::ExpertReset, &fBias, true))) 1730 1777 ("Send the RESET command (note that this is possibly harmfull command)"); 1731 1778
Note:
See TracChangeset
for help on using the changeset viewer.