From f27fc32bb1ae56b7b2908bd02d11a90ddff6d35c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Voltz?= Date: Tue, 3 Jun 2008 04:41:08 +0000 Subject: [PATCH] - fixed wrong offset for start of scanarea for MD6471 scanner. --- ChangeLog | 4 +++ backend/genesys_gl646.c | 64 ++++++++++++++++++++++++++++++++++------- 2 files changed, 58 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7a193e51c..807aa78b5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2008-06-03 Stéphane Voltz + * backend/genesys_gl646.c: fixed wrong offset for start + of scanarea for MD6471 scanner. + 2008-05-30 m. allan noah * backend/fujitsu.[ch], backend/fujitsu-scsi.h, doc/descriptions/fujitsu.desc: backend version 64, diff --git a/backend/genesys_gl646.c b/backend/genesys_gl646.c index 4b82458c1..d74962027 100644 --- a/backend/genesys_gl646.c +++ b/backend/genesys_gl646.c @@ -3,7 +3,7 @@ Copyright (C) 2003 Oliver Rauch Copyright (C) 2003, 2004 Henning Meier-Geinitz Copyright (C) 2004 Gerhard Jaeger - Copyright (C) 2004 - 2007 Stephane Voltz + Copyright (C) 2004 - 2008 Stéphane Voltz Copyright (C) 2005, 2006 Pierre Willenbrock Copyright (C) 2007 Luke @@ -3002,7 +3002,7 @@ gl646_init_regs_for_scan (Genesys_Device * dev) minus the steps done during shading calibration - then we move by the needed offset whitin physical scanning area - - todo: substract steps done during motor acceleration or + - TODO: substract steps done during motor acceleration or will it be included in y_offset ? assumption: steps are expressed at maximum motor resolution @@ -3031,14 +3031,48 @@ gl646_init_regs_for_scan (Genesys_Device * dev) DBG (DBG_info, "gl646_init_regs_for_scan: move=%d steps\n", move); move += (SANE_UNFIX (dev->model->y_offset) * move_dpi) / MM_PER_INCH; - if (move < 0) - { - DBG (DBG_error, - "gl646_init_regs_for_scan: overriding negative move value %d\n", - move); - move = 1; - } - DBG (DBG_info, "gl646_init_regs_for_scan: move=%d steps\n", move); + + /* the right fix involves computing distance for acceleration, do it + * this crudly for now, it might also come from the way slopes table + * are generated, we may consider switching to the newer and more + * accurate method */ + DBG (DBG_info, "gl646_init_regs_for_scan: move=%d steps/yres=%d (XXX STEF XXX)\n", move, dev->settings.yres); + if (dev->model->motor_type == MOTOR_5345) + { + switch(dev->settings.yres) + { + case 2400: + move += 50; + break; + case 1200: + move += 100; + break; + case 600: + move -= 150; + break; + case 500: + move -= 150; + break; + case 400: + move -= 100; + break; + case 300: + case 250: + case 200: + break; + case 150: + move += 100; + break; + case 100: + move += 120; + break; + case 50: + move += 100; + break; + default: + break; + } + } /* add tl_y to base movement */ /* move += (dev->settings.tl_y * dev->motor.optical_ydpi) / MM_PER_INCH; */ @@ -3060,6 +3094,16 @@ gl646_init_regs_for_scan (Genesys_Device * dev) move = ((move + dummy) / (dummy + 1)) * (dummy + 1); DBG (DBG_info, "gl646_init_regs_for_scan: move=%d steps\n", move); + /* security check */ + if (move < 0) + { + DBG (DBG_error, + "gl646_init_regs_for_scan: overriding negative move value %d\n", + move); + move = 1; + } + DBG (DBG_info, "gl646_init_regs_for_scan: move=%d steps\n", move); + /* set feed steps number of motor move */ dev->reg[reg_0x3d].value = LOBYTE (HIWORD (move)); dev->reg[reg_0x3e].value = HIBYTE (LOWORD (move));