Changeset 14680


Ignore:
Timestamp:
11/21/12 22:43:38 (12 years ago)
Author:
tbretz
Message:
Fixed the timing around the movement; a conditional sign in Execute was wrong; added descriptions for OPEN and CLOSE
File:
1 edited

Legend:

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

    r14553 r14680  
    328328    {
    329329        fNextCommand = post;
     330
     331        fLid1.status = "";
     332        fLid2.status = "";
    330333        //PostRequest("POST", post);
    331334    }
     
    335338        PostRequest("POST", fNextCommand);
    336339        fNextCommand = "";
    337 
    338         fLid1.status = "";
    339         fLid2.status = "";
    340340
    341341        fKeepAlive.expires_from_now(boost::posix_time::seconds(fInterval));
     
    441441    Time fLastCommand;
    442442
     443    uint16_t fTimeToMove;
     444
    443445    bool CheckEventSize(size_t has, const char *name, size_t size)
    444446    {
     
    513515        if (T::GetCurrentState()==Lid::State::kMoving &&
    514516            (rc==Lid::State::kConnected || rc==Lid::State::kDisconnected) &&
    515             fLastCommand+boost::posix_time::seconds(6*fLid.GetInterval()) < Time())
     517            fLastCommand+boost::posix_time::seconds(fTimeToMove+fLid.GetInterval()) > Time())
     518        {
    516519            return Lid::State::kMoving;
     520        }
    517521
    518522        return rc==Lid::State::kConnected ? T::GetCurrentState() : rc;
     
    562566
    563567        T::AddEvent("OPEN", Lid::State::kInconsistent, Lid::State::kClosed)
    564             (bind(&StateMachineLidControl::Open, this));
     568            (bind(&StateMachineLidControl::Open, this))
     569            ("Open the lids");
    565570
    566571        T::AddEvent("CLOSE", Lid::State::kInconsistent, Lid::State::kOpen)
    567             (bind(&StateMachineLidControl::Close, this));
     572            (bind(&StateMachineLidControl::Close, this))
     573            ("Close the lids");
    568574
    569575        T::AddEvent("POST", "C")
     
    581587        fLid.SetEndpoint(conf.Get<string>("addr"));
    582588        fLid.StartConnect();
     589
     590        fTimeToMove = conf.Get<uint16_t>("time-to-move");
    583591
    584592        return -1;
     
    606614        ("quiet,q",    po_bool(true),  "Disable printing contents of all received messages (except dynamic data) in clear text.")
    607615        ("interval,i", var<uint16_t>(5), "Interval between two updates on the server in seconds")
     616        ("time-to-move", var<uint16_t>(20), "Expected minimum time the lid taks to open/close")
    608617        ("debug-tx",   po_bool(), "Enable debugging of ethernet transmission.")
    609618        ;
Note: See TracChangeset for help on using the changeset viewer.