Changeset 12591 for trunk/Cosy


Ignore:
Timestamp:
11/21/11 12:54:18 (13 years ago)
Author:
tbretz
Message:
Changed the starguider command to make it work with FACT; added the WM_LEDS to be able to set the FACT LED voltages; added the status to the reports; make stat1 and stat2 two bytes long when updating the GUI
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Cosy/main/MCosy.cc

    r10035 r12591  
    118118ZdAz MCosy::GetSePos() const
    119119{
    120     const Double_t pa = fMac1 ? (Double_t)fMac1->GetPdoPos2()/fMac1->GetPosRes()  : 0;
     120    const Double_t pa = fMac1 ? (Double_t)fMac1->GetPdoPos2()/fMac1->GetPosRes() : 0;
    121121    const Double_t p1 = fMac2 ? (Double_t)fMac2->GetPdoPos2()/fMac2->GetPosRes() : 0;
    122122
     
    261261        pointing.Zd(-pointing.Zd());
    262262        pointing.Az(pointing.Az()+180);
    263         //gLog << "ZD=-ZD Az+=180" << endl;
    264263    }
    265264
    266265    const ZdAz se = GetSePos()*TMath::TwoPi();   // [rad]
    267266    const ZdAz unbendedse = fBending.CorrectBack(se)*TMath::RadToDeg(); // ist pointing
    268 
    269     //gLog << "Unbended: " << unbendedse.Zd() << " " << unbendedse.Az() << endl;
    270267
    271268    do
     
    275272            break;
    276273
    277         //gLog << "AZ += " << TMath::Sign(360., d) << endl;
    278 
    279274        pointing.Az(pointing.Az()+TMath::Sign(360., d));
     275
    280276    } while (1);
    281277
     
    484480Int_t MCosy::Proc(int msg, void *mp)
    485481{
     482    cout << "*** Received " << hex << msg << endl;
    486483    switch (msg)
    487484    {
     
    498495
    499496    case WM_TPOINT:
     497#ifdef FACT
     498        fStarguider->fTPoint->SetDown(kTRUE);
     499#else
    500500        {
    501501            //cout << "WM_TPoint: start." << endl;
     
    545545            //cout << "WM_TPoint: done. (return 0xaffe)" << endl;
    546546        }
    547         break;
    548 
     547#endif
     548        break;
    549549    case WM_STARGTPOINT:
    550550        if (fStarguider)
     
    574574        }
    575575        //cout << "WM_TrackPosition: done. (return 0xabcd)" << endl;
     576        break;
     577
     578    case WM_LEDS:
     579        {
     580            if (!CheckNetwork())
     581                return 0xebb0;
     582
     583            const Long_t *u = (Long_t*)mp;
     584
     585            fMac1->SetLedVoltage(u[0]);
     586            fMac2->SetLedVoltage(u[1]);
     587        }
    576588        break;
    577589
     
    898910    {
    899911        tout.Start(999);
    900         fCom->SendReport(fStatus, fRaDec, fHourAngle, fZdAzSoll, bendist, fTrackingError, armed,
    901                          fStarguider ? fStarguider->GetStarguiderMode() : 0);
     912        fCom->SendReport(fStatus, fMJD, fRaDec, fHourAngle, fZdAzSoll, bendist, fTrackingError, armed,
     913                         fStarguider ? fStarguider->GetStarguiderMode() : 0, ((stat1&0xffff)<<16)|(stat2&0xffff));
    902914    }
    903915
    904916    fWin->UpdateWeather(*fCom);
    905917    fWin->Update(bendist, fTrackingError, /*fVelocity, fOffset,*/
    906                  fRaDec, fZdAzSoll, fStatus, ((stat1&0xff)<<8)|(stat2&0xff), HasConnection(), armed, statzd, stataz);
     918                 fRaDec, fZdAzSoll, fStatus, ((stat1&0xffff)<<16)|(stat2&0xffff), HasConnection(), armed, statzd, stataz);
    907919
    908920    gLog.UpdateGui();
     
    9931005MCosy::MCosy(MEnv &env, MDriveCom *com)
    9941006: Network(), fObservatory(MObservatory::kMagic1), fStarguider(NULL),
    995 fMac1(0), fMac2(0), fStatus(MDriveCom::kStopped), fOutTp(0), fOutRep(0)
     1007fMac1(0), fMac2(0), fMJD(0), fStatus(MDriveCom::kStopped), fOutTp(0), fOutRep(0)
    9961008{
    9971009    const Int_t id1 = env.GetValue("Az_Id", 1);
Note: See TracChangeset for help on using the changeset viewer.