Changeset 10875
- Timestamp:
- 05/27/11 17:19:25 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/fadctrl.cc
r10863 r10875 380 380 } 381 381 382 void CmdSetRunNumber(uint32_t num) 383 { 384 PostCmd(FAD::kCmdWriteRunNumberLSW, num&0xffff); 385 PostCmd(FAD::kCmdWriteRunNumberMSW, num>>16); 386 } 387 382 388 void CmdSetRegister(uint8_t addr, uint16_t val) 383 389 { … … 398 404 bool CmdSetRoi(int8_t addr, uint16_t val) 399 405 { 400 if (addr>FAD::kMaxRoiAddr)401 return false;402 403 406 if (val>FAD::kMaxRoiValue) 404 407 return false; 405 408 406 409 if (addr<0) 407 for (int i=0; i<=FAD::kMaxRoiAddr; i++) 410 { 411 for (unsigned int i=0; i<=FAD::kMaxRoiAddr; i++) 408 412 PostCmd(FAD::kCmdWriteRoi + i, val); 409 else 410 PostCmd(FAD::kCmdWriteRoi + addr, val); 411 413 return true; 414 } 415 416 if (uint8_t(addr)>FAD::kMaxRoiAddr) 417 return false; 418 419 PostCmd(FAD::kCmdWriteRoi + addr, val); 412 420 return true; 413 421 } … … 732 740 } 733 741 742 int SetRunNumber(const EventImp &evt) 743 { 744 if (!CheckEventSize(evt.GetSize(), "SetRunNumber", 8)) 745 return T::kSM_FatalError; 746 747 const uint64_t num = evt.Get<uint64_t>(); 748 749 if (num>FAD::kMaxRunNumber) 750 { 751 ostringstream msg; 752 msg << hex << "Value " << num << " out of range, max=" << FAD::kMaxRunNumber; 753 T::Error(msg); 754 return false; 755 } 756 757 for (BoardList::iterator i=fBoards.begin(); i!=fBoards.end(); i++) 758 i->second.second->CmdSetRunNumber(num); 759 760 return T::GetCurrentState(); 761 } 762 734 763 int Test(const EventImp &evt) 735 764 { … … 750 779 751 780 for (BoardList::iterator i=fBoards.begin(); i!=fBoards.end(); i++) 752 i->second.second->SetVerbose(evt.Get Text()[0]!=0);781 i->second.second->SetVerbose(evt.GetBool()); 753 782 754 783 return T::GetCurrentState(); … … 761 790 762 791 for (BoardList::iterator i=fBoards.begin(); i!=fBoards.end(); i++) 763 i->second.second->SetHexOutput(evt.Get Text()[0]!=0);792 i->second.second->SetHexOutput(evt.GetBool()); 764 793 765 794 return T::GetCurrentState(); … … 772 801 773 802 for (BoardList::iterator i=fBoards.begin(); i!=fBoards.end(); i++) 774 i->second.second->SetDataOutput(evt.Get Text()[0]!=0);803 i->second.second->SetDataOutput(evt.GetBool()); 775 804 776 805 return T::GetCurrentState(); … … 1144 1173 (""); 1145 1174 1175 T::AddEvent("SET_RUN_NUMBER", "X:1") 1176 (boost::bind(&StateMachineFAD::SetRunNumber, this, _1)) 1177 (""); 1178 1146 1179 T::AddEvent("SET_REGISTER", "I:2") 1147 1180 (boost::bind(&StateMachineFAD::SetRegister, this, _1))
Note:
See TracChangeset
for help on using the changeset viewer.