Changeset 15103
- Timestamp:
- 03/18/13 14:56:33 (12 years ago)
- Location:
- trunk/FACT++/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/HeadersLid.h
r14360 r15103 10 10 kDisconnected = 1, 11 11 kConnected, 12 kUnidentified, 12 13 kInconsistent, 13 14 kUnknown, 15 kPowerProblem, 14 16 kClosed, 15 17 kOpen, -
trunk/FACT++/src/lidctrl.cc
r14978 r15103 166 166 fRdfData = ""; 167 167 168 if ((fLid1.status!="Open" && fLid1.status!="Closed" && fLid1.status!="Unknown") || 169 (fLid2.status!="Open" && fLid2.status!="Closed" && fLid2.status!="Unknown")) 170 { 171 Warn("Lid status unknown ("+fLid1.status+"/"+fLid2.status+")"); 172 PostClose(false); 173 return; 174 } 168 if ((fLid1.status!="Open" && fLid1.status!="Closed" && fLid1.status!="Power Problem" && fLid1.status!="Unknown") || 169 (fLid2.status!="Open" && fLid2.status!="Closed" && fLid2.status!="Power Problem" && fLid2.status!="Unknown")) 170 Warn("Lid reported status unknown by lidctrl ("+fLid1.status+"/"+fLid2.status+")"); 175 171 176 172 fLastReport = Time(); … … 358 354 return State::kDisconnected; 359 355 356 // Unidentified state detected 357 if ((fLid1.status!="Open" && fLid1.status!="Closed" && fLid1.status!="Power Problem" && fLid1.status!="Unknown") || 358 (fLid2.status!="Open" && fLid2.status!="Closed" && fLid2.status!="Power Problem" && fLid2.status!="Unknown")) 359 return State::kUnidentified; 360 361 // This is an assumption, but the best we have... 362 if (fLid1.status=="Closed" && fLid2.status=="Power Problem") 363 return State::kClosed; 364 if (fLid2.status=="Closed" && fLid1.status=="Power Problem") 365 return State::kClosed; 366 if (fLid1.status=="Open" && fLid2.status=="Power Problem") 367 return State::kOpen; 368 if (fLid2.status=="Open" && fLid1.status=="Power Problem") 369 return State::kOpen; 370 360 371 // Inconsistency 361 372 if (fLid1.status!=fLid2.status) … … 365 376 if (fLid1.status=="Unknown") 366 377 return State::kUnknown; 378 379 // Power Problem 380 if (fLid1.status=="Power Problem") 381 return State::kPowerProblem; 367 382 368 383 // Closed … … 413 428 DimData data; 414 429 430 if (l1.status=="Unknown") 431 data.status[0] = 3; 432 if (l1.status=="Power Problem") 433 data.status[0] = 2; 415 434 if (l1.status=="Open") 416 435 data.status[0] = 1; … … 418 437 data.status[0] = 0; 419 438 439 if (l2.status=="Unknown") 440 data.status[1] = 3; 441 if (l2.status=="Power Problem") 442 data.status[1] = 2; 420 443 if (l2.status=="Open") 421 444 data.status[1] = 1; … … 429 452 data.position[1] = l2.position; 430 453 454 fDim.setQuality(GetState()); 431 455 fDim.Update(data); 432 456 } … … 544 568 "Connection established, but status still not known"); 545 569 570 T::AddStateName(Lid::State::kUnidentified, "Unidentified", 571 "At least one lid reported a state which could not be identified by lidctrl"); 572 546 573 T::AddStateName(Lid::State::kInconsistent, "Inconsistent", 547 574 "Both lids show different states"); … … 549 576 T::AddStateName(Lid::State::kUnknown, "Unknown", 550 577 "Arduino reports at least one lids in an unknown status"); 578 579 T::AddStateName(Lid::State::kPowerProblem, "PowerProblem", 580 "Arduino reports both lids to have a power problem (might also be that both are at the end switches)"); 551 581 552 582 T::AddStateName(Lid::State::kClosed, "Closed", … … 566 596 "|verbosity[bool]:disable or enable verbosity for received data (yes/no), except dynamic data"); 567 597 568 T::AddEvent("OPEN", Lid::State::k Inconsistent, Lid::State::kUnknown, Lid::State::kClosed)598 T::AddEvent("OPEN", Lid::State::kUnidentified, Lid::State::kInconsistent, Lid::State::kUnknown, Lid::State::kPowerProblem, Lid::State::kClosed) 569 599 (bind(&StateMachineLidControl::Open, this)) 570 600 ("Open the lids"); 571 601 572 T::AddEvent("CLOSE", Lid::State::k Inconsistent, Lid::State::kUnknown, Lid::State::kOpen)602 T::AddEvent("CLOSE", Lid::State::kUnidentified, Lid::State::kInconsistent, Lid::State::kUnknown, Lid::State::kPowerProblem, Lid::State::kOpen) 573 603 (bind(&StateMachineLidControl::Close, this)) 574 604 ("Close the lids");
Note:
See TracChangeset
for help on using the changeset viewer.