Changeset 12654 for trunk/FACT++/src


Ignore:
Timestamp:
11/27/11 10:33:59 (13 years ago)
Author:
tbretz
Message:
Changing the step size didn't work with the previous implementation.
File:
1 edited

Legend:

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

    r12555 r12654  
    6868    DimDescribedService fDimProc;
    6969
    70     int fCounter;
    7170    int fSeconds;
    72 
    7371    int fSecondsMax;
     72
     73    int fThreshold;
    7474    int fThresholdMin;
    7575    int fThresholdMax;
     
    154154                return;
    155155
    156             if (fCounter<0/* || fStatusFTM.second!=FTM::kTakingData*/)
     156            if (fThreshold<0/* || fStatusFTM.second!=FTM::kTakingData*/)
    157157                return;
    158158
     
    176176            {
    177177                Message("Rate scan stopped due zero trigger rate.");
    178                 fCounter = -1;
     178                fThreshold = -1;
    179179                return;
    180180            }
     
    208208
    209209            const double   time = sdata.fElapsedTime*fSeconds;
    210             const uint32_t th   = fThresholdMin+fCounter*fThresholdStep;
     210            const uint32_t th   = fThreshold;
    211211
    212212            float data[2+3+1+40+160];
     
    237237            fDimData.Update();
    238238
    239             fCounter++;
     239            fThreshold += fThresholdStep;
    240240
    241241            if (fSeconds>=fSecondsMax)
    242242            {
    243243                Message("Rate scan stopped due to timeout.");
    244                 fCounter=-1;
     244                fThreshold=-1;
    245245                return;
    246246            }
    247247
    248             if (fThresholdMin+fCounter*fThresholdStep>fThresholdMax)
     248            if (fThreshold>fThresholdMax)
    249249            {
    250250                Message("Rate scan finished.");
    251                 fCounter = -1;
    252 
    253                 //DimClient::sendCommandNB("FTM_CONTROL/STOP_TRIGGER", NULL, 0);
     251                fThreshold = -1;
    254252                return;
    255253            }
     
    257255            fSeconds = -2;  // FIXME: In principle one missed report is enough
    258256
    259             const int32_t cmd[2] = { -1, fThresholdMin+fCounter*fThresholdStep };
     257            const int32_t cmd[2] = { -1, fThreshold };
    260258            DimClient::sendCommandNB(fCommand.c_str(), (void*)cmd, 8);
    261259        }
     
    324322        //Dim::SendCommand("FTM_CONTROL/STOP_TRIGGER");
    325323
    326         fCounter = 0;
     324        fThreshold = fThresholdMin;
    327325        fSeconds = -2;
    328326
     
    338336    int StopRateScan()
    339337    {
    340         fCounter = -1;
     338        fThreshold = -1;
    341339        Message("Rate scan manually stopped.");
    342340
     
    431429        // At least one subsystem is not connected
    432430        //        if (fStatusFTM.second>=FTM::kConnected)
    433         return fCounter<0 ? kStateConnected : kStateInProgress;
     431        return fThreshold<0 ? kStateConnected : kStateInProgress;
    434432    }
    435433
     
    447445                 "|max[DAC]:Value at which scan will end"
    448446                 "|step[DAC]:Step size for scan"),
    449         fCounter(-1), fReference(kCamera), fReferenceIdx(0)
     447        fThreshold(-1), fReference(kCamera), fReferenceIdx(0)
    450448    {
    451449        // ba::io_service::work is a kind of keep_alive for the loop.
Note: See TracChangeset for help on using the changeset viewer.