Changeset 16775


Ignore:
Timestamp:
06/08/13 12:30:58 (11 years ago)
Author:
tbretz
Message:
Introduced a new state kConfiguring3 which checks if the messages to enable the trigger line were really delivered before switching to kConfigured. This never seems necessary, but maybe only because there is a natural delay until the mcp reacts and enables the trigger; removed the ConfigTimer. It seems obsolete with the recent changes in the output buffer queue
File:
1 edited

Legend:

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

    r16732 r16775  
    10881088        }
    10891089
    1090         fConfigTimer = Time(Time::none);
    1091 
    10921090        // Now the old run is stopped already. So all other servers can start a new run
    10931091        // (Note that we might need another step which only checks if the continous trigger
     
    10951093        const int64_t runs[2] = { runno, runno+1 };
    10961094        fDimStartRun.Update(runs);
    1097 
    1098         // T::Info(" ==> TODO: Insert/update run configuration in database!");
    10991095
    11001096        return FAD::State::kConfiguring1;
     
    15101506            if (T::GetCurrentState()==FAD::State::kConfiguring1)
    15111507            {
    1512                 // We need some delay so that the FAD is not busy anymore
    1513                 // and really sees the software trigger
    1514                 // FIXME: Do we need this to be configurable?
    1515                 //if (Time()-fConfigTimer<boost::posix_time::milliseconds(3000))
    1516 
    15171508                // Wait until the configuration commands to all boards
    15181509                // have been sent and achknowledged
     
    15211512                        return FAD::State::kConfiguring1;
    15221513
    1523                 if (!fConfigTimer)
    1524                     fConfigTimer = Time();
    1525 
    1526                 // Wait a short moment to ensure that all board have processed
    1527                 // the received data
    1528                 if (Time()-fConfigTimer<boost::posix_time::milliseconds(250))
    1529                     return FAD::State::kConfiguring1;
    1530 
     1514                // Now we can sent the trigger
    15311515                for (BoardList::iterator it=fBoards.begin(); it!=fBoards.end(); it++)
    15321516                    it->second->Cmd(FAD::kCmdSingleTrigger);
     
    15671551//                const lock_guard<mutex> guard(fMutexReconnect);
    15681552//                fReconnectionList.clear();
     1553
     1554                return FAD::State::kConfiguring3;
     1555            }
     1556
     1557            if (T::GetCurrentState()==FAD::State::kConfiguring3)
     1558            {
     1559                // Wait until the configuration commands to all boards
     1560                // have been sent and achknowledged
     1561                for (BoardList::iterator it=fBoards.begin(); it!=fBoards.end(); it++)
     1562                    if (!it->second->IsTxQueueEmpty())
     1563                        return FAD::State::kConfiguring3;
    15691564
    15701565                return FAD::State::kConfigured;
     
    16751670        T::AddStateName(FAD::State::kConfiguring2, "Configuring2",
    16761671                        "Waiting until all boards returned their configuration and they are valid.");
     1672
     1673        T::AddStateName(FAD::State::kConfiguring3, "Configuring3",
     1674                        "Waiting until 'enable trigger line' was sent to all boards.");
    16771675
    16781676        T::AddStateName(FAD::State::kConfigured, "Configured",
     
    17901788             "|run_type[string]:Run type which describes the runs");
    17911789
    1792         T::AddEvent("RESET_CONFIGURE", FAD::State::kConfiguring1, FAD::State::kConfiguring2, FAD::State::kConfigured)
     1790        T::AddEvent("RESET_CONFIGURE", FAD::State::kConfiguring1, FAD::State::kConfiguring2, FAD::State::kConfiguring3, FAD::State::kConfigured)
    17931791            (bind(&StateMachineFAD::ResetConfig, this))
    17941792            ("If configuration failed and the fadctrl is waiting for something, use this to reset the state.");
     
    19571955    Configs fConfigs;
    19581956    Configs::const_iterator fTargetConfig;
    1959 
    1960     Time fConfigTimer;
    19611957
    19621958
Note: See TracChangeset for help on using the changeset viewer.