Changeset 1727 for trunk/MagicSoft/Cosy/devdrv/shaftencoder.cc
- Timestamp:
- 01/23/03 13:32:58 (22 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Cosy/devdrv/shaftencoder.cc
r1703 r1727 1 1 #include "shaftencoder.h" 2 2 3 #include " timer.h"3 #include "base/timer.h" 4 4 #include "network.h" 5 5 … … 17 17 ShaftEncoder::ShaftEncoder(const BYTE_t nodeid, const char *name, MLog &out) 18 18 : NodeDrv(nodeid, name, out), fLabel(NULL), fPosHasChanged(false) 19 {20 }21 22 ShaftEncoder::~ShaftEncoder()23 19 { 24 20 } … … 55 51 return; 56 52 53 case 0x100c: 54 lout << "- Guardtime: " << dec << val << "ms" << endl; 55 return; 56 57 case 0x100d: 58 lout << "- Lifetimefactor: " << dec << val << endl; 59 return; 60 61 case 0x100e: 62 lout << "- CobId for guarding: 0x" << hex << val << endl; 63 return; 64 57 65 case 0x6000: 58 66 case 0x6500: 59 lout << "- Counting: " << (val&1 67 lout << "- Counting: " << (val&1 ?"anti-clockwise":"clockwise") << " "; 60 68 lout << "HwTest: " << (val&2 ?"on":"off") << " "; 61 69 lout << "Scaling: " << (val&4 ?"on":"off") << " "; … … 95 103 void ShaftEncoder::DisplayVal() 96 104 { 97 if ( fIsZombie)105 if (IsZombieNode()) 98 106 { 99 107 fLabel[0]->SetText(new TGString("")); … … 162 170 } 163 171 172 //#include <fstream.h> 173 //ofstream fout("log/shaftencoder.log"); 174 164 175 void ShaftEncoder::HandlePDOType2(BYTE_t *data, timeval_t *tv) 165 176 { … … 188 199 fPos = pos; 189 200 fTurn = turn; 201 202 //fout << dec << (int)GetId() << " " << turn << " " << pos << endl; 203 190 204 fTime.SetTimer(tv); 191 205 fPosHasChanged=true; … … 208 222 //----------------------------------------------------------------------- 209 223 224 StopGuarding(); 225 210 226 // 211 227 // Requesting and checking (FIXME) type of encoder … … 215 231 WaitForSdo(0x1000); 216 232 217 if ( fIsZombie)233 if (IsZombieNode()) 218 234 { 219 235 lout << GetNodeName() << " - Init failed!" << endl; … … 274 290 lout << "- " << GetNodeName() << ": Start Node (NMT)." << endl; 275 291 SendNMT(kNMT_START); 292 293 StartGuarding(125, 2); 276 294 } 277 295 … … 282 300 WaitForSdo(0x100b); 283 301 } 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 out297 // of the Zombie-Status.298 //299 bool ShaftEncoder::Reboot()300 {301 fIsZombie = false;302 303 Init();304 305 return !fIsZombie;306 }307 */308 302 309 303 void ShaftEncoder::ReqPos() … … 321 315 lout << "- " << GetNodeName() << ": Setting Preset." << endl; 322 316 323 SendSDO(0x6003, (LWORD_t) fPos);317 SendSDO(0x6003, (LWORD_t)pre); 324 318 if (!WaitForSdo(0x6003)) 325 319 return;
Note:
See TracChangeset
for help on using the changeset viewer.