Changeset 2278 for trunk/MagicSoft/Cosy/devdrv/macs.cc
- Timestamp:
- 07/15/03 15:05:21 (21 years ago)
- File:
-
- 1 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()
Note:
See TracChangeset
for help on using the changeset viewer.