Changeset 1703 for trunk/MagicSoft/Cosy/devdrv/shaftencoder.cc
- Timestamp:
- 01/14/03 12:08:46 (22 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Cosy/devdrv/shaftencoder.cc
r1701 r1703 51 51 } 52 52 case 0x100b: 53 lout << "Node ID: " << dec << val << endl; 53 // Do not display, this is used for CheckConnection 54 // lout << "Node ID: " << dec << val << endl; 54 55 return; 55 56 … … 94 95 void ShaftEncoder::DisplayVal() 95 96 { 97 if (fIsZombie) 98 { 99 fLabel[0]->SetText(new TGString("")); 100 fLabel[1]->SetText(new TGString("")); 101 fLabel[2]->SetText(new TGString("")); 102 fUpdPos = ~fPos; 103 fUpdVel = ~fVel; 104 fUpdAcc = ~fAcc; 105 return; 106 } 107 96 108 char text[21]; 97 109 … … 190 202 } 191 203 192 void ShaftEncoder::InitDevice(Network *net) 193 { 194 NodeDrv::InitDevice(net); 195 204 void ShaftEncoder::Init() 205 { 196 206 //----------------------------------------------------------------------- 197 207 // Start Setup of the Shaft Encoder … … 203 213 lout << "- " << GetNodeName() << ": Requesting Hardware Type (0x1000)." << endl; 204 214 RequestSDO(0x1000); 205 if (!WaitForSdo(0x1000)) 206 { 207 lout << " ... failed." << endl; 208 fIsZombie = true; 215 WaitForSdo(0x1000); 216 217 if (fIsZombie) 218 { 219 lout << GetNodeName() << " - Init failed!" << endl; 209 220 return; 210 221 } … … 265 276 } 266 277 278 void ShaftEncoder::CheckConnection() 279 { 280 // Request Node number 281 RequestSDO(0x100b); 282 WaitForSdo(0x100b); 283 } 284 /* 285 bool ShaftEncoder::InitDevice(Network *net) 286 { 287 NodeDrv::InitDevice(net); 288 289 Init(); 290 291 return !fIsZombie; 292 } 293 294 // -------------------------------------------------------------------------- 295 // 296 // This should be called from a master or main thread to get a node out 297 // of the Zombie-Status. 298 // 299 bool ShaftEncoder::Reboot() 300 { 301 fIsZombie = false; 302 303 Init(); 304 305 return !fIsZombie; 306 } 307 */ 308 267 309 void ShaftEncoder::ReqPos() 268 310 { … … 277 319 void ShaftEncoder::SetPreset(LWORD_t pre) 278 320 { 321 lout << "- " << GetNodeName() << ": Setting Preset." << endl; 322 323 SendSDO(0x6003, (LWORD_t)fPos); 324 if (!WaitForSdo(0x6003)) 325 return; 326 279 327 fPos = pre%16384; 280 328 fTurn = pre/16384; 281 282 lout << "- " << GetNodeName() << ": Setting Preset." << endl;283 SendSDO(0x6003, (LWORD_t)fPos);284 WaitForSdo(0x6003);285 329 } 286 330
Note:
See TracChangeset
for help on using the changeset viewer.