Changeset 12532
- Timestamp:
- 11/16/11 00:27:47 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/drivectrl.cc
r12309 r12532 124 124 } 125 125 126 virtual void UpdateStatus(const Time &, const array<uint8_t, 3> &) 127 { 128 } 129 126 130 virtual void UpdateStarguider(const Time &, const Drive::DimStarguider &) 127 131 { … … 131 135 { 132 136 } 137 133 138 134 139 protected: … … 189 194 StartReadReport(); 190 195 196 if (line.substr(0, 13)=="DRIVE-STATUS ") 197 { 198 Message(line.substr(70)); 199 return; 200 } 201 191 202 if (line.substr(0, 13)=="STARG-REPORT ") 192 203 { … … 366 377 stream >> stgmd; 367 378 379 uint32_t pdo3; 380 stream >> hex >> pdo3; 381 368 382 if (stream.fail()) 369 383 return; … … 375 389 if (status1==0) 376 390 status1 = 99; 377 fState = status1==1 ? armed+1 : status1; 391 392 const bool ready = (pdo3&0xef00ef)==0xef00ef; 393 if (!ready) 394 fState = 0; 395 else 396 fState = status1==1 ? armed+1 : status1; 397 398 // 1: Not ready 399 // 2: Not armed 400 // 3: Armed 401 // 4: Moving 402 // 5: Tracking 403 // 99: Error 404 405 406 407 // pdo3: 408 // 1 Ab 409 // 2 1 410 // 4 Emergency 411 // 8 OverVolt 412 // 10 Move (Drehen-soll) 413 // 20 Af 414 // 40 1 415 // 80 Power on Az 416 // ------------------ 417 // 100 NOT UPS Alarm 418 // 200 UPS on Battery 419 // 400 UPS charging 420 421 // Power cut: 2ef02ef 422 // charging: 4ef04ef 423 424 const array<uint8_t, 3> state = {{ uint8_t(pdo3>>16), uint8_t(pdo3), uint8_t(pdo3>>24) }}; 425 UpdateStatus(t1, state); 378 426 379 427 const array<double, 2> point = {{ zd2, az2 }}; … … 509 557 public: 510 558 ConnectionDrive(ba::io_service& ioservice, MessageImp &imp) : Connection(ioservice, imp()), 511 fState( 0), fIsVerbose(true), fKeepAlive(ioservice)559 fState(-1), fIsVerbose(true), fKeepAlive(ioservice) 512 560 { 513 561 SetLogStream(&imp); … … 519 567 } 520 568 521 int GetState() const { return IsConnected() ? fState+1 : 1; } 569 int GetState() const 570 { 571 if (!IsConnected()) 572 return 1; 573 if (IsConnected() && fState<0) 574 return 2; 575 return fState+3; 576 } 522 577 }; 523 578 … … 535 590 DimDescribedService fDimTracking; 536 591 DimDescribedService fDimTPoint; 592 DimDescribedService fDimStatus; 537 593 538 594 virtual void UpdatePointing(const Time &t, … … 548 604 fDimTracking.setData(arr); 549 605 fDimTracking.Update(t); 606 } 607 virtual void UpdateStatus(const Time &t, 608 const array<uint8_t, 3> &arr) 609 { 610 fDimStatus.setData(arr); 611 fDimStatus.Update(t); 550 612 } 551 613 virtual void UpdateTPoint(const Time &t, … … 592 654 "|Ys[pix]:Y position of star in CCD camera frame" 593 655 "|Ms[mag]:Artifical magnitude of star (calculated form image))" 594 "|Mc[mag]:Catalog magnitude of star") 656 "|Mc[mag]:Catalog magnitude of star"), 657 fDimStatus("DRIVE_CONTROL/STATUS", "C:2;C:1", "") 595 658 596 659 { … … 623 686 kStateDisconnected = 1, 624 687 kStateConnected, 688 kStateNotReady, 689 kStateReady, 625 690 kStateArmed, 626 691 kStateMoving, … … 676 741 { 677 742 fDrive.PostMessage(str); 743 T::Message("Sending: "+str); 678 744 return T::GetCurrentState(); 679 745 } … … 786 852 AddStateName(kStateConnected, "Connected", 787 853 "Cosy connected, drive stopped"); 854 855 AddStateName(kStateNotReady, "NotReady", 856 "Drive system not ready for movement"); 857 858 AddStateName(kStateReady, "Ready", 859 "Drive system ready for movement"); 788 860 789 861 AddStateName(kStateArmed, "Armed",
Note:
See TracChangeset
for help on using the changeset viewer.