Ignore:
Timestamp:
01/14/03 12:08:46 (22 years ago)
Author:
tbretz
Message:
*** empty log message ***
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Cosy/devdrv/shaftencoder.cc

    r1701 r1703  
    5151        }
    5252    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;
    5455        return;
    5556
     
    9495void ShaftEncoder::DisplayVal()
    9596{
     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
    96108    char text[21];
    97109
     
    190202}
    191203
    192 void ShaftEncoder::InitDevice(Network *net)
    193 {
    194     NodeDrv::InitDevice(net);
    195 
     204void ShaftEncoder::Init()
     205{
    196206    //-----------------------------------------------------------------------
    197207    //                    Start Setup of the Shaft Encoder
     
    203213    lout << "- " << GetNodeName() << ": Requesting Hardware Type (0x1000)." << endl;
    204214    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;
    209220        return;
    210221    }
     
    265276}
    266277
     278void ShaftEncoder::CheckConnection()
     279{
     280    // Request Node number
     281    RequestSDO(0x100b);
     282    WaitForSdo(0x100b);
     283}
     284/*
     285bool 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//
     299bool ShaftEncoder::Reboot()
     300{
     301    fIsZombie = false;
     302
     303    Init();
     304
     305    return !fIsZombie;
     306}
     307*/
     308
    267309void ShaftEncoder::ReqPos()
    268310{
     
    277319void ShaftEncoder::SetPreset(LWORD_t pre)
    278320{
     321    lout << "- " << GetNodeName() << ": Setting Preset." << endl;
     322
     323    SendSDO(0x6003, (LWORD_t)fPos);
     324    if (!WaitForSdo(0x6003))
     325        return;
     326
    279327    fPos  = pre%16384;
    280328    fTurn = pre/16384;
    281 
    282     lout << "- " << GetNodeName() << ": Setting Preset." << endl;
    283     SendSDO(0x6003, (LWORD_t)fPos);
    284     WaitForSdo(0x6003);
    285329}
    286330
Note: See TracChangeset for help on using the changeset viewer.