Index: trunk/MagicSoft/Cosy/Changelog
===================================================================
--- trunk/MagicSoft/Cosy/Changelog	(revision 7295)
+++ trunk/MagicSoft/Cosy/Changelog	(revision 7296)
@@ -1,28 +1,55 @@
                                                                   -*-*- END -*-*-
 
+ 2005/08/22 - Thomas Bretz
+
+   * caos/Ring.[h,cc]:
+     - added a sanity check for the case a led entry == NULL
+
+   * caos/Rings.[h,cc]:
+     - code cleanup
+     - added a sanity check to CalcRings
+
+   * devdrv/shaftencoder.h:
+     - added new member function GetPosDirCorrected
+     - added new member function GetOffsetDirCorrected
+
+   * main/MStarguider.cc:
+     - set number of minimum required LEDs for the ring calculation
+       to 3. With two LEDs you can NEVER calculate a ring!
+     - added another sanity check in FindStars
+
+   * main/MTracking.cc:
+     - replaced ?:-operators by new functions Get*DirCorrected
+     - made sure that if both directions have changed the reset
+       really causes the correct values to be used immediatly!
+     - added some code for future use
+
+
+
  2005/07/28 - Florian Goebel
 
-  * videodev/FilterLed.[cc,h]
-    - add GetMeanPositionCircle and FindStarCircle
+   * videodev/FilterLed.[cc,h]
+     - add GetMeanPositionCircle and FindStarCircle
  
-  * devdrv/shaftencoder.[cc,h]
-    - add: fDirHasChanged, fDirChangedPos, fDirChangedOffset,
-           fDirection, fHysteresisPos, fHysteresisNeg
-
-  * main/MCosy.cc
-    - set faster acceleration and Velocity parameters in TrackPositionGRB
-
-  * main/MPointing.cc
-    - correct bug which always set speed to LO-SPEED
-
-  * main/MStarguider.[cc,h]
-    - add new Popup "Operation" (functionality is not ready yet)
-    - add new procedure: FindRoqueLamp
-    - in MStarguider::FindStar now use Leds::FindStarCircle 
-      (instead of Leds::FindStar)
-
-  * main/MTracking.cc
-    - calculate DirHasChanged etc.
- 
+   * devdrv/shaftencoder.[cc,h]
+     - add: fDirHasChanged, fDirChangedPos, fDirChangedOffset,
+            fDirection, fHysteresisPos, fHysteresisNeg
+
+   * main/MCosy.cc
+     - set faster acceleration and Velocity parameters in TrackPositionGRB
+
+   * main/MPointing.cc
+     - correct bug which always set speed to LO-SPEED
+
+   * main/MStarguider.[cc,h]
+     - add new Popup "Operation" (functionality is not ready yet)
+     - add new procedure: FindRoqueLamp
+     - in MStarguider::FindStar now use Leds::FindStarCircle 
+       (instead of Leds::FindStar)
+
+   * main/MTracking.cc
+     - calculate DirHasChanged etc.
+
+
 
  2005/04/11 - Thomas Bretz
Index: trunk/MagicSoft/Cosy/caos/Ring.cc
===================================================================
--- trunk/MagicSoft/Cosy/caos/Ring.cc	(revision 7295)
+++ trunk/MagicSoft/Cosy/caos/Ring.cc	(revision 7296)
@@ -20,13 +20,29 @@
 bool Ring::CalcCenter(const Leds &leds, Int_t i, Int_t j, Int_t k)
 {
+    if (leds.At(i)==NULL)
+    {
+        cout << "Ring::CalcCenter: Led i=" << i << " is NULL." << endl;
+        return kFALSE;
+    }
+    if (leds.At(j)==NULL)
+    {
+        cout << "Ring::CalcCenter: Led j=" << j << " is NULL." << endl;
+        return kFALSE;
+    }
+    if (leds.At(k)==NULL)
+    {
+        cout << "Ring::CalcCenter: Led k=" << k << " is NULL." << endl;
+        return kFALSE;
+    }
+
     Double_t h1 = leds(i).GetY()- leds(j).GetY();
 
     if (h1==0)
     {
-        Swap(&j, &k);
+        Swap(j, k);
         h1 = leds(i).GetY()- leds(j).GetY();
         if (h1==0)
         {
-            cout << "h1==0" <<endl;
+            cout << "Ring::CalcCenter: h1==0" <<endl;
             return kFALSE;
         }
@@ -37,9 +53,9 @@
     if (h2==0)
     {
-        Swap(&i, &j);
+        Swap(i, j);
         h2 = leds(j).GetY() - leds(k).GetY();
         if (h2==0)
         {
-            cout << "h2==0" << endl;
+            cout << "Ring::CalcCenter: h2==0" << endl;
             return kFALSE;
         }
@@ -54,5 +70,5 @@
     if (m2-m1==0)
     {
-        cout << "All three points in a row! (m2-m1==0)" << endl;
+        cout << "Ring::CalcCenter: All three points in a row! (m2-m1==0)" << endl;
         return kFALSE;
     }
