Ignore:
Timestamp:
01/13/03 18:18:15 (22 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Cosy/devdrv
Files:
2 edited

Legend:

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

    r1701 r1702  
    243243    WaitForSdo(0x2004);
    244244    */
    245     EnableTimeout(kFALSE);
    246 
    247245    lout << "- " << GetNodeName() << ": Requesting Mac Software Version." << endl;
    248246    RequestSDO(0x100a);
    249247    WaitForSdo(0x100a);
    250248
     249    if (IsZombie())
     250        return;
     251
     252    EnableTimeout(kFALSE);
    251253    SetRpmMode(FALSE);
    252254
     
    437439    fPdoPos    = (data[4]<<24) | (data[5]<<16) | (data[6]<<8) | data[7];
    438440
    439     fPosActive = data[3]&0x02;
    440     fRpmActive = data[3]&0x04;
     441              // data[3]&0x01; // motor not moving
     442    fPosActive = data[3]&kPosActive; // positioning active
     443    fRpmActive = data[3]&kRpmActive; // RPM mode switched on
     444              // data[3]&0x08; //  - unused -
     445              // data[3]&0x10; //  - unused -
     446              // data[3]&0x20; //  - unused -
     447    fInControl = data[3]&0x40; // motor uncontrolled
     448              // data[3]&0x80; // axis resetted (after errclr, motor stop, motor on)
     449
     450    fStatus = data[3];
    441451
    442452    fPdoTime.SetTimer(tv);
     
    450460    //
    451461    // errnum==0 gives a sudden information that something happened. Now the
    452     // microcontroller is running inside its interrup procedure which
     462    // microcontroller is running inside its interrupt procedure which
    453463    // stopped the normal program. The interrupt procedure should try to clear
    454464    // the error state of the hardware. This should never create a new error!
  • trunk/MagicSoft/Cosy/devdrv/macs.h

    r1701 r1702  
    2525    BYTE_t   fPosActive;
    2626    BYTE_t   fRpmActive;
     27    BYTE_t   fInControl;
     28    BYTE_t   fStatus;
    2729
    2830    TTimer  *fTimeout;
     
    4042
    4143public:
     44    enum
     45    {
     46        kNotMoving = BIT(0),    // motor not moving
     47        kPosActive = BIT(1),    // positioning active
     48        kRpmActive = BIT(2),    // RPM mode switched on
     49        // BIT(3-5) unsused
     50        kOutOfControl = BIT(6), // motor uncontrolled
     51        kAxisReset = BIT(7)     // axis resetted (after errclr, motor stop, motor on)
     52    };
     53
    4254    Macs(const BYTE_t nodeid, const char *name=NULL, MLog &out=gLog);
    4355    virtual ~Macs();
     
    90102    void StopMotor();
    91103
    92     int IsPositioning() { return fPosActive; }
     104    int IsPositioning() const { return fPosActive; }
     105    BYTE_t GetStatus() const { return fStatus; }
    93106
    94107    double GetTime();
     
    98111    double GetPdoMjd();
    99112
    100     LWORDS_t GetPdoPos() { return fPdoPos; }
     113    LWORDS_t GetPdoPos() const { return fPdoPos; }
    101114
    102     LWORDS_t GetPos()    { return fPos; }
    103     LWORDS_t GetVel()    { return fVel; }
    104     LWORD_t  GetVelRes() { return fVelRes; } // Velocity units (would be 100 for %)
    105     LWORD_t  GetRes()    { return fRes; }    // Encoder resolution
     115    LWORDS_t GetPos()    const { return fPos; }
     116    LWORDS_t GetVel()    const { return fVel; }
     117    LWORD_t  GetVelRes() const { return fVelRes; } // Velocity units (would be 100 for %)
     118    LWORD_t  GetRes()    const { return fRes; }    // Encoder resolution
    106119
    107120    void HandleError();
Note: See TracChangeset for help on using the changeset viewer.