loop several time while searching for a white area

- when doing sheetfed calibration try 10 times to find a proper area for
  doing calibration
merge-requests/1/head
Stphane Voltz 2009-11-16 20:35:50 +01:00
rodzic 90e5b6427d
commit 3a3e581f90
1 zmienionych plików z 106 dodań i 74 usunięć

Wyświetl plik

@ -2030,6 +2030,10 @@ gt68xx_sheetfed_scanner_calibrate (GT68xx_Scanner * scanner)
return status;
}
/* loop until we find a white area to calibrate on */
i = 0;
do
{
/* start scan */
status =
gt68xx_scanner_start_scan_extended (scanner, &request, SA_CALIBRATE,
@ -2083,6 +2087,10 @@ gt68xx_sheetfed_scanner_calibrate (GT68xx_Scanner * scanner)
/* end scan */
gt68xx_scanner_stop_scan (scanner);
i++;
}
while (i < 20 && white < WHITE_LINES);
/* check if we found a white area */
if (white != WHITE_LINES)
{
@ -2107,30 +2115,44 @@ gt68xx_sheetfed_scanner_calibrate (GT68xx_Scanner * scanner)
status = gt68xx_scanner_calibrate (scanner, &request);
if (status != SANE_STATUS_GOOD)
{
DBG (1, "gt68xx_sheetfed_scanner_calibrate: gt68xx_scanner_calibrate returned %s\n", sane_strstatus (status));
DBG (1,
"gt68xx_sheetfed_scanner_calibrate: gt68xx_scanner_calibrate returned %s\n",
sane_strstatus (status));
return status;
}
/* allocate and save per dpi calibrators */
scanner->calibrations[i].dpi = request.xdpi;
status = gt68xx_calibrator_create_copy (&(scanner->calibrations[i].red), scanner->cal_r, params.pixel_xs, 0);
status =
gt68xx_calibrator_create_copy (&(scanner->calibrations[i].red),
scanner->cal_r, params.pixel_xs, 0);
if (status != SANE_STATUS_GOOD)
{
DBG (1, "gt68xx_sheetfed_scanner_calibrate: failed to create calibrator: %s\n", sane_strstatus (status));
DBG (1,
"gt68xx_sheetfed_scanner_calibrate: failed to create calibrator: %s\n",
sane_strstatus (status));
return status;
}
status = gt68xx_calibrator_create_copy (&(scanner->calibrations[i].green), scanner->cal_g, params.pixel_xs, 0);
status =
gt68xx_calibrator_create_copy (&(scanner->calibrations[i].green),
scanner->cal_g, params.pixel_xs, 0);
if (status != SANE_STATUS_GOOD)
{
DBG (1, "gt68xx_sheetfed_scanner_calibrate: failed to create calibrator: %s\n", sane_strstatus (status));
DBG (1,
"gt68xx_sheetfed_scanner_calibrate: failed to create calibrator: %s\n",
sane_strstatus (status));
return status;
}
status = gt68xx_calibrator_create_copy (&(scanner->calibrations[i].blue), scanner->cal_b, params.pixel_xs, 0);
status =
gt68xx_calibrator_create_copy (&(scanner->calibrations[i].blue),
scanner->cal_b, params.pixel_xs, 0);
if (status != SANE_STATUS_GOOD)
{
DBG (1, "gt68xx_sheetfed_scanner_calibrate: failed to create calibrator: %s\n", sane_strstatus (status));
DBG (1,
"gt68xx_sheetfed_scanner_calibrate: failed to create calibrator: %s\n",
sane_strstatus (status));
return status;
}
@ -2139,19 +2161,29 @@ gt68xx_sheetfed_scanner_calibrate (GT68xx_Scanner * scanner)
status = gt68xx_scanner_calibrate (scanner, &request);
if (status != SANE_STATUS_GOOD)
{
DBG (1, "gt68xx_sheetfed_scanner_calibrate: gt68xx_scanner_calibrate returned %s\n", sane_strstatus (status));
DBG (1,
"gt68xx_sheetfed_scanner_calibrate: gt68xx_scanner_calibrate returned %s\n",
sane_strstatus (status));
return status;
}
status = gt68xx_calibrator_create_copy (&(scanner->calibrations[i].gray), scanner->cal_gray, params.pixel_xs, 0);
status =
gt68xx_calibrator_create_copy (&(scanner->calibrations[i].gray),
scanner->cal_gray, params.pixel_xs, 0);
if (status != SANE_STATUS_GOOD)
{
DBG (1, "gt68xx_sheetfed_scanner_calibrate: failed to create calibrator: %s\n", sane_strstatus (status));
DBG (1,
"gt68xx_sheetfed_scanner_calibrate: failed to create calibrator: %s\n",
sane_strstatus (status));
return status;
}
/* next resolution */
i++;
/* since auto afe is done at a fixed resolution, we don't need to
* do each each time, once is enough */
scanner->auto_afe = SANE_FALSE;
}
scanner->calibrated = SANE_TRUE;