Changeset 13483


Ignore:
Timestamp:
04/30/12 22:57:32 (13 years ago)
Author:
tbretz
Message:
Added BIAS_CONTROL/VOLTAGE
File:
1 edited

Legend:

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

    r13479 r13483  
    4848    pair<Time, int> fStatusDriveControl;
    4949    pair<Time, int> fStatusMagicWeather;
     50    pair<Time, int> fStatusFeedback;
    5051    pair<Time, int> fStatusBiasControl;
    5152    pair<Time, int> fStatusFadControl;
     
    6061    DimStampedInfo fDimMagicWeather;
    6162    DimStampedInfo fDimMagicWeatherData;
     63
     64    DimStampedInfo fDimFeedbackCalibration;
    6265
    6366    DimStampedInfo fDimBiasControl;
     
    226229    }
    227230
     231    void HandleFeedbackCalibration(const DimData &d)
     232    {
     233        if (!CheckDataSize(d, "BiasControl:Voltage", 1664))
     234            return;
     235
     236        vector<float> v(d.ptr<float>(), d.ptr<float>()+320);
     237        sort(v.begin(), v.end());
     238
     239        fBiasControlVoltageMed = (v[159]+v[160])/2;
     240
     241        const char *ptr = d.ptr<char>();
     242
     243        ofstream fout("www/biascontrol-voltage.bin");
     244        fout.write(ptr, 320*sizeof(float));
     245    }
     246
    228247    void HandleBiasControlVoltage(const DimData &d)
    229248    {
     
    309328            return;
    310329
    311         if (HandleService(curr, fDimMagicWeatherData,    &StateMachineSmartFACT::HandleMagicWeatherData))
    312             return;
    313         if (HandleService(curr, fDimBiasControlVoltage,  &StateMachineSmartFACT::HandleBiasControlVoltage))
    314             return;
    315         if (HandleService(curr, fDimBiasControlCurrent,  &StateMachineSmartFACT::HandleBiasControlCurrent))
     330        if (HandleService(curr, fDimMagicWeatherData,     &StateMachineSmartFACT::HandleMagicWeatherData))
     331            return;
     332        if (HandleService(curr, fDimFeedbackCalibration,  &StateMachineSmartFACT::HandleFeedbackCalibration))
     333            return;
     334        if (HandleService(curr, fDimBiasControlVoltage,   &StateMachineSmartFACT::HandleBiasControlVoltage))
     335            return;
     336        if (HandleService(curr, fDimBiasControlCurrent,   &StateMachineSmartFACT::HandleBiasControlCurrent))
    316337            return;
    317338        if (HandleService(curr, *fDimFadControlEventData, &StateMachineSmartFACT::HandleFadControlEventData))
     
    319340
    320341        if (UpdateState(curr, fDimMagicWeather, fStatusMagicWeather))
     342            return;
     343        if (UpdateState(curr, fDimFeedback, fStatusFeedback))
    321344            return;
    322345        if (UpdateState(curr, fDimBiasControl, fStatusBiasControl))
     
    370393        PrintState(fStatusMagicWeather, "MAGIC_WEATHER");
    371394        PrintState(fStatusDriveControl, "DRIVE_CONTROL");
     395        PrintState(fStatusFeedback,     "FEEDBACK");
    372396        PrintState(fStatusBiasControl,  "BIAS_CONTROL");
    373397        PrintState(fStatusFadControl,   "FAD_CONTROL");
     
    473497        fStatusDriveControl(make_pair(Time(), -2)),
    474498        fStatusMagicWeather(make_pair(Time(), -2)),
     499        fStatusFeedback    (make_pair(Time(), -2)),
    475500        fStatusBiasControl (make_pair(Time(), -2)),
    476501        fStatusFadControl  (make_pair(Time(), -2)),
     
    485510        fDimMagicWeather        ("MAGIC_WEATHER/STATE",             (void*)NULL, 0, this),
    486511        fDimMagicWeatherData    ("MAGIC_WEATHER/DATA",              (void*)NULL, 0, this),
     512        //---
     513        fDimFeedback            ("FEEDBACK/STATE",                  (void*)NULL, 0, this),
     514        fDimFeedbackCalibration ("FEEDBACK/CALIBRATION",            (void*)NULL, 0, this),
    487515        //---
    488516        fDimBiasControl         ("BIAS_CONTROL/STATE",              (void*)NULL, 0, this),
Note: See TracChangeset for help on using the changeset viewer.