Ignore:
Timestamp:
01/10/03 15:38:47 (22 years ago)
Author:
tbretz
Message:
*** empty log message ***
File:
1 edited

Legend:

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

    r1699 r1701  
    110110
    111111    case 0x6002:
    112         lout << "- Velocity resolution " << GetNodeName() << ": " << dec << val << " ticks/min" << endl;
     112        lout << "- " << GetNodeName() << ": Velocity resolution = " << dec << val << " ticks/min" << endl;
    113113        fVelRes = val;
    114114        return;
    115115
    116116    case 0x6501:
    117         lout << "- Encoder resolution " << GetNodeName() << ": " << dec << val << " ticks/min" << endl;
     117        lout << "- " << GetNodeName() << ": Encoder resolution = " << dec << val << " ticks/min" << endl;
    118118        fRes = val;
    119119        return;
     
    132132        case 0:
    133133            lout << ddev(MLog::eGui);
    134             lout << "- Velocity set (" << GetNodeName() << ")" << endl;
     134            lout << "- " << GetNodeName() << ": Velocity set." << endl;
    135135            lout << edev(MLog::eGui);
    136136            return;
     
    142142        case 0:
    143143            lout << ddev(MLog::eGui);
    144             lout << "- Acceleration set (" << GetNodeName() << ")" << endl;
     144            lout << "- " << GetNodeName() << ": Acceleration set." << endl;
    145145            lout << edev(MLog::eGui);
    146146            return;
    147147        case 1:
    148148            lout << ddev(MLog::eGui);
    149             lout << "- Deceleration set (" << GetNodeName() << ")" << endl;
     149            lout << "- " << GetNodeName() << ": Decceleration set." << endl;
    150150            lout << edev(MLog::eGui);
    151151            return;
     
    157157        case 0:
    158158            lout << ddev(MLog::eGui);
    159             lout << "- RPM mode switched (" << GetNodeName() << ")" << endl;
     159            lout << "- " << GetNodeName() << ": RPM mode switched." << endl;
    160160            lout << edev(MLog::eGui);
    161161            return;
     
    182182        case 0:
    183183            lout << ddev(MLog::eGui);
    184             lout << "- Absolute positioning started (" << GetNodeName() << ")" << endl;
     184            lout << "- " << GetNodeName() << ": Absolute positioning started." << endl;
    185185            lout << edev(MLog::eGui);
    186186            return;
     
    188188        case 1:
    189189            lout << ddev(MLog::eGui);
    190             lout << "- Relative positioning started (" << GetNodeName() << ")" << endl;
     190            lout << "- " << GetNodeName() << ": Relative positioning started." << endl;
    191191            lout << edev(MLog::eGui);
    192192            return;
     
    202202void Macs::ReqVelRes()
    203203{
    204     lout << "- Requesting velocity resolution (velres, 0x6002) of " << GetNodeName() << endl;
     204    lout << "- " << GetNodeName() << ": Requesting velocity resolution (velres, 0x6002)." << endl;
    205205    RequestSDO(0x6002);
    206206    WaitForSdo(0x6002);
    207207}
    208208
     209void Macs::ReqRes()
     210{
     211    lout << "- " << GetNodeName() << ": Requesting encoder resolution (res, 0x6501)." << endl;
     212    RequestSDO(0x6501);
     213    WaitForSdo(0x6501);
     214}
     215
    209216void Macs::SetPDO1On(BYTE_t flag)
    210217{
    211     lout << "- " << (flag?"Enable":"Disable") << " PDO1 of " << GetNodeName() << endl;
     218    lout << "- " << GetNodeName() << ": " << (flag?"Enable":"Disable") << " PDO1." << endl;
    212219    SendSDO(0x1800, 1, (LWORD_t)(flag?0:1)<<31);
    213220    WaitForSdo(0x1800, 1);           
     
    216223void Macs::InitDevice(Network *net)
    217224{
    218     lout << "- MAC Init device." << endl;
     225    lout << "- " << GetNodeName() << ": MAC Init device." << endl;
    219226    NodeDrv::InitDevice(net);
    220     lout << "- MAC Init device...done." << endl;
     227    lout << "- " << GetNodeName() << ": MAC Init device...done." << endl;
    221228
    222229//    SendSDO(0x4003, (LWORD_t)('E'<<24 | 'X'<<16 | 'I'<<8 'T'));
     
    238245    EnableTimeout(kFALSE);
    239246
    240     lout << "- Requesting Mac Software Version of " << GetNodeName() << endl;
     247    lout << "- " << GetNodeName() << ": Requesting Mac Software Version." << endl;
    241248    RequestSDO(0x100a);
    242249    WaitForSdo(0x100a);
     
    244251    SetRpmMode(FALSE);
    245252
     253    ReqRes();    // Init fRes
    246254    ReqVelRes(); // Init fVelRes
    247255
    248     lout << "- Motor on of " << GetNodeName() << endl;
     256    lout << "- " << GetNodeName() << ": Motor on." << endl;
    249257    SendSDO(0x3000, string('o', 'n'));
    250258    WaitForSdo(0x3000);
     
    286294    SetPDO1On(FALSE);
    287295
    288     lout << "- Motor off of " << GetNodeName() << endl;
     296    lout << "- " << GetNodeName() << ": Motor off." << endl;
    289297    SendSDO(0x3000, string('o', 'f', 'f'));
    290298    WaitForSdo(0x3000);
     
    299307void Macs::ReqPos()
    300308{
    301     lout << "- Requesting Position of " << GetNodeName() << endl;
     309    lout << "- " << GetNodeName() << ": Requesting Position." << endl;
    302310    RequestSDO(0x6004);
    303311    WaitForSdo(0x6004);
    304312}
    305313
    306 void Macs::ReqRes()
    307 {
    308     lout << "- Requesting Encoder Resolution of " << GetNodeName() << endl;
    309     RequestSDO(0x6501);
    310     WaitForSdo(0x6501);
    311 }
    312 
    313314void Macs::ReqVel()
    314315{
    315     lout << "- Requesting Velocity of " << GetNodeName() << endl;
     316    lout << "- " << GetNodeName() << ": Requesting Velocity." << endl;
    316317    RequestSDO(0x2002);
    317318    WaitForSdo(0x2002);
     
    320321void Macs::SetHome(LWORDS_t pos, WORD_t maxtime)
    321322{
    322     lout << "- Driving " << GetNodeName() << " to home position, Offset=" << dec << pos << endl;
     323    /*
     324    Bool_t to = fTimerOn;
     325
     326    if (to)
     327        EnableTimeout(kFALSE);
     328    */
     329    lout << "- " << GetNodeName() << ": Driving to home position, Offset=" << dec << pos << endl;
    323330    SendSDO(0x6003, 2, (LWORD_t)pos);       // home
    324331    WaitForSdo(0x6003, 2);
     
    328335    SendSDO(0x3001, string('h','o','m','e'));       // home
    329336    WaitForSdo(0x3001, 0, maxtime*1000);
    330     lout << "- Home position of " << GetNodeName() << " reached. " << endl;
     337    lout << "- " << GetNodeName() << ": Home position reached. " << endl;
    331338
    332339    SendSDO(0x6003, 0, string('s','e','t'));       // home
    333340    WaitForSdo(0x6003, 0);
     341
     342    //if (to)
     343    //    EnableTimeout(kTRUE);
    334344}
    335345
     
    379389void Macs::SetNoWait(BYTE_t flag)
    380390{
    381     lout << "- Setting NOWAIT " << (flag?"ON ":"OFF ") << GetNodeName() << endl;
     391    lout << "- " << GetNodeName() << ": Setting NOWAIT " << (flag?"ON":"OFF") << "." << endl;
    382392    SendSDO(0x3008, flag ? string('o', 'n') : string('o', 'f', 'f'));
    383393    WaitForSdo(0x3008);
     
    390400    // or by a positioning command (POSA, ...)
    391401    //
    392     lout << "- Setting Vel Sync Mode of " << GetNodeName() << endl;
     402    lout << "- " << GetNodeName() << ": Starting RPM Sync Mode." << endl;
    393403    SendSDO(0x3007, 0, string('s', 'y', 'n', 'c'));
    394404    WaitForSdo(0x3007, 0);
     
    401411    // or by a positioning command (POSA, ...)
    402412    //
    403     lout << "- Setting Pos Sync Mode of " << GetNodeName() << endl;
     413    lout << "- " << GetNodeName() << ": Starting Posistion Sync Mode." << endl;
    404414    SendSDO(0x3007, 1, string('s', 'y', 'n', 'c'));
    405415    WaitForSdo(0x3007, 1);
     
    446456    if (!errnum)
    447457    {
    448         lout << "Mac " << GetNodeName() << " reports Error occursion." << endl;
     458        lout << "- " << GetNodeName() << ": reports Error occursion." << endl;
    449459        SetError(-1);
    450460        return;
     
    456466    //
    457467    if (GetError()>0)
    458         lout << GetNodeName() << " WARNING! Error #" << GetError() << " unhandled by software." << endl;
     468    {
     469        lout << GetNodeName() << ": WARNING! Error #" << GetError() << " unhandled (not cleared) by software." << endl;
     470
     471        //
     472        // If the error is unhadled and/or not cleared, don't try it again.
     473        //
     474        if (GetError()==errnum)
     475            return;
     476    }
    459477
    460478    SetError(errnum);
     
    464482    {
    465483    case 6:
     484        //
     485        // Report the error to the user. All possible movements should have
     486        // been stopped anyhow. Now delete the error to prevent the system
     487        // from reporting this error a thousands of times.
     488        //
    466489        lout << "Home position not the first positioning command." << endl;
     490        SetError(0);
    467491        return;
    468492
     
    607631void Macs::EnableTimeout(bool enable, LWORDS_t ms)
    608632{
    609     lout << "- MAC " << (enable?"En":"Dis") << "able timeout, " << dec << ms << "ms." << endl;
     633    lout << "- " << GetNodeName() << ": " << (enable?"En":"Dis") << "able timeout, " << dec << ms << "ms." << endl;
    610634    if (!enable)
    611635    {
     
    613637        WaitForSdo(0x4000, 1);
    614638
    615         lout << "- Stopping handshake (PC)." << endl;
     639        lout << "- " << GetNodeName() << ": Stopping handshake (PC)." << endl;
    616640
    617641        fTimeout->Stop(); //kTRUE);
     
    634658        // any reason
    635659        //
    636         lout << "- MAC starting handshake." << endl;
     660        lout << "- " << GetNodeName() << ": starting handshake." << endl;
    637661        SendSDO(0x4000, 1, string('o', 'n'));
    638662        WaitForSdo(0x4000, 1);
    639663    }
    640     lout << "- Timeout timer of " << GetNodeName() << " turned "
     664    lout << "- " << GetNodeName() << ": Timeout timer turned "
    641665        << (enable?"on.":"off.") << endl;
    642666}
Note: See TracChangeset for help on using the changeset viewer.