Ignore:
Timestamp:
01/10/03 15:38:47 (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

    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}
  • trunk/MagicSoft/Cosy/devdrv/macs.h

    r1690 r1701  
    3939    Bool_t HandleTimer(TTimer *t);
    4040
    41     void ReqRes();
    42 
    4341public:
    4442    Macs(const BYTE_t nodeid, const char *name=NULL, MLog &out=gLog);
     
    6563    //void ReqAxEnd();
    6664    void ReqVelRes();
     65    void ReqRes();
    6766    void SetHome(LWORDS_t pos=0, WORD_t maxtime=25);
    6867    void SetAcceleration(LWORD_t acc);
  • trunk/MagicSoft/Cosy/devdrv/shaftencoder.cc

    r1690 r1701  
    6060        lout << "Scaling: " <<  (val&4   ?"on":"off") << "  ";
    6161        lout << "Modulo: " <<   (val&4096?"on":"off") << endl;
     62        return;
    6263
    6364    case 0x6001:
     
    7879
    7980    case 0x6502:
     81        if (val==0)
     82            val = 1;  // Single Turn = Multiturn with one turn
    8083        lout << "- Possible Turns: " << dec << val << endl;
    81         fTurns = val ? val : 1; // Single Turn = Multiturn with one turn
     84        fTurns = val;
    8285        return;
    8386
     
    198201    // Requesting and checking (FIXME) type of encoder
    199202    //
    200     lout << "- Requesting Hardware Type (SDO 0x1000) of " << GetNodeName() << endl;
     203    lout << "- " << GetNodeName() << ": Requesting Hardware Type (0x1000)." << endl;
    201204    RequestSDO(0x1000);
    202205    if (!WaitForSdo(0x1000))
     
    210213    // Read physical ticks per revolution
    211214    //
    212     lout << "- Requesting physical ticks/revolution (SDO 0x6501) of " << GetNodeName() << endl;
     215    lout << "- " << GetNodeName() << ": Requesting physical ticks/revolution (SDO 0x6501)." << endl;
    213216    RequestSDO(0x6501);
    214217    WaitForSdo(0x6501);
     
    217220    // Read number of possible ticks per revolution
    218221    //
    219     lout << "- Requesting possible ticks/revolution (SDO 0x6502) of " << GetNodeName() << endl;
     222    lout << "- " << GetNodeName() << ": Requesting possible ticks/revolution (SDO 0x6502)." << endl;
    220223    RequestSDO(0x6502);
    221224    WaitForSdo(0x6502);
     
    224227    // Set logic ticks/revolution = physical ticks/revolution => scale factor = 1
    225228    //
    226     lout << "- Configuring SDO 0x6001 of " << GetNodeName() << endl;
     229    lout << "- " << GetNodeName() << ": Configuring log. tick/rev (0x6001)." << endl;
    227230    SendSDO(0x6001, fTicks);
    228231    WaitForSdo(0x6001);
     
    231234    // Set maximum number of ticks (ticks * turns)
    232235    //
    233     lout << "- Configuring SDO 0x6002 of " << GetNodeName() << endl;
     236    lout << "- " << GetNodeName() << ": Configuring max number of ticks (0x6002)." << endl;
    234237    SendSDO(0x6002, (LWORD_t)(fTicks*fTurns));
    235238    WaitForSdo(0x6002);
    236239
    237240    //
     241    // Delete preset Value
     242    //
     243    lout << "- " << GetNodeName() << ": Delete preset value (0x6003)." << endl;
     244    SendSDO(0x6003, (LWORD_t)0xffffffff);
     245    WaitForSdo(0x6003);
     246
     247    //
    238248    // Configure PDOs
    239249    //
    240     lout << "- Configuring SDO 0x1802 of " << GetNodeName() << endl;
     250    lout << "- " << GetNodeName() << ": Configuring PDOs (0x1802)." << endl;
    241251    SendSDO(0x1802, 1, (LWORD_t)0x281);
    242252    WaitForSdo(0x1802, 1);
    243253
    244254    //
    245     // Delete preset Value
    246     //
    247     lout << "- Configuring SDO 0x6003 of " << GetNodeName() << endl;
    248     SendSDO(0x6003, (LWORD_t)0xffffffff);
    249     WaitForSdo(0x6003);
    250 
    251     //
    252255    // Request Parameter
    253256    //
    254     lout << "- Requesting SDO 0x6000 of " << GetNodeName() << endl;
     257    lout << "- " << GetNodeName() << ": Requesting SDO 0x6000." << endl;
    255258    RequestSDO(0x6000);
    256259    WaitForSdo(0x6000);
     
    258261    ReqPos();
    259262
    260     lout << "- Start Node " << GetNodeName() << endl;
     263    lout << "- " << GetNodeName() << ": Start Node (NMT)." << endl;
    261264    SendNMT(kNMT_START);
    262265}
     
    267270    // Request Position
    268271    //
    269     lout << "- Requesting Position of " << GetNodeName() << endl;
     272    lout << "- " << GetNodeName() << ": Requesting Position." << endl;
    270273    RequestSDO(0x6004);
    271274    WaitForSdo(0x6004);
     
    277280    fTurn = pre/16384;
    278281
    279     lout << " - Setting Preset " << GetNodeName() << endl;
     282    lout << "- " << GetNodeName() << ": Setting Preset." << endl;
    280283    SendSDO(0x6003, (LWORD_t)fPos);
    281284    WaitForSdo(0x6003);
     
    284287void ShaftEncoder::StopDevice()
    285288{
    286     lout << "- Stop Node " << GetNodeName() << endl;
     289    lout << "- " << GetNodeName() << ": Stop Node (NMT)." << endl;
    287290    SendNMT(kNMT_STOP);
    288291}
Note: See TracChangeset for help on using the changeset viewer.