Ignore:
Timestamp:
12/18/02 17:48:44 (22 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Cosy/devdrv
Files:
4 edited

Legend:

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

    r1275 r1690  
    113113        fVelRes = val;
    114114        return;
     115
     116    case 0x6501:
     117        lout << "- Encoder resolution " << GetNodeName() << ": " << dec << val << " ticks/min" << endl;
     118        fRes = val;
     119        return;
    115120    }
    116121    cout << "Macs: SDO, idx=0x"<< hex << idx << "/" << (int)subidx;
     
    211216void Macs::InitDevice(Network *net)
    212217{
     218    lout << "- MAC Init device." << endl;
    213219    NodeDrv::InitDevice(net);
     220    lout << "- MAC Init device...done." << endl;
    214221
    215222//    SendSDO(0x4003, (LWORD_t)('E'<<24 | 'X'<<16 | 'I'<<8 'T'));
     
    295302    RequestSDO(0x6004);
    296303    WaitForSdo(0x6004);
     304}
     305
     306void Macs::ReqRes()
     307{
     308    lout << "- Requesting Encoder Resolution of " << GetNodeName() << endl;
     309    RequestSDO(0x6501);
     310    WaitForSdo(0x6501);
    297311}
    298312
     
    491505    case 100:
    492506        lout << "Connection timed out." << endl;
     507        EnableTimeout(false);
    493508        return;
    494509
     
    592607void Macs::EnableTimeout(bool enable, LWORDS_t ms)
    593608{
     609    lout << "- MAC " << (enable?"En":"Dis") << "able timeout, " << dec << ms << "ms." << endl;
    594610    if (!enable)
    595611    {
     
    597613        WaitForSdo(0x4000, 1);
    598614
     615        lout << "- Stopping handshake (PC)." << endl;
     616
    599617        fTimeout->Stop(); //kTRUE);
    600618
     
    610628        fTimerOn = kTRUE;
    611629        fTimeout->Start(fGuardTime/*/3*2*/, kTRUE); //kFALSE); //TRUE);
     630
    612631        //
    613632        // Start with kFALSE would be a continous timer, but this
     
    615634        // any reason
    616635        //
    617 
    618 //        SendSDO(0x4000, 1, string('o', 'n'));
    619 //        WaitForSdo(0x4000, 1);
     636        lout << "- MAC starting handshake." << endl;
     637        SendSDO(0x4000, 1, string('o', 'n'));
     638        WaitForSdo(0x4000, 1);
    620639    }
    621640    lout << "- Timeout timer of " << GetNodeName() << " turned "
     
    666685    // --- lout << edev(MLog::eGui);
    667686
    668     if (time.Now() > fTimeoutTime+0.5)
     687    if (time.Now() > fTimeoutTime)
    669688    {
    670689        lout << ddev(MLog::eGui);
     
    703722    fGuardTime = ms/3;      // how often do we send/request the handshake
    704723
    705     SendSDO(0x4000, 2, ms); // How often do we check for the handshake
     724    SendSDO(0x4000, 2, ms*2); // How often do we check for the handshake
    706725    WaitForSdo(0x4000, 2);
    707726}
  • trunk/MagicSoft/Cosy/devdrv/macs.h

    r1140 r1690  
    1818    Timer    fPosTime;
    1919
     20    LWORD_t  fRes;      // Encoder resolution
     21
    2022    LWORDS_t fPdoPos;
    2123    Timer    fPdoTime;
     
    3638    void ResetTimeout();
    3739    Bool_t HandleTimer(TTimer *t);
     40
     41    void ReqRes();
    3842
    3943public:
     
    100104    LWORDS_t GetVel()    { return fVel; }
    101105    LWORD_t  GetVelRes() { return fVelRes; } // Velocity units (would be 100 for %)
     106    LWORD_t  GetRes()    { return fRes; }    // Encoder resolution
    102107
    103108    void HandleError();
  • trunk/MagicSoft/Cosy/devdrv/shaftencoder.cc

    r1531 r1690  
    200200    lout << "- Requesting Hardware Type (SDO 0x1000) of " << GetNodeName() << endl;
    201201    RequestSDO(0x1000);
    202     WaitForSdo(0x1000);
     202    if (!WaitForSdo(0x1000))
     203    {
     204        lout << "  ... failed." << endl;
     205        fIsZombie = true;
     206        return;
     207    }
    203208
    204209    //
  • trunk/MagicSoft/Cosy/devdrv/shaftencoder.h

    r1140 r1690  
    5151
    5252    LWORDS_t GetPos() { return fPos+fTurn*fTicks; }
     53    LWORD_t  GetPhysRes() { return fTicks; }
    5354
    5455    double GetTime();
Note: See TracChangeset for help on using the changeset viewer.