Merge branch 'genesys-repark-before-setting-shading-regs' into 'master'

genesys: Repark before regs are setup in white_shading_calibration()

See merge request sane-project/backends!98
merge-requests/100/head
Povilas Kanapickas 2019-08-08 18:51:09 +00:00
commit 820ff5293a
1 zmienionych plików z 24 dodań i 15 usunięć

Wyświetl plik

@ -1958,6 +1958,23 @@ genesys_dummy_dark_shading (Genesys_Device * dev, const Genesys_Sensor& sensor)
}
static void genesys_repark_sensor_before_shading(Genesys_Device* dev)
{
if (dev->model->flags & GENESYS_FLAG_SHADING_REPARK) {
// rewind keeps registers and slopes table intact from previous scan but is not
// available on all supported chipsets (or may cause scan artifacts, see #7)
if (dev->model->cmd_set->rewind) {
TIE(dev->model->cmd_set->rewind(dev));
} else {
TIE(dev->model->cmd_set->slow_back_home(dev, SANE_TRUE));
}
if (dev->settings.scan_method == ScanMethod::TRANSPARENCY) {
dev->model->cmd_set->move_to_ta(dev);
}
}
}
static SANE_Status
genesys_white_shading_calibration (Genesys_Device * dev, const Genesys_Sensor& sensor)
{
@ -1999,21 +2016,6 @@ genesys_white_shading_calibration (Genesys_Device * dev, const Genesys_Sensor& s
sanei_genesys_set_lamp_power(dev, sensor, dev->calib_reg, true);
sanei_genesys_set_motor_power(dev->calib_reg, motor);
/* if needed, go back before doing next scan */
if (dev->model->flags & GENESYS_FLAG_SHADING_REPARK)
{
/* rewind keeps registers and slopes table intact from previous
scan but is not available on all supported chipsets (or may
cause scan artifacts, see #7) */
status = (dev->model->cmd_set->rewind
? dev->model->cmd_set->rewind (dev)
: dev->model->cmd_set->slow_back_home (dev, SANE_TRUE));
if (dev->settings.scan_method == ScanMethod::TRANSPARENCY)
{
dev->model->cmd_set->move_to_ta(dev);
}
}
status =
dev->model->cmd_set->bulk_write_register(dev, dev->calib_reg);
if (status != SANE_STATUS_GOOD)
@ -3299,6 +3301,9 @@ genesys_flatbed_calibration(Genesys_Device * dev, Genesys_Sensor& sensor)
}
else
{
DBG(DBG_proc, "%s : genesys_dark_shading_calibration dev->calib_reg ", __func__);
debug_dump(DBG_proc, dev->calib_reg);
if (dev->model->flags & GENESYS_FLAG_DARK_CALIBRATION)
{
sanei_usb_testing_record_message("genesys_dark_shading_calibration");
@ -3311,6 +3316,8 @@ genesys_flatbed_calibration(Genesys_Device * dev, Genesys_Sensor& sensor)
}
}
genesys_repark_sensor_before_shading(dev);
sanei_usb_testing_record_message("init_regs_for_shading2");
RIE(dev->model->cmd_set->init_regs_for_shading(dev, sensor, dev->calib_reg));
@ -3504,6 +3511,8 @@ static SANE_Status genesys_sheetfed_calibration(Genesys_Device * dev, Genesys_Se
throw;
}
genesys_repark_sensor_before_shading(dev);
status = dev->model->cmd_set->init_regs_for_shading(dev, sensor, dev->calib_reg);
if (status != SANE_STATUS_GOOD)
{