Index: trunk/FACT++/drive/Camera.cc
===================================================================
--- trunk/FACT++/drive/Camera.cc	(revision 18625)
+++ trunk/FACT++/drive/Camera.cc	(revision 18626)
@@ -24,11 +24,8 @@
 #include "Camera.h"
 
-#include "MLog.h"
-#include "MLogManip.h"
+#include <iostream>
 
 #include "MVideo.h"
 #include "PixClient.h"
-
-//ClassImp(Camera);
 
 using namespace std;
@@ -55,35 +52,18 @@
     gettimeofday(&fTime, NULL);
 
-    const Int_t W = fVideo->GetWidth();
-    const Int_t H = fVideo->GetHeight();
-/*
-    const Bool_t crop = W!=768 || H!=576;
+#if 1
+    for (int y=0; y<576; y++)
+        for (int x=0; x<768; x++)
+        {
+            const Int_t p = (x+y*768)*4;
+            fImg[x+y*768] = ((UInt_t)img[p+1]+(UInt_t)img[p+2]+(UInt_t)img[p+3])/3;
+        }
+#endif
 
-    // FIXME: This only works for one RGB24
-    if (!crop)
-    {
-        // FIXME: Grey scale assumed!
-        const unsigned char *end = img + 768*576*depth;
-        char *beg = fImg;
-        while (img < end)
-        {
-            *beg++ = *img;
-            img += depth;
-        }
-    }
-    else
- */
-    {
-        const Int_t w = TMath::Min(W, 768);
-        const Int_t h = TMath::Min(H, 576);
-
-        memset(fImg, 0, 768*576);
-        for (int y=0; y<h; y++)
-            for (int x=0; x<w; x++)
-            {
-                const Int_t p = (x+y*W)*depth;
-                fImg[x+y*768] = ((UInt_t)img[p]+(UInt_t)img[p+1]+(UInt_t)img[p+2])/3;
-            }
-    }
+#if 0
+    unsigned char *dest = fImg;
+    for (const unsigned char *ptr=img; ptr<img+768*576*4; ptr+=4)
+        *dest++ = (UShort_t(ptr[1])+UShort_t(ptr[2])+UShort_t(ptr[3]))/3;
+#endif
 
     fClient.ProcessFrame(fNumFrame-1, (byte*)fImg, &fTime);
@@ -97,17 +77,24 @@
     if (!fVideo->IsOpen())
     {
-        gLog << err << "Camera::Thread: ERROR - Device not open." << endl;
+        cout << "Camera::Thread: ERROR - Device not open." << endl;
         return kFALSE;
     }
 
-    gLog << dbg << "Start Camera::Thread at frame " << fNumFrame%fVideo->GetNumBuffers() << endl;
+    cout << "Start Camera::Thread at frame " << fNumFrame%fVideo->GetNumBuffers() << endl;
 
     for (int f=0; f<fVideo->GetNumBuffers(); f++)
+    {
         if (!fVideo->CaptureStart(f))
             return kFALSE;
+    }
+
+    if (!fVideo->Start())
+        return kFALSE;
 
     Int_t timeouts = 0;
     while (1)
     {
+
+        /*
         // Switch channel if necessary
         switch (fVideo->SetChannel(fChannel))
@@ -126,9 +113,11 @@
                     return kFALSE;
             break;
-        }
+        }*/
+
+        //cout << "*** Wait " << fNumFrame << endl;
 
         // Check and wait until capture into the next buffer is finshed
         unsigned char *img = 0;
-        switch (fVideo->CaptureWait(fNumFrame++, &img))
+        switch (fVideo->CaptureWait(fNumFrame, &img))
         {
         case kTRUE: // Process frame
@@ -145,4 +134,5 @@
                 break;
 
+            fNumFrame++;
             timeouts = 0;
             continue;
@@ -151,5 +141,8 @@
             break;
 
-        case kSKIP:  // Skip frame
+        case -1:  // Skip frame
+            usleep(10000); // Wait half a frame
+            continue;
+
             fNumFrame--;
             fNumSkipped++;
Index: trunk/FACT++/drive/Camera.h
===================================================================
--- trunk/FACT++/drive/Camera.h	(revision 18625)
+++ trunk/FACT++/drive/Camera.h	(revision 18626)
@@ -5,13 +5,13 @@
 #include "MThread.h"
 #endif
-
+/*
 #ifndef COSY_PixGetter
 #include "PixGetter.h"
 #endif
-
+*/
 class MVideo;
 class PixClient;
 
-class Camera : public PixGetter, public MThread
+class Camera : /*public PixGetter,*/ public MThread
 {
 private:
@@ -21,7 +21,7 @@
     static const int cols  = 768;
     static const int rows  = 576;
-    static const int depth = 3;
+    static const int depth = 4;
 
-    char fImg[cols*rows];
+    unsigned char fImg[cols*rows];
     struct timeval fTime;
 
