genesys: Deduplicate move_to_ta()

merge-requests/244/head
Povilas Kanapickas 2020-05-26 01:32:44 +03:00
rodzic c4135d63a7
commit 8ec6bc2e5d
16 zmienionych plików z 22 dodań i 93 usunięć

Wyświetl plik

@ -130,9 +130,6 @@ public:
/// eject document from scanner
virtual void eject_document(Genesys_Device* dev) const = 0;
/// move scanning head to transparency adapter
virtual void move_to_ta(Genesys_Device* dev) const = 0;
/// write shading data calibration to ASIC
virtual void send_shading_data(Genesys_Device* dev, const Genesys_Sensor& sensor,
std::uint8_t* data, int size) const = 0;

Wyświetl plik

@ -899,6 +899,15 @@ void scanner_move(Genesys_Device& dev, ScanMethod scan_method, unsigned steps, D
dev.interface->sleep_ms(100);
}
void scanner_move_to_ta(Genesys_Device& dev)
{
DBG_HELPER(dbg);
unsigned feed = static_cast<unsigned>((dev.model->y_offset_sensor_to_ta * dev.motor.base_ydpi) /
MM_PER_INCH);
scanner_move(dev, dev.model->default_method, feed, Direction::FORWARD);
}
void scanner_move_back_home(Genesys_Device& dev, bool wait_until_home)
{
DBG_HELPER_ARGS(dbg, "wait_until_home = %d", wait_until_home);
@ -2511,7 +2520,7 @@ static void genesys_repark_sensor_before_shading(Genesys_Device* dev)
if (dev->settings.scan_method == ScanMethod::TRANSPARENCY ||
dev->settings.scan_method == ScanMethod::TRANSPARENCY_INFRARED)
{
dev->cmd_set->move_to_ta(dev);
scanner_move_to_ta(*dev);
}
}
}
@ -3727,7 +3736,7 @@ static void genesys_flatbed_calibration(Genesys_Device* dev, Genesys_Sensor& sen
if (dev->settings.scan_method == ScanMethod::TRANSPARENCY ||
dev->settings.scan_method == ScanMethod::TRANSPARENCY_INFRARED)
{
dev->cmd_set->move_to_ta(dev);
scanner_move_to_ta(*dev);
}
// shading calibration
@ -4051,7 +4060,7 @@ static void genesys_start_scan(Genesys_Device* dev, bool lamp_off)
if (dev->settings.scan_method == ScanMethod::TRANSPARENCY ||
dev->settings.scan_method == ScanMethod::TRANSPARENCY_INFRARED)
{
dev->cmd_set->move_to_ta(dev);
scanner_move_to_ta(*dev);
}
genesys_warmup_lamp(dev);
@ -4068,7 +4077,7 @@ static void genesys_start_scan(Genesys_Device* dev, bool lamp_off)
if (dev->settings.scan_method == ScanMethod::TRANSPARENCY ||
dev->settings.scan_method == ScanMethod::TRANSPARENCY_INFRARED)
{
dev->cmd_set->move_to_ta(dev);
scanner_move_to_ta(*dev);
}
/* load document if needed (for sheetfed scanner for instance) */
@ -4110,7 +4119,7 @@ static void genesys_start_scan(Genesys_Device* dev, bool lamp_off)
if (dev->settings.scan_method == ScanMethod::TRANSPARENCY ||
dev->settings.scan_method == ScanMethod::TRANSPARENCY_INFRARED)
{
dev->cmd_set->move_to_ta(dev);
scanner_move_to_ta(*dev);
}
init_regs_for_scan(*dev, sensor, dev->reg);

Wyświetl plik

@ -1387,11 +1387,5 @@ void CommandSetGl124::eject_document(Genesys_Device* dev) const
throw SaneException("not implemented");
}
void CommandSetGl124::move_to_ta(Genesys_Device* dev) const
{
(void) dev;
throw SaneException("not implemented");
}
} // namespace gl124
} // namespace genesys

Wyświetl plik

@ -105,8 +105,6 @@ public:
void eject_document(Genesys_Device* dev) const override;
void move_to_ta(Genesys_Device* dev) const override;
void send_shading_data(Genesys_Device* dev, const Genesys_Sensor& sensor, uint8_t* data,
int size) const override;

Wyświetl plik

@ -2657,13 +2657,6 @@ void CommandSetGl646::init(Genesys_Device* dev) const
dev->already_initialized = true;
}
void CommandSetGl646::move_to_ta(Genesys_Device* dev) const
{
DBG_HELPER(dbg);
simple_move(dev, static_cast<int>(dev->model->y_offset_sensor_to_ta));
}
static void simple_scan(Genesys_Device* dev, const Genesys_Sensor& sensor,
const ScanSession& session, bool move,
std::vector<uint8_t>& data, const char* scan_identifier)

Wyświetl plik

