Changeset 17644 for trunk/FACT++/src


Ignore:
Timestamp:
04/03/14 16:07:02 (11 years ago)
Author:
tbretz
Message:
Implemented the auto pause command, the pause and resume command and a Paused state.
Location:
trunk/FACT++/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/FACT++/src/HeadersRateScan.h

    r13918 r17644  
    1414            kConfiguring,
    1515            kInProgress,
     16            kPaused,
    1617        };
    1718    }
  • trunk/FACT++/src/ratescan.cc

    r16866 r17644  
    3737    DimDescribedService fDimProc;
    3838
     39    bool fAutoPause;
     40
    3941    int fCounter;
    4042    int fCounterMax;
     
    9395            return GetCurrentState();
    9496
    95         if (GetCurrentState()!=RateScan::State::kInProgress)
     97        if (GetCurrentState()<RateScan::State::kInProgress)
    9698            return GetCurrentState();
    9799
     
    100102        if (++fCounter<0)
    101103            return GetCurrentState();
     104
     105        if (GetCurrentState()==RateScan::State::kPaused)
     106            fCounter=0;
    102107
    103108        if (fCounter==0)
     
    285290        Message(msg);
    286291
    287         return RateScan::State::kInProgress;
     292        if (!fAutoPause)
     293            return RateScan::State::kInProgress;
     294
     295        fAutoPause = false;
     296
     297        return RateScan::State::kPaused;
    288298    }
    289299
    290300    int StopRateScan()
    291301    {
    292         if (GetCurrentState()!=RateScan::State::kConfiguring && GetCurrentState()!=RateScan::State::kInProgress)
     302        if (GetCurrentState()<RateScan::State::kConfiguring)
    293303            return GetCurrentState();
    294304
     
    364374
    365375        return GetCurrentState();
     376    }
     377
     378    int TriggerAutoPause(const EventImp &evt)
     379    {
     380        fAutoPause = true;
     381        return GetCurrentState();
     382    }
     383
     384    int Pause()
     385    {
     386        return RateScan::State::kPaused;
     387    }
     388
     389    int Resume()
     390    {
     391        return RateScan::State::kInProgress;
    366392    }
    367393
     
    398424                 "|max[DAC]:Value at which scan will end"
    399425                 "|step[DAC]:Step size for scan"),
    400         fThreshold(-1), fReference(kCamera), fReferenceIdx(0)
     426        fAutoPause(false), fThreshold(-1), fReference(kCamera), fReferenceIdx(0)
    401427    {
    402428        // ba::io_service::work is a kind of keep_alive for the loop.
     
    430456                     "Rate scan in progress.");
    431457
     458        AddStateName(RateScan::State::kPaused, "Paused",
     459                     "Rate scan in progress but paused.");
     460
    432461        AddEvent("START_THRESHOLD_SCAN", "I:3", RateScan::State::kConnected)
    433462            (bind(&StateMachineRateScan::StartRateScan, this, placeholders::_1, "SET_THRESHOLD"))
     
    444473             "|step[int]:Single step in DAC counts");
    445474
    446         AddEvent("CHANGE_STEP_SIZE", "I:1", RateScan::State::kInProgress)
     475        AddEvent("CHANGE_STEP_SIZE", "I:1", RateScan::State::kPaused, RateScan::State::kInProgress)
    447476            (bind(&StateMachineRateScan::ChangeStepSize, this, placeholders::_1))
    448477            ("Change the step size during a ratescan in progress"
    449478             "|step[int]:Single step in DAC counts");
    450479
    451         AddEvent("CHANGE_MAXIMUM", "I:1", RateScan::State::kInProgress)
     480        AddEvent("CHANGE_MAXIMUM", "I:1", RateScan::State::kPaused, RateScan::State::kInProgress)
    452481            (bind(&StateMachineRateScan::ChangeMaximum, this, placeholders::_1))
    453482            ("Change the maximum limit during a ratescan in progress"
    454483             "|max[int]:Limiting value in DAC counts");
    455484
    456         AddEvent("STOP", RateScan::State::kConfiguring, RateScan::State::kInProgress)
     485        AddEvent("STOP", RateScan::State::kConfiguring, RateScan::State::kPaused, RateScan::State::kInProgress)
    457486            (bind(&StateMachineRateScan::StopRateScan, this))
    458487            ("Stop a ratescan in progress");
     
    469498            ("Use the given patch trigger-rate as reference for the reolution"
    470499             "|patch[idx]:Index of the patch (360*crate+36*board+patch)");
     500
     501        AddEvent("TRIGGER_AUTO_PAUSE", RateScan::State::kDimNetworkNA, RateScan::State::kDisconnected, RateScan::State::kConnected)
     502            (bind(&StateMachineRateScan::TriggerAutoPause, this, placeholders::_1))
     503            ("Enable an automatic pause for the next ratescan, after it got configured.");
     504
     505        AddEvent("PAUSE", RateScan::State::kInProgress)
     506            (bind(&StateMachineRateScan::Pause, this))
     507            ("Pause a ratescan in progress");
     508        AddEvent("RESUME", RateScan::State::kPaused)
     509            (bind(&StateMachineRateScan::Resume, this))
     510            ("Resume a paused ratescan");
    471511
    472512        AddEvent("PRINT")
Note: See TracChangeset for help on using the changeset viewer.