Changeset 16445
- Timestamp:
- 05/30/13 00:23:28 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/ratecontrol.cc
r16282 r16445 48 48 PixelMap fMap; 49 49 50 bool fPhysTriggerEnabled; 50 51 bool fTriggerOn; 51 52 … … 100 101 // return; 101 102 102 if ( !fThresholds.empty())103 if (fThresholds.empty()) 103 104 return; 104 105 … … 360 361 361 362 const FTM::DimStaticData &sdata = *static_cast<const FTM::DimStaticData*>(evt.GetData()); 362 fTriggerOn = sdata.HasTrigger(); 363 363 fPhysTriggerEnabled = sdata.HasTrigger(); 364 fTriggerOn = (evt.GetQoS()&FTM::kFtmStates)==FTM::kFtmRunning; 365 366 Out() << "\n" << evt.GetTime() << ": " << (bool)fTriggerOn << " " << (bool)fPhysTriggerEnabled << endl; 364 367 PrintThresholds(sdata); 365 368 … … 371 374 int HandleTriggerRates(const EventImp &evt) 372 375 { 376 fTriggerOn = (evt.GetQoS()&FTM::kFtmStates)==FTM::kFtmRunning; 377 373 378 if (fThresholds.empty()) 374 379 return GetCurrentState(); … … 523 528 int Calibrate() 524 529 { 525 if (!f TriggerOn)530 if (!fPhysTriggerEnabled) 526 531 { 527 532 Info("Physics trigger not enabled... CALIBRATE command ignored."); … … 551 556 int CalibrateByCurrent() 552 557 { 553 if (!f TriggerOn)558 if (!fPhysTriggerEnabled) 554 559 { 555 560 Info("Physics trigger not enabled... CALIBRATE command ignored."); … … 596 601 Info("No calibration requested."); 597 602 return RateControl::State::kGlobalThresholdSet; 603 break; 598 604 599 605 case 1: … … 615 621 int StopRC() 616 622 { 623 Info("Stop received."); 617 624 return RateControl::State::kConnected; 618 625 } … … 669 676 return RateControl::State::kDisconnected; 670 677 671 const bool inprog = fTriggerOn && fDimRS.state()<RateScan::State::kConfiguring; 678 // Do not allow any action while a ratescan is configured or in progress 679 if (fDimRS.state()>=RateScan::State::kConfiguring) 680 return RateControl::State::kConnected; 672 681 673 682 switch (GetCurrentState()) … … 677 686 678 687 case RateControl::State::kGlobalThresholdSet: 679 if (!inprog) 680 return RateControl::State::kGlobalThresholdSet; 688 689 // Wait for the trigger to get switched on before starting control loop 690 if (fTriggerOn && fPhysTriggerEnabled) 691 return RateControl::State::kInProgress; 692 693 return RateControl::State::kGlobalThresholdSet; 681 694 682 695 case RateControl::State::kInProgress: 683 if (inprog) 684 return RateControl::State::kInProgress; 696 697 // Go back to connected when the trigger has been switched off 698 if (!fTriggerOn || !fPhysTriggerEnabled) 699 return RateControl::State::kConnected; 700 701 return RateControl::State::kInProgress; 685 702 } 686 703 … … 690 707 public: 691 708 StateMachineRateControl(ostream &out=cout) : StateMachineDim(out, "RATE_CONTROL"), 692 f TriggerOn(false), fBlock(40),709 fPhysTriggerEnabled(false), fTriggerOn(false), fBlock(40), 693 710 fDimFTM("FTM_CONTROL"), 694 711 fDimRS("RATE_SCAN"), … … 748 765 AddEvent("CALIBRATE_RUN", "C") 749 766 (bind(&StateMachineRateControl::CalibrateRun, this, placeholders::_1)) 750 ("Start a threshold calibration as defined in the setup for this run-type ");767 ("Start a threshold calibration as defined in the setup for this run-type, state change to InProgress is delayed until trigger enabled"); 751 768 752 769 AddEvent("STOP", RateControl::State::kSettingGlobalThreshold, RateControl::State::kGlobalThresholdSet, RateControl::State::kInProgress)
Note:
See TracChangeset
for help on using the changeset viewer.