Changeset 920


Ignore:
Timestamp:
08/29/01 16:44:38 (23 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft
Files:
14 added
28 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Cosy/Changelog

    r919 r920  
    11                                                                  -*-*- END -*-*-
    22 2001/08/29 - Thomas Bretz:
     3
     4   * base/BaseLinkDef.h, base/BaseIncl.h,
     5     candrv/CandrvIncl.h, candrv/CandrvLinkDef.h,
     6     catalog/CatalogLinkDef.h, catalog/CatalogIncl.h,
     7     devdrv/DevdrvIncl.h, devdrv/DevdrvLinkDef.h,
     8     gui/GuiLinkDef.h, gui/GuiIncl.h,
     9     slalib/SlalibIncl.h, slalib/SlalibLinkDef.h,
     10     videodev/VideodevLinkDef.h, videodev/VideodevIncl.h:
     11     - added
     12     
     13   * Makefile.rules:
     14     - added CINTHEADERS
     15     
     16   * cosy.cc:
     17     - changed logging to MLog
     18     
     19   * base/Makefile:
     20     - added MLog and MLogManip
     21     
     22   * base/log.h, candrv/canopen.[h,cc], candrv/network.[h,cc],
     23     candrv/nodedrv.[h,cc], candrv/vmodican.[h,cc],
     24     devdrv/macs.[h,cc]
     25     - changed from ostream to MLog
     26     
     27   * devdrv/shaftencoder.[h,cc]
     28     - changed from ostream to MLog
     29     - changed buffering of values
     30     - removed old updating thread stuff
     31     
     32   * catalog/SlaStars.[h,cc]:
     33     - added GetApproxVel
     34     
     35   * gui/MGAccuracy.cc:
     36     - fixed the wrong deg2rad value
     37     - added more accurate calculation of one dimensional
     38       tracking error value
     39     
     40   * MGCosy.[h,cc]:
     41     - added a TGListBox
     42     - added some Labels to display offset as value
     43     - removed offset display
     44     - changed layout of dialog
     45     - added layout manager
     46     - added status frame
     47     - added tabs
     48     - added status display and update
     49     
     50   * gui/MGEmbeddedCanvas.cc:
     51     - removed raised frame around embedded canvas
     52     - enhanced size by 1
     53     
     54   * gui/MGSkyPosition.cc:
     55     - a new position checks now for a new angle, too
     56     - removed debugging output
     57     
     58   * slalib/Makefile:
     59     - added altaz.c
    360 
    461   * MCosy.[cc,h]:
     
    865     - TerminateApp now sends WM_QUIT
    966     - removed comments with old GUI thread
     67     - added a missing bracket, which prevents us from stopping
     68       a positioning command
     69     - changed some output from cout to lout
     70     - added empty prototype to Limit speed in tracking mode
     71     - changed constructor to use of MLog
    1072
    1173   * base/MGList.h:
    1274     - added DBG_MGLIST for debugging
    1375     
    14    * devdrv/shaftencoder.[h,cc]:
    15      - removed old updating thread stuff
    16      
    17    * gui/MGAccuracy.[h,cc]:
    18      - added more accurate calculation of one dimensional
    19        tracking error value
    20 
    2176   * gui/MGCoordinate.cc:
    2277     - removed logging statement from destructor
    23      
    24    * gui/MGCosy.cc:
    25      - changed layout of dialog
    26      - added layout manager
    27      - added status frame
    28      - added tabs
    29      - added status display and update
    30      
    31    * gui/MGEmbeddedCanvas.cc:
    32      - enhanced size by 1
    33      
    34    * gui/MGSkyPosition.cc:
    35      - removed debugging output
    3678     
    3779   * gui/MGVelocity.cc:
  • trunk/MagicSoft/Cosy/MCosy.cc

    r918 r920  
    1313#include "MGCosy.h"
    1414#include "SlaStars.h"
     15
     16#include "slalib/slalib.h"  // FIXME: REMOVE
    1517
    1618#include "macs.h"
     
    202204    cout << "SDO..." << flush;
    203205
    204     while (fMac1->IsPositioning() || fMac2->IsPositioning() && !StopWaitingForSDO())
     206    while ((fMac1->IsPositioning() || fMac2->IsPositioning()) && !StopWaitingForSDO())
    205207        usleep(1);
    206208
     
    234236    const ZdAz dest = CorrectTarget(src, dst);
    235237
    236     cout << "Positioning to Target..." << endl;
     238    lout << "Positioning to Target..." << endl;
    237239    //cout << "Source        Zd: " << src.Zd()  << "se  Az:" << src.Az()  << "se" << endl;
    238240    //cout << "Destination   Zd: " << Rad2SE(dst.Zd()) << "se  Az:" << Rad2SE(dst.Az())  << "se" << endl;
     
    265267        if (!cdzd && !cdaz)
    266268        {
    267             cout << "Positioning done with " << i << "manuvers." << endl;
     269            lout << "Positioning done with " << i << "manuvers." << endl;
    268270            return TRUE;
    269271        }
     
    300302    CheckForError();
    301303
    302     cout << "Positioning ERROR!" << endl;
     304    lout << "Warning: Requested position not reached." << endl;
    303305    return FALSE;
    304306}
     
    313315        return kTRUE;
    314316
    315     lout << "Error #6004 (requesting re pos from Macs) happened." << endl;
     317    if (HasError())
     318        lout << "Error #6004 (requesting re pos from Macs) happened." << endl;
     319
    316320    return kFALSE;
    317321}
     
    325329        return kTRUE;
    326330
    327     lout << "Error #3006 (setting velocity of Macs) happened." << endl;
     331    if (HasError())
     332        lout << "Error #3006 (setting velocity of Macs) happened." << endl;
     333
    328334    return kFALSE;
    329335}
     
    346352}
    347353
     354void MCosy::LimitSpeed(ZdAz *vt, const ZdAz &vcalc) const
     355{
     356    return;
     357
     358    //
     359    // How to limit the speed. If the wind comes and blowes
     360    // we cannot forbid changing of the sign. But on the other hand
     361    // we don't want fast changes!
     362    //
     363
     364    ULong_t vrzd = fMac1->GetVelRes();
     365    ULong_t vraz = fMac2->GetVelRes();
     366
     367#define sgn(x) (x<0?-1:1)
     368
     369    if (sgn(vt->Az()) != sgn(vcalc.Az()))
     370        vt->Az(0.1*vcalc.Az());
     371    else
     372        if (fabs(vt->Az()) > 0.9*vraz)
     373            vt->Az(0.9*vraz*sgn(vt->Az()));
     374
     375    if (sgn(vt->Zd()) != sgn(vcalc.Zd()))
     376        vt->Zd(0.1*vcalc.Zd());
     377    else
     378        if (fabs(vt->Zd()) > 0.9*vrzd)
     379            vt->Zd(0.9*vrzd*sgn(vt->Zd()));
     380}
     381
    348382void MCosy::TrackPosition(const RaDec &dst) // ra, dec [rad]
    349383{
     
    358392    if (!SetPosition(dest))
    359393    {
    360         cout << "ERROR: Cannot start tracking, unable to reach requested position." << endl;
     394        lout << "ERROR: Cannot start tracking, unable to reach requested position." << endl;
    361395        return;
    362396    }
     
    386420    InitTracking();
    387421
    388     cout << "Start tracking:";
    389     cout << " Ra: " << Rad2Deg(dst.Ra())  << "deg  ";
    390     cout << "Dec: " << Rad2Deg(dst.Dec()) << "deg" << endl;
     422    lout << "Start tracking:";
     423    lout << " Ra: " << Rad2Deg(dst.Ra())  << "deg  ";
     424    lout << "Dec: " << Rad2Deg(dst.Dec()) << "deg" << endl;
    391425
    392426    //
     
    414448        //
    415449        sla.SetMjd(sla.CalcMjd()+dt/(60*60*24));
    416         dest = CorrectTarget(GetSePos(), sla.CalcZdAz(dst));
     450        dest = CorrectTarget(GetSePos(), sla.CalcZdAz(dst)); // [se]
     451
     452        //ZdAz vcalc = sla.GetApproxVel(dst) * kGearRatio2*4./60.;  // [re/min]
    417453
    418454        //
     
    428464        // Shaft- and the rotary encoders
    429465        //
    430         dest *= kGearRatio;
     466        dest *= kGearRatio;  // [re]
    431467        dest -= GetRePos() + fOffset;
    432468
     
    442478        //
    443479        ZdAz vt = v/4;
     480        //LimitSpeed(&vt, vcalc);
    444481        vt.Round();
    445482
     
    449486        if (v.Zd()>.9*fMac1->GetVelRes() || v.Az()>.9*fMac2->GetVelRes())
    450487        {
    451             cout << "Error: Tracking speed faster than possible maximum velocity." << endl;
     488            lout << "Error: Tracking speed faster than possible maximum velocity." << endl;
    452489            break;
    453490        }
     
    490527    SetStatus(kStopped);
    491528
    492     cout << "Tracking stopped." << endl;
     529    lout << "Tracking stopped." << endl;
    493530
    494531    CheckForError();
     
    750787
    751788    fWin->Update(ist, fTrackingError/kGearRatio2,
    752                  fVelocity, fOffset/kGearRatio2,
     789                 fVelocity, fOffset/*/kGearRatio2*/,
    753790                 fStatus);
    754791
     
    788825}
    789826
    790 MCosy::MCosy(const char *dev, const int baud, ostream &out)
     827MCosy::MCosy(const char *dev, const int baud, MLog &out)
    791828: Network(dev, baud, out), fTracking(kFALSE)
    792829{
     
    822859    fAlt2->SetDisplay(fWin->GetLabel3());
    823860
     861    lout.SetOutputGui(fWin->GetLog(), kTRUE);
    824862}
    825863
     
    857895    cout << "Deleting MGCosy." << endl;
    858896
     897    lout.DisableOutputDevice(MLog::eGui);
     898
    859899    delete fWin;
    860900
  • trunk/MagicSoft/Cosy/MCosy.h

    r918 r920  
    8888
    8989    void InitTracking();
     90    void LimitSpeed(ZdAz *vt, const ZdAz &vcalc) const;
    9091
    9192    void TalkThread();
     
    102103
    103104public:
    104     MCosy(const char *dev, const int baud, ostream &out=cout);
     105    MCosy(const char *dev, const int baud, MLog &out=gLog);
    105106    ~MCosy();
    106107
  • trunk/MagicSoft/Cosy/Makefile.rules

    r909 r920  
    44        -f Makefile.depend 2> kk.kk ; cat kk.kk
    55
    6 $(LIB): $(OBJS) $(HEADERS)
     6$(LIB): $(OBJS) $(HEADERS) $(CINT)Cint.o
    77        @echo " - Building Library lib$(LIB) ... "
    88        $(AR) $(LIB) *.o
    99
    10 $(CINT)Cint.cc: $(HEADERS)
     10$(CINT)Cint.cc: $(CINTHEADERS)
    1111        @echo
    1212        @echo " - Generating dictionary $(CINT)Cint.cc ..."
    1313
    1414        $(ROOTSYS)/bin/rootcint -f $(CINT)Cint.cc \
    15         -c $(INCLUDES) $(DEFINES) $(HEADERS) $(CINT)Incl.h $(CINT)LinkDef.h
     15        -c $(INCLUDES) $(DEFINES) $(CINTHEADERS) $(CINT)Incl.h $(CINT)LinkDef.h
    1616
    1717.cxx.o:
  • trunk/MagicSoft/Cosy/ToDo

    r918 r920  
    1010   
    1111 - Check why it crashes if you exit the program while 'going home'
     12 
     13 - If one axis stops because of an error the other axis isn't stopped
     14   ( SetPosition, software endswitch activated)
    1215
  • trunk/MagicSoft/Cosy/base/Makefile

    r910 r920  
    3636           MTimeout.cc \
    3737           msgqueue.cc \
     38           MLog.cc \
     39           MLogManip.cc \
    3840           timer.cc
     41
     42CINTHEADERS = MLog.h \
     43              MLogManip.h
    3944
    4045SRCS    = $(SRCFILES)
  • trunk/MagicSoft/Cosy/base/log.h

    r732 r920  
    44#include <ostream.h>
    55
     6#include "MLog.h"
     7
     8//#ifndef __CINT__
     9extern MLog gLog;
     10//#endif
     11
    612class Log
    713{
    814protected:
    9     ostream &lout;
     15    MLog &lout;
    1016
    1117public:
    12     Log(ostream &out=cout) : lout(out) {}
     18    Log(MLog &out=gLog) : lout(out) {}
    1319};
    1420
  • trunk/MagicSoft/Cosy/candrv/canopen.cc

    r909 r920  
    44#include <iomanip.h>  // setw, setfill
    55
    6 CanOpen::CanOpen(const char *dev, const int baud, ostream &out=cout) : VmodIcan(dev, baud, out)
     6CanOpen::CanOpen(const char *dev, const int baud, MLog &out) : VmodIcan(dev, baud, out)
    77{
    88    for (int i=0; i<32; i++)
  • trunk/MagicSoft/Cosy/candrv/network.cc

    r909 r920  
    2424}
    2525
    26 Network::Network(const char *dev, const int baud, ostream &out) : CanOpen(dev, baud, out)
     26Network::Network(const char *dev, const int baud, MLog &out) : CanOpen(dev, baud, out)
    2727{
    2828    for (int i=0; i<32; i++)
  • trunk/MagicSoft/Cosy/candrv/network.h

    r909 r920  
    2121
    2222public:
    23     Network(const char *dev, const int baud, ostream &out=cout);
     23    Network(const char *dev, const int baud, MLog &out=gLog);
    2424
    2525    void SetNode(NodeDrv *drv);
  • trunk/MagicSoft/Cosy/candrv/nodedrv.cc

    r909 r920  
    55
    66#include "network.h"
     7#include "MLogManip.h"
    78
    8 NodeDrv::NodeDrv(BYTE_t nodeid, ostream &out) : Log(out), fNetwork(NULL), fId(32), fError(0)
     9NodeDrv::NodeDrv(BYTE_t nodeid, MLog &out) : Log(out), fNetwork(NULL), fId(32), fError(0)
    910{
    1011    if (nodeid>31)
     
    3132void NodeDrv::HandleSDOOK(WORD_t idx, BYTE_t subidx)
    3233{
     34    const Bool_t gui = lout.IsOutputDeviceEnabled(MLog::eGui);
     35
     36    if (gui)
     37        lout << ddev(MLog::eGui);
     38
    3339    lout << hex << setfill('0');
    3440    lout << "Sdo=" << idx  << "/" << (int)subidx << " set.";
    3541    lout << endl;
     42
     43    if (gui)
     44        lout << edev(MLog::eGui);
    3645}
    3746
  • trunk/MagicSoft/Cosy/candrv/nodedrv.h

    r909 r920  
    2121
    2222public:
    23     NodeDrv(BYTE_t nodeid, ostream &out=cout);
     23    NodeDrv(BYTE_t nodeid, MLog &out=gLog);
    2424
    2525    BYTE_t   GetId()      { return fId; }
  • trunk/MagicSoft/Cosy/candrv/vmodican.cc

    r910 r920  
    758758}
    759759
    760 VmodIcan::VmodIcan(const char *dev, const int baud, ostream &out) : Log(out), MThread(false)//: CanDriver(dev, baud)
     760VmodIcan::VmodIcan(const char *dev, const int baud, MLog &out) : Log(out), MThread(false)//: CanDriver(dev, baud)
    761761{
    762762    //
  • trunk/MagicSoft/Cosy/candrv/vmodican.h

    r910 r920  
    5656
    5757public:
    58     VmodIcan(const char *dev, const int baud, ostream &out=cout);
     58    VmodIcan(const char *dev, const int baud, MLog &out=gLog);
    5959    virtual ~VmodIcan();
    6060
  • trunk/MagicSoft/Cosy/catalog/SlaStars.cc

    r912 r920  
    107107    return AltAz(DPI/2-zdaz.Zd(), zdaz.Az());
    108108}
     109
     110ZdAz SlaStars::GetApproxVel(const RaDec &radec) const // [rad/rad]
     111{
     112    double az, vaz, aaz;
     113    double el, vel, ael;
     114    double pa, vpa, apa;
     115    slaAltaz(GetAlpha()-radec.Ra(), radec.Dec(), GetPhi(),
     116             &az, &vaz, &aaz,
     117             &el, &vel, &ael,
     118             &pa, &vpa, &apa);
     119
     120    return ZdAz(-vel, vaz);
     121}
  • trunk/MagicSoft/Cosy/catalog/SlaStars.h

    r912 r920  
    2727    void   Set(const RaDec &radec);
    2828
     29    ZdAz   GetApproxVel(const RaDec &radec) const; // [rad/rad];
     30
    2931    RaDec  CalcRaDec(const AltAz &altaz) const;
    3032    RaDec  CalcRaDec(const ZdAz  &altaz) const;
  • trunk/MagicSoft/Cosy/cosy.cc

    r912 r920  
    99#include <TApplication.h>
    1010
     11#include "MLogManip.h"
     12#include "base/timer.h"
     13
     14#define clog(txt) \
     15    lout << edev(MLog::eStdout) << txt << endl << ddev(MLog::eStdout)
     16
    1117int main(int argc, char **argv)
    1218{
    13     cout << endl;
    14     cout << "Starting..." << endl;
    15     cout << endl;
     19    Timer time;
     20    time.Now();
    1621
    1722    //
    1823    // this must move to MGCosy !!!! (or MApplication)
    1924    //
    20     ofstream lout("cosy.log");
    21     lout << "Starting Cosy" << endl;
     25    MLog lout("cosy.log", kTRUE);
     26
     27    clog("Starting Cosy at " << time.GetTimeStr() << " ...");
    2228
    2329    //
    2430    // start the main window
    2531    //
    26     lout << "- Initialising Root environment." << endl;
     32    clog("- Initialising Root environment.");
     33
    2734    TROOT root("Cosy", "Magic Control System");
    2835    TApplication app("App", &argc, argv);
     
    3441    cosy->Start();
    3542
    36     lout << "- Starting mainloop." << endl;
     43    clog("- Starting mainloop.");
    3744    app.Run(kTRUE);
    3845
    39     lout << "- Stopping cosy." << endl;
     46    clog("- Stopping cosy.");
    4047    cosy->Stop();
    41     lout << "- cosy stopped." << endl;
     48    clog("- cosy stopped.");
    4249
    4350    delete cosy;
    4451
    45     lout << "- Terminating Program." << endl;
     52    clog("- Terminating Program.");
    4653    cout << "The End." << endl;
    4754}
  • trunk/MagicSoft/Cosy/devdrv/macs.cc

    r912 r920  
    77#include "network.h"
    88
    9 Macs::Macs(BYTE_t nodeid, ostream &out=cout)
     9Macs::Macs(BYTE_t nodeid, MLog &out)
    1010    : NodeDrv(nodeid, out), fMacId(2*nodeid+1),
    1111    fPos(0), fPosTime(0.0), fPdoPos(0), fPdoTime(0.0),
  • trunk/MagicSoft/Cosy/devdrv/macs.h

    r910 r920  
    2828
    2929public:
    30     Macs(BYTE_t nodeid, ostream &out=cout);
     30    Macs(BYTE_t nodeid, MLog &out=gLog);
    3131    virtual ~Macs();
    3232
  • trunk/MagicSoft/Cosy/devdrv/shaftencoder.cc

    r918 r920  
    1313#include <sys/resource.h>  // PRIO_PROCESS
    1414
    15 ShaftEncoder::ShaftEncoder(BYTE_t nodeid, ostream &out=cout) : NodeDrv(nodeid, out), fLabel(NULL)
     15ShaftEncoder::ShaftEncoder(BYTE_t nodeid, MLog &out) : NodeDrv(nodeid, out), fLabel(NULL)
    1616{
    1717}
     
    8888void ShaftEncoder::DisplayVal()
    8989{
    90     static LWORDS_t pos;   // ticks
    91     static WORDS_t  vel;   // ticks per 5ms
    92     static WORDS_t  acc;   // ticks per 25ms^2
    93 
    9490    char text[21];
    9591
    96     if (fPos!=pos)
     92    if (fPos!=fUpdPos)
    9793    {
    9894        sprintf(text, "%ld", fPos);
    9995        fLabel[0]->SetText(new TGString(text));
    100     }
    101 
    102     if (fVel!=vel)
     96        fUpdPos = fPos;
     97    }
     98
     99    if (fVel!=fUpdVel)
    103100    {
    104101        sprintf(text, "%d", fVel);
    105102        fLabel[1]->SetText(new TGString(text));
    106     }
    107 
    108     if (fAcc!=acc)
     103        fUpdVel = fVel;
     104    }
     105
     106    if (fAcc!=fUpdAcc)
    109107    {
    110108        sprintf(text, "%d", fAcc);
    111109        fLabel[2]->SetText(new TGString(text));
     110        fUpdAcc = fAcc;
    112111    }
    113112}
  • trunk/MagicSoft/Cosy/devdrv/shaftencoder.h

    r918 r920  
    1818
    1919    TGLabel **fLabel;
     20    LWORDS_t  fUpdPos;   // ticks
     21    WORDS_t   fUpdVel;   // ticks per 5ms
     22    WORDS_t   fUpdAcc;   // ticks per 25ms^2
    2023
    2124    Timer fTime;
     
    2831
    2932public:
    30     ShaftEncoder(BYTE_t nodeid, ostream &out=cout);
     33    ShaftEncoder(BYTE_t nodeid, MLog &out=gLog);
    3134    virtual ~ShaftEncoder();
    3235
  • trunk/MagicSoft/Cosy/gui/MGAccuracy.cc

    r918 r920  
    184184void MGAccuracy::UpdateText(Float_t pzd, Float_t azd, Float_t aaz)
    185185{
    186     const Float_t d2r = TMath::Pi()/360.;
     186    const Float_t d2r = TMath::Pi()/180.;
    187187
    188188    pzd *= d2r;
  • trunk/MagicSoft/Cosy/gui/MGCosy.cc

    r918 r920  
    1212#include <TSystem.h>       // gSystem
    1313#include <TGLabel.h>       // TGLabel
     14#include <TGListBox.h>     // TGListBox
    1415#include <TG3DLine.h>      // TGHorizontal3DLine (TGSplitter)
    1516#include <TGFrame.h>       // TGGroupFrame
     
    7273void MGCosy::CreateLabel(TGCompositeFrame *f)
    7374{
     75    const int x = 180;
    7476    const int y = 25;
    75     const int x = 180;
     77
     78    TGLabel *l;
     79
     80    l = new TGLabel(f, "SE-Az:");
     81    l->Move(x-60, y);
     82    fList->Add(l);
     83
     84    l = new TGLabel(f, "SE-Zd1:");
     85    l->Move(x-60, y+20);
     86    fList->Add(l);
     87
     88    l = new TGLabel(f, "SE-Zd2:");
     89    l->Move(x-60, y+40);
     90    fList->Add(l);
     91
    7692
    7793    fLabel1 = new TGLabel*[3];
     
    126142    //f->AddFrame(fLabel3[2]);
    127143
     144    l = new TGLabel(f, "Offset-Zd:");
     145    l->Move(x-60, y+80);
     146    fList->Add(l);
     147
     148    l = new TGLabel(f, "Offset-Az:");
     149    l->Move(x-60, y+100);
     150    fList->Add(l);
     151
     152    fOffsetZd = new TGLabel(f, "0000000");
     153    fOffsetAz = new TGLabel(f, "0000000");
     154    fOffsetZd->SetTextJustify(kTextRight);
     155    fOffsetAz->SetTextJustify(kTextRight);
     156    fOffsetZd->Move(x, y+80);
     157    fOffsetAz->Move(x, y+100);
     158    fList->Add(fOffsetZd);
     159    fList->Add(fOffsetAz);
     160
    128161
    129162    fError    = new TGLabel(f, "Error");
     
    258291    fAccuracy    = new MGAccuracy   (f, 300);
    259292    fVelocity    = new MGVelocity   (f, "Velocity ['/min]", 300);
    260     fOffset      = new MGVelocity   (f, "Offset se-re [']", 300);
     293//    fOffset      = new MGVelocity   (f, "Offset se-re [']", 300);
    261294
    262295    fList->Add(fSkyPosition);
    263296    fList->Add(fAccuracy);
    264297    fList->Add(fVelocity);
    265     fList->Add(fOffset);
     298//    fList->Add(fOffset);
    266299
    267300    TGGroupFrame *frame = new TGGroupFrame(f, "Status");
    268301    frame->Resize(300, 300);
    269302    fList->Add(frame);
     303
     304    fLog = new TGListBox(f, -1, kSunkenFrame);  //kSunkenFrame|kDoubleBorder,
     305    fLog->Resize(300, 300);
     306    fList->Add(fLog);
    270307
    271308    //
     
    277314    f->AddFrame(frame);
    278315    f->AddFrame(fVelocity);
    279     f->AddFrame(fOffset);
     316    f->AddFrame(fLog);
    280317
    281318    AddFrame(f, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 0, 0, 1, 0));
     
    337374}
    338375
     376void MGCosy::UpdateOffset(ZdAz &off)
     377{
     378    static Int_t zd=~0;
     379    static Int_t az=~0;
     380
     381    char text[21];
     382
     383    if (zd!=(Int_t)off.Zd())
     384    {
     385        zd = (Int_t)off.Zd();
     386        sprintf(text, "%ld", zd);
     387        fOffsetZd->SetText(new TGString(text));
     388    }
     389    if (az!=(Int_t)off.Az())
     390    {
     391        az = (Int_t)off.Az();
     392        sprintf(text, "%ld", az);
     393        fOffsetAz->SetText(new TGString(text));
     394    }
     395}
     396
    339397void MGCosy::Update(ZdAz pos, ZdAz acc, ZdAz vel, ZdAz off, UInt_t stat)
    340398{
     
    342400    fAccuracy->Update(pos, acc);
    343401    fVelocity->Update(vel);
    344     fOffset->Update(off);
     402    UpdateOffset(off);
    345403
    346404#define kError     0x01
     
    358416    stat&kTracking ? fAccuracy->MapWindow() : fAccuracy->UnmapWindow();
    359417    stat&kTracking ? fVelocity->MapWindow() : fVelocity->UnmapWindow();
    360     stat&kTracking ? fOffset->MapWindow()   : fOffset->UnmapWindow();
     418    //    stat&kTracking ? fOffset->MapWindow()   : fOffset->UnmapWindow();
     419
     420    if (!fLog->TestBit(kHasChanged))
     421        return;
     422
     423    fLog->MapSubwindows();
     424    fLog->Layout();
     425    fLog->ResetBit(kHasChanged);
    361426}
    362427// ======================================================================
  • trunk/MagicSoft/Cosy/gui/MGCosy.h

    r918 r920  
    3333class TGCompositeFrame;
    3434class TGTab;
     35class TGListBox;
    3536
    3637class MGCosy : public TGMainFrame
     
    5051    TGLabel      **fLabel3;
    5152
     53    TGLabel       *fOffsetZd;
     54    TGLabel       *fOffsetAz;
     55
    5256    MGCoordinates *fCoord;
    5357    MGSkyPosition *fSkyPosition;
     
    6670    TGLabel *fStopped;
    6771
     72    TGListBox *fLog;
     73
    6874    void CreateMenu();
    6975    void CreateLabel(TGCompositeFrame *f);
     
    7379
    7480    void EnableLabel(TGLabel *label, Bool_t stat);
     81    void UpdateOffset(ZdAz &off);
    7582
    7683public:
     
    8087    void CloseWindow();
    8188
    82     TGLabel **GetLabel1() { return fLabel1; }
    83     TGLabel **GetLabel2() { return fLabel2; }
    84     TGLabel **GetLabel3() { return fLabel3; }
     89    TGLabel **GetLabel1() const { return fLabel1; }
     90    TGLabel **GetLabel2() const { return fLabel2; }
     91    TGLabel **GetLabel3() const { return fLabel3; }
     92
     93    TGListBox *GetLog() const { return fLog; }
    8594
    8695    void Update(ZdAz pos, ZdAz acc, ZdAz vel, ZdAz off, UInt_t stat);
  • trunk/MagicSoft/Cosy/gui/MGEmbeddedCanvas.cc

    r918 r920  
    1212MGEmbeddedCanvas::MGEmbeddedCanvas(const char *name, const TGWindow* p,
    1313                                   const UInt_t width, Float_t range)
    14     : TRootEmbeddedCanvas(name, p, width+1, width+1, kRaisedFrame),//, 0) //234, 76, kFixedSize)
     14    : TRootEmbeddedCanvas(name, p, width+1, width+1, 0/*kRaisedFrame*/),
    1515      fModified(kFALSE), fWidth(width), fRange(range), fPix(2.*range/width)
    1616{
  • trunk/MagicSoft/Cosy/gui/MGSkyPosition.cc

    r918 r920  
    203203void MGSkyPosition::UpdatePosition(Float_t zd, Float_t az)
    204204{
    205     static int X=~0;
    206     static int Y=~0;
     205    static int X =~0;
     206    static int Y =~0;
     207    static int Rx=~0;
     208    static int Ry=~0;
    207209
    208210    const float rad = D2PI*az/360.0;
     
    217219    const int pixy = (int)(y/fPix);
    218220
    219     if (X==pixx && Y==pixy)
     221    const int rx = (int)(s*fWidth/2.);
     222    const int ry = (int)(c*fWidth/2.);
     223
     224    if (X==pixx && Y==pixy && Rx==rx && Ry==ry)
    220225        return;
    221226
    222227    X = pixx;
    223228    Y = pixy;
     229
     230    Rx = rx;
     231    Ry = ry;
    224232
    225233    const float dx = s*4.;
  • trunk/MagicSoft/slalib/Makefile

    r912 r920  
    3737        nutc.c   dmxv.c   refro.c  prec.c   nut.c   dmxm.c  evp.c    \
    3838        drange.c deuler.c cldj.c   aopqk.c  refz.c  dh2e.c  de2h.c   \
    39         dt.c     dmoon.c  planet.c planel.c el2ue.c ue2pv.c pv2ue.c
     39        dt.c     dmoon.c  planet.c planel.c el2ue.c ue2pv.c pv2ue.c  \
     40        altaz.c
    4041#       addet.c
    4142#        afin.c airmas.c altaz.c amp.c \
Note: See TracChangeset for help on using the changeset viewer.