genesys park and preview improvements

- use fatest motor speed to park for gl843, gl847 and gl124
- use sensor lowest dpi (and not motor's one) as default value so
	preview is done with it
merge-requests/1/head
Stphane Voltz 2011-08-23 07:20:52 +02:00
rodzic 3256972afe
commit d5189e200d
7 zmienionych plików z 75 dodań i 33 usunięć

Wyświetl plik

@ -1,3 +1,9 @@
2011-08-23 Stéphane Voltz <stef.dev@free.fr>
* backend/genesys_gl847.c backend/genesys_low.c backend/genesys_low.h
backend/genesys.c backend/genesys_gl124.c backend/genesys_gl843.c:
make sure to use the fatest speed when parking, use lowest sensor dpi
as default resolution
2011-08-22 Stéphane Voltz <stef.dev@free.fr>
* backend/genesys*.[ch]: enable calibration for G4050/G4010 and
minor code refactors

Wyświetl plik

@ -5846,19 +5846,19 @@ init_options (Genesys_Scanner * s)
/* resolution */
min_dpi=200000;
for (count = 0; model->ydpi_values[count] != 0; count++)
for (count = 0; model->xdpi_values[count] != 0; count++)
{
if(model->ydpi_values[count]<min_dpi)
if(model->xdpi_values[count]<min_dpi)
{
min_dpi=model->ydpi_values[count];
min_dpi=model->xdpi_values[count];
}
}
dpi_list = malloc ((count + 1) * sizeof (SANE_Word));
if (!dpi_list)
return SANE_STATUS_NO_MEM;
dpi_list[0] = count;
for (count = 0; model->ydpi_values[count] != 0; count++)
dpi_list[count + 1] = model->ydpi_values[count];
for (count = 0; model->xdpi_values[count] != 0; count++)
dpi_list[count + 1] = model->xdpi_values[count];
s->opt[OPT_RESOLUTION].name = SANE_NAME_SCAN_RESOLUTION;
s->opt[OPT_RESOLUTION].title = SANE_TITLE_SCAN_RESOLUTION;
s->opt[OPT_RESOLUTION].desc = SANE_DESC_SCAN_RESOLUTION;

Wyświetl plik

@ -1210,7 +1210,9 @@ gl124_init_optical_regs_scan (Genesys_Device * dev,
unsigned int pixels,
int channels,
int depth,
SANE_Bool half_ccd, int color_filter, int flags)
SANE_Bool half_ccd,
int color_filter,
int flags)
{
unsigned int words_per_line, segcnt;
unsigned int startx, endx, used_pixels, segnb;
@ -1439,7 +1441,8 @@ gl124_init_scan_regs (Genesys_Device * dev,
float lines,
unsigned int depth,
unsigned int channels,
int color_filter, unsigned int flags)
int color_filter,
unsigned int flags)
{
int used_res;
int start, used_pixels;
@ -2153,6 +2156,7 @@ gl124_slow_back_home (Genesys_Device * dev, SANE_Bool wait_until_home)
uint8_t val;
float resolution;
int loop = 0;
int scan_mode;
DBG (DBG_proc, "gl124_slow_back_home (wait_until_home = %d)\n",
wait_until_home);
@ -2191,8 +2195,11 @@ gl124_slow_back_home (Genesys_Device * dev, SANE_Bool wait_until_home)
memset (local_reg, 0, sizeof (local_reg));
memcpy (local_reg, dev->reg, GENESYS_GL124_MAX_REGS * sizeof (Genesys_Register_Set));
resolution=sanei_genesys_get_lowest_ydpi(dev);
resolution=sanei_genesys_get_lowest_dpi(dev);
/* TODO add scan_mode to the API */
scan_mode= dev->settings.scan_mode;
dev->settings.scan_mode=SCAN_MODE_LINEART;
gl124_init_scan_regs (dev,
local_reg,
resolution,
@ -2202,17 +2209,12 @@ gl124_slow_back_home (Genesys_Device * dev, SANE_Bool wait_until_home)
100,
100,
8,
3,
dev->settings.color_filter,
1,
0,
SCAN_FLAG_DISABLE_SHADING |
SCAN_FLAG_DISABLE_GAMMA |
SCAN_FLAG_FEEDING |
SCAN_FLAG_IGNORE_LINE_DISTANCE);
/* set exposure to zero */
sanei_genesys_set_triple(local_reg,REG_EXPR,0);
sanei_genesys_set_triple(local_reg,REG_EXPG,0);
sanei_genesys_set_triple(local_reg,REG_EXPB,0);
dev->settings.scan_mode=scan_mode;
/* clear scan and feed count */
RIE (sanei_genesys_write_register (dev, REG0D, REG0D_CLRLNCNT | REG0D_CLRMCNT));
@ -2546,6 +2548,7 @@ gl124_init_regs_for_shading (Genesys_Device * dev)
dev->calib_lines = dev->model->shading_lines;
dpihw=sanei_genesys_compute_dpihw(dev,dev->settings.xres);
factor=dev->sensor.optical_res/dpihw;
resolution=dpihw;
dev->calib_resolution = resolution;
dev->calib_pixels = dev->sensor.sensor_pixels/factor;
@ -2719,7 +2722,9 @@ gl124_init_regs_for_scan (Genesys_Device * dev)
dev->settings.pixels,
dev->settings.lines,
depth,
channels, dev->settings.color_filter, flags);
channels,
dev->settings.color_filter,
flags);
if (status != SANE_STATUS_GOOD)
return status;

