Changeset 10555 for trunk/FACT++


Ignore:
Timestamp:
05/04/11 10:21:41 (13 years ago)
Author:
tbretz
Message:
Implemented ENABLE_FTU and TOGGLE_FTU
File:
1 edited

Legend:

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

    r10542 r10555  
    574574            fStaticData[patch/4].fDAC[patch%4] = value;
    575575
     576        // Maybe move to a "COMMIT" command?
     577        CmdSendStatDat();
     578
     579        return true;
     580    }
     581
     582    bool EnableFTU(int32_t board, bool enable)
     583    {
     584        if (board>39)
     585            return false;
     586
     587        if (board<0)
     588        {
     589            if (enable)
     590                fStaticData.EnableAllFTU();
     591            else
     592                fStaticData.DisableAllFTU();
     593        }
     594        else
     595        {
     596            if (enable)
     597                fStaticData.EnableFTU(board);
     598            else
     599                fStaticData.DisableFTU(board);
     600
     601        }
     602
     603        // Maybe move to a "COMMIT" command?
     604        CmdSendStatDat();
     605
     606        return true;
     607    }
     608
     609    bool ToggleFTU(uint32_t board)
     610    {
     611        if (board>39)
     612            return false;
     613
     614        fStaticData.ToggleFTU(board);
     615
     616        // Maybe move to a "COMMIT" command?
    576617        CmdSendStatDat();
    577618
     
    838879    }
    839880
     881    int EnableFTU(const EventImp &evt)
     882    {
     883        if (!CheckEventSize(evt.GetSize(), "EnableFTU", 5))
     884            return T::kSM_FatalError;
     885
     886        const int32_t &board  = *reinterpret_cast<const int32_t*>(evt.GetText());
     887        const int8_t  &enable = *reinterpret_cast<const int8_t*>(evt.GetText()+4);
     888
     889        if (!fFTM.EnableFTU(board, enable))
     890            T::Warn("EnableFTU - Board number must be <40.");
     891
     892        return T::GetCurrentState();
     893    }
     894
     895    int ToggleFTU(const EventImp &evt)
     896    {
     897        if (!CheckEventSize(evt.GetSize(), "ToggleFTU", 4))
     898            return T::kSM_FatalError;
     899
     900        if (!fFTM.ToggleFTU(evt.GetInt()))
     901            T::Warn("ToggleFTU - Allowed range of boards 0-39.");
     902
     903        return T::GetCurrentState();
     904    }
     905
    840906    int Disconnect()
    841907    {
     
    899965        fFTM(*this, *this)
    900966    {
    901         cout << "FTM" << endl;
    902 
    903967        // ba::io_service::work is a kind of keep_alive for the loop.
    904968        // It prevents the io_service to go to stopped state, which
     
    9691033            (boost::bind(&StateMachineFTM::SetThreshold, this, _1))
    9701034            ("Set the comparator threshold"
    971              "|Patch[idx]:Index of the patch"
     1035             "|Patch[idx]:Index of the patch (0-159), -1 for all"
    9721036             "|Threshold[counts]:Threshold to be set in binary counts");
     1037
     1038        AddConfiguration("ENABLE_FTU", "I:1;B:1", kStateIdle)
     1039            (boost::bind(&StateMachineFTM::EnableFTU, this, _1))
     1040            ("Enable or disable FTU"
     1041             "|Board[idx]:Index of the board (0-39), -1 for all"
     1042             "|Enable[bool]:Whether FTU should be enabled or disabled (yes/no)");
     1043
     1044        AddConfiguration("TOGGLE_FTU", "I:1", kStateIdle)
     1045            (boost::bind(&StateMachineFTM::ToggleFTU, this, _1))
     1046            ("Toggle status of FTU (this is mainly meant to be used in the GUI)"
     1047             "|Board[idx]:Index of the board (0-39)");
    9731048
    9741049        T::AddConfiguration("SET_VERBOSE", "B")
     
    10041079        fFTM.StartConnect();
    10051080
    1006 
    1007         // SET_THRESHOLD          idx val
    1008         // ---> SetThreshold(idx==-1, val)
    10091081
    10101082        // ENABLE_FTU             idx bool
Note: See TracChangeset for help on using the changeset viewer.