define and use HAS_UTA flag for G4050

- remove unused ALT_SLOPE flag
- create HAS_UTA_FLAG
- ease some compilation warnings
merge-requests/1/head
Stphane Voltz 2011-11-03 07:40:50 +01:00
rodzic 99df6f2b0a
commit ec8bdc31a3
3 zmienionych plików z 18 dodań i 68 usunięć

Wyświetl plik

@ -437,62 +437,6 @@ sanei_genesys_create_slope_table3 (Genesys_Device * dev,
return sum_time;
}
/* Generate slope table for motor movement */
/* This function translates a call of the old slope creation function to a
call to the new one
*/
static SANE_Int
genesys_create_slope_table4 (Genesys_Device * dev,
uint16_t * slope_table, int steps,
int step_type, int exposure_time,
SANE_Bool same_speed, double yres,
int power_mode)
{
unsigned int sum_time = 0;
unsigned int vtarget;
unsigned int vend;
unsigned int vstart;
DBG (DBG_proc,
"sanei_genesys_create_slope_table: %d steps, step_type = %d, "
"exposure_time = %d, same_speed = %d, yres = %.2f, power_mode = %d\n",
steps, step_type, exposure_time, same_speed, yres, power_mode);
/* final speed */
vtarget = (exposure_time * yres) / dev->motor.base_ydpi;
vstart = dev->motor.slopes[power_mode][step_type].maximum_start_speed;
vend = dev->motor.slopes[power_mode][step_type].maximum_speed;
vtarget >>= step_type;
if (vtarget > 65535)
vtarget = 65535;
vstart >>= step_type;
if (vstart > 65535)
vstart = 65535;
vend >>= step_type;
if (vend > 65535)
vend = 65535;
sum_time = sanei_genesys_generate_slope_table (slope_table, 128,
steps,
vtarget,
vstart,
vend,
dev->motor.slopes[power_mode]
[step_type].minimum_steps <<
step_type,
dev->motor.slopes[power_mode]
[step_type].g, NULL, NULL);
DBG (DBG_proc,
"sanei_genesys_create_slope_table: returns sum_time=%d, completed\n",
sum_time);
return sum_time;
}
/* alternate slope table creation function */
/* the hardcoded values (g and vstart) will go in a motor struct */
@ -635,11 +579,6 @@ sanei_genesys_create_slope_table (Genesys_Device * dev,
dev = dev;
if (dev->model->flags & GENESYS_FLAG_ALT_SLOPE_CREATE)
return genesys_create_slope_table4 (dev, slope_table, steps,
step_type, exposure_time,
same_speed, yres, power_mode);
if (dev->model->motor_type == MOTOR_5345
|| dev->model->motor_type == MOTOR_HP2300
|| dev->model->motor_type == MOTOR_HP2400)
@ -5777,7 +5716,14 @@ init_options (Genesys_Scanner * s)
s->opt[OPT_SOURCE].size = max_string_size (source_list);
s->opt[OPT_SOURCE].constraint.string_list = source_list;
s->val[OPT_SOURCE].s = strdup (FLATBED);
DISABLE (OPT_SOURCE);
if (!(model->flags & GENESYS_FLAG_HAS_UTA))
{
DISABLE (OPT_SOURCE);
}
else
{
ENABLE (OPT_SOURCE);
}
/* preview */
s->opt[OPT_PREVIEW].name = SANE_NAME_PREVIEW;
@ -7001,6 +6947,7 @@ sane_close (SANE_Handle handle)
Genesys_Scanner *prev, *s;
Genesys_Calibration_Cache *cache, *next_cache;
SANE_Status status;
SANE_Range *range;
DBG (DBG_proc, "sane_close: start\n");
@ -7064,12 +7011,14 @@ sane_close (SANE_Handle handle)
FREE_IFNOT_NULL (s->dev->sensor.blue_gamma_table);
/* for an handful of bytes .. */
free (s->opt[OPT_RESOLUTION].constraint.word_list);
free ((void *)s->opt[OPT_RESOLUTION].constraint.word_list);
free (s->val[OPT_SOURCE].s);
free (s->val[OPT_MODE].s);
free (s->val[OPT_COLOR_FILTER].s);
FREE_IFNOT_NULL (s->opt[OPT_TL_X].constraint.range);
FREE_IFNOT_NULL (s->opt[OPT_TL_Y].constraint.range);
range=s->opt[OPT_TL_X].constraint.range;
FREE_IFNOT_NULL (range);
range=s->opt[OPT_TL_Y].constraint.range;
FREE_IFNOT_NULL (range);
if (prev)
prev->next = s->next;
@ -7335,8 +7284,8 @@ set_option_value (Genesys_Scanner * s, int option, void *val,
}
/* assign new values */
free(s->opt[OPT_TL_X].constraint.range);
free(s->opt[OPT_TL_Y].constraint.range);
free((SANE_Range *)s->opt[OPT_TL_X].constraint.range);
free((SANE_Range *)s->opt[OPT_TL_Y].constraint.range);
s->opt[OPT_TL_X].constraint.range = x_range;
s->val[OPT_TL_X].w = 0;
s->opt[OPT_TL_Y].constraint.range = y_range;

Wyświetl plik

@ -1255,6 +1255,7 @@ static Genesys_Model hpg4050_model = {
GENESYS_FLAG_STAGGERED_LINE |
GENESYS_FLAG_SKIP_WARMUP |
GENESYS_FLAG_DARK_CALIBRATION |
GENESYS_FLAG_HAS_UTA |
GENESYS_FLAG_CUSTOM_GAMMA,
GENESYS_HAS_SCAN_SW | GENESYS_HAS_FILE_SW | GENESYS_HAS_COPY_SW,
100,

Wyświetl plik

@ -115,7 +115,7 @@
#define GENESYS_FLAG_MUST_WAIT (1 << 10) /**> tells wether the scanner must wait for the head when parking */
#define GENESYS_FLAG_ALT_SLOPE_CREATE (1 << 11) /**> use alternative slope creation function */
#define GENESYS_FLAG_HAS_UTA (1 << 11) /**> scanner has a transparency adapter */
#define GENESYS_FLAG_DARK_WHITE_CALIBRATION (1 << 12) /**> yet another calibration method. does white and dark shading in one run, depending on a black and a white strip*/
#define GENESYS_FLAG_CUSTOM_GAMMA (1 << 13) /**> allow custom gamma tables */