Ignore:
Timestamp:
07/15/03 15:05:21 (21 years ago)
Author:
tbretz
Message:
*** empty log message ***
File:
1 edited

Legend:

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

    r2019 r2278  
    127127}
    128128
    129 void Macs::HandleSDOOK(WORD_t idx, BYTE_t subidx, timeval_t *tv)
    130 {
    131 //    cout << "Node #" << dec << (int)GetId() << ": Sdo=" << hex << idx  << "/" << (int)subidx << " set." << endl;
     129void Macs::HandleSDOOK(WORD_t idx, BYTE_t subidx, LWORD_t data, timeval_t *tv)
     130{
     131    //    cout << "Node #" << dec << (int)GetId() << ": Sdo=" << hex << idx  << "/" << (int)subidx << " set." << endl;
     132
     133    // If a real drive operation is requested from the MACS and
     134    // the MACS is not correctly initialized the operation is
     135    // rejected. (This is expecially harmfull if the NoWait state
     136    // is set incorrectly)
     137    if (data)
     138        SetZombie();
     139
    132140    switch (idx)
    133141    {
     
    201209
    202210    }
    203     NodeDrv::HandleSDOOK(idx, subidx, tv);
     211    NodeDrv::HandleSDOOK(idx, subidx, data, tv);
    204212}
    205213
     
    223231    SendSDO(0x1800, 1, (LWORD_t)(flag?0:1)<<31);
    224232    WaitForSdo(0x1800, 1);           
     233}
     234
     235void Macs::StartNode()
     236{
     237    //
     238    // Switch node from pre-operational state to operational state
     239    // (This is not CANOpen compatible)
     240    // After this the MACS will react on real movement commands.
     241    //
     242    lout << "- " << GetNodeName() << ": Starting Node." << endl;
     243    SendSDO(0x1000, 1, (LWORD_t)1);
     244    WaitForSdo(0x1000, 1);
    225245}
    226246
     
    251271    StopGuarding();
    252272
    253     usleep(2000*GetGuardTime());
     273// ****FIXME***   usleep(2000*GetGuardTime());
    254274
    255275    lout << "- " << GetNodeName() << ": Requesting Mac Software Version." << endl;
     
    257277    WaitForSdo(0x100a);
    258278    // FIXME! Not statically linked!
    259     if (fSoftVersion<0x00000044) // 00.68
     279    //if (fSoftVersion<0x00000044) // 00.68
     280    if (fSoftVersion<0x00000045) // 00.69
    260281    {
    261282        lout << GetNodeName() << " - Software Version too old!" << endl;
     
    269290    ReqVelRes(); // Init fVelRes
    270291
    271     lout << "- " << GetNodeName() << ": Motor on." << endl;
    272     SendSDO(0x3000, string('o', 'n'));
    273     WaitForSdo(0x3000);
     292    /* Should not be necessary anymore. This is done by the MACS itself.
     293     lout << "- " << GetNodeName() << ": Motor on." << endl;
     294     SendSDO(0x3000, string('o', 'n'));
     295     WaitForSdo(0x3000);
     296     */
    274297
    275298    SetPDO1On(FALSE); // this is a workaround for the Macs
    276299    SetPDO1On(TRUE);
    277300
    278     SetNoWait(TRUE);
    279 
    280 //    StartGuarding(200, 2, kFALSE); // Using PDO1 @ 100ms
    281 
    282 //    StartGuarding(250, 4);
    283 //    StartHostGuarding();
    284 }
    285 
     301    //This is now standard in the MACS
     302    //SetNoWait(TRUE);
     303
     304    // StartGuarding(200, 2, kFALSE); // Using PDO1 @ 100ms
     305    // StartGuarding(250, 4);
     306    // StartHostGuarding();
     307
     308    StartNode();
     309}
     310/*
    286311void Macs::StopMotor()
    287312{
     
    292317    WaitForSdo(0x3000);
    293318}
    294 
     319*/
    295320void Macs::StopDevice()
    296321{
    297322    //EnableTimeout(kFALSE);
    298323
    299     SetNoWait(FALSE);
     324    //No need to switch it off.
     325    //SetNoWait(FALSE);
    300326
    301327    StopHostGuarding();
     
    402428}
    403429
     430/*
    404431void Macs::SetNoWait(BYTE_t flag)
    405432{
     
    408435    WaitForSdo(0x3008);
    409436}
     437*/
    410438
    411439void Macs::StartVelSync()
Note: See TracChangeset for help on using the changeset viewer.