Index: trunk/psModules/src/camera/pmFPA.c
===================================================================
--- trunk/psModules/src/camera/pmFPA.c	(revision 19011)
+++ trunk/psModules/src/camera/pmFPA.c	(revision 19013)
@@ -282,4 +282,6 @@
     tmpReadout->lastWeightScan = 0;
 
+    tmpReadout->forceScan = false;
+
     return(tmpReadout);
 }
Index: trunk/psModules/src/camera/pmFPA.h
===================================================================
--- trunk/psModules/src/camera/pmFPA.h	(revision 19011)
+++ trunk/psModules/src/camera/pmFPA.h	(revision 19013)
@@ -6,6 +6,6 @@
  * @author Eugene Magnier, IfA
  *
- * @version $Revision: 1.24 $ $Name: not supported by cvs2svn $
- * @date $Date: 2008-08-01 03:16:10 $
+ * @version $Revision: 1.25 $ $Name: not supported by cvs2svn $
+ * @date $Date: 2008-08-12 02:51:20 $
  * Copyright 2005-2006 Institute for Astronomy, University of Hawaii
  */
@@ -136,4 +136,5 @@
     int thisWeightScan;                 ///< start scan for next/current read
     int lastWeightScan;                 ///< start scan of the last read
+    bool forceScan;                     ///< Force pmFPARead to obey the above commanded this and last scans.
 } pmReadout;
 
Index: trunk/psModules/src/camera/pmFPARead.c
===================================================================
--- trunk/psModules/src/camera/pmFPARead.c	(revision 19011)
+++ trunk/psModules/src/camera/pmFPARead.c	(revision 19013)
@@ -44,5 +44,5 @@
 //////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
-// Return pointer to appropriate value for tracking scans
+// Get the "thisXXXScan" value in the readout for the appropriate image type
 static int readoutGetThisScan(pmReadout *readout, // Readout of interest
                               fpaReadType type // Type of image
@@ -61,19 +61,58 @@
 }
 