@ -105,8 +105,6 @@ public:
void eject_document(Genesys_Device* dev) const override;
void move_to_ta(Genesys_Device* dev) const override;
void send_shading_data(Genesys_Device* dev, const Genesys_Sensor& sensor, uint8_t* data,
int size) const override;

Wyświetl plik

@ -2283,12 +2283,6 @@ void CommandSetGl841::wait_for_motor_stop(Genesys_Device* dev) const
(void) dev;
}
void CommandSetGl841::move_to_ta(Genesys_Device* dev) const
{
(void) dev;
throw SaneException("not implemented");
}
void CommandSetGl841::asic_boot(Genesys_Device *dev, bool cold) const
{
// reset ASIC in case of cold boot

Wyświetl plik

@ -105,8 +105,6 @@ public:
void eject_document(Genesys_Device* dev) const override;
void move_to_ta(Genesys_Device* dev) const override;
void send_shading_data(Genesys_Device* dev, const Genesys_Sensor& sensor, uint8_t* data,
int size) const override;

Wyświetl plik

@ -544,7 +544,7 @@ ScanSession CommandSetGl842::calculate_scan_session(const Genesys_Device* dev,
if (settings.scan_method == ScanMethod::TRANSPARENCY ||
settings.scan_method == ScanMethod::TRANSPARENCY_INFRARED)
{
// note: move_to_ta() function has already been called and the sensor is at the
// note: scanner_move_to_ta() function has already been called and the sensor is at the
// transparency adapter
if (!dev->ignore_offsets) {
move = dev->model->y_offset_ta - dev->model->y_offset_sensor_to_ta;
@ -737,7 +737,7 @@ void CommandSetGl842::init_regs_for_shading(Genesys_Device* dev, const Genesys_S
if (dev->settings.scan_method == ScanMethod::TRANSPARENCY ||
dev->settings.scan_method == ScanMethod::TRANSPARENCY_INFRARED)
{
// note: move_to_ta() function has already been called and the sensor is at the
// note: scanner_move_to_ta() function has already been called and the sensor is at the
// transparency adapter
move = static_cast<int>(dev->model->y_offset_calib_white_ta -
dev->model->y_offset_sensor_to_ta);
@ -923,19 +923,6 @@ void CommandSetGl842::update_hardware_sensors(Genesys_Scanner* s) const
(void) s;
}
/** @brief move sensor to transparency adaptor
* Move sensor to the calibration of the transparency adapator (XPA).
* @param dev device to use
*/
void CommandSetGl842::move_to_ta(Genesys_Device* dev) const
{
DBG_HELPER(dbg);
unsigned feed = static_cast<unsigned>((dev->model->y_offset_sensor_to_ta * dev->motor.base_ydpi) /
MM_PER_INCH);
scanner_move(*dev, dev->model->default_method, feed, Direction::FORWARD);
}
/**
* Send shading calibration data. The buffer is considered to always hold values
* for all the channels.

Wyświetl plik

@ -101,8 +101,6 @@ public:
void eject_document(Genesys_Device* dev) const override;
void move_to_ta(Genesys_Device* dev) const override;
void send_shading_data(Genesys_Device* dev, const Genesys_Sensor& sensor, uint8_t* data,
int size) const override;

Wyświetl plik

@ -1079,7 +1079,7 @@ ScanSession CommandSetGl843::calculate_scan_session(const Genesys_Device* dev,
if (settings.scan_method == ScanMethod::TRANSPARENCY ||
settings.scan_method == ScanMethod::TRANSPARENCY_INFRARED)
{
// note: move_to_ta() function has already been called and the sensor is at the
// note: scanner_move_to_ta() function has already been called and the sensor is at the
// transparency adapter
if (!dev->ignore_offsets) {
move = dev->model->y_offset_ta - dev->model->y_offset_sensor_to_ta;
@ -1402,7 +1402,7 @@ void CommandSetGl843::init_regs_for_shading(Genesys_Device* dev, const Genesys_S
if (dev->settings.scan_method == ScanMethod::TRANSPARENCY ||
dev->settings.scan_method == ScanMethod::TRANSPARENCY_INFRARED)
{
// note: move_to_ta() function has already been called and the sensor is at the
// note: scanner_move_to_ta() function has already been called and the sensor is at the
// transparency adapter
move = static_cast<int>(dev->model->y_offset_calib_white_ta - dev->model->y_offset_sensor_to_ta);
if (dev->model->model_id == ModelId::CANON_8600F && resolution == 2400) {
@ -1698,19 +1698,6 @@ void CommandSetGl843::update_hardware_sensors(Genesys_Scanner* s) const
}
}
/** @brief move sensor to transparency adaptor
* Move sensor to the calibration of the transparency adapator (XPA).
* @param dev device to use
*/
void CommandSetGl843::move_to_ta(Genesys_Device* dev) const
{
DBG_HELPER(dbg);
unsigned feed = static_cast<unsigned>((dev->model->y_offset_sensor_to_ta * dev->motor.base_ydpi) /
MM_PER_INCH);
scanner_move(*dev, dev->model->default_method, feed, Direction::FORWARD);
}
/**
* Send shading calibration data. The buffer is considered to always hold values
* for all the channels.

Wyświetl plik

@ -101,8 +101,6 @@ public:
void eject_document(Genesys_Device* dev) const override;
void move_to_ta(Genesys_Device* dev) const override;
void send_shading_data(Genesys_Device* dev, const Genesys_Sensor& sensor, uint8_t* data,
int size) const override;

Wyświetl plik

@ -717,7 +717,7 @@ ScanSession CommandSetGl846::calculate_scan_session(const Genesys_Device* dev,
if (settings.scan_method == ScanMethod::TRANSPARENCY ||
settings.scan_method == ScanMethod::TRANSPARENCY_INFRARED)
{
// note: move_to_ta() function has already been called and the sensor is at the
// note: scanner_move_to_ta() function has already been called and the sensor is at the
// transparency adapter
if (!dev->ignore_offsets) {
move = dev->model->y_offset_ta - dev->model->y_offset_sensor_to_ta;
@ -857,7 +857,7 @@ void CommandSetGl846::init_regs_for_shading(Genesys_Device* dev, const Genesys_S
if (dev->settings.scan_method == ScanMethod::TRANSPARENCY ||
dev->settings.scan_method == ScanMethod::TRANSPARENCY_INFRARED)
{
// note: move_to_ta() function has already been called and the sensor is at the
// note: scanner_move_to_ta() function has already been called and the sensor is at the
// transparency adapter
move = static_cast<int>(dev->model->y_offset_calib_white_ta - dev->model->y_offset_sensor_to_ta);
flags |= ScanFlag::USE_XPA;
@ -1154,14 +1154,5 @@ void CommandSetGl846::eject_document(Genesys_Device* dev) const
throw SaneException("not implemented");
}
void CommandSetGl846::move_to_ta(Genesys_Device* dev) const
{
DBG_HELPER(dbg);
unsigned feed = static_cast<unsigned>((dev->model->y_offset_sensor_to_ta * dev->motor.base_ydpi) /
MM_PER_INCH);
scanner_move(*dev, dev->model->default_method, feed, Direction::FORWARD);
}
} // namespace gl846
} // namespace genesys

Wyświetl plik

@ -105,8 +105,6 @@ public:
void eject_document(Genesys_Device* dev) const override;
void move_to_ta(Genesys_Device* dev) const override;
void send_shading_data(Genesys_Device* dev, const Genesys_Sensor& sensor, uint8_t* data,
int size) const override;

Wyświetl plik

@ -603,7 +603,7 @@ ScanSession CommandSetGl847::calculate_scan_session(const Genesys_Device* dev,
if (settings.scan_method == ScanMethod::TRANSPARENCY ||
settings.scan_method == ScanMethod::TRANSPARENCY_INFRARED)
{
// note: move_to_ta() function has already been called and the sensor is at the
// note: scanner_move_to_ta() function has already been called and the sensor is at the
// transparency adapter
if (!dev->ignore_offsets) {
move = dev->model->y_offset_ta - dev->model->y_offset_sensor_to_ta;
@ -754,7 +754,7 @@ void CommandSetGl847::init_regs_for_shading(Genesys_Device* dev, const Genesys_S
if (dev->settings.scan_method == ScanMethod::TRANSPARENCY ||
dev->settings.scan_method == ScanMethod::TRANSPARENCY_INFRARED)
{
// note: move_to_ta() function has already been called and the sensor is at the
// note: scanner_move_to_ta() function has already been called and the sensor is at the
// transparency adapter
move = dev->model->y_offset_calib_white_ta - dev->model->y_offset_sensor_to_ta;
flags |= ScanFlag::USE_XPA;
@ -1081,14 +1081,5 @@ void CommandSetGl847::eject_document(Genesys_Device* dev) const
throw SaneException("not implemented");
}
void CommandSetGl847::move_to_ta(Genesys_Device* dev) const
{
DBG_HELPER(dbg);
unsigned feed = static_cast<unsigned>((dev->model->y_offset_sensor_to_ta * dev->motor.base_ydpi) /
MM_PER_INCH);
scanner_move(*dev, dev->model->default_method, feed, Direction::FORWARD);
}
} // namespace gl847
} // namespace genesys

Wyświetl plik

@ -105,8 +105,6 @@ public:
void eject_document(Genesys_Device* dev) const override;
void move_to_ta(Genesys_Device* dev) const override;
void send_shading_data(Genesys_Device* dev, const Genesys_Sensor& sensor, uint8_t* data,
int size) const override;