Index: /trunk/MagicSoft/Cosy/base/MThread.cc
===================================================================
--- /trunk/MagicSoft/Cosy/base/MThread.cc	(revision 1272)
+++ /trunk/MagicSoft/Cosy/base/MThread.cc	(revision 1273)
@@ -10,8 +10,11 @@
 // Starts the derived thread if you don't specify false.
 //
-MThread::MThread(bool start) : fIsRunning(false), fIsDetached(false), fThread(NULL), fReturn(NULL), fPriority(0)
+MThread::MThread(bool start, int prio) : fIsRunning(false), fIsDetached(false), fThread(NULL), fReturn(NULL)
 {
     if (start)
+    {
+        SetPriority(prio);
         Start();
+    }
 }
 
Index: /trunk/MagicSoft/Cosy/base/MThread.h
===================================================================
--- /trunk/MagicSoft/Cosy/base/MThread.h	(revision 1272)
+++ /trunk/MagicSoft/Cosy/base/MThread.h	(revision 1273)
@@ -26,5 +26,5 @@
 
 public:
-    MThread(bool start=true);
+    MThread(bool start=true, int prio=0);
     virtual ~MThread();
 
Index: /trunk/MagicSoft/Cosy/base/coord.h
===================================================================
--- /trunk/MagicSoft/Cosy/base/coord.h	(revision 1272)
+++ /trunk/MagicSoft/Cosy/base/coord.h	(revision 1273)
@@ -118,4 +118,7 @@
     double Dec() const { return fY; }
 
+    void Ra(double x)  { fX = x; }
+    void Dec(double y) { fY = y; }
+
     RaDec operator/(double c) const { return RaDec(fX/c, fY/c); }
     RaDec operator*(double c) const { return RaDec(fX*c, fY*c); }
Index: /trunk/MagicSoft/Cosy/base/msgqueue.cc
===================================================================
--- /trunk/MagicSoft/Cosy/base/msgqueue.cc	(revision 1272)
+++ /trunk/MagicSoft/Cosy/base/msgqueue.cc	(revision 1273)
@@ -57,4 +57,8 @@
 
         fRc=Proc(fMsg, fMp);
+
+        if (fMsg==WM_QUIT)
+            break;
+
     }
 }
Index: /trunk/MagicSoft/Cosy/base/msgqueue.h
===================================================================
--- /trunk/MagicSoft/Cosy/base/msgqueue.h	(revision 1272)
+++ /trunk/MagicSoft/Cosy/base/msgqueue.h	(revision 1273)
@@ -5,4 +5,5 @@
 
 #define WM_NULL 0x0000
+#define WM_QUIT 0xffff
 
 class MsgQueue
Index: /trunk/MagicSoft/Cosy/candrv/network.cc
===================================================================
--- /trunk/MagicSoft/Cosy/candrv/network.cc	(revision 1272)
+++ /trunk/MagicSoft/Cosy/candrv/network.cc	(revision 1273)
@@ -263,8 +263,23 @@
 bool Network::HasError() const
 {
-    for (int i=0; i<32; i++)
-        if (fNodes[i] && fNodes[i]->HasError())
-            return true;
-
-    return false;
-}
+    bool rc = false;
+
+    for (int i=0; i<32; i++)
+    {
+        if (!fNodes[i])
+            continue;
+
+        if (!fNodes[i]->HasError())
+            continue;
+
+        rc = true;
+
+        if (fNodes[i]->GetError() <= 0)
+            continue;
+
+        lout << "- Node #" << dec << i << " '" << fNodes[i]->GetNodeName();
+        lout << "' has error #" << fNodes[i]->GetError() << endl;
+    }
+
+    return rc;
+}
Index: /trunk/MagicSoft/Cosy/candrv/nodedrv.cc
===================================================================
--- /trunk/MagicSoft/Cosy/candrv/nodedrv.cc	(revision 1272)
+++ /trunk/MagicSoft/Cosy/candrv/nodedrv.cc	(revision 1273)
@@ -74,5 +74,5 @@
     }
 
-    lout << "- Node #" << nodeid << " (" << name << ") initialized." << endl;
+    lout << "- Node #" << (int)nodeid << " (" << name << ") initialized." << endl;
 }
 
Index: /trunk/MagicSoft/Cosy/candrv/vmodican.cc
===================================================================
--- /trunk/MagicSoft/Cosy/candrv/vmodican.cc	(revision 1272)
+++ /trunk/MagicSoft/Cosy/candrv/vmodican.cc	(revision 1273)
@@ -915,10 +915,9 @@
 //  and switch the can bus communication on
 //
