Changeset 1701 for trunk/MagicSoft/Cosy/devdrv/macs.cc
- Timestamp:
- 01/10/03 15:38:47 (22 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Cosy/devdrv/macs.cc
r1699 r1701 110 110 111 111 case 0x6002: 112 lout << "- Velocity resolution " << GetNodeName() << ":" << dec << val << " ticks/min" << endl;112 lout << "- " << GetNodeName() << ": Velocity resolution = " << dec << val << " ticks/min" << endl; 113 113 fVelRes = val; 114 114 return; 115 115 116 116 case 0x6501: 117 lout << "- Encoder resolution " << GetNodeName() << ":" << dec << val << " ticks/min" << endl;117 lout << "- " << GetNodeName() << ": Encoder resolution = " << dec << val << " ticks/min" << endl; 118 118 fRes = val; 119 119 return; … … 132 132 case 0: 133 133 lout << ddev(MLog::eGui); 134 lout << "- Velocity set (" << GetNodeName() << ")" << endl;134 lout << "- " << GetNodeName() << ": Velocity set." << endl; 135 135 lout << edev(MLog::eGui); 136 136 return; … … 142 142 case 0: 143 143 lout << ddev(MLog::eGui); 144 lout << "- Acceleration set (" << GetNodeName() << ")" << endl;144 lout << "- " << GetNodeName() << ": Acceleration set." << endl; 145 145 lout << edev(MLog::eGui); 146 146 return; 147 147 case 1: 148 148 lout << ddev(MLog::eGui); 149 lout << "- Deceleration set (" << GetNodeName() << ")" << endl;149 lout << "- " << GetNodeName() << ": Decceleration set." << endl; 150 150 lout << edev(MLog::eGui); 151 151 return; … … 157 157 case 0: 158 158 lout << ddev(MLog::eGui); 159 lout << "- RPM mode switched (" << GetNodeName() << ")" << endl;159 lout << "- " << GetNodeName() << ": RPM mode switched." << endl; 160 160 lout << edev(MLog::eGui); 161 161 return; … … 182 182 case 0: 183 183 lout << ddev(MLog::eGui); 184 lout << "- Absolute positioning started (" << GetNodeName() << ")" << endl;184 lout << "- " << GetNodeName() << ": Absolute positioning started." << endl; 185 185 lout << edev(MLog::eGui); 186 186 return; … … 188 188 case 1: 189 189 lout << ddev(MLog::eGui); 190 lout << "- Relative positioning started (" << GetNodeName() << ")" << endl;190 lout << "- " << GetNodeName() << ": Relative positioning started." << endl; 191 191 lout << edev(MLog::eGui); 192 192 return; … … 202 202 void Macs::ReqVelRes() 203 203 { 204 lout << "- Requesting velocity resolution (velres, 0x6002) of " << GetNodeName()<< endl;204 lout << "- " << GetNodeName() << ": Requesting velocity resolution (velres, 0x6002)." << endl; 205 205 RequestSDO(0x6002); 206 206 WaitForSdo(0x6002); 207 207 } 208 208 209 void Macs::ReqRes() 210 { 211 lout << "- " << GetNodeName() << ": Requesting encoder resolution (res, 0x6501)." << endl; 212 RequestSDO(0x6501); 213 WaitForSdo(0x6501); 214 } 215 209 216 void Macs::SetPDO1On(BYTE_t flag) 210 217 { 211 lout << "- " << (flag?"Enable":"Disable") << " PDO1 of " << GetNodeName()<< endl;218 lout << "- " << GetNodeName() << ": " << (flag?"Enable":"Disable") << " PDO1." << endl; 212 219 SendSDO(0x1800, 1, (LWORD_t)(flag?0:1)<<31); 213 220 WaitForSdo(0x1800, 1); … … 216 223 void Macs::InitDevice(Network *net) 217 224 { 218 lout << "- MAC Init device." << endl;225 lout << "- " << GetNodeName() << ": MAC Init device." << endl; 219 226 NodeDrv::InitDevice(net); 220 lout << "- MAC Init device...done." << endl;227 lout << "- " << GetNodeName() << ": MAC Init device...done." << endl; 221 228 222 229 // SendSDO(0x4003, (LWORD_t)('E'<<24 | 'X'<<16 | 'I'<<8 'T')); … … 238 245 EnableTimeout(kFALSE); 239 246 240 lout << "- Requesting Mac Software Version of " << GetNodeName()<< endl;247 lout << "- " << GetNodeName() << ": Requesting Mac Software Version." << endl; 241 248 RequestSDO(0x100a); 242 249 WaitForSdo(0x100a); … … 244 251 SetRpmMode(FALSE); 245 252 253 ReqRes(); // Init fRes 246 254 ReqVelRes(); // Init fVelRes 247 255 248 lout << "- Motor on of " << GetNodeName()<< endl;256 lout << "- " << GetNodeName() << ": Motor on." << endl; 249 257 SendSDO(0x3000, string('o', 'n')); 250 258 WaitForSdo(0x3000); … … 286 294 SetPDO1On(FALSE); 287 295 288 lout << "- Motor off of " << GetNodeName()<< endl;296 lout << "- " << GetNodeName() << ": Motor off." << endl; 289 297 SendSDO(0x3000, string('o', 'f', 'f')); 290 298 WaitForSdo(0x3000); … … 299 307 void Macs::ReqPos() 300 308 { 301 lout << "- Requesting Position of " << GetNodeName()<< endl;309 lout << "- " << GetNodeName() << ": Requesting Position." << endl; 302 310 RequestSDO(0x6004); 303 311 WaitForSdo(0x6004); 304 312 } 305 313 306 void Macs::ReqRes()307 {308 lout << "- Requesting Encoder Resolution of " << GetNodeName() << endl;309 RequestSDO(0x6501);310 WaitForSdo(0x6501);311 }312 313 314 void Macs::ReqVel() 314 315 { 315 lout << "- Requesting Velocity of " << GetNodeName()<< endl;316 lout << "- " << GetNodeName() << ": Requesting Velocity." << endl; 316 317 RequestSDO(0x2002); 317 318 WaitForSdo(0x2002); … … 320 321 void Macs::SetHome(LWORDS_t pos, WORD_t maxtime) 321 322 { 322 lout << "- Driving " << GetNodeName() << " to home position, Offset=" << dec << pos << endl; 323 /* 324 Bool_t to = fTimerOn; 325 326 if (to) 327 EnableTimeout(kFALSE); 328 */ 329 lout << "- " << GetNodeName() << ": Driving to home position, Offset=" << dec << pos << endl; 323 330 SendSDO(0x6003, 2, (LWORD_t)pos); // home 324 331 WaitForSdo(0x6003, 2); … … 328 335 SendSDO(0x3001, string('h','o','m','e')); // home 329 336 WaitForSdo(0x3001, 0, maxtime*1000); 330 lout << "- Home position of " << GetNodeName() << "reached. " << endl;337 lout << "- " << GetNodeName() << ": Home position reached. " << endl; 331 338 332 339 SendSDO(0x6003, 0, string('s','e','t')); // home 333 340 WaitForSdo(0x6003, 0); 341 342 //if (to) 343 // EnableTimeout(kTRUE); 334 344 } 335 345 … … 379 389 void Macs::SetNoWait(BYTE_t flag) 380 390 { 381 lout << "- Setting NOWAIT " << (flag?"ON ":"OFF ") << GetNodeName()<< endl;391 lout << "- " << GetNodeName() << ": Setting NOWAIT " << (flag?"ON":"OFF") << "." << endl; 382 392 SendSDO(0x3008, flag ? string('o', 'n') : string('o', 'f', 'f')); 383 393 WaitForSdo(0x3008); … … 390 400 // or by a positioning command (POSA, ...) 391 401 // 392 lout << "- Setting Vel Sync Mode of " << GetNodeName()<< endl;402 lout << "- " << GetNodeName() << ": Starting RPM Sync Mode." << endl; 393 403 SendSDO(0x3007, 0, string('s', 'y', 'n', 'c')); 394 404 WaitForSdo(0x3007, 0); … … 401 411 // or by a positioning command (POSA, ...) 402 412 // 403 lout << "- Setting Pos Sync Mode of " << GetNodeName()<< endl;413 lout << "- " << GetNodeName() << ": Starting Posistion Sync Mode." << endl; 404 414 SendSDO(0x3007, 1, string('s', 'y', 'n', 'c')); 405 415 WaitForSdo(0x3007, 1); … … 446 456 if (!errnum) 447 457 { 448 lout << " Mac " << GetNodeName() << "reports Error occursion." << endl;458 lout << "- " << GetNodeName() << ": reports Error occursion." << endl; 449 459 SetError(-1); 450 460 return; … … 456 466 // 457 467 if (GetError()>0) 458 lout << GetNodeName() << " WARNING! Error #" << GetError() << " unhandled by software." << endl; 468 { 469 lout << GetNodeName() << ": WARNING! Error #" << GetError() << " unhandled (not cleared) by software." << endl; 470 471 // 472 // If the error is unhadled and/or not cleared, don't try it again. 473 // 474 if (GetError()==errnum) 475 return; 476 } 459 477 460 478 SetError(errnum); … … 464 482 { 465 483 case 6: 484 // 485 // Report the error to the user. All possible movements should have 486 // been stopped anyhow. Now delete the error to prevent the system 487 // from reporting this error a thousands of times. 488 // 466 489 lout << "Home position not the first positioning command." << endl; 490 SetError(0); 467 491 return; 468 492 … … 607 631 void Macs::EnableTimeout(bool enable, LWORDS_t ms) 608 632 { 609 lout << "- MAC" << (enable?"En":"Dis") << "able timeout, " << dec << ms << "ms." << endl;633 lout << "- " << GetNodeName() << ": " << (enable?"En":"Dis") << "able timeout, " << dec << ms << "ms." << endl; 610 634 if (!enable) 611 635 { … … 613 637 WaitForSdo(0x4000, 1); 614 638 615 lout << "- Stopping handshake (PC)." << endl;639 lout << "- " << GetNodeName() << ": Stopping handshake (PC)." << endl; 616 640 617 641 fTimeout->Stop(); //kTRUE); … … 634 658 // any reason 635 659 // 636 lout << "- MACstarting handshake." << endl;660 lout << "- " << GetNodeName() << ": starting handshake." << endl; 637 661 SendSDO(0x4000, 1, string('o', 'n')); 638 662 WaitForSdo(0x4000, 1); 639 663 } 640 lout << "- Timeout timer of " << GetNodeName() << "turned "664 lout << "- " << GetNodeName() << ": Timeout timer turned " 641 665 << (enable?"on.":"off.") << endl; 642 666 }
Note:
See TracChangeset
for help on using the changeset viewer.