Changeset 10749 for trunk


Ignore:
Timestamp:
05/19/11 08:54:17 (14 years ago)
Author:
tbretz
Message:
Implemented enable/disable pixel; renamed kTimeMarker to kClockConditioner and adapted commands.
File:
1 edited

Legend:

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

    r10735 r10749  
    238238            {
    239239                stringstream str;
    240                 str << "Invalid header received: start delimiter wrong, received " << hex << fHeader.fDelimiter << " expected " << FTM::kDelimiterStart << ".";
     240                str << "Invalid header received: start delimiter wrong, received ";
     241                str << hex << fHeader.fDelimiter << ", expected " << FTM::kDelimiterStart << ".";
    241242                Error(str);
    242243                PostClose(false);
     
    298299            stringstream str;
    299300            str << "Invalid data received: end delimiter wrong, received ";
    300             str << hex << ntohs(fBuffer.back()) << " expected " << FTM::kDelimiterEnd << ".";
     301            str << hex << ntohs(fBuffer.back()) << ", expected " << FTM::kDelimiterEnd << ".";
    301302            Error(str);
    302303            PostClose(false);
     
    484485public:
    485486
    486     static const uint16_t kMaxAddr;
     487//    static const uint16_t kMaxAddr;
    487488
    488489public:
     
    549550    bool CmdSetRegister(uint16_t addr, uint16_t val)
    550551    {
    551         if (addr>kMaxAddr)
     552        if (addr>FTM::StaticData::kMaxAddr)
    552553            return false;
    553554
     
    564565    bool CmdGetRegister(uint16_t addr)
    565566    {
    566         if (addr>kMaxAddr)
     567        if (addr>FTM::StaticData::kMaxAddr)
    567568            return false;
    568569
     
    872873    }
    873874
    874     bool DisablePixel(uint16_t idx, bool disable)
     875    bool EnablePixel(uint16_t idx, bool enable)
    875876    {
    876877        if (idx>FTM::StaticData::kMaxPixelIdx)
    877878            return false;
    878879
    879         fStaticData.EnablePixel(idx, !disable);
     880        cout << "ENABLE " << idx << " " << enable << endl;
     881        fStaticData.EnablePixel(idx, enable);
     882
     883        CmdSendStatDat();
     884
     885        return true;
     886    }
     887
     888    bool TogglePixel(uint16_t idx)
     889    {
     890        if (idx>FTM::StaticData::kMaxPixelIdx)
     891            return false;
     892
     893        cout << "TOGGLE " << idx << endl;
     894
     895        fStaticData.EnablePixel(idx, !fStaticData.Enabled(idx));
    880896
    881897        CmdSendStatDat();
     
    887903};
    888904
    889 const uint16_t ConnectionFTM::kMaxAddr = 0xfff;
     905//const uint16_t ConnectionFTM::kMaxAddr = 0xfff;
    890906
    891907// ------------------------------------------------------------------------
     
    13301346    }
    13311347
    1332     int DisablePixel(const EventImp &evt)
    1333     {
    1334         if (!CheckEventSize(evt.GetSize(), "DisablePixel", 3))
    1335             return T::kSM_FatalError;
    1336 
    1337         fFTM.DisablePixel(evt.GetUShort(), evt.GetText()[2]!=0);
     1348    int EnablePixel(const EventImp &evt, bool b)
     1349    {
     1350        if (!CheckEventSize(evt.GetSize(), "EnablePixel", 2))
     1351            return T::kSM_FatalError;
     1352
     1353        fFTM.EnablePixel(evt.GetUShort(), b);
     1354
     1355        return T::GetCurrentState();
     1356    }
     1357
     1358    int TogglePixel(const EventImp &evt)
     1359    {
     1360        if (!CheckEventSize(evt.GetSize(), "TogglePixel", 2))
     1361            return T::kSM_FatalError;
     1362
     1363        fFTM.TogglePixel(evt.GetUShort());
    13381364
    13391365        return T::GetCurrentState();
     
    14831509             "|Enable[bool]:Whether FTU should be enabled or disabled (yes/no)");
    14841510
    1485         AddEvent("DISABLE_PIXEL", "S:1;B:1", kStateIdle)
    1486             (boost::bind(&StateMachineFTM::DisablePixel, this, _1))
     1511        AddEvent("DISABLE_PIXEL", "S:1", kStateIdle)
     1512            (boost::bind(&StateMachineFTM::EnablePixel, this, _1, false))
     1513            ("");
     1514
     1515        AddEvent("ENABLE_PIXEL", "S:1", kStateIdle)
     1516            (boost::bind(&StateMachineFTM::EnablePixel, this, _1, true))
     1517            ("");
     1518
     1519        AddEvent("TOGGLE_PIXEL", "S:1", kStateIdle)
     1520            (boost::bind(&StateMachineFTM::TogglePixel, this, _1))
    14871521            ("");
    14881522
     
    15331567            ("Enable veto line"
    15341568             "|Enable[bool]:Enable veto (yes/no)");
     1569
     1570        AddEvent("ENABLE_CLOCK_CONDITIONER", "B:1", kStateIdle)
     1571            (boost::bind(&StateMachineFTM::Enable, this, _1, FTM::StaticData::kClockConditioner))
     1572            ("Enable clock conidtioner output in favor of time marker output"
     1573             "|Enable[bool]:Enable clock conditioner (yes/no)");
    15351574
    15361575        AddEvent("SET_TRIGGER_SEQUENCE", "C:3", kStateIdle)
Note: See TracChangeset for help on using the changeset viewer.