Changeset 2278 for trunk/MagicSoft/Cosy/devdrv
- Timestamp:
- 07/15/03 15:05:21 (22 years ago)
- Location:
- trunk/MagicSoft/Cosy/devdrv
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Cosy/devdrv/macs.cc
r2019 r2278 127 127 } 128 128 129 void Macs::HandleSDOOK(WORD_t idx, BYTE_t subidx, timeval_t *tv) 130 { 131 // cout << "Node #" << dec << (int)GetId() << ": Sdo=" << hex << idx << "/" << (int)subidx << " set." << endl; 129 void Macs::HandleSDOOK(WORD_t idx, BYTE_t subidx, LWORD_t data, timeval_t *tv) 130 { 131 // cout << "Node #" << dec << (int)GetId() << ": Sdo=" << hex << idx << "/" << (int)subidx << " set." << endl; 132 133 // If a real drive operation is requested from the MACS and 134 // the MACS is not correctly initialized the operation is 135 // rejected. (This is expecially harmfull if the NoWait state 136 // is set incorrectly) 137 if (data) 138 SetZombie(); 139 132 140 switch (idx) 133 141 { … … 201 209 202 210 } 203 NodeDrv::HandleSDOOK(idx, subidx, tv);211 NodeDrv::HandleSDOOK(idx, subidx, data, tv); 204 212 } 205 213 … … 223 231 SendSDO(0x1800, 1, (LWORD_t)(flag?0:1)<<31); 224 232 WaitForSdo(0x1800, 1); 233 } 234 235 void Macs::StartNode() 236 { 237 // 238 // Switch node from pre-operational state to operational state 239 // (This is not CANOpen compatible) 240 // After this the MACS will react on real movement commands. 241 // 242 lout << "- " << GetNodeName() << ": Starting Node." << endl; 243 SendSDO(0x1000, 1, (LWORD_t)1); 244 WaitForSdo(0x1000, 1); 225 245 } 226 246 … … 251 271 StopGuarding(); 252 272 253 273 // ****FIXME*** usleep(2000*GetGuardTime()); 254 274 255 275 lout << "- " << GetNodeName() << ": Requesting Mac Software Version." << endl; … … 257 277 WaitForSdo(0x100a); 258 278 // FIXME! Not statically linked! 259 if (fSoftVersion<0x00000044) // 00.68 279 //if (fSoftVersion<0x00000044) // 00.68 280 if (fSoftVersion<0x00000045) // 00.69 260 281 { 261 282 lout << GetNodeName() << " - Software Version too old!" << endl; … … 269 290 ReqVelRes(); // Init fVelRes 270 291 271 lout << "- " << GetNodeName() << ": Motor on." << endl; 272 SendSDO(0x3000, string('o', 'n')); 273 WaitForSdo(0x3000); 292 /* Should not be necessary anymore. This is done by the MACS itself. 293 lout << "- " << GetNodeName() << ": Motor on." << endl; 294 SendSDO(0x3000, string('o', 'n')); 295 WaitForSdo(0x3000); 296 */ 274 297 275 298 SetPDO1On(FALSE); // this is a workaround for the Macs 276 299 SetPDO1On(TRUE); 277 300 278 SetNoWait(TRUE); 279 280 // StartGuarding(200, 2, kFALSE); // Using PDO1 @ 100ms 281 282 // StartGuarding(250, 4); 283 // StartHostGuarding(); 284 } 285 301 //This is now standard in the MACS 302 //SetNoWait(TRUE); 303 304 // StartGuarding(200, 2, kFALSE); // Using PDO1 @ 100ms 305 // StartGuarding(250, 4); 306 // StartHostGuarding(); 307 308 StartNode(); 309 } 310 /* 286 311 void Macs::StopMotor() 287 312 { … … 292 317 WaitForSdo(0x3000); 293 318 } 294 319 */ 295 320 void Macs::StopDevice() 296 321 { 297 322 //EnableTimeout(kFALSE); 298 323 299 SetNoWait(FALSE); 324 //No need to switch it off. 325 //SetNoWait(FALSE); 300 326 301 327 StopHostGuarding(); … … 402 428 } 403 429 430 /* 404 431 void Macs::SetNoWait(BYTE_t flag) 405 432 { … … 408 435 WaitForSdo(0x3008); 409 436 } 437 */ 410 438 411 439 void Macs::StartVelSync() -
trunk/MagicSoft/Cosy/devdrv/macs.h
r1804 r2278 34 34 35 35 void HandleSDO(WORD_t idx, BYTE_t subidx, LWORD_t val, timeval_t *tv); 36 void HandleSDOOK(WORD_t idx, BYTE_t subidx, timeval_t *tv);36 void HandleSDOOK(WORD_t idx, BYTE_t subidx, LWORD_t data, timeval_t *tv); 37 37 //void HandleSDOError(LWORD_t data) { NodeDrv::HandleSDOError(data); } 38 38 … … 84 84 void SetDeceleration(LWORD_t dec); 85 85 void SetVelocity(LWORD_t vel); 86 void SetNoWait(BYTE_t flag=TRUE);86 //void SetNoWait(BYTE_t flag=TRUE); 87 87 void SetRpmMode(BYTE_t mode=TRUE); 88 88 void SetRpmVelocity(LWORDS_t cvel); … … 99 99 void StartAbsPos(LWORDS_t pos); 100 100 101 void StopMotor(); 101 //void StopMotor(); 102 103 void StartNode(); 102 104 103 105 int IsPositioning() const { return fPosActive; } -
trunk/MagicSoft/Cosy/devdrv/shaftencoder.cc
r1953 r2278 16 16 17 17 ShaftEncoder::ShaftEncoder(const BYTE_t nodeid, const char *name, MLog &out) 18 : NodeDrv(nodeid, name, out), fLabel(NULL), fPosHasChanged(false) 18 : NodeDrv(nodeid, name, out), fPos(0), fVel(0), fAcc(0), 19 fTurn(0), fLabel(NULL), fPosHasChanged(false) 19 20 { 20 21 }
Note:
See TracChangeset
for help on using the changeset viewer.