Changeset 16375 for trunk


Ignore:
Timestamp:
05/28/13 13:37:10 (11 years ago)
Author:
tbretz
Message:
First make sure that the ratecontrol is switched off before starting the ftm configuration. We have had cases in which this interfered.
File:
1 edited

Legend:

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

    r16197 r16375  
    223223        Message(str);
    224224
     225        // Strictly speaking, it is not necessary, but
     226        // stopping the ratecontrol before we configure
     227        // the FTM ensures that no threshold setting commands
     228        // interfere with the configuration of the FTM.
     229        if (fDimRC.state()!=RateControl::State::kConnected)
     230        {
     231            Dim::SendCommandNB("RATE_CONTROL/STOP");
     232            Message("Stopping ratecontrol");
     233        }
     234
     235        if (fDimLog.state()<30/*kSM_WaitForRun*/)
     236        {
     237            Dim::SendCommandNB("DATA_LOGGER/START_RUN_LOGGING");
     238            Message("Starting datalogger");
     239        }
     240
    225241        Update(MCP::State::kConfiguring1);
    226 
    227242        return MCP::State::kConfiguring1;
    228243    }
     
    264279        Value *buf = GetBuffer();
    265280
     281        Dim::SendCommandNB("FAD_CONTROL/CONFIGURE", buf, sizeof(Value)+fRunType.length()+1);
    266282        Message("Configuring FAD");
    267         Dim::SendCommandNB("FAD_CONTROL/CONFIGURE", buf, sizeof(Value)+fRunType.length()+1);
    268283
    269284        delete buf;
     
    301316        if (GetCurrentState()==MCP::State::kConfiguring1)
    302317        {
    303             if (fDimLog.state()<30/*kSM_WaitForRun*/)
    304             {
    305                 Message("Starting datalogger");
    306                 Dim::SendCommandNB("DATA_LOGGER/START_RUN_LOGGING");
    307             }
    308 
     318            if (fDimRC.state()!=RateControl::State::kConnected)
     319                return MCP::State::kConfiguring1;
     320
     321            Dim::SendCommandNB("FTM_CONTROL/CONFIGURE", fRunType);
    309322            Message("Configuring Trigger (FTM)");
    310             Dim::SendCommandNB("FTM_CONTROL/CONFIGURE", fRunType);
    311 
    312             // That's a bit stupid, but we have to stop the ratecontrol
    313             // first, otherwise it might be detected to be
    314             // in a state larger than Connected in Configuring3
    315             // (because it still was) before the state change introduced
    316             // by the Configuring2 state is even received. If instead
    317             // we wait in Configuring2 for the rate control to be connected,
    318             // we can be sure that it works.
    319             Message("Stopping ratecontrol");
    320             Dim::SendCommandNB("RATE_CONTROL/STOP");
    321323
    322324            Update(MCP::State::kConfiguring2);
     
    328330        if (GetCurrentState()==MCP::State::kConfiguring2)
    329331        {
    330             // FIMXE: Reset in case of error
    331             if ((/*fDimFTM.state() != FTM::State::kConfiguring2 &&*/
    332                  fDimFTM.state() != FTM::State::kConfigured) ||
     332            if (fDimFTM.state() != FTM::State::kConfigured ||
    333333                fDimLog.state()<30 || fDimLog.state()>0xff ||
    334334                fDimRC.state()!=RateControl::State::kConnected)
    335335                return MCP::State::kConfiguring2;
    336336
    337             // FIMXE: This is to make sure that the rate control
    338             // has received the correct trigger setup already...
    339             //usleep(1000000);
    340 
     337            Dim::SendCommandNB("RATE_CONTROL/CALIBRATE_RUN", fRunType);
    341338            Message("Starting Rate Control");
    342             // State of RC is not reported back fast enough!
    343             Dim::SendCommandNB("RATE_CONTROL/CALIBRATE_RUN", fRunType);
    344339
    345340            ConfigureFAD();
     
    375370                return MCP::State::kConfiguring3;
    376371
     372            Dim::SendCommandNB("FTM_CONTROL/START_TRIGGER");
    377373            Message("Starting Trigger (FTM)");
    378             Dim::SendCommandNB("FTM_CONTROL/START_TRIGGER");
    379374
    380375            Update(MCP::State::kConfigured);
     
    553548                     "Waiting for next configuration command");
    554549        AddStateName(MCP::State::kConfiguring1, "Configuring1",
    555                      "Starting configuration procedure, checking Datalogger state");
     550                     "Starting configuration procedure, checking datalogger/ratecontrol state");
    556551        AddStateName(MCP::State::kConfiguring2, "Configuring2",
    557                      "Waiting for FTM and Datalogger to get ready");
     552                     "Starting ratecontrol, waiting for FTM to get configured and Datalogger to get ready");
    558553        AddStateName(MCP::State::kConfiguring3, "Configuring3",
    559                      "Waiting for FADs and rate control to get ready");
     554                     "Waiting for FADs and ratecontrol to get ready");
    560555        /*
    561556        AddStateName(MCP::State::kCrateReset0, "CrateReset0",
Note: See TracChangeset for help on using the changeset viewer.