-// Return pointer to appropriate value for tracking scans
-static int readoutSetLastScan(pmReadout *readout, // Readout of interest
-                              fpaReadType type,   // Type of image
-                              int numScans        // requested number of scans
+// Set the "thisXXXScan" value in the readout for the appropriate image type
+static int readoutSetThisScan(pmReadout *readout, // Readout of interest
+                              fpaReadType type, // Type of image
+                              int thisScan // Starting scan number
     )
 {
     switch (type) {
       case FPA_READ_TYPE_IMAGE:
-        readout->lastImageScan = readout->thisImageScan + numScans;
+        readout->thisImageScan = thisScan;
         return readout->lastImageScan;
       case FPA_READ_TYPE_MASK:
-        readout->lastMaskScan = readout->thisMaskScan + numScans;
+        readout->thisMaskScan = thisScan;
         return readout->lastMaskScan;
       case FPA_READ_TYPE_WEIGHT:
-        readout->lastWeightScan = readout->thisWeightScan + numScans;
+        readout->thisWeightScan = thisScan;
+        return readout->lastWeightScan;
+      default:
+        psAbort("Unknown read type: %x\n", type);
+    }
+    return false;
+}
+
+// Get the "lastXXXScan" value in the readout for the appropriate image type
+static int readoutGetLastScan(pmReadout *readout, // Readout of interest
+                              fpaReadType type // Type of image
+    )
+{
+    switch (type) {
+      case FPA_READ_TYPE_IMAGE:
+        return readout->lastImageScan;
+      case FPA_READ_TYPE_MASK:
+        return readout->lastMaskScan;
+      case FPA_READ_TYPE_WEIGHT:
+        return readout->lastWeightScan;
+      default:
+        psAbort("Unknown read type: %x\n", type);
+    }
+}
+
+// Set the "lastXXXScan" value in the readout for the appropriate image type
+static int readoutSetLastScan(pmReadout *readout, // Readout of interest
+                              fpaReadType type, // Type of image
+                              int lastScan // Last scan number
+    )
+{
+    switch (type) {
+      case FPA_READ_TYPE_IMAGE:
+        readout->lastImageScan = lastScan;
+        return readout->lastImageScan;
+      case FPA_READ_TYPE_MASK:
+        readout->lastMaskScan = lastScan;
+        return readout->lastMaskScan;
+      case FPA_READ_TYPE_WEIGHT:
+        readout->lastWeightScan = lastScan;
         return readout->lastWeightScan;
       default:
@@ -156,8 +195,9 @@
 }
 
-// Does the current readout, with scans set for a new read, represent any real data, or is it
-// beyond the end?  Requires that cellNumReadouts() has been called before (for header and
-// concepts to have been read) In the process, adjusts the TRIMSEC
-static bool readoutHaveMoreScans(bool *result,   // true : more data to read
+// Does the current readout, with scans set for a new read, represent any real data, or is it beyond the end?
+// Requires that cellNumReadouts() has been called before (for header and concepts to have been read)
+// In the process, adjusts the TRIMSEC
+static bool readoutHaveMoreScans(int *start, // Start of scan
+                                 int *last, // Last possible scan (defined by TRIMSEC)
                                  pmReadout *readout, // Readout of interest
                                  int numScans, // Number of scans to read at a time
@@ -166,8 +206,7 @@
                                  )
 {
-    assert(result);
+    assert(start);
+    assert(last);
     assert(readout);
-
-    *result = false;
 
     if (!pmConceptsReadCell(readout->parent, PM_CONCEPT_SOURCE_DEFAULTS | PM_CONCEPT_SOURCE_DATABASE,
@@ -213,24 +252,21 @@
     }
 
+    *last = (readdir == 1) ? trimsec->y1 : trimsec->x1; // Maximum possible scan number
+
     // Calculate the segment offset and upper limit
     if (numScans == 0) {
-        // in the case of numScans == 0, we never call this funtion unless the data has not yet
-        // been read.  thus, only if the delta is  should we return false (ie, trimsec defines an empty region)
-        int thisScan = (readdir == 1) ? trimsec->y0 : trimsec->x0;
-        int lastScan = (readdir == 1) ? trimsec->y1 : trimsec->x1;
-        *result = (lastScan > thisScan);
-        return true;
-    }
-
-    // allow multiple threads to read different segments into different readouts
-    // this thread may not have read a segment yet; but others have.  trust readout->imageScan
-
-    // is the start scan of the read less than the last possible scan?
-    int thisScan = readoutGetThisScan(readout, type);
-    int lastScan = (readdir == 1) ? trimsec->y1 : trimsec->x1;
-
-    *result = (lastScan > thisScan);
+        // Read entire image.  In that case, we never call this funtion unless the data has not yet been read.
+        // thus, only if the delta is should we return false (ie, trimsec defines an empty region)
+        *start = (readdir == 1) ? trimsec->y0 : trimsec->x0;
+    } else if (readout->forceScan) {
+        // We're forced to read what we're told
+        *start = readoutGetThisScan(readout, type);
+    } else {
+        // Progressive scans
+        psImage *image = *readoutImageByType(readout, type); // Appropriate image from readout
+        *start = image ? readoutGetLastScan(readout, type) + numScans : 0;
+    }
+
     return true;
-    // XXX fold this and the above case together
 }
 
@@ -271,11 +307,11 @@
     }
 
-    bool haveData;
-    if (!readoutHaveMoreScans(&haveData, readout, numScans, type, config)) {
+    int start, last;                    // Start and last scans
+    if (!readoutHaveMoreScans(&start, &last, readout, numScans, type, config)) {
         psError(PS_ERR_UNKNOWN, false, "Unable to determine readout properties.");
         return false;
     }
 
-    return haveData;
+    return start < last;
 }
 
@@ -458,14 +494,14 @@
     }
 
-    bool haveData;
-    if (!readoutHaveMoreScans(&haveData, readout, numScans, type, config)) {
+    int thisScan;                       // Starting scan for this read
+    int maxScan;                        // Maximum scan number
+    if (!readoutHaveMoreScans(&thisScan, &maxScan, readout, numScans, type, config)) {
         psError(PS_ERR_UNKNOWN, false, "Unable to determine readout properties.");
         return false;
     }
-    if (!haveData) {
+    if (thisScan >= maxScan) {
         psError(PS_ERR_IO, true, "No more of the readout to read.");
         return false;
     }
-
 
     pmHDU *hdu = pmHDUFromCell(cell);   // The HDU
@@ -511,15 +547,14 @@
     }
 
-    // Determine the numbe of scans to read
-    int thisScan = readoutGetThisScan(readout, type);
-    int lastScan = readoutSetLastScan (readout, type, numScans);
+    // Determine the number of scans to read
+    int lastScan = readoutSetLastScan(readout, type, thisScan + numScans);
     if (thisScan == 0) {
         overlap = 0;
     }
     thisScan -= overlap;
+    readoutSetThisScan(readout, type, thisScan);
 
     // Calculate limits, adjust readout->row0,col0
     // XXX Should row0,col0 be adjusted, since they are used for astrometry???
-    // Just moved to using the "scansTracker" for tracking position in chunk reads, so row0,col0 not required
     if (readdir == 1) {
         // Reading rows
