genesys: Move moving to home out of *_init_regs_for_scan()

merge-requests/84/head
Povilas Kanapickas 2019-06-30 14:05:28 +03:00
rodzic 442ffd0486
commit a92187edad
8 zmienionych plików z 26 dodań i 16 usunięć

Wyświetl plik

@ -3887,6 +3887,13 @@ genesys_start_scan (Genesys_Device * dev, SANE_Bool lamp_off)
dev->model->cmd_set->wait_for_motor_stop(dev);
}
if (dev->model->cmd_set->needs_home_before_init_regs_for_scan &&
dev->model->cmd_set->needs_home_before_init_regs_for_scan(dev) &&
dev->model->cmd_set->slow_back_home)
{
RIE(dev->model->cmd_set->slow_back_home(dev, SANE_TRUE));
}
status = dev->model->cmd_set->init_regs_for_scan(dev, sensor);
if (status != SANE_STATUS_GOOD)
{

Wyświetl plik

@ -2455,9 +2455,6 @@ gl124_init_regs_for_scan (Genesys_Device * dev, const Genesys_Sensor& sensor)
DBG(DBG_info, "%s ", __func__);
debug_dump(DBG_info, dev->settings);
/* ensure head is parked in case of calibration */
RIE (gl124_slow_back_home (dev, SANE_TRUE));
/* channels */
if (dev->settings.scan_mode == ScanColorMode::COLOR_SINGLE_PASS)
channels = 3;
@ -3533,6 +3530,8 @@ gl124_update_hardware_sensors (Genesys_Scanner * s)
static Genesys_Command_Set gl124_cmd_set = {
"gl124-generic", /* the name of this set */
[](Genesys_Device* dev) -> bool { (void) dev; return true; },
gl124_init,
gl124_init_regs_for_warmup,
gl124_init_regs_for_coarse_calibration,

Wyświetl plik

@ -2813,6 +2813,11 @@ gl646_init_regs_for_shading(Genesys_Device * dev, const Genesys_Sensor& sensor,
return status;
}
static bool gl646_needs_home_before_init_regs_for_scan(Genesys_Device* dev)
{
return (dev->scanhead_position_in_steps > 0 &&
dev->settings.scan_method == ScanMethod::FLATBED);
}
/**
* set up registers for the actual scan. The scan's parameters are given
@ -2825,14 +2830,6 @@ gl646_init_regs_for_scan (Genesys_Device * dev, const Genesys_Sensor& sensor)
DBGSTART;
/* park head after calibration if needed */
if (dev->scanhead_position_in_steps > 0
&& dev->settings.scan_method == ScanMethod::FLATBED)
{
RIE(gl646_slow_back_home (dev, SANE_TRUE));
dev->scanhead_position_in_steps = 0;
}
RIE(setup_for_scan(dev, sensor, &dev->reg, dev->settings, SANE_FALSE, SANE_TRUE, SANE_TRUE));
/* gamma is only enabled at final scan time */
@ -4907,6 +4904,8 @@ gl646_search_strip(Genesys_Device * dev, const Genesys_Sensor& sensor, SANE_Bool
static Genesys_Command_Set gl646_cmd_set = {
"gl646-generic", /* the name of this set */
gl646_needs_home_before_init_regs_for_scan,
gl646_init,
gl646_init_regs_for_warmup,
gl646_init_regs_for_coarse_calibration,

Wyświetl plik

@ -3807,8 +3807,6 @@ gl841_init_regs_for_scan (Genesys_Device * dev, const Genesys_Sensor& sensor)
DBG(DBG_info, "%s ", __func__);
debug_dump(DBG_info, dev->settings);
gl841_slow_back_home(dev,SANE_TRUE);
/* channels */
if (dev->settings.scan_mode == ScanColorMode::COLOR_SINGLE_PASS)
channels = 3;
@ -5565,6 +5563,8 @@ gl841_send_shading_data (Genesys_Device * dev, const Genesys_Sensor& sensor,
static Genesys_Command_Set gl841_cmd_set = {
"gl841-generic", /* the name of this set */
[](Genesys_Device* dev) -> bool { (void) dev; return true; },
gl841_init,
gl841_init_regs_for_warmup,
gl841_init_regs_for_coarse_calibration,

Wyświetl plik

@ -2939,9 +2939,6 @@ gl843_init_regs_for_scan (Genesys_Device * dev, const Genesys_Sensor& sensor)
DBG(DBG_info, "%s ", __func__);
debug_dump(DBG_info, dev->settings);
/* ensure head is parked in case of calibration */
gl843_slow_back_home (dev, SANE_TRUE);
/* channels */
if (dev->settings.scan_mode == ScanColorMode::COLOR_SINGLE_PASS)
channels = 3;
@ -4359,6 +4356,8 @@ gl843_send_shading_data (Genesys_Device * dev, const Genesys_Sensor& sensor,
static Genesys_Command_Set gl843_cmd_set = {
"gl843-generic", /* the name of this set */
[](Genesys_Device* dev) -> bool { (void) dev; return true; },
gl843_init,
gl843_init_regs_for_warmup,
gl843_init_regs_for_coarse_calibration,

Wyświetl plik

@ -3332,6 +3332,8 @@ gl846_coarse_gain_calibration(Genesys_Device * dev, const Genesys_Sensor& sensor
static Genesys_Command_Set gl846_cmd_set = {
"gl846-generic", /* the name of this set */
nullptr,
gl846_init,
NULL,
gl846_init_regs_for_coarse_calibration,

Wyświetl plik

@ -3456,6 +3456,8 @@ gl847_coarse_gain_calibration(Genesys_Device * dev, const Genesys_Sensor& sensor
static Genesys_Command_Set gl847_cmd_set = {
"gl847-generic", /* the name of this set */
nullptr,
gl847_init,
NULL, /*gl847_init_regs_for_warmup*/
gl847_init_regs_for_coarse_calibration,

Wyświetl plik

@ -975,6 +975,8 @@ typedef struct Genesys_Command_Set
/*@} */
bool (*needs_home_before_init_regs_for_scan) (Genesys_Device* dev);
/** For ASIC initialization */
SANE_Status (*init) (Genesys_Device * dev);