slow back home rework

- use available resolution for motor
- don't park on sane_close
merge-requests/1/head
Stphane Voltz 2010-10-19 07:10:21 +02:00
rodzic 9b229f06b9
commit 95e9a75df4
4 zmienionych plików z 43 dodań i 28 usunięć

Wyświetl plik

@ -7278,7 +7278,7 @@ sane_close (SANE_Handle handle)
else
{
/* for flatbed scanners, get sure the head is parked before leaving */
s->dev->model->cmd_set->slow_back_home (s->dev, SANE_TRUE);
/* XXX STEF XXX s->dev->model->cmd_set->slow_back_home (s->dev, SANE_TRUE); */
}
/* here is the place to store calibration cache */

Wyświetl plik

@ -1055,8 +1055,8 @@ static Genesys_Model hpg4010_model = {
GENESYS_GL843,
NULL,
{ /*2400, 1200, */600, 400, 300, 200, 150, 100, 0}, /* TODO when settled down, add 800 and 1600 */
{ /*2400, 1200, */600, 400, 300, 200, 150, 100, 0}, /* TODO 4800 available */
{ 2400, 1200, 600, 400, 300, 200, 150, 100, 0}, /* TODO when settled down, add 800 and 1600 */
{ 2400, 1200, 600, 400, 300, 200, 150, 100, 0}, /* TODO 4800 available */
{16, 8, 0}, /* possible depths in gray mode */
{16, 8, 0}, /* possible depths in color mode */
@ -1107,8 +1107,8 @@ static Genesys_Model hpg4050_model = {
GENESYS_GL843,
NULL,
{ /*2400, 1200, */600, 400, 300, 200, 150, 100, 0}, /* TODO when settled down, add 800 and 1600 */
{ /*2400, 1200, */600, 400, 300, 200, 150, 100, 0}, /* TODO 4800 available */
{ 2400, 1200, 600, 400, 300, 200, 150, 100, 0}, /* TODO when settled down, add 800 and 1600 */
{ 2400, 1200, 600, 400, 300, 200, 150, 100, 0}, /* TODO 4800 available */
{16, 8, 0}, /* possible depths in gray mode */
{16, 8, 0}, /* possible depths in color mode */

Wyświetl plik

@ -630,9 +630,17 @@ gl843_setup_sensor (Genesys_Device * dev, Genesys_Register_Set * regs, int dpi)
}
else /* 800 to 2400 case */
{
sanei_genesys_write_register (dev, 0x74, 0x00);
sanei_genesys_write_register (dev, 0x75, 0x3f);
sanei_genesys_write_register (dev, 0x5a, 0x40);
sanei_genesys_write_register (dev, 0x74, 0x0f);
sanei_genesys_write_register (dev, 0x75, 0xff);
sanei_genesys_write_register (dev, 0x76, 0xff);
sanei_genesys_write_register (dev, 0x77, 0x00);
sanei_genesys_write_register (dev, 0x78, 0x01);
sanei_genesys_write_register (dev, 0x7a, 0x00);
sanei_genesys_write_register (dev, 0x7b, 0x01);
sanei_genesys_write_register (dev, 0x7d, 0x90);
sanei_genesys_write_register (dev, 0x80, 0x05);
sanei_genesys_write_register (dev, 0x9e, 0xc0);
}
}
@ -1161,7 +1169,7 @@ gl843_get_dpihw (Genesys_Device * dev)
return 0;
}
/**@brief compute hardware sensor dpi exposure to use
/**@brief compute hardware sensor dpi to use
* compute the sensor hardware dpi based on target resolution
*/
static int gl843_compute_dpihw(Genesys_Device *dev, int xres)
@ -1196,11 +1204,11 @@ static int gl843_compute_exposure(Genesys_Device *dev, int xres)
switch(dev->model->ccd_type)
{
case CCD_G4050:
if(xres<1200)
if(xres<=600)
{
return 8016;
}
return 21376;
return 56064 /* 21376 */;
case CCD_KVSS080:
default:
return 8000;
@ -1497,7 +1505,9 @@ gl843_get_led_exposure (Genesys_Device * dev)
static
#endif
SANE_Status
gl843_init_scan_regs (Genesys_Device * dev, Genesys_Register_Set * reg, float xres, /*dpi */
gl843_init_scan_regs (Genesys_Device * dev,
Genesys_Register_Set * reg,
float xres, /*dpi */
float yres, /*dpi */
float startx, /*optical_res, from dummy_pixel+1 */
float starty, /*base_ydpi, from home! */
@ -2365,7 +2375,6 @@ gl843_begin_scan (Genesys_Device * dev, Genesys_Register_Set * reg,
RIE(sanei_genesys_write_register(dev,0x7e,0x01));
}
/* clear scan and feed count */
RIE (sanei_genesys_write_register (dev, REG0D, REG0D_CLRLNCNT | REG0D_CLRMCNT));
@ -2426,7 +2435,8 @@ gl843_end_scan (Genesys_Device * dev, Genesys_Register_Set * reg,
}
/* Moves the slider to the home (top) position slowly */
/** @brief Moves the slider to the home (top) position slowly
* */
#ifndef UNIT_TESTING
static
#endif
@ -2437,6 +2447,8 @@ gl843_slow_back_home (Genesys_Device * dev, SANE_Bool wait_until_home)
SANE_Status status;
Genesys_Register_Set *r;
uint8_t val;
float resolution;
int loop = 0;
DBG (DBG_proc, "gl843_slow_back_home (wait_until_home = %d)\n",
wait_until_home);
@ -2464,32 +2476,35 @@ gl843_slow_back_home (Genesys_Device * dev, SANE_Bool wait_until_home)
memcpy (local_reg, dev->reg,
GENESYS_GL843_MAX_REGS * sizeof (Genesys_Register_Set));
resolution=gl843_get_lowest_ydpi(dev);
gl843_init_scan_regs (dev,
local_reg,
300,
300,
dev->sensor.sensor_pixels/4,
0,
dev->sensor.sensor_pixels/2,
1,
resolution,
resolution,
100,
100,
100,
100,
8,
3,
dev->settings.color_filter,
SCAN_FLAG_DISABLE_SHADING |
SCAN_FLAG_DISABLE_GAMMA |
SCAN_FLAG_SINGLE_LINE |
SCAN_FLAG_IGNORE_LINE_DISTANCE);
gl843_init_motor_regs_scan (dev,
local_reg,
gl843_compute_exposure (dev, 300),
300,
gl843_compute_exposure (dev, resolution),
resolution,
gl843_compute_step_type(dev, resolution),
1,
1,
1,
30000,
30000, /* feed steps */
0,
0);
/* clear scan and feed count */
RIE (sanei_genesys_write_register (dev, REG0D, REG0D_CLRLNCNT | REG0D_CLRMCNT));
/* set up for reverse and no scan */
r = sanei_genesys_get_address (local_reg, REG02);
@ -2497,7 +2512,7 @@ gl843_slow_back_home (Genesys_Device * dev, SANE_Bool wait_until_home)
r = sanei_genesys_get_address (local_reg, REG01);
r->value &= ~REG01_SCAN;
RIE ( gl843_bulk_write_register (dev, local_reg, GENESYS_GL843_MAX_REGS));
RIE (gl843_bulk_write_register (dev, local_reg, GENESYS_GL843_MAX_REGS));
status = gl843_start_action (dev);
if (status != SANE_STATUS_GOOD)
@ -2513,7 +2528,6 @@ gl843_slow_back_home (Genesys_Device * dev, SANE_Bool wait_until_home)
if (wait_until_home)
{
int loop = 0;
while (loop < 300) /* do not wait longer then 30 seconds */
{
@ -2737,7 +2751,7 @@ gl843_init_regs_for_shading (Genesys_Device * dev)
dev->calib_channels = 3;
dev->calib_pixels = dev->sensor.sensor_pixels;
resolution=dev->sensor.optical_res;
resolution=gl843_compute_dpihw(dev,dev->settings.xres);
/* distance to move to reach white target */
move = SANE_UNFIX (dev->model->y_offset_calib);
@ -3575,7 +3589,7 @@ gl843_is_compatible_calibration (Genesys_Device * dev,
sane_strstatus (status));
return status;
}
resolution=dev->sensor.optical_res;
resolution=gl843_compute_dpihw(dev,dev->settings.xres);
dev->current_setup.scan_method = dev->settings.scan_method;
DBG (DBG_proc, "gl843_is_compatible_calibration: checking\n");

Wyświetl plik

@ -532,6 +532,7 @@ static Motor_Profile motors[]={
{MOTOR_KVSS080, 8000, kvss080},
{MOTOR_G4050, 8016, g4050},
{MOTOR_G4050, 21376, g4050},
{MOTOR_G4050, 56064, g4050},
};
/* *INDENT-ON* */