Ignore:
Timestamp:
04/12/03 19:06:27 (22 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Cosy/devdrv
Files:
3 edited

Legend:

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

    r1804 r1953  
    4646    switch (idx)
    4747    {
     48    case 0x1003:
     49        // FIXME, see Init
     50        if (subidx!=2)
     51            return;
     52        lout << "- " << GetNodeName() << ": Error[0]=" << dec << val << endl;
     53        SetError(val);
     54        return;
     55
    4856    case 0x100a:
    4957        lout << "- " << GetNodeName() << ": Using Software Version V" << dec << (int)(val>>16) << "." << (int)(val&0xff) << endl;
     
    221229}
    222230
    223 
    224231void Macs::Init()
    225232{
     233    //
     234    // Request current error status (FIXME: is the first entry in the
     235    // error list)
     236    //
     237    lout << "- " << GetNodeName() << ": Requesting Error[0]." << endl;
     238    RequestSDO(0x1003, 2);
     239    WaitForSdo(0x1003, 2);
    226240    if (HasError())
    227241    {
     
    238252    RequestSDO(0x100a);
    239253    WaitForSdo(0x100a);
    240 
    241254    if (IsZombieNode())
    242     {
    243         lout << GetNodeName() << " - InitDevice failed!" << endl;
    244         return;
    245     }
     255        return;
    246256
    247257    // FIXME! Not statically linked!
     
    538548        return;
    539549
     550    case 71:
     551        lout << "Array out of bound." << endl;
     552        return;
     553
    540554    case 84:
    541555        lout << "Too many (>12) ON TIME calls." << endl;
  • trunk/MagicSoft/Cosy/devdrv/shaftencoder.cc

    r1804 r1953  
    4040            default:
    4141                lout << "?" << endl;
     42                SetZombie();
    4243                return;
    4344            }
    4445        default:
    4546            lout << "???" << endl;
     47            SetZombie();
    4648            return;
    4749        }
     
    8890
    8991    case 0x6502:
    90         if (val==0)
    91             val = 1;  // Single Turn = Multiturn with one turn
    92         lout << "- Possible Turns: " << dec << val << endl;
     92        //if (val==0)
     93        //    val = 1;  // Single Turn = Multiturn with one turn
     94        lout << "- Number of Revolutions: " << dec << val << endl;
    9395        fTurns = val;
    9496        return;
     
    105107    if (IsZombieNode())
    106108    {
    107         fLabel[0]->SetText(new TGString(""));
    108         fLabel[1]->SetText(new TGString(""));
    109         fLabel[2]->SetText(new TGString(""));
     109        fLabel->SetText(new TGString(""));
    110110        fUpdPos = ~fPos;
    111         fUpdVel = ~fVel;
    112         fUpdAcc = ~fAcc;
    113111        return;
    114112    }
     
    116114    char text[21];
    117115
    118     if (fPos!=fUpdPos && fLabel[0])
     116    if (fPos!=fUpdPos && fLabel)
    119117    {
    120118        sprintf(text, "%ld", fPos);
    121         fLabel[0]->SetText(new TGString(text));
     119        fLabel->SetText(new TGString(text));
    122120        fUpdPos = fPos;
    123     }
    124 
    125     if (fVel!=fUpdVel && fLabel[1])
    126     {
    127         sprintf(text, "%d", fVel);
    128         fLabel[1]->SetText(new TGString(text));
    129         fUpdVel = fVel;
    130     }
    131 
    132     if (fAcc!=fUpdAcc && fLabel[2])
    133     {
    134         sprintf(text, "%d", fAcc);
    135         fLabel[2]->SetText(new TGString(text));
    136         fUpdAcc = fAcc;
    137121    }
    138122}
     
    183167    fAcc = data[6] | (data[7]<<8);
    184168
    185     const int uplim = 9*fTicks/10;
    186     const int dnlim = 1*fTicks/10;
     169    const int dnlim = fTicks/10;
     170    const int uplim = fTurns*fTicks-dnlim;
    187171
    188172    int turn = fTurn;
     
    199183    fPos  = pos;
    200184    fTurn = turn;
    201 
    202     //fout << dec << (int)GetId() << " " << turn << " " << pos << endl;
    203185
    204186    fTime.SetTimer(tv);
     
    230212    RequestSDO(0x1000);
    231213    WaitForSdo(0x1000);
    232 
    233214    if (IsZombieNode())
    234     {
    235         lout << GetNodeName() << " - Init failed!" << endl;
    236         return;
    237     }
     215        return;
    238216
    239217    //
  • trunk/MagicSoft/Cosy/devdrv/shaftencoder.h

    r1727 r1953  
    1717    WORD_t   fTurns; // Number of possible turns
    1818
    19     TGLabel **fLabel;     //
     19    TGLabel  *fLabel;     //
    2020    LWORDS_t  fUpdPos;    // ticks
    21     WORDS_t   fUpdVel;    // ticks per 5ms
    22     WORDS_t   fUpdAcc;    // ticks per 25ms^2
     21    //    WORDS_t   fUpdVel;    // ticks per 5ms
     22    //    WORDS_t   fUpdAcc;    // ticks per 25ms^2
    2323
    2424    bool fPosHasChanged;  //!
     
    4040    void StopDevice();
    4141
    42     void SetDisplay(TGLabel **label) { fLabel = label; }
     42    void SetDisplay(TGLabel *label) { fLabel = label; }
    4343
    4444    void HandleSDO(WORD_t idx, BYTE_t subidx, LWORD_t val, timeval_t *tv);
Note: See TracChangeset for help on using the changeset viewer.