-VmodIcan::VmodIcan(const char *dev, const int baud, MLog &out) : Log(out), MThread(false)//: CanDriver(dev, baud)
+VmodIcan::VmodIcan(const char *dev, const int baud, MLog &out) : Log(out), MThread(false, -10)//: CanDriver(dev, baud)
 {
     //
     // Set priority of receiving thread and detach the receiving thread
     //
-    SetPriority(-10);
     Detach();
 
Index: /trunk/MagicSoft/Cosy/gui/MGCosy.cc
===================================================================
--- /trunk/MagicSoft/Cosy/gui/MGCosy.cc	(revision 1272)
+++ /trunk/MagicSoft/Cosy/gui/MGCosy.cc	(revision 1273)
@@ -169,9 +169,17 @@
     fStopped  = new TGLabel(f, "Stopped");
 
-    fError   ->SetBackgroundColor(224); // red
-    fMoving  ->SetBackgroundColor(10);  // blue
-    fTracking->SetBackgroundColor(47);  // blue
-    fStopping->SetBackgroundColor(164); // orange
-    fStopped ->SetBackgroundColor(20);  // green
+
+    ULong_t color;
+
+    gClient->GetColorByName("Red", color);
+    fError->SetBackgroundColor(color);
+    gClient->GetColorByName("LightBlue", color);
+    fMoving->SetBackgroundColor(color);
+    gClient->GetColorByName("Blue", color);
+    fTracking->SetBackgroundColor(color);
+    gClient->GetColorByName("Orange", color);
+    fStopping->SetBackgroundColor(color);
+    gClient->GetColorByName("Green", color);
+    fStopped->SetBackgroundColor(color);
 
     fError   ->Move(10, 25);
@@ -264,6 +272,9 @@
     fList->Add(but);
 
+    ULong_t color;
+
     but = new TGTextButton(this, "Start", kPB_START);
-    but->SetBackgroundColor(20);
+    gClient->GetColorByName("Green", color);
+    but->SetBackgroundColor(color);
     but->Move(147, 275);
     but->Resize(62, 25);
@@ -272,5 +283,7 @@
 
     but = new TGTextButton(this, "Stop",  kPB_STOP);
-    but->SetBackgroundColor(224);
+
+    gClient->GetColorByName("Red", color);
+    but->SetBackgroundColor(color);
     but->Move(212, 275);
     but->Resize(62, 25);
@@ -285,15 +298,21 @@
     fList = new MGList;
 
+    cout << "MGCosy: Creating Menu" << endl;
     CreateMenu();
 
+    cout << "MGCosy: Creating TGCompositeFrame" << endl;
     TGCompositeFrame *f = new TGCompositeFrame(this, 0, 0);
     f->SetLayoutManager(new TGMatrixLayout(f, 3, 2, 10));
     fList->Add(f);
 
+    cout << "MGCosy: Creating TGTab" << endl;
     fTab = new TGTab(f, 300, 300);
     fList->Add(fTab);
 
+    cout << "MGCosy: Creating MGSkyPosition" << endl;
     fSkyPosition = new MGSkyPosition(f, 300);
+    cout << "MGCosy: Creating MGAccuracy" << endl;
     fAccuracy    = new MGAccuracy   (f, 300);
+    cout << "MGCosy: Creating MGVelocity" << endl;
     fVelocity    = new MGVelocity   (f, "Velocity [\"/min]", 300);
 //    fOffset      = new MGVelocity   (f, "Offset se-re [']", 300);
@@ -304,8 +323,10 @@
 //    fList->Add(fOffset);
 
+    cout << "MGCosy: Creating TGGroupFrame" << endl;
     TGGroupFrame *frame = new TGGroupFrame(f, "Status");
     frame->Resize(300, 300);
     fList->Add(frame);
 
+    cout << "MGCosy: Creating TGListBox" << endl;
     fLog = new TGListBox(f, -1, kSunkenFrame);  //kSunkenFrame|kDoubleBorder,
     fLog->Resize(300, 300);
@@ -328,5 +349,7 @@
     // FIXME!
     //
+    cout << "MGCosy: Creating Tabs" << endl;
     CreateTabs(fTab);
+    cout << "MGCosy: Creating Label" << endl;
     CreateLabel(frame);
 
@@ -334,4 +357,5 @@
     //   Map the window, set up the layout, etc.
     //
+    cout << "MGCosy: Setting Size" << endl;
     const Int_t w = 940;
     const Int_t h = 660;
@@ -341,4 +365,5 @@
     SetIconName("Cosy");
 
+    cout << "MGCosy: Map Window" << endl;
     MapSubwindows();
     Resize(GetDefaultSize());
Index: /trunk/MagicSoft/Cosy/gui/MGSkyPosition.cc
===================================================================
--- /trunk/MagicSoft/Cosy/gui/MGSkyPosition.cc	(revision 1272)
+++ /trunk/MagicSoft/Cosy/gui/MGSkyPosition.cc	(revision 1273)
@@ -16,7 +16,16 @@
 
 #include "coord.h"
+#include "SlaStars.h"
 #include "SlaPlanets.h"
 
 ClassImp(MGSkyPosition);
+
+void MGSkyPosition::InitArc(TArc *arc, Int_t fillstyle, Int_t fillcolor, Int_t linecolor)
+{
+    arc->SetFillStyle(fillstyle);      // (s. TAttFill)
+    arc->SetFillColor(fillcolor);      // (s. TAttFill)
+    arc->SetLineColor(linecolor);
+    arc->Draw();
+}
 
 void MGSkyPosition::InitPlanets()
@@ -34,5 +43,6 @@
     //   Neptun     7.8
     //
-    fSlalib = new SlaPlanets;
+    fSlaPlanet = new SlaPlanets;
+    fSlaStar   = new SlaStars;
 
     //
@@ -41,27 +51,15 @@
     //   1, 12, 13, 14, 15, 16, 17, 18, 19, 10
     //
-    fMars = new TArc(0, 0, 1);
-    fMars->SetFillStyle(1001);     // solid      (s. TAttFill)
-    fMars->SetFillColor(13);       // light grey (s. TAttFill)
-    fMars->SetLineColor(12);
-    fMars->Draw();
-
-    fVenus = new TArc(0, 0, 2);
-    fVenus->SetFillStyle(1001);    // solid      (s. TAttFill)
-    fVenus->SetFillColor(15);      // light grey (s. TAttFill)
-    fVenus->SetLineColor(14);
-    fVenus->Draw();
-
+    fMars    = new TArc(0, 0, 1);
+    fVenus   = new TArc(0, 0, 2);
     fJupiter = new TArc(0, 0, 2);
-    fJupiter->SetFillStyle(1001);  // solid      (s. TAttFill)
-    fJupiter->SetFillColor(17);    // light grey (s. TAttFill)
-    fJupiter->SetLineColor(16);
-    fJupiter->Draw();
-
-    fMoon = new TArc(0, 0, 3, 290, 70);
-    fMoon->SetFillStyle(1001);     // solid      (s. TAttFill)
-    fMoon->SetFillColor(19);       // light grey (s. TAttFill)
-    fMoon->SetLineColor(15);
-    fMoon->Draw();
+    fMoon    = new TArc(0, 0, 3, 290, 70);
+    fSun     = new TArc(0, 0, 2);
+
+    InitArc(fMars,    1001, 13, 12);
+    InitArc(fVenus,   1001, 15, 14);
+    InitArc(fJupiter, 1001, 17, 16);
+    InitArc(fMoon,    1001, 19, 15);
+    InitArc(fSun,     1001, 10, 19);
 
     for (int i=0; i<4; i++)
@@ -74,10 +72,4 @@
         fList->Add(fSunL[i]);
     }