Wyświetl plik

@ -2421,19 +2421,13 @@ gl843_slow_back_home (Genesys_Device * dev, SANE_Bool wait_until_home)
100,
100,
8,
3,
1,
dev->settings.color_filter,
SCAN_FLAG_DISABLE_SHADING |
SCAN_FLAG_DISABLE_GAMMA |
SCAN_FLAG_FEEDING |
SCAN_FLAG_DISABLE_BUFFER_FULL_MOVE |
SCAN_FLAG_IGNORE_LINE_DISTANCE);
/* set exposure to zero */
sanei_genesys_set_double(local_reg,REG_EXPR,0);
sanei_genesys_set_double(local_reg,REG_EXPG,0);
sanei_genesys_set_double(local_reg,REG_EXPB,0);
/* clear scan and feed count */
RIE (sanei_genesys_write_register (dev, REG0D, REG0D_CLRLNCNT | REG0D_CLRMCNT));

Wyświetl plik

@ -774,10 +774,6 @@ gl847_set_fe (Genesys_Device * dev, uint8_t set)
#define MOTOR_FLAG_AUTO_GO_HOME 1
#define MOTOR_FLAG_DISABLE_BUFFER_FULL_MOVE 2
#define MOTOR_ACTION_FEED 1
#define MOTOR_ACTION_GO_HOME 2
#define MOTOR_ACTION_HOME_FREE 3
/** @brief setup motor for off mode
*
*/
@ -2140,15 +2136,11 @@ gl847_slow_back_home (Genesys_Device * dev, SANE_Bool wait_until_home)
100,
3,
8,
3,
1,
dev->settings.color_filter,
SCAN_FLAG_DISABLE_SHADING |
SCAN_FLAG_DISABLE_GAMMA |
SCAN_FLAG_FEEDING |
SCAN_FLAG_IGNORE_LINE_DISTANCE);
sanei_genesys_set_double(local_reg,REG_EXPR,0);
sanei_genesys_set_double(local_reg,REG_EXPG,0);
sanei_genesys_set_double(local_reg,REG_EXPB,0);
/* clear scan and feed count */
RIE (sanei_genesys_write_register (dev, REG0D, REG0D_CLRLNCNT));

Wyświetl plik

@ -1342,6 +1342,36 @@ int sanei_genesys_get_lowest_ydpi(Genesys_Device *dev)
return min;
}
/** @brief returns the lowest possible dpi for the device
* Parses device entry to find lowest motor or sensor dpi.
* @param dev device description
* @return lowest motor resolution
*/
int sanei_genesys_get_lowest_dpi(Genesys_Device *dev)
{
int min=20000;
int i=0;
while(dev->model->ydpi_values[i]!=0)
{
if(dev->model->ydpi_values[i]<min)
{
min=dev->model->ydpi_values[i];
}
i++;
}
i=0;
while(dev->model->xdpi_values[i]!=0)
{
if(dev->model->xdpi_values[i]<min)
{
min=dev->model->xdpi_values[i];
}
i++;
}
return min;
}
/** @brief check is a cache entry may be used
* Compares current settings with the cache entry and return
* SANE_TRUE if they are compatible.

Wyświetl plik

@ -911,9 +911,24 @@ int sanei_genesys_compute_step_type(Motor_Profile *motors, int motor_type, int e
extern
int sanei_genesys_slope_table(uint16_t *slope, int *steps, int dpi, int exposure, int base_dpi, int step_type, int factor, int motor_type, Motor_Profile *motors);
/** @brief find lowest motor resolution for the device.
* Parses the resolution list for motor and
* returns the lowest value.
* @param device for which to find the lowest motor resolution
* @return the lowest available motor resolution for the device
*/
extern
int sanei_genesys_get_lowest_ydpi(Genesys_Device *dev);
/** @brief find lowest resolution for the device.
* Parses the resolution list for motor and sensor and
* returns the lowest value.
* @param device for which to find the lowest resolution
* @return the lowest available resolution for the device
*/
extern
int sanei_genesys_get_lowest_dpi(Genesys_Device *dev);
/**
* reads previously cached calibration data
* from file