Changeset 1690 for trunk/MagicSoft/Cosy/devdrv
- Timestamp:
- 12/18/02 17:48:44 (22 years ago)
- Location:
- trunk/MagicSoft/Cosy/devdrv
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Cosy/devdrv/macs.cc
r1275 r1690 113 113 fVelRes = val; 114 114 return; 115 116 case 0x6501: 117 lout << "- Encoder resolution " << GetNodeName() << ": " << dec << val << " ticks/min" << endl; 118 fRes = val; 119 return; 115 120 } 116 121 cout << "Macs: SDO, idx=0x"<< hex << idx << "/" << (int)subidx; … … 211 216 void Macs::InitDevice(Network *net) 212 217 { 218 lout << "- MAC Init device." << endl; 213 219 NodeDrv::InitDevice(net); 220 lout << "- MAC Init device...done." << endl; 214 221 215 222 // SendSDO(0x4003, (LWORD_t)('E'<<24 | 'X'<<16 | 'I'<<8 'T')); … … 295 302 RequestSDO(0x6004); 296 303 WaitForSdo(0x6004); 304 } 305 306 void Macs::ReqRes() 307 { 308 lout << "- Requesting Encoder Resolution of " << GetNodeName() << endl; 309 RequestSDO(0x6501); 310 WaitForSdo(0x6501); 297 311 } 298 312 … … 491 505 case 100: 492 506 lout << "Connection timed out." << endl; 507 EnableTimeout(false); 493 508 return; 494 509 … … 592 607 void Macs::EnableTimeout(bool enable, LWORDS_t ms) 593 608 { 609 lout << "- MAC " << (enable?"En":"Dis") << "able timeout, " << dec << ms << "ms." << endl; 594 610 if (!enable) 595 611 { … … 597 613 WaitForSdo(0x4000, 1); 598 614 615 lout << "- Stopping handshake (PC)." << endl; 616 599 617 fTimeout->Stop(); //kTRUE); 600 618 … … 610 628 fTimerOn = kTRUE; 611 629 fTimeout->Start(fGuardTime/*/3*2*/, kTRUE); //kFALSE); //TRUE); 630 612 631 // 613 632 // Start with kFALSE would be a continous timer, but this … … 615 634 // any reason 616 635 // 617 618 //SendSDO(0x4000, 1, string('o', 'n'));619 //WaitForSdo(0x4000, 1);636 lout << "- MAC starting handshake." << endl; 637 SendSDO(0x4000, 1, string('o', 'n')); 638 WaitForSdo(0x4000, 1); 620 639 } 621 640 lout << "- Timeout timer of " << GetNodeName() << " turned " … … 666 685 // --- lout << edev(MLog::eGui); 667 686 668 if (time.Now() > fTimeoutTime +0.5)687 if (time.Now() > fTimeoutTime) 669 688 { 670 689 lout << ddev(MLog::eGui); … … 703 722 fGuardTime = ms/3; // how often do we send/request the handshake 704 723 705 SendSDO(0x4000, 2, ms ); // How often do we check for the handshake724 SendSDO(0x4000, 2, ms*2); // How often do we check for the handshake 706 725 WaitForSdo(0x4000, 2); 707 726 } -
trunk/MagicSoft/Cosy/devdrv/macs.h
r1140 r1690 18 18 Timer fPosTime; 19 19 20 LWORD_t fRes; // Encoder resolution 21 20 22 LWORDS_t fPdoPos; 21 23 Timer fPdoTime; … … 36 38 void ResetTimeout(); 37 39 Bool_t HandleTimer(TTimer *t); 40 41 void ReqRes(); 38 42 39 43 public: … … 100 104 LWORDS_t GetVel() { return fVel; } 101 105 LWORD_t GetVelRes() { return fVelRes; } // Velocity units (would be 100 for %) 106 LWORD_t GetRes() { return fRes; } // Encoder resolution 102 107 103 108 void HandleError(); -
trunk/MagicSoft/Cosy/devdrv/shaftencoder.cc
r1531 r1690 200 200 lout << "- Requesting Hardware Type (SDO 0x1000) of " << GetNodeName() << endl; 201 201 RequestSDO(0x1000); 202 WaitForSdo(0x1000); 202 if (!WaitForSdo(0x1000)) 203 { 204 lout << " ... failed." << endl; 205 fIsZombie = true; 206 return; 207 } 203 208 204 209 // -
trunk/MagicSoft/Cosy/devdrv/shaftencoder.h
r1140 r1690 51 51 52 52 LWORDS_t GetPos() { return fPos+fTurn*fTicks; } 53 LWORD_t GetPhysRes() { return fTicks; } 53 54 54 55 double GetTime();
Note:
See TracChangeset
for help on using the changeset viewer.