-
-    fSun = new TArc(0, 0, 2);
-    fSun->SetFillStyle(1001);     // solid      (s. TAttFill)
-    fSun->SetFillColor(10);       // white      (s. TAttFill)
-    fSun->SetLineColor(19);
-    fSun->Draw();
 
     fList->Add(fMars);
@@ -168,4 +160,11 @@
     fList->Add(fLin1b);
     fList->Add(fLin2);
+
+    for (int i=0; i<6; i++)
+    {
+        fDot[i] = new TArc(0, 0, 1);
+        InitArc(fDot[i], 1001, 10, 19);
+        fList->Add(fDot[i]);
+    }
 }
 
@@ -173,4 +172,5 @@
     : MGEmbeddedCanvas("SkyPosition", p, w, 110)
 {
+    cout << "MGSkyPosition: Initilizing." << endl;
     DrawCoordinateSystem();
     InitPlanets();
@@ -178,9 +178,11 @@
     InitText();
     InitCanvas();
+    cout << "MGSkyPosition: Initilizing done." << endl;
 }
 
 MGSkyPosition::~MGSkyPosition()
 {
-    delete fSlalib;
+    delete fSlaPlanet;
+    delete fSlaStar;
 
     cout << "MGSkyPosition destroyed." << endl;
@@ -203,6 +205,27 @@
 }
 
