From 8e22b9418a2fec4a44c71132b4319117514f6b94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Voltz?= Date: Thu, 17 May 2012 16:41:25 +0200 Subject: [PATCH] LiDE 700F WIP - shading calibration data not aligned yet - slow_back home is going back too far during shading calibration - y_offset_calib not working yet - intermittent failure at start --- backend/genesys.c | 1 + backend/genesys_devices.c | 21 ++++++------ backend/genesys_gl847.c | 72 +++++++++++++++++++++++++++------------ backend/genesys_gl847.h | 12 +++---- 4 files changed, 68 insertions(+), 38 deletions(-) diff --git a/backend/genesys.c b/backend/genesys.c index 7d98bd03c..b45d46671 100644 --- a/backend/genesys.c +++ b/backend/genesys.c @@ -5300,6 +5300,7 @@ calc_parameters (Genesys_Scanner * s) /* we need an even number of pixels for even/odd handling */ if (s->dev->model->flags & GENESYS_FLAG_SIS_SENSOR + || s->dev->model->asic_type == GENESYS_GL847 || s->dev->model->asic_type == GENESYS_GL124 || s->dev->model->asic_type == GENESYS_GL843) { diff --git a/backend/genesys_devices.c b/backend/genesys_devices.c index fdad686fe..9a7aa8b00 100644 --- a/backend/genesys_devices.c +++ b/backend/genesys_devices.c @@ -472,10 +472,10 @@ static Genesys_Sensor Sensor[] = { /* CANONLIDE700 */ {CIS_CANONLIDE700, 4800, /* optical resolution */ - 107*4, /* black pixels */ - 16*4, /* dummy pixels */ - 400*8, /* CCD_startx_offset 323 */ - 5187*8, + 73*8, /* black pixels */ + 16*8, /* dummy pixels */ + 384*8, /* CCD_startx_offset 384 at 600 */ + 5186*8, /* 8x5570 segments */ 210, 200, {0x00, 0x00, 0x00, 0x00}, @@ -491,7 +491,7 @@ static Genesys_Sensor Sensor[] = { 0x41 } , - 1.7, 1.7, 1.7, + 1.0, 1.0, 1.0, NULL, NULL, NULL} , /* CANONLIDE100 */ @@ -1620,12 +1620,12 @@ static Genesys_Model canon_lide_700f_model = { {16, 8, 0}, /* possible depths in gray mode */ {16, 8, 0}, /* possible depths in color mode */ - SANE_FIX (1.1), /* Start of scan area in mm (x) */ - SANE_FIX (8.3), /* Start of scan area in mm (y) */ + SANE_FIX (3.1), /* Start of scan area in mm (x) */ + SANE_FIX (8.1), /* Start of scan area in mm (y) */ SANE_FIX (216.07), /* Size of scan area in mm (x) */ SANE_FIX (297.0), /* Size of scan area in mm (y) */ - SANE_FIX (3.0), /* Start of white strip in mm (y) */ + SANE_FIX (0.0), /* Start of white strip in mm (y) */ SANE_FIX (0.0), /* Start of black mark in mm (x) */ SANE_FIX (0.0), /* Start of scan area in TA mode in mm (x) */ @@ -1651,8 +1651,7 @@ static Genesys_Model canon_lide_700f_model = { GPO_CANONLIDE700, MOTOR_CANONLIDE700, GENESYS_FLAG_SKIP_WARMUP - | GENESYS_FLAG_NO_CALIBRATION - | GENESYS_FLAG_MUST_WAIT + /*| GENESYS_FLAG_MUST_WAIT*/ | GENESYS_FLAG_SIS_SENSOR | GENESYS_FLAG_OFFSET_CALIBRATION | GENESYS_FLAG_DARK_CALIBRATION @@ -1682,7 +1681,7 @@ static Genesys_Model canon_lide_200_model = { SANE_FIX (216.07), /* Size of scan area in mm (x) */ SANE_FIX (299.0), /* Size of scan area in mm (y) */ - SANE_FIX (1.0), /* Start of white strip in mm (y) */ + SANE_FIX (0.0), /* Start of white strip in mm (y) */ SANE_FIX (0.0), /* Start of black mark in mm (x) */ SANE_FIX (0.0), /* Start of scan area in TA mode in mm (x) */ diff --git a/backend/genesys_gl847.c b/backend/genesys_gl847.c index 694ad68c9..63ecfb289 100644 --- a/backend/genesys_gl847.c +++ b/backend/genesys_gl847.c @@ -621,7 +621,7 @@ gl847_init_registers (Genesys_Device * dev) * @param table_nr index of the slope table in ASIC memory * Must be in the [0-4] range. * @param slope_table pointer to 16 bit values array of the slope table - * @param steps number of elemnts in the slope table + * @param steps number of elements in the slope table */ static SANE_Status gl847_send_slope_table (Genesys_Device * dev, int table_nr, @@ -1162,7 +1162,14 @@ gl847_init_optical_regs_scan (Genesys_Device * dev, /* sensors are built from 600 dpi segments for LiDE 100/200 * and 1200 dpi for the 700F */ - segnb=dpihw/600; + if (dev->model->flags & GENESYS_FLAG_SIS_SENSOR) + { + segnb=dpihw/600; + } + else + { + segnb=1; + } /* compute pixel coordinate in the given dpihw space, * taking segments into account */ @@ -1172,21 +1179,20 @@ gl847_init_optical_regs_scan (Genesys_Device * dev, dev->dist=0; dev->skip=0; - /* in case of 4800 dpi, we must match full sensor width */ - if(dpihw==4800) - { - dev->skip=startx-dev->sensor.CCD_start_xoffset/segnb; - if(depth==16) - dev->skip*=2; - startx = dev->sensor.CCD_start_xoffset/segnb; - used_pixels = sensor->segcnt; - endx = startx + used_pixels; - } - /* in cas of multi-segments sensor, we have to add the witdh * of the sensor crossed by the scan area */ if (dev->model->flags & GENESYS_FLAG_SIS_SENSOR && segnb>1) { + /* in case of 4800 dpi, we must match full sensor width */ + if(dpihw==4800) + { + dev->skip=startx-dev->sensor.CCD_start_xoffset/segnb; + if(depth==16) + dev->skip*=2; + startx = dev->sensor.CCD_start_xoffset/segnb; + used_pixels = sensor->segcnt; + endx = startx + used_pixels; + } dev->dist = sensor->segcnt; } endx += dev->dist*(segnb-1); @@ -2036,6 +2042,11 @@ gl847_slow_back_home (Genesys_Device * dev, SANE_Bool wait_until_home) int scan_mode; + /* post scan gpio : without that HOMSNR is unreliable */ + RIE (sanei_genesys_read_register (dev, REG6C, &val)); + val &= ~REG6C_GPIO10; + RIE (sanei_genesys_write_register (dev, REG6C, val)); + DBG (DBG_proc, "gl847_slow_back_home (wait_until_home = %d)\n", wait_until_home); @@ -2124,7 +2135,7 @@ gl847_slow_back_home (Genesys_Device * dev, SANE_Bool wait_until_home) return status; } - /* post scan gpio */ + /* post scan gpio : without that HOMSNR is unreliable */ RIE (sanei_genesys_read_register (dev, REG6C, &val)); val &= ~REG6C_GPIO10; RIE (sanei_genesys_write_register (dev, REG6C, val)); @@ -2145,8 +2156,9 @@ gl847_slow_back_home (Genesys_Device * dev, SANE_Bool wait_until_home) if (val & HOMESNR) /* home sensor */ { DBG (DBG_info, "gl847_slow_back_home: reached home position\n"); - DBGCOMPLETED; + gl847_stop_action (dev); dev->scanhead_position_in_steps = 0; + DBGCOMPLETED; return SANE_STATUS_GOOD; } usleep (100000); /* sleep 100 ms */ @@ -2353,14 +2365,30 @@ gl847_feed (Genesys_Device * dev, unsigned int steps) Genesys_Register_Set *r; float resolution; uint8_t val; + unsigned int i; DBGSTART; + DBG (DBG_io, "%s: steps=%d\n", __FUNCTION__, steps); /* prepare local registers */ memset (local_reg, 0, sizeof (local_reg)); memcpy (local_reg, dev->reg, GENESYS_GL847_MAX_REGS * sizeof (Genesys_Register_Set)); resolution=200; + resolution=150; + + /* search lowest move dpi XXX STEF XXX*/ + i=0; + resolution=600; + while(imodel->ccd_type && sensors[i].dpicalib_lines = dev->model->shading_lines; if(dev->calib_resolution==4800) dev->calib_lines *= 2; - DBG (DBG_io, "%s: lines = %d\n", __FUNCTION__, dev->calib_lines); dev->calib_pixels = (dev->sensor.sensor_pixels*dev->calib_resolution)/dev->sensor.optical_res; + DBG (DBG_io, "%s: calib_lines = %d\n", __FUNCTION__, dev->calib_lines); + DBG (DBG_io, "%s: calib_pixels = %d\n", __FUNCTION__, dev->calib_pixels); status = gl847_init_scan_regs (dev, dev->calib_reg, @@ -2709,11 +2741,11 @@ gl847_send_shading_data (Genesys_Device * dev, uint8_t * data, int size) strpixel=tempo; sanei_genesys_get_double(dev->reg,REG_ENDPIXEL,&tempo); endpixel=tempo; - DBG( DBG_io2, "%s: STRPIXEL=%d, ENDPIXEL=%d, PIXELS=%d\n",__FUNCTION__,strpixel,endpixel,endpixel-strpixel); /* compute deletion factor */ sanei_genesys_get_double(dev->reg,REG_DPISET,&tempo); dpiset=tempo; + DBG( DBG_io2, "%s: STRPIXEL=%d, ENDPIXEL=%d, PIXELS=%d, DPISET=%d\n",__FUNCTION__,strpixel,endpixel,endpixel-strpixel,dpiset); dpihw=sanei_genesys_compute_dpihw(dev,dpiset); factor=dpihw/dpiset; DBG( DBG_io2, "%s: factor=%d\n",__FUNCTION__,factor); @@ -2857,9 +2889,7 @@ gl847_led_calibration (Genesys_Device * dev) SCAN_FLAG_IGNORE_LINE_DISTANCE); if (status != SANE_STATUS_GOOD) { - DBG (DBG_error, - "gl847_led_calibration: failed to setup scan: %s\n", - sane_strstatus (status)); + DBG (DBG_error, "%s: failed to setup scan: %s\n", __FUNCTION__, sane_strstatus (status)); return status; } @@ -3208,7 +3238,7 @@ gl847_init (Genesys_Device * dev) RIE (gl847_set_fe (dev, AFE_INIT)); /* move head away from park position */ - /* XXX gl847_feed (dev, 300) STEF XXX;*/ + /* XXX STEF XXX gl847_feed (dev, 300); */ /* now hardware part is OK, set up device struct */ FREE_IFNOT_NULL (dev->white_average_data); diff --git a/backend/genesys_gl847.h b/backend/genesys_gl847.h index a83e0c72f..fff97d759 100644 --- a/backend/genesys_gl847.h +++ b/backend/genesys_gl847.h @@ -630,11 +630,11 @@ static Sensor_Profile sensors[]={ {CIS_CANONLIDE200, 4800, 10416, 60, 159, 85, 5136, 255, 2692, 1728, 1221, order_0246, 0x04}, /* LiDE 700F */ - {CIS_CANONLIDE700, 150, 2848, 135, 249, 85, 5188, 255, 465, 310, 239, NULL , 0x0c}, - {CIS_CANONLIDE700, 300, 1424, 135, 249, 85, 5188, 255, 465, 310, 239, NULL , 0x0c}, - {CIS_CANONLIDE700, 600, 1504, 135, 249, 85, 5188, 255, 465, 310, 239, order_01 , 0x0c}, - {CIS_CANONLIDE700, 1200, 2696, 135, 249, 85, 5188, 255, 1464, 844, 555, order_0213, 0x0a}, - {CIS_CANONLIDE700, 2400, 10576, 135, 249, 85, 5188, 255, 2798, 1558, 972, order_0246, 0x08}, + {CIS_CANONLIDE700, 150, 2848, 135, 249, 85, 5186, 255, 465, 310, 239, 0x0c}, + {CIS_CANONLIDE700, 300, 1424, 135, 249, 85, 5186, 255, 465, 310, 239, 0x0c}, + {CIS_CANONLIDE700, 600, 1504, 135, 249, 85, 5186, 255, 465, 310, 239, 0x0c}, + {CIS_CANONLIDE700, 1200, 2836, 135, 249, 85, 5186, 255, 1464, 844, 555, 0x0a}, /* 2696 */ + {CIS_CANONLIDE700, 2400, 10576, 135, 249, 85, 5186, 255, 2798, 1558, 972, 0x08}, }; /* *INDENT-ON* */ @@ -675,7 +675,7 @@ static Motor_Profile gl847_motors[]={ {MOTOR_CANONLIDE700, 2848, FULL_STEP , lide200_base}, {MOTOR_CANONLIDE700, 1424, FULL_STEP , lide200_base}, {MOTOR_CANONLIDE700, 752, FULL_STEP , lide200_base}, - {MOTOR_CANONLIDE700, 2696, HALF_STEP , lide700_medium}, + {MOTOR_CANONLIDE700, 2836, HALF_STEP , lide700_medium}, /* 2696 */ {MOTOR_CANONLIDE700, 10576, EIGHTH_STEP, lide700_high}, /* end of database entry */