Changeset 14680
- Timestamp:
- 11/21/12 22:43:38 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/lidctrl.cc
r14553 r14680 328 328 { 329 329 fNextCommand = post; 330 331 fLid1.status = ""; 332 fLid2.status = ""; 330 333 //PostRequest("POST", post); 331 334 } … … 335 338 PostRequest("POST", fNextCommand); 336 339 fNextCommand = ""; 337 338 fLid1.status = "";339 fLid2.status = "";340 340 341 341 fKeepAlive.expires_from_now(boost::posix_time::seconds(fInterval)); … … 441 441 Time fLastCommand; 442 442 443 uint16_t fTimeToMove; 444 443 445 bool CheckEventSize(size_t has, const char *name, size_t size) 444 446 { … … 513 515 if (T::GetCurrentState()==Lid::State::kMoving && 514 516 (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 { 516 519 return Lid::State::kMoving; 520 } 517 521 518 522 return rc==Lid::State::kConnected ? T::GetCurrentState() : rc; … … 562 566 563 567 T::AddEvent("OPEN", Lid::State::kInconsistent, Lid::State::kClosed) 564 (bind(&StateMachineLidControl::Open, this)); 568 (bind(&StateMachineLidControl::Open, this)) 569 ("Open the lids"); 565 570 566 571 T::AddEvent("CLOSE", Lid::State::kInconsistent, Lid::State::kOpen) 567 (bind(&StateMachineLidControl::Close, this)); 572 (bind(&StateMachineLidControl::Close, this)) 573 ("Close the lids"); 568 574 569 575 T::AddEvent("POST", "C") … … 581 587 fLid.SetEndpoint(conf.Get<string>("addr")); 582 588 fLid.StartConnect(); 589 590 fTimeToMove = conf.Get<uint16_t>("time-to-move"); 583 591 584 592 return -1; … … 606 614 ("quiet,q", po_bool(true), "Disable printing contents of all received messages (except dynamic data) in clear text.") 607 615 ("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") 608 617 ("debug-tx", po_bool(), "Enable debugging of ethernet transmission.") 609 618 ;
Note:
See TracChangeset
for help on using the changeset viewer.