-void MGSkyPosition::UpdatePosition(Float_t zd, Float_t az)
-{
+void MGSkyPosition::SetDot(TArc *arc, RaDec &radec, Int_t off)
+{
+    RaDec rd(radec.Ra()+off*360/24*kDeg2Rad, radec.Dec());
+    ZdAz zdaz = fSlaStar->CalcZdAz(rd);
+
+    const float s = sin(zdaz.Az());
+    const float c = cos(zdaz.Az());
+
+    const float x = s*zdaz.Zd()*kRad2Deg;             // [deg]
+    const float y = c*zdaz.Zd()*kRad2Deg;             // [deg]
+
+    arc->SetX1(x);
+    arc->SetY1(y);
+
+    SetModified();
+}
+
+void MGSkyPosition::UpdatePosition(RaDec &radec, Float_t zd, Float_t az)
+{
+    //
+    // zd [deg]
+    // az [deg]
+    //
     static int X =~0;
     static int Y =~0;
@@ -210,11 +233,11 @@
     static int Ry=~0;
 
-    const float rad = az*kDeg2Rad;
+    const float rad = az*kDeg2Rad;    // [rad]
 
     const float s = sin(rad);
     const float c = cos(rad);
 
-    const float x = s*zd;
-    const float y = c*zd;
+    const float x = s*zd;             // [deg]
+    const float y = c*zd;             // [deg]
 
     const int pixx = (int)(x/fPix);
@@ -238,4 +261,12 @@
     SetLin1(s*95., c*95.);
     SetLin2(x+dy, y-dx, x-dy, y+dx);
+
+    if (zd<80)
+    {
+        for(int i=0; i<3; i++)
+            SetDot(fDot[i], radec, i-3);
+        for(int i=3; i<6; i++)
+            SetDot(fDot[i], radec, i-2);
+    }
 
     SetModified();
@@ -279,5 +310,6 @@
     // calculate actual time for planet positions
     //
-    fSlalib->SetMjd2Now();
+    fSlaPlanet->SetMjd2Now();
+    fSlaStar->SetMjd2Now();
 
     UpdatePlanet(kESun,     fSun);
@@ -287,5 +319,7 @@
     UpdatePlanet(kEMars,    fMars);
 
-    UpdatePosition(pos.Zd(), pos.Az());
+    RaDec radec = fSlaStar->CalcRaDec(pos*kDeg2Rad);
+
+    UpdatePosition(radec, pos.Zd(), pos.Az());
     UpdateText(pos.Zd(), pos.Az());
 
@@ -298,7 +332,7 @@
     // calculate actual position of planet
     //
-    fSlalib->UpdatePlanetPos((ePlanets_t)planet);
-
-    ZdAz zdaz = fSlalib->GetPlanetPos((ePlanets_t)planet);
+    fSlaPlanet->UpdatePlanetPos((ePlanets_t)planet);
+
+    ZdAz zdaz = fSlaPlanet->GetPlanetPos((ePlanets_t)planet);
 
     //
Index: /trunk/MagicSoft/Cosy/gui/MGSkyPosition.h
===================================================================
--- /trunk/MagicSoft/Cosy/gui/MGSkyPosition.h	(revision 1272)
+++ /trunk/MagicSoft/Cosy/gui/MGSkyPosition.h	(revision 1273)
@@ -17,5 +17,7 @@
 
 class ZdAz;
+class RaDec;
 class TText;
+class SlaStars;
 class SlaPlanets;
 
@@ -28,4 +30,6 @@
     TArc       *fSun;
 
+    TArc       *fDot[6];
+
     TLine      *fLin1a;
     TLine      *fLin1b;
@@ -36,8 +40,11 @@
     TText      *fText;
 
-    SlaPlanets *fSlalib;
+    SlaStars   *fSlaStar;
+    SlaPlanets *fSlaPlanet;
 
     Int_t fX[9];
     Int_t fY[9];
+
+    void InitArc(TArc *arc, Int_t fillstyle, Int_t fillcolor, Int_t linecolor);
 
     void InitText();
@@ -49,7 +56,9 @@
     void SetLin2(Float_t x1, Float_t y1, Float_t x2, Float_t y2);
 
+    void SetDot(TArc *arc, RaDec &radec, Int_t off);
+
     void UpdateText(Float_t zd, Float_t az);
     void UpdatePlanet(Int_t planet, TArc *arc);
-    void UpdatePosition(Float_t zd, Float_t az);
+    void UpdatePosition(RaDec &radec, Float_t zd, Float_t az);
 
 public:
