Ignore:
Timestamp:
11/21/11 11:31:09 (13 years ago)
Author:
tbretz
Message:
Added possibility to track celestial objects; adapted status bit pattern for pdo3 for FACT
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Cosy/gui/MGCosy.cc

    r9439 r12589  
    7575    kCB_PredefPos,
    7676    kCB_StarList,
     77    kCB_CelestList,
    7778    kPB_SavePreDef,
    7879    kPB_SaveStar,
     
    391392}
    392393
     394void MGCosy::CreateCelestList(TGCompositeFrame *tf1)
     395{
     396    TGComboBox *box = new TGComboBox(tf1, kCB_CelestList);
     397    box->Resize(170, 20);
     398    box->Associate(this);
     399
     400    TGLayoutHints *lay = new TGLayoutHints(kLHintsLeft|kLHintsTop,
     401                                           27, 0, 70, 0);
     402    tf1->AddFrame(box, lay);
     403
     404    fList->Add(box);
     405    fList->Add(lay);
     406
     407    box->AddEntry("Moon",    3);
     408    box->AddEntry("Mercury", 1);
     409    box->AddEntry("Venus",   2);
     410    box->AddEntry("Mars",    4);
     411    box->AddEntry("Jupiter", 5);
     412    box->AddEntry("Saturn",  6);
     413    box->AddEntry("Uranus",  7);
     414    box->AddEntry("Neptune", 8);
     415    box->AddEntry("Pluto",   9);
     416
     417    box->Select(3);
     418}
     419
    393420void MGCosy::CreateTabs(const char *prepos)
    394421{
    395422    TGCompositeFrame *tf1 = fTab->AddTab("Position");
    396423    TGCompositeFrame *tf2 = fTab->AddTab("Track");
     424    TGCompositeFrame *tf7 = fTab->AddTab("Celest");
    397425    TGCompositeFrame *tf4 = fTab->AddTab("Calib");
    398426#ifdef EXPERT
     
    410438    CreatePredefinedPos(tf1, prepos);
    411439    CreateStarList(tf4);
     440    CreateCelestList(tf7);
    412441
    413442    fCRaDec = new MGCoordinates(tf2, kETypeRaDec);
     
    462491    fList->Add(l3);
    463492    //fList->Add(l4);
     493
     494    l1 = new TGLabel(tf7, "Track a celestial object by object name.");
     495//    l2 = new TGLabel(tf7, "Right Ascension and declination must be given");
     496//    l3 = new TGLabel(tf7, "in the FK5, J2000 coordinate system.");
     497    l1->Move(x, y);
     498//    l2->Move(x, y+h);
     499//    l3->Move(x, y+2*h);
     500    fList->Add(l1);
     501//    fList->Add(l2);
     502//    fList->Add(l3);
     503
    464504
    465505#ifdef EXPERT
     
    729769
    730770MGCosy::MGCosy(MObservatory::LocationName_t key, const char *prepos, MsgQueue *q)
    731     : TGMainFrame(gClient->GetRoot(), 1, 1), fObservatory(key), fQueue(q)
     771    : TGMainFrame(gClient->GetRoot(), 1, 1), fObservatory(key), fQueue(q), fCelestObj(3)
    732772{
    733773    // This means that all objects added with AddFrame are deleted
     
    10721112    EnableLabel(fRaSoll,   stat&MDriveCom::kTracking);
    10731113    EnableLabel(fDecSoll,  stat&MDriveCom::kTracking);
    1074     EnableLabel(fZdSoll,   stat&MDriveCom::kMoving);
    1075     EnableLabel(fAzSoll,   stat&MDriveCom::kMoving);
     1114    EnableLabel(fZdSoll,   stat&MDriveCom::kMoving || stat&MDriveCom::kTracking);
     1115    EnableLabel(fAzSoll,   stat&MDriveCom::kMoving || stat&MDriveCom::kTracking);
    10761116
    10771117    SetLabelColor(fAvailTcp, stat2);
     
    10801120        pdo3 = 0;
    10811121
     1122    //   1 X Ab
     1123    //   2 1
     1124    //   4 Emergency
     1125    //   8 OverVolt
     1126    //  10 Move (Drehen-soll)
     1127    //  20 X Af
     1128    //  40 1
     1129    //  80 Power on Az
     1130    // ------------------
     1131    // 100 NOT UPS Alarm
     1132    // 200 UPS on Battery
     1133    // 400 UPS charging
     1134
     1135#ifdef FACT
     1136    SetLabelColor(fDkcReady1,     pdo3&0x00000001);
     1137    SetLabelColor(fDkcReady2,     pdo3&0x00010000);
     1138    SetLabelColor(fDkcEmergency, (pdo3&0x00040004)==0x00040004);
     1139    SetLabelColor(fDkcPcMode,    (pdo3&0x00100010)!=0x00100010);
     1140    SetLabelColor(fDkcRF1,        pdo3&0x00000020);
     1141    SetLabelColor(fDkcRF2,        pdo3&0x00200000);
     1142    SetLabelColor(fDkcBrake,     (pdo3&0x00400040)==0x00400040);
     1143    SetLabelColor(fDkcPower,     (pdo3&0x00800080)==0x00800080);
     1144#else
    10821145    SetLabelColor(fDkcReady1,       pdo3&0x0001);
    10831146    SetLabelColor(fDkcReady2,       pdo3&0x0100);
     
    10881151    SetLabelColor(fDkcBrake,       (pdo3&0x4040)==0x4040);
    10891152    SetLabelColor(fDkcPower,       (pdo3&0x8080)==0x8080);
     1153#endif
    10901154
    10911155    EnableLabel(fArmed, armed);
     
    11921256
    11931257    cout << "PostMsg (WM_Track) returned." << endl;
     1258}
     1259
     1260void MGCosy::StartCelest()
     1261{
     1262    cout << "Start celest." << endl;
     1263
     1264    Double_t tx[3] = { fCelestObj, 0, 0 };
     1265
     1266    fQueue->PostMsg(WM_CELEST, tx, sizeof(Double_t)*3);
     1267
     1268    cout << "PostMsg (WM_CELEST) returned." << endl;
    11941269}
    11951270
     
    13801455                    return kTRUE;
    13811456                }
     1457            case kCB_CelestList:
     1458                {
     1459                    fCelestObj = mp2;
     1460                    return kTRUE;
     1461                }
    13821462            }
    13831463            return kTRUE;
     
    14101490                    return kTRUE;
    14111491                case 2:
     1492                    StartCelest();
     1493                    return kTRUE;
     1494                case 3:
    14121495                    fCRaDec->SetCoordinates(fCCalib->GetCoordinates());
    14131496                    StartTrack(false);
    14141497                    return kTRUE;
    1415                 case 3:
     1498                case 4:
    14161499                    fQueue->Proc(WM_TESTSE, (void*)1);
    14171500                    return kTRUE;
    1418                 case 4:
     1501                case 5:
    14191502                    fQueue->Proc(WM_GEAR, (void*)1);
    14201503                    return kTRUE;
    14211504#ifdef HAS_DEMO
    1422                 case 5:
     1505                case 6:
    14231506                    StartDemo();
    14241507                    return kTRUE;
     
    14331516#endif
    14341517                fQueue->PostMsg(WM_STOP);
    1435                 if (fTab->GetCurrent()==3)
     1518                if (fTab->GetCurrent()==4)
    14361519                    fQueue->Proc(WM_TESTSE);
    1437                 if (fTab->GetCurrent()==4)
     1520                if (fTab->GetCurrent()==5)
    14381521                    fQueue->Proc(WM_GEAR);
    14391522                cout << "PostMsg (WM_Stop) returned." << endl;
Note: See TracChangeset for help on using the changeset viewer.