Changeset 1959


Ignore:
Timestamp:
04/14/03 17:54:32 (22 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Cosy
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Cosy/Changelog

    r1954 r1959  
    11                                                                  -*-*- END -*-*-
     2 2003/04/13 - Thomas Bretz
     3
     4   * base/timer.cc:
     5     - added cast to _suseconds_t
     6   
     7   * candrv/nodedrv.cc:
     8     - set starting timeout
     9   
     10   * devdrv/macs.cc:
     11     - after requsting error[0] check Zombie-status
     12     - Software version 0.66 --> 0.68
     13     - added all known MACS error messages
     14
     15   * gui/MGStarguider.cc, videodev/Filter.[h,cc]:
     16     - added stretching of the picture
     17
     18
     19
    220 2003/04/12 - Thomas Bretz
    321
  • trunk/MagicSoft/Cosy/base/timer.cc

    r1810 r1959  
    3030{
    3131    tv->tv_sec  = fSecs;
    32     tv->tv_usec = fMs;
     32    tv->tv_usec = (__suseconds_t)fMs;
    3333}
    3434
  • trunk/MagicSoft/Cosy/candrv/nodedrv.cc

    r1953 r1959  
    501501    fTimeout->Reset();
    502502
    503 //    Timer t;
    504 //    fTimeoutTime = t.Now() + (fGuardTime*fLifeTimeFactor/1000.);
     503    Timer t;
     504    fTimeoutTime = t.Now() + (fGuardTime*fLifeTimeFactor/1000.);
     505    //cout << GetNodeName() << ": " << fmod(fTimeoutTime*10000, 10000)/10 << endl;
    505506
    506507    fTimeout->TurnOn();
     
    583584    if (now > fTimeoutTime)
    584585    {
    585         cout << "==out==> " << fmod(now*1000, 10000)/10 << " > " << fmod(fTimeoutTime*10000, 10000)/10 << endl;
     586        cout << GetNodeName() << ": " << "==out==> " << fmod(now*1000, 10000)/10 << " > " << fmod(fTimeoutTime*10000, 10000)/10 << endl;
    586587        //cout << "ERROR - " << GetNodeName() << " didn't respond in timeout window." << endl;
    587588        //lout << "ERROR - " << GetNodeName() << " didn't respond in timeout window." << endl;
     
    609610    Timer t(tv);
    610611    fTimeoutTime = t + (fGuardTime*fLifeTimeFactor/1000.);
     612    //cout << GetNodeName() << ": " << fmod(fTimeoutTime*10000, 10000)/10 << endl;
    611613}
    612614
  • trunk/MagicSoft/Cosy/devdrv/macs.cc

    r1953 r1959  
    4444void Macs::HandleSDO(WORD_t idx, BYTE_t subidx, LWORD_t val, timeval_t *tv)
    4545{
     46  // cout << "SdoRx: Idx=0x"<< hex << idx << "/" << (int)subidx;
     47  // cout << ", val=0x" << val << endl;
    4648    switch (idx)
    4749    {
     
    127129void Macs::HandleSDOOK(WORD_t idx, BYTE_t subidx, timeval_t *tv)
    128130{
     131//    cout << "Node #" << dec << (int)GetId() << ": Sdo=" << hex << idx  << "/" << (int)subidx << " set." << endl;
    129132    switch (idx)
    130133    {
     
    201204}
    202205
    203 
    204206void Macs::ReqVelRes()
    205207{
     
    243245        SetZombie();
    244246    }
     247    if (IsZombieNode())
     248        return;
    245249
    246250    StopHostGuarding();
     
    252256    RequestSDO(0x100a);
    253257    WaitForSdo(0x100a);
    254     if (IsZombieNode())
    255         return;
    256 
    257258    // FIXME! Not statically linked!
    258     if (fSoftVersion<0x00000042) // 00.66
     259    if (fSoftVersion<0x00000044) // 00.68
    259260    {
    260261        lout << GetNodeName() << " - Software Version too old!" << endl;
     
    272273    WaitForSdo(0x3000);
    273274
    274 //    SetHome(250000);
    275 
    276 //    lout << "- Requesting SDO 0x2001 of " << (int)GetId() << endl;
    277 //    RequestSDO(0x2001);
    278 //    WaitForSdo(0x2001);
    279 
    280275    SetPDO1On(FALSE); // this is a workaround for the Macs
    281276    SetPDO1On(TRUE);
     
    283278    SetNoWait(TRUE);
    284279
    285     //    StartGuarding(500, 2);
    286     //    StartHostGuarding();
     280//    StartGuarding(250, 4);
     281//    StartHostGuarding();
    287282}
    288283
     
    301296
    302297    SetNoWait(FALSE);
     298
     299    StopHostGuarding();
     300    StopGuarding();
    303301
    304302    //
     
    506504    switch (errnum)
    507505    {
     506    case 3:
     507        lout << "Axis does not existing." << endl;
     508        return;
     509    case 5:
     510        lout << "Error not cleared (while trying to move axis)" << endl;
     511        return;
    508512    case 6:
    509513        //
     
    515519        SetError(0);
    516520        return;
    517 
    518521    case 8:
    519522        lout << "Control deviation overflow." << endl;
    520523        return;
    521 
    522524    case 9:
    523525        lout << "Zero index not found." << endl;
    524526        return;
    525 
     527    case 10:
     528        lout << "Unknown command, syntax error." << endl;
     529        lout << "Please recompile and reload program." << endl;
     530        return;
    526531    case 11:
    527532    case 25:
     
    540545        {
    541546        case 11:
    542             lout << " software endswitch activated." << endl;
     547            lout << " software";
    543548            break;
    544549        case 25:
    545             lout << " hardware endswitch activated." << endl;
     550            lout << " hardware";
    546551            break;
    547552        }
    548         return;
    549 
     553        lout << " endswitch activated." << endl;
     554        return;
     555    case 12:
     556        lout << "Wrong parameter number used in SET command." << endl;
     557        return;
     558    case 14:
     559        lout << " Too many LOOP calls." << endl;
     560        return;
     561    case 16:
     562        lout << "Parameter in EEPROM broken (means: EEPROM broken, or saving not finished)" << endl;
     563        lout << "Please use APOSS to 'Reset' the MACS and reload the parameters." << endl;
     564        return;
     565    case 17:
     566        lout << "Program in EEPROM broken (means: EEPROM broken, or saving not finished)" << endl;
     567        lout << "Please use APOSS to delete all Programs restore the programs." << endl;
     568        return;
     569    case 18:
     570        lout << "Reset by CPU (reset called by Watch-dog cause of CPU halted)" << endl;
     571        lout << "Possible reasons: short under-/overvoltage or shortcut." << endl;
     572        return;
     573    case 19:
     574        lout << "User break (autostart program stopped by user)" << endl;
     575        return;
     576    case 51:
     577        lout << "Too many (>=10) GOSUB calls." << endl;
     578        return;
     579    case 52:
     580        lout << "Too many RETURN calls." << endl;
     581        return;
     582    case 62:
     583        lout << "Error veryfiing EEPROM after access (Try again savaing parameters or program)" << endl;
     584        return;
     585    case 70:
     586        lout << "Error in DIM call (call to DIM doesn't fit existing DIM call)" << endl;
     587        return;
    550588    case 71:
    551589        lout << "Array out of bound." << endl;
    552590        return;
    553 
     591    case 79:
     592        lout << "Timeout waiting for index (WAITNDX)." << endl;
     593        return;
    554594    case 84:
    555595        lout << "Too many (>12) ON TIME calls." << endl;
     596        return;
     597    case 87:
     598        lout << "Out of memory for variables - Check APOSS predifined number of" << endl;
     599        lout << "variables and try deleting the array by doing a 'Reset' from APOSS." << endl;
     600        return;
     601    case 89:
     602        lout << "CAN I/O error (REOPEN=" << dec << errinf << " " << (errinf==0?"OK":"ERR") << ")" << endl;
    556603        return;
    557604
  • trunk/MagicSoft/Cosy/gui/MGStarguider.cc

    r1953 r1959  
    5656    IDM_kPNG,
    5757    IDM_kOnce,
     58    IDM_kStretch,
    5859    IDM_kUseFileRaDec,
    5960    IDM_kContinous,
     
    204205    fDisplay->AddEntry("Sao &Catalog", IDM_kCatalog);
    205206    fDisplay->AddEntry("Starguider",   IDM_kStarguider);
     207    fDisplay->AddEntry("Stretch",      IDM_kStretch);
    206208    fDisplay->DisableEntry(IDM_kStarguider);
     209    fDisplay->CheckEntry(IDM_kStretch);
    207210    fDisplay->Associate(this);
    208211    fList->Add(fDisplay);
     
    637640            case IDM_kStarguider:
    638641                Toggle(fDisplay, IDM_kStarguider);
     642                gSystem->Unlink("tracking_error.txt");
    639643                return kTRUE;
    640644
     
    648652                    fDisplay->DisableEntry(IDM_kStarguider);
    649653                }
     654                return kTRUE;
     655
     656            case IDM_kStretch:
     657                Toggle(fDisplay, IDM_kStretch);
    650658                return kTRUE;
    651659
     
    928936    pos1 -= pos0;
    929937
    930     ofstream fout2("tracking_error.txt");
     938    ofstream fout2("tracking_error.txt", ios::app);
    931939    fout2 << setprecision(10) << fSao->GetMjd()-52000 << " " << -pos1.Alt() << " " << pos1.Az() << endl;
    932940
     
    10171025        return;
    10181026
    1019     cout << "Img: " << n << endl;
     1027    //cout << "Img: " << n << endl;
    10201028
    10211029    byte c[768*576];
    10221030    for (int i=0; i<768*576; i++)
    10231031        c[i] = (byte)(myimg[i]/fIntRate+.5);
     1032
     1033    if (fDisplay->IsEntryChecked(IDM_kStretch))
     1034        Filter::Stretch(c);
    10241035
    10251036    if (!fWritePictures->IsEntryEnabled(IDM_kStart) &&
  • trunk/MagicSoft/Cosy/videodev/Filter.cc

    r1531 r1959  
    203203}
    204204
     205void Filter::Stretch(byte *img)
     206{
     207    const int offset = 10;
     208
     209    int max;
     210    int min;
     211
     212    /*const float mean =*/Mean(img, offset, &min, &max);
     213
     214    for (int x=0; x<768; x++)
     215        for (int y=0; y<576; y++)
     216        {
     217            img[y*768+x] -= min;
     218            img[y*768+x] *= 255/(max-min);
     219        }
     220}
  • trunk/MagicSoft/Cosy/videodev/Filter.h

    r1111 r1959  
    2929public:
    3030    static void Execute(byte *img);
     31    static void Stretch(byte *img);
    3132
    3233    ClassDef(Filter, 0)
Note: See TracChangeset for help on using the changeset viewer.