Changeset 14433 for trunk


Ignore:
Timestamp:
10/02/12 10:14:40 (12 years ago)
Author:
tbretz
Message:
If a board is blocked, then do not execute any code for this board; fixed a problem with the execute function (kInProgress was never reached); added some missing explanations.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/FACT++/src/ratecontrol.cc

    r14354 r14433  
    167167        for (int i=0; i<40; i++)
    168168        {
     169            if (fBlock[i])
     170            {
     171                fBlock[i] = false;
     172                continue;
     173            }
     174
    169175            int maxi = -1;
    170176
     
    186192            }
    187193
    188             if (fBlock[i])
    189             {
    190                 fBlock[i] = false;
    191                 continue;
    192             }
    193 
    194194            for (int j=0; j<4; j++)
    195195            {
     
    441441            return RateControl::State::kDisconnected;
    442442
    443         if (GetCurrentState()==RateControl::State::kSettingGlobalThreshold)
     443        const bool inprog = fEnabled && fTriggerOn && fDimRS.state()<RateScan::State::kConfiguring;
     444
     445        switch (GetCurrentState())
     446        {
     447        case RateControl::State::kSettingGlobalThreshold:
    444448            return RateControl::State::kSettingGlobalThreshold;
    445449
    446         if (GetCurrentState()==RateControl::State::kGlobalThresholdSet)
    447             return RateControl::State::kGlobalThresholdSet;
    448 
    449         if (fEnabled && fTriggerOn && fDimRS.state()<RateScan::State::kConfiguring)
    450             return RateControl::State::kInProgress;
    451 
    452         return RateControl::State::kConnected;
     450        case RateControl::State::kGlobalThresholdSet:
     451            if (!inprog)
     452                return RateControl::State::kGlobalThresholdSet;
     453
     454        case RateControl::State::kInProgress:
     455            if (inprog)
     456                return RateControl::State::kInProgress;
     457        }
     458
     459        return RateControl::State::kInConnected;
    453460    }
    454461
     
    487494                     "All needed subsystems are connected to their hardware, no action is performed.");
    488495
    489         AddStateName(RateControl::State::kSettingGlobalThreshold, "Calibrating", "");
    490         AddStateName(RateControl::State::kGlobalThresholdSet, "GlobalThresholdSet", "");
     496        AddStateName(RateControl::State::kSettingGlobalThreshold, "Calibrating",
     497                     "A global minimum thrshold is currently determined.");
     498
     499        AddStateName(RateControl::State::kGlobalThresholdSet, "GlobalThresholdSet",
     500                     "A global threshold has ben set, waiting for the trigger to be switched on.");
    491501
    492502        AddStateName(RateControl::State::kInProgress, "InProgress",
    493                      "Rate scan in progress.");
     503                     "Rate control in progress.");
    494504
    495505        AddEvent("CALIBRATE")
    496506            (bind(&StateMachineRateControl::Calibrate, this))
    497             ("");
     507            ("Start a search for a reasonable minimum global threshold");
    498508
    499509        AddEvent("START", "", RateControl::State::kConnected, RateControl::State::kGlobalThresholdSet)
    500510            (bind(&StateMachineRateControl::StartRC, this))
    501             ("");
     511            ("Enable rate control (it will start when the trigger is on and a calibration was successfull)");
    502512
    503513        AddEvent("STOP", "", RateControl::State::kSettingGlobalThreshold, RateControl::State::kInProgress)
    504514            (bind(&StateMachineRateControl::StopRC, this))
    505             ("");
     515            ("Stop rat control");
    506516
    507517        AddEvent("SET_MIN_THRESHOLD", "I:1")
    508518            (bind(&StateMachineRateControl::SetMinThreshold, this, placeholders::_1))
    509             ("");
     519            ("Set a minimum threshold at which th rate control starts calibrating");
    510520
    511521        AddEvent("SET_TARGET_RATE", "F:1")
    512522            (bind(&StateMachineRateControl::SetTargetRate, this, placeholders::_1))
    513             ("");
     523            ("Set a target trigger rate for the calibration");
    514524
    515525        AddEvent("PRINT")
    516526            (bind(&StateMachineRateControl::Print, this))
    517             ("");
     527            ("Print current status");
    518528
    519529        AddEvent("SET_VERBOSE", "B")
Note: See TracChangeset for help on using the changeset viewer.