From d4079557e4ac839a8f9fd21f75af2fd1eaca3000 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Voltz?= Date: Mon, 16 Nov 2009 06:34:07 +0100 Subject: [PATCH] sheetfed calibration tuning - use sensor max resolution to do led/offset/gain calibration - use different thresholds when detecting white/black pixels in search strip function - tune device flags for DP485, DP487 and XP100 --- backend/genesys.c | 18 +++++++++++++----- backend/genesys_devices.c | 11 ++++++----- backend/genesys_gl646.c | 2 +- backend/genesys_gl841.c | 2 +- 4 files changed, 21 insertions(+), 12 deletions(-) diff --git a/backend/genesys.c b/backend/genesys.c index 0288ef884..9162361de 100644 --- a/backend/genesys.c +++ b/backend/genesys.c @@ -3678,6 +3678,7 @@ genesys_sheetfed_calibration (Genesys_Device * dev) { SANE_Status status = SANE_STATUS_GOOD; SANE_Bool forward = SANE_TRUE; + int xres; DBG (DBG_proc, "genesys_sheetfed_calibration: start\n"); if (dev->model->cmd_set->search_strip == NULL) @@ -3697,13 +3698,17 @@ genesys_sheetfed_calibration (Genesys_Device * dev) return status; } - int yres; DBG (DBG_info, "genesys_flatbed_calibration\n"); - yres = dev->sensor.optical_res; - if (dev->settings.yres <= dev->sensor.optical_res / 2) - yres /= 2; + /* led, offset and gain calibration are influenced by scan + * settings. So we set it to sensor resolution */ + xres = dev->sensor.optical_res; + dev->settings.xres = dev->sensor.optical_res; + /* XP200 needs to calibrate a full and half sensor's resolution */ + if (dev->model->ccd_type == CIS_XP200 + && dev->settings.xres <= dev->sensor.optical_res / 2) + dev->settings.xres /= 2; /* the afe needs to sends valid data even before calibration */ @@ -3744,7 +3749,7 @@ genesys_sheetfed_calibration (Genesys_Device * dev) /* since all the registers are set up correctly, just use them */ - status = dev->model->cmd_set->coarse_gain_calibration (dev, yres); + status = dev->model->cmd_set->coarse_gain_calibration (dev, xres); if (status != SANE_STATUS_GOOD) { DBG (DBG_error, @@ -3880,6 +3885,9 @@ genesys_sheetfed_calibration (Genesys_Device * dev) sane_strstatus (status)); return status; } + + /* resotre settings */ + dev->settings.xres = xres; DBG (DBG_proc, "genesys_sheetfed_calibration: end\n"); return SANE_STATUS_GOOD; } diff --git a/backend/genesys_devices.c b/backend/genesys_devices.c index c4c78f281..c11e8ed38 100644 --- a/backend/genesys_devices.c +++ b/backend/genesys_devices.c @@ -1456,9 +1456,10 @@ static Genesys_Model visioneer_xp100_r3_model = { MOTOR_ROADWARRIOR, GENESYS_FLAG_LAZY_INIT /* Which flags are needed for this scanner? */ | GENESYS_FLAG_SKIP_WARMUP - | GENESYS_FLAG_NO_CALIBRATION, - GENESYS_HAS_SCAN_SW | GENESYS_HAS_PAGE_LOADED_SW, - 300, + | GENESYS_FLAG_OFFSET_CALIBRATION + | GENESYS_FLAG_DARK_CALIBRATION, + GENESYS_HAS_SCAN_SW | GENESYS_HAS_PAGE_LOADED_SW | GENESYS_HAS_CALIBRATE, + 100, 400 }; @@ -1560,7 +1561,7 @@ static Genesys_Model syscan_docketport_485_model = { | GENESYS_FLAG_SKIP_WARMUP | GENESYS_FLAG_OFFSET_CALIBRATION | GENESYS_FLAG_DARK_CALIBRATION, - GENESYS_HAS_SCAN_SW | GENESYS_HAS_PAGE_LOADED_SW, + GENESYS_HAS_SCAN_SW | GENESYS_HAS_PAGE_LOADED_SW | GENESYS_HAS_CALIBRATE, 100, 400 }; @@ -1613,7 +1614,7 @@ static Genesys_Model dct_docketport_487_model = { | GENESYS_FLAG_OFFSET_CALIBRATION | GENESYS_FLAG_DARK_CALIBRATION | GENESYS_FLAG_UNTESTED, - GENESYS_HAS_SCAN_SW | GENESYS_HAS_PAGE_LOADED_SW, + GENESYS_HAS_SCAN_SW | GENESYS_HAS_PAGE_LOADED_SW | GENESYS_HAS_CALIBRATE, 100, 400 }; diff --git a/backend/genesys_gl646.c b/backend/genesys_gl646.c index ee7db78c6..bc73888a7 100644 --- a/backend/genesys_gl646.c +++ b/backend/genesys_gl646.c @@ -5040,7 +5040,7 @@ gl646_search_strip (Genesys_Device * dev, SANE_Bool forward, SANE_Bool black) for (x = 0; x < settings.pixels; x++) { /* when searching for black, detect white pixels */ - if (black && data[y * settings.pixels + x] > 60) + if (black && data[y * settings.pixels + x] > 90) { count++; } diff --git a/backend/genesys_gl841.c b/backend/genesys_gl841.c index ec7f7b2b4..f28d2b698 100644 --- a/backend/genesys_gl841.c +++ b/backend/genesys_gl841.c @@ -6073,7 +6073,7 @@ gl841_search_strip (Genesys_Device * dev, SANE_Bool forward, SANE_Bool black) for (x = 0; x < pixels; x++) { /* when searching for black, detect white pixels */ - if (black && data[y * pixels + x] > 60) + if (black && data[y * pixels + x] > 90) { count++; }