kopia lustrzana https://gitlab.com/sane-project/backends
Merge branch 'genesys-cleanup' into 'master'
genesys: Miscellaneous cleanup See merge request sane-project/backends!476merge-requests/244/head
commit
e1be18fbef
|
@ -71,8 +71,6 @@ public:
|
||||||
|
|
||||||
virtual void init_regs_for_shading(Genesys_Device* dev, const Genesys_Sensor& sensor,
|
virtual void init_regs_for_shading(Genesys_Device* dev, const Genesys_Sensor& sensor,
|
||||||
Genesys_Register_Set& regs) const = 0;
|
Genesys_Register_Set& regs) const = 0;
|
||||||
virtual void init_regs_for_scan(Genesys_Device* dev, const Genesys_Sensor& sensor,
|
|
||||||
Genesys_Register_Set& regs) const = 0;
|
|
||||||
|
|
||||||
/** Set up registers for a scan. Similar to init_regs_for_scan except that the session is
|
/** Set up registers for a scan. Similar to init_regs_for_scan except that the session is
|
||||||
already computed from the session
|
already computed from the session
|
||||||
|
@ -132,9 +130,6 @@ public:
|
||||||
/// eject document from scanner
|
/// eject document from scanner
|
||||||
virtual void eject_document(Genesys_Device* dev) const = 0;
|
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
|
/// write shading data calibration to ASIC
|
||||||
virtual void send_shading_data(Genesys_Device* dev, const Genesys_Sensor& sensor,
|
virtual void send_shading_data(Genesys_Device* dev, const Genesys_Sensor& sensor,
|
||||||
std::uint8_t* data, int size) const = 0;
|
std::uint8_t* data, int size) const = 0;
|
||||||
|
|
|
@ -172,6 +172,27 @@ SANE_Status wrap_exceptions_to_status_code(const char* func, F&& function)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<class F>
|
||||||
|
SANE_Status wrap_exceptions_to_status_code_return(const char* func, F&& function)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
return function();
|
||||||
|
} catch (const SaneException& exc) {
|
||||||
|
DBG(DBG_error, "%s: got error: %s\n", func, exc.what());
|
||||||
|
return exc.status();
|
||||||
|
} catch (const std::bad_alloc& exc) {
|
||||||
|
(void) exc;
|
||||||
|
DBG(DBG_error, "%s: failed to allocate memory\n", func);
|
||||||
|
return SANE_STATUS_NO_MEM;
|
||||||
|
} catch (const std::exception& exc) {
|
||||||
|
DBG(DBG_error, "%s: got uncaught exception: %s\n", func, exc.what());
|
||||||
|
return SANE_STATUS_INVAL;
|
||||||
|
} catch (...) {
|
||||||
|
DBG(DBG_error, "%s: got unknown uncaught exception\n", func);
|
||||||
|
return SANE_STATUS_INVAL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
template<class F>
|
template<class F>
|
||||||
void catch_all_exceptions(const char* func, F&& function)
|
void catch_all_exceptions(const char* func, F&& function)
|
||||||
{
|
{
|
||||||
|
|
|
@ -899,6 +899,15 @@ void scanner_move(Genesys_Device& dev, ScanMethod scan_method, unsigned steps, D
|
||||||
dev.interface->sleep_ms(100);
|
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)
|
void scanner_move_back_home(Genesys_Device& dev, bool wait_until_home)
|
||||||
{
|
{
|
||||||
DBG_HELPER_ARGS(dbg, "wait_until_home = %d", 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 ||
|
if (dev->settings.scan_method == ScanMethod::TRANSPARENCY ||
|
||||||
dev->settings.scan_method == ScanMethod::TRANSPARENCY_INFRARED)
|
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 ||
|
if (dev->settings.scan_method == ScanMethod::TRANSPARENCY ||
|
||||||
dev->settings.scan_method == ScanMethod::TRANSPARENCY_INFRARED)
|
dev->settings.scan_method == ScanMethod::TRANSPARENCY_INFRARED)
|
||||||
{
|
{
|
||||||
dev->cmd_set->move_to_ta(dev);
|
scanner_move_to_ta(*dev);
|
||||||
}
|
}
|
||||||
|
|
||||||
// shading calibration
|
// shading calibration
|
||||||
|
@ -3995,6 +4004,37 @@ static void genesys_warmup_lamp(Genesys_Device* dev)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void init_regs_for_scan(Genesys_Device& dev, const Genesys_Sensor& sensor,
|
||||||
|
Genesys_Register_Set& regs)
|
||||||
|
{
|
||||||
|
DBG_HELPER(dbg);
|
||||||
|
debug_dump(DBG_info, dev.settings);
|
||||||
|
|
||||||
|
auto session = dev.cmd_set->calculate_scan_session(&dev, sensor, dev.settings);
|
||||||
|
|
||||||
|
if (dev.model->asic_type == AsicType::GL124 ||
|
||||||
|
dev.model->asic_type == AsicType::GL845 ||
|
||||||
|
dev.model->asic_type == AsicType::GL846 ||
|
||||||
|
dev.model->asic_type == AsicType::GL847)
|
||||||
|
{
|
||||||
|
/* Fast move to scan area:
|
||||||
|
|
||||||
|
We don't move fast the whole distance since it would involve computing
|
||||||
|
acceleration/deceleration distance for scan resolution. So leave a remainder for it so
|
||||||
|
scan makes the final move tuning
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (dev.settings.get_channels() * dev.settings.yres >= 600 && session.params.starty > 700) {
|
||||||
|
scanner_move(dev, dev.model->default_method,
|
||||||
|
static_cast<unsigned>(session.params.starty - 500),
|
||||||
|
Direction::FORWARD);
|
||||||
|
session.params.starty = 500;
|
||||||
|
}
|
||||||
|
compute_session(&dev, session, sensor);
|
||||||
|
}
|
||||||
|
|
||||||
|
dev.cmd_set->init_regs_for_scan_session(&dev, sensor, ®s, session);
|
||||||
|
}
|
||||||
|
|
||||||
// High-level start of scanning
|
// High-level start of scanning
|
||||||
static void genesys_start_scan(Genesys_Device* dev, bool lamp_off)
|
static void genesys_start_scan(Genesys_Device* dev, bool lamp_off)
|
||||||
|
@ -4020,7 +4060,7 @@ static void genesys_start_scan(Genesys_Device* dev, bool lamp_off)
|
||||||
if (dev->settings.scan_method == ScanMethod::TRANSPARENCY ||
|
if (dev->settings.scan_method == ScanMethod::TRANSPARENCY ||
|
||||||
dev->settings.scan_method == ScanMethod::TRANSPARENCY_INFRARED)
|
dev->settings.scan_method == ScanMethod::TRANSPARENCY_INFRARED)
|
||||||
{
|
{
|
||||||
dev->cmd_set->move_to_ta(dev);
|
scanner_move_to_ta(*dev);
|
||||||
}
|
}
|
||||||
|
|
||||||
genesys_warmup_lamp(dev);
|
genesys_warmup_lamp(dev);
|
||||||
|
@ -4037,7 +4077,7 @@ static void genesys_start_scan(Genesys_Device* dev, bool lamp_off)
|
||||||
if (dev->settings.scan_method == ScanMethod::TRANSPARENCY ||
|
if (dev->settings.scan_method == ScanMethod::TRANSPARENCY ||
|
||||||
dev->settings.scan_method == ScanMethod::TRANSPARENCY_INFRARED)
|
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) */
|
/* load document if needed (for sheetfed scanner for instance) */
|
||||||
|
@ -4079,10 +4119,10 @@ static void genesys_start_scan(Genesys_Device* dev, bool lamp_off)
|
||||||
if (dev->settings.scan_method == ScanMethod::TRANSPARENCY ||
|
if (dev->settings.scan_method == ScanMethod::TRANSPARENCY ||
|
||||||
dev->settings.scan_method == ScanMethod::TRANSPARENCY_INFRARED)
|
dev->settings.scan_method == ScanMethod::TRANSPARENCY_INFRARED)
|
||||||
{
|
{
|
||||||
dev->cmd_set->move_to_ta(dev);
|
scanner_move_to_ta(*dev);
|
||||||
}
|
}
|
||||||
|
|
||||||
dev->cmd_set->init_regs_for_scan(dev, sensor, dev->reg);
|
init_regs_for_scan(*dev, sensor, dev->reg);
|
||||||
|
|
||||||
/* no lamp during scan */
|
/* no lamp during scan */
|
||||||
if (lamp_off) {
|
if (lamp_off) {
|
||||||
|
@ -6236,7 +6276,8 @@ SANE_Status sane_start(SANE_Handle handle)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void sane_read_impl(SANE_Handle handle, SANE_Byte * buf, SANE_Int max_len, SANE_Int* len)
|
// returns SANE_STATUS_GOOD if there are more data, SANE_STATUS_EOF otherwise
|
||||||
|
SANE_Status sane_read_impl(SANE_Handle handle, SANE_Byte * buf, SANE_Int max_len, SANE_Int* len)
|
||||||
{
|
{
|
||||||
DBG_HELPER(dbg);
|
DBG_HELPER(dbg);
|
||||||
Genesys_Scanner* s = reinterpret_cast<Genesys_Scanner*>(handle);
|
Genesys_Scanner* s = reinterpret_cast<Genesys_Scanner*>(handle);
|
||||||
|
@ -6282,7 +6323,7 @@ void sane_read_impl(SANE_Handle handle, SANE_Byte * buf, SANE_Int max_len, SANE_
|
||||||
dev->cmd_set->move_back_home(dev, false);
|
dev->cmd_set->move_back_home(dev, false);
|
||||||
dev->parking = true;
|
dev->parking = true;
|
||||||
}
|
}
|
||||||
throw SaneException(SANE_STATUS_EOF);
|
return SANE_STATUS_EOF;
|
||||||
}
|
}
|
||||||
|
|
||||||
local_len = max_len;
|
local_len = max_len;
|
||||||
|
@ -6294,14 +6335,15 @@ void sane_read_impl(SANE_Handle handle, SANE_Byte * buf, SANE_Int max_len, SANE_
|
||||||
dbg.log(DBG_error, "error: returning incorrect length");
|
dbg.log(DBG_error, "error: returning incorrect length");
|
||||||
}
|
}
|
||||||
DBG(DBG_proc, "%s: %d bytes returned\n", __func__, *len);
|
DBG(DBG_proc, "%s: %d bytes returned\n", __func__, *len);
|
||||||
|
return SANE_STATUS_GOOD;
|
||||||
}
|
}
|
||||||
|
|
||||||
SANE_GENESYS_API_LINKAGE
|
SANE_GENESYS_API_LINKAGE
|
||||||
SANE_Status sane_read(SANE_Handle handle, SANE_Byte * buf, SANE_Int max_len, SANE_Int* len)
|
SANE_Status sane_read(SANE_Handle handle, SANE_Byte * buf, SANE_Int max_len, SANE_Int* len)
|
||||||
{
|
{
|
||||||
return wrap_exceptions_to_status_code(__func__, [=]()
|
return wrap_exceptions_to_status_code_return(__func__, [=]()
|
||||||
{
|
{
|
||||||
sane_read_impl(handle, buf, max_len, len);
|
return sane_read_impl(handle, buf, max_len, len);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1020,25 +1020,6 @@ void CommandSetGl124::wait_for_motor_stop(Genesys_Device* dev) const
|
||||||
dev->interface->sleep_ms(50);
|
dev->interface->sleep_ms(50);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @brief set up registers for the actual scan
|
|
||||||
*/
|
|
||||||
void CommandSetGl124::init_regs_for_scan(Genesys_Device* dev, const Genesys_Sensor& sensor,
|
|
||||||
Genesys_Register_Set& regs) const
|
|
||||||
{
|
|
||||||
DBG_HELPER(dbg);
|
|
||||||
auto session = calculate_scan_session(dev, sensor, dev->settings);
|
|
||||||
|
|
||||||
if (dev->settings.get_channels() * dev->settings.yres >= 600 && session.params.starty > 700) {
|
|
||||||
scanner_move(*dev, dev->model->default_method,
|
|
||||||
static_cast<unsigned>(session.params.starty - 500),
|
|
||||||
Direction::FORWARD);
|
|
||||||
session.params.starty = 500;
|
|
||||||
}
|
|
||||||
compute_session(dev, session, sensor);
|
|
||||||
|
|
||||||
init_regs_for_scan_session(dev, sensor, ®s, session);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send shading calibration data. The buffer is considered to always hold values
|
* Send shading calibration data. The buffer is considered to always hold values
|
||||||
* for all the channels.
|
* for all the channels.
|
||||||
|
@ -1406,11 +1387,5 @@ void CommandSetGl124::eject_document(Genesys_Device* dev) const
|
||||||
throw SaneException("not implemented");
|
throw SaneException("not implemented");
|
||||||
}
|
}
|
||||||
|
|
||||||
void CommandSetGl124::move_to_ta(Genesys_Device* dev) const
|
|
||||||
{
|
|
||||||
(void) dev;
|
|
||||||
throw SaneException("not implemented");
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace gl124
|
} // namespace gl124
|
||||||
} // namespace genesys
|
} // namespace genesys
|
||||||
|
|
|
@ -65,9 +65,6 @@ public:
|
||||||
void init_regs_for_shading(Genesys_Device* dev, const Genesys_Sensor& sensor,
|
void init_regs_for_shading(Genesys_Device* dev, const Genesys_Sensor& sensor,
|
||||||
Genesys_Register_Set& regs) const override;
|
Genesys_Register_Set& regs) const override;
|
||||||
|
|
||||||
void init_regs_for_scan(Genesys_Device* dev, const Genesys_Sensor& sensor,
|
|
||||||
Genesys_Register_Set& regs) const override;
|
|
||||||
|
|
||||||
void init_regs_for_scan_session(Genesys_Device* dev, const Genesys_Sensor& sensor,
|
void init_regs_for_scan_session(Genesys_Device* dev, const Genesys_Sensor& sensor,
|
||||||
Genesys_Register_Set* reg,
|
Genesys_Register_Set* reg,
|
||||||
const ScanSession& session) const override;
|
const ScanSession& session) const override;
|
||||||
|
@ -108,8 +105,6 @@ public:
|
||||||
|
|
||||||
void eject_document(Genesys_Device* dev) const override;
|
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,
|
void send_shading_data(Genesys_Device* dev, const Genesys_Sensor& sensor, uint8_t* data,
|
||||||
int size) const override;
|
int size) const override;
|
||||||
|
|
||||||
|
|
|
@ -68,15 +68,6 @@ static void write_control(Genesys_Device* dev, const Genesys_Sensor& sensor, int
|
||||||
|
|
||||||
static void gl646_set_fe(Genesys_Device* dev, const Genesys_Sensor& sensor, uint8_t set, int dpi);
|
static void gl646_set_fe(Genesys_Device* dev, const Genesys_Sensor& sensor, uint8_t set, int dpi);
|
||||||
|
|
||||||
/**
|
|
||||||
* Does a simple move of the given distance by doing a scan at lowest resolution
|
|
||||||
* shading correction. Memory for data is allocated in this function
|
|
||||||
* and must be freed by caller.
|
|
||||||
* @param dev device of the scanner
|
|
||||||
* @param distance distance to move in MM
|
|
||||||
*/
|
|
||||||
static void simple_move(Genesys_Device* dev, SANE_Int distance);
|
|
||||||
|
|
||||||
static void simple_scan(Genesys_Device* dev, const Genesys_Sensor& sensor,
|
static void simple_scan(Genesys_Device* dev, const Genesys_Sensor& sensor,
|
||||||
const ScanSession& session, bool move,
|
const ScanSession& session, bool move,
|
||||||
std::vector<uint8_t>& data, const char* test_identifier);
|
std::vector<uint8_t>& data, const char* test_identifier);
|
||||||
|
@ -1860,22 +1851,6 @@ bool CommandSetGl646::needs_home_before_init_regs_for_scan(Genesys_Device* dev)
|
||||||
dev->settings.scan_method == ScanMethod::FLATBED;
|
dev->settings.scan_method == ScanMethod::FLATBED;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* set up registers for the actual scan. The scan's parameters are given
|
|
||||||
* through the device settings. It allocates the scan buffers.
|
|
||||||
*/
|
|
||||||
void CommandSetGl646::init_regs_for_scan(Genesys_Device* dev, const Genesys_Sensor& sensor,
|
|
||||||
Genesys_Register_Set& regs) const
|
|
||||||
{
|
|
||||||
DBG_HELPER(dbg);
|
|
||||||
|
|
||||||
debug_dump(DBG_info, dev->settings);
|
|
||||||
|
|
||||||
ScanSession session = calculate_scan_session(dev, sensor, dev->settings);
|
|
||||||
|
|
||||||
init_regs_for_scan_session(dev, sensor, ®s, session);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* this function send gamma table to ASIC
|
* this function send gamma table to ASIC
|
||||||
*/
|
*/
|
||||||
|
@ -2673,13 +2648,6 @@ void CommandSetGl646::init(Genesys_Device* dev) const
|
||||||
dev->already_initialized = true;
|
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,
|
static void simple_scan(Genesys_Device* dev, const Genesys_Sensor& sensor,
|
||||||
const ScanSession& session, bool move,
|
const ScanSession& session, bool move,
|
||||||
std::vector<uint8_t>& data, const char* scan_identifier)
|
std::vector<uint8_t>& data, const char* scan_identifier)
|
||||||
|
@ -2769,54 +2737,6 @@ static void simple_scan(Genesys_Device* dev, const Genesys_Sensor& sensor,
|
||||||
end_scan_impl(dev, &dev->reg, true, false);
|
end_scan_impl(dev, &dev->reg, true, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Does a simple move of the given distance by doing a scan at lowest resolution
|
|
||||||
* shading correction. Memory for data is allocated in this function
|
|
||||||
* and must be freed by caller.
|
|
||||||
* @param dev device of the scanner
|
|
||||||
* @param distance distance to move in MM
|
|
||||||
*/
|
|
||||||
static void simple_move(Genesys_Device* dev, SANE_Int distance)
|
|
||||||
{
|
|
||||||
DBG_HELPER_ARGS(dbg, "%d mm", distance);
|
|
||||||
|
|
||||||
unsigned resolution = sanei_genesys_get_lowest_dpi(dev);
|
|
||||||
|
|
||||||
const auto& sensor = sanei_genesys_find_sensor(dev, resolution, 3, dev->model->default_method);
|
|
||||||
|
|
||||||
unsigned lines = static_cast<unsigned>((distance * resolution) / MM_PER_INCH);
|
|
||||||
|
|
||||||
// round up to multiple of 3 in case of CIS scanner
|
|
||||||
if (dev->model->is_cis) {
|
|
||||||
lines = ((lines + 2) / 3) * 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto* regs = &dev->reg;
|
|
||||||
|
|
||||||
ScanSession session;
|
|
||||||
session.params.xres = resolution;
|
|
||||||
session.params.yres = resolution;
|
|
||||||
session.params.startx = 0;
|
|
||||||
session.params.starty = 0;
|
|
||||||
session.params.pixels = dev->model->x_size_calib_mm * resolution / MM_PER_INCH;
|
|
||||||
session.params.lines = lines;
|
|
||||||
session.params.depth = 8;
|
|
||||||
session.params.channels = 3;
|
|
||||||
session.params.scan_method = dev->settings.scan_method;
|
|
||||||
session.params.scan_mode = ScanColorMode::COLOR_SINGLE_PASS;
|
|
||||||
session.params.color_filter = ColorFilter::RED;
|
|
||||||
session.params.flags = ScanFlag::NONE;
|
|
||||||
if (dev->settings.scan_method == ScanMethod::TRANSPARENCY) {
|
|
||||||
session.params.flags |= ScanFlag::USE_XPA;
|
|
||||||
}
|
|
||||||
compute_session(dev, session, sensor);
|
|
||||||
|
|
||||||
dev->cmd_set->init_regs_for_scan_session(dev, sensor, regs, session);
|
|
||||||
|
|
||||||
std::vector<uint8_t> data;
|
|
||||||
simple_scan(dev, sensor, session, true, data, "simple_move");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* update the status of the required sensor in the scanner session
|
* update the status of the required sensor in the scanner session
|
||||||
* the button fileds are used to make events 'sticky'
|
* the button fileds are used to make events 'sticky'
|
||||||
|
|
|
@ -69,9 +69,6 @@ public:
|
||||||
void init_regs_for_shading(Genesys_Device* dev, const Genesys_Sensor& sensor,
|
void init_regs_for_shading(Genesys_Device* dev, const Genesys_Sensor& sensor,
|
||||||
Genesys_Register_Set& regs) const override;
|
Genesys_Register_Set& regs) const override;
|
||||||
|
|
||||||
void init_regs_for_scan(Genesys_Device* dev, const Genesys_Sensor& sensor,
|
|
||||||
Genesys_Register_Set& regs) const override;
|
|
||||||
|
|
||||||
void init_regs_for_scan_session(Genesys_Device* dev, const Genesys_Sensor& sensor,
|
void init_regs_for_scan_session(Genesys_Device* dev, const Genesys_Sensor& sensor,
|
||||||
Genesys_Register_Set* reg,
|
Genesys_Register_Set* reg,
|
||||||
const ScanSession& session) const override;
|
const ScanSession& session) const override;
|
||||||
|
@ -108,8 +105,6 @@ public:
|
||||||
|
|
||||||
void eject_document(Genesys_Device* dev) const override;
|
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,
|
void send_shading_data(Genesys_Device* dev, const Genesys_Sensor& sensor, uint8_t* data,
|
||||||
int size) const override;
|
int size) const override;
|
||||||
|
|
||||||
|
|
|
@ -1617,19 +1617,6 @@ void CommandSetGl841::init_regs_for_shading(Genesys_Device* dev, const Genesys_S
|
||||||
dev->calib_session = session;
|
dev->calib_session = session;
|
||||||
}
|
}
|
||||||
|
|
||||||
// set up registers for the actual scan
|
|
||||||
void CommandSetGl841::init_regs_for_scan(Genesys_Device* dev, const Genesys_Sensor& sensor,
|
|
||||||
Genesys_Register_Set& regs) const
|
|
||||||
{
|
|
||||||
DBG_HELPER(dbg);
|
|
||||||
|
|
||||||
debug_dump(DBG_info, dev->settings);
|
|
||||||
|
|
||||||
auto session = calculate_scan_session(dev, sensor, dev->settings);
|
|
||||||
init_regs_for_scan_session(dev, sensor, ®s, session);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// this function sends generic gamma table (ie linear ones) or the Sensor specific one if provided
|
// this function sends generic gamma table (ie linear ones) or the Sensor specific one if provided
|
||||||
void CommandSetGl841::send_gamma_table(Genesys_Device* dev, const Genesys_Sensor& sensor) const
|
void CommandSetGl841::send_gamma_table(Genesys_Device* dev, const Genesys_Sensor& sensor) const
|
||||||
{
|
{
|
||||||
|
@ -2296,12 +2283,6 @@ void CommandSetGl841::wait_for_motor_stop(Genesys_Device* dev) const
|
||||||
(void) dev;
|
(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
|
void CommandSetGl841::asic_boot(Genesys_Device *dev, bool cold) const
|
||||||
{
|
{
|
||||||
// reset ASIC in case of cold boot
|
// reset ASIC in case of cold boot
|
||||||
|
|
|
@ -65,9 +65,6 @@ public:
|
||||||
void init_regs_for_shading(Genesys_Device* dev, const Genesys_Sensor& sensor,
|
void init_regs_for_shading(Genesys_Device* dev, const Genesys_Sensor& sensor,
|
||||||
Genesys_Register_Set& regs) const override;
|
Genesys_Register_Set& regs) const override;
|
||||||
|
|
||||||
void init_regs_for_scan(Genesys_Device* dev, const Genesys_Sensor& sensor,
|
|
||||||
Genesys_Register_Set& regs) const override;
|
|
||||||
|
|
||||||
void init_regs_for_scan_session(Genesys_Device* dev, const Genesys_Sensor& sensor,
|
void init_regs_for_scan_session(Genesys_Device* dev, const Genesys_Sensor& sensor,
|
||||||
Genesys_Register_Set* reg,
|
Genesys_Register_Set* reg,
|
||||||
const ScanSession& session) const override;
|
const ScanSession& session) const override;
|
||||||
|
@ -108,8 +105,6 @@ public:
|
||||||
|
|
||||||
void eject_document(Genesys_Device* dev) const override;
|
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,
|
void send_shading_data(Genesys_Device* dev, const Genesys_Sensor& sensor, uint8_t* data,
|
||||||
int size) const override;
|
int size) const override;
|
||||||
|
|
||||||
|
|
|
@ -544,7 +544,7 @@ ScanSession CommandSetGl842::calculate_scan_session(const Genesys_Device* dev,
|
||||||
if (settings.scan_method == ScanMethod::TRANSPARENCY ||
|
if (settings.scan_method == ScanMethod::TRANSPARENCY ||
|
||||||
settings.scan_method == ScanMethod::TRANSPARENCY_INFRARED)
|
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
|
// transparency adapter
|
||||||
if (!dev->ignore_offsets) {
|
if (!dev->ignore_offsets) {
|
||||||
move = dev->model->y_offset_ta - dev->model->y_offset_sensor_to_ta;
|
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 ||
|
if (dev->settings.scan_method == ScanMethod::TRANSPARENCY ||
|
||||||
dev->settings.scan_method == ScanMethod::TRANSPARENCY_INFRARED)
|
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
|
// transparency adapter
|
||||||
move = static_cast<int>(dev->model->y_offset_calib_white_ta -
|
move = static_cast<int>(dev->model->y_offset_calib_white_ta -
|
||||||
dev->model->y_offset_sensor_to_ta);
|
dev->model->y_offset_sensor_to_ta);
|
||||||
|
@ -769,15 +769,6 @@ void CommandSetGl842::init_regs_for_shading(Genesys_Device* dev, const Genesys_S
|
||||||
dev->calib_session = session;
|
dev->calib_session = session;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CommandSetGl842::init_regs_for_scan(Genesys_Device* dev, const Genesys_Sensor& sensor,
|
|
||||||
Genesys_Register_Set& regs) const
|
|
||||||
{
|
|
||||||
DBG_HELPER(dbg);
|
|
||||||
ScanSession session = calculate_scan_session(dev, sensor, dev->settings);
|
|
||||||
|
|
||||||
init_regs_for_scan_session(dev, sensor, ®s, session);
|
|
||||||
}
|
|
||||||
|
|
||||||
void CommandSetGl842::send_gamma_table(Genesys_Device* dev, const Genesys_Sensor& sensor) const
|
void CommandSetGl842::send_gamma_table(Genesys_Device* dev, const Genesys_Sensor& sensor) const
|
||||||
{
|
{
|
||||||
DBG_HELPER(dbg);
|
DBG_HELPER(dbg);
|
||||||
|
@ -932,23 +923,6 @@ void CommandSetGl842::update_hardware_sensors(Genesys_Scanner* s) const
|
||||||
(void) s;
|
(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);
|
|
||||||
|
|
||||||
const auto& resolution_settings = dev->model->get_resolution_settings(dev->model->default_method);
|
|
||||||
float resolution = resolution_settings.get_min_resolution_y();
|
|
||||||
|
|
||||||
unsigned multiplier = 16;
|
|
||||||
unsigned feed = static_cast<unsigned>(multiplier * (dev->model->y_offset_sensor_to_ta * resolution) /
|
|
||||||
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
|
* Send shading calibration data. The buffer is considered to always hold values
|
||||||
* for all the channels.
|
* for all the channels.
|
||||||
|
|
|
@ -65,9 +65,6 @@ public:
|
||||||
void init_regs_for_shading(Genesys_Device* dev, const Genesys_Sensor& sensor,
|
void init_regs_for_shading(Genesys_Device* dev, const Genesys_Sensor& sensor,
|
||||||
Genesys_Register_Set& regs) const override;
|
Genesys_Register_Set& regs) const override;
|
||||||
|
|
||||||
void init_regs_for_scan(Genesys_Device* dev, const Genesys_Sensor& sensor,
|
|
||||||
Genesys_Register_Set& regs) const override;
|
|
||||||
|
|
||||||
void init_regs_for_scan_session(Genesys_Device* dev, const Genesys_Sensor& sensor,
|
void init_regs_for_scan_session(Genesys_Device* dev, const Genesys_Sensor& sensor,
|
||||||
Genesys_Register_Set* reg,
|
Genesys_Register_Set* reg,
|
||||||
const ScanSession& session) const override;
|
const ScanSession& session) const override;
|
||||||
|
@ -104,8 +101,6 @@ public:
|
||||||
|
|
||||||
void eject_document(Genesys_Device* dev) const override;
|
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,
|
void send_shading_data(Genesys_Device* dev, const Genesys_Sensor& sensor, uint8_t* data,
|
||||||
int size) const override;
|
int size) const override;
|
||||||
|
|
||||||
|
|
|
@ -1079,7 +1079,7 @@ ScanSession CommandSetGl843::calculate_scan_session(const Genesys_Device* dev,
|
||||||
if (settings.scan_method == ScanMethod::TRANSPARENCY ||
|
if (settings.scan_method == ScanMethod::TRANSPARENCY ||
|
||||||
settings.scan_method == ScanMethod::TRANSPARENCY_INFRARED)
|
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
|
// transparency adapter
|
||||||
if (!dev->ignore_offsets) {
|
if (!dev->ignore_offsets) {
|
||||||
move = dev->model->y_offset_ta - dev->model->y_offset_sensor_to_ta;
|
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 ||
|
if (dev->settings.scan_method == ScanMethod::TRANSPARENCY ||
|
||||||
dev->settings.scan_method == ScanMethod::TRANSPARENCY_INFRARED)
|
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
|
// transparency adapter
|
||||||
move = static_cast<int>(dev->model->y_offset_calib_white_ta - dev->model->y_offset_sensor_to_ta);
|
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) {
|
if (dev->model->model_id == ModelId::CANON_8600F && resolution == 2400) {
|
||||||
|
@ -1439,17 +1439,6 @@ void CommandSetGl843::init_regs_for_shading(Genesys_Device* dev, const Genesys_S
|
||||||
dev->calib_session = session;
|
dev->calib_session = session;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @brief set up registers for the actual scan
|
|
||||||
*/
|
|
||||||
void CommandSetGl843::init_regs_for_scan(Genesys_Device* dev, const Genesys_Sensor& sensor,
|
|
||||||
Genesys_Register_Set& regs) const
|
|
||||||
{
|
|
||||||
DBG_HELPER(dbg);
|
|
||||||
ScanSession session = calculate_scan_session(dev, sensor, dev->settings);
|
|
||||||
|
|
||||||
init_regs_for_scan_session(dev, sensor, ®s, session);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function sends gamma tables to ASIC
|
* This function sends gamma tables to ASIC
|
||||||
*/
|
*/
|
||||||
|
@ -1709,27 +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);
|
|
||||||
|
|
||||||
const auto& resolution_settings = dev->model->get_resolution_settings(dev->model->default_method);
|
|
||||||
float resolution = resolution_settings.get_min_resolution_y();
|
|
||||||
|
|
||||||
unsigned multiplier = 16;
|
|
||||||
if (dev->model->model_id == ModelId::CANON_8400F ||
|
|
||||||
dev->model->model_id == ModelId::CANON_4400F) {
|
|
||||||
multiplier = 4;
|
|
||||||
}
|
|
||||||
unsigned feed = static_cast<unsigned>(multiplier * (dev->model->y_offset_sensor_to_ta * resolution) /
|
|
||||||
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
|
* Send shading calibration data. The buffer is considered to always hold values
|
||||||
* for all the channels.
|
* for all the channels.
|
||||||
|
|
|
@ -65,9 +65,6 @@ public:
|
||||||
void init_regs_for_shading(Genesys_Device* dev, const Genesys_Sensor& sensor,
|
void init_regs_for_shading(Genesys_Device* dev, const Genesys_Sensor& sensor,
|
||||||
Genesys_Register_Set& regs) const override;
|
Genesys_Register_Set& regs) const override;
|
||||||
|
|
||||||
void init_regs_for_scan(Genesys_Device* dev, const Genesys_Sensor& sensor,
|
|
||||||
Genesys_Register_Set& regs) const override;
|
|
||||||
|
|
||||||
void init_regs_for_scan_session(Genesys_Device* dev, const Genesys_Sensor& sensor,
|
void init_regs_for_scan_session(Genesys_Device* dev, const Genesys_Sensor& sensor,
|
||||||
Genesys_Register_Set* reg,
|
Genesys_Register_Set* reg,
|
||||||
const ScanSession& session) const override;
|
const ScanSession& session) const override;
|
||||||
|
@ -104,8 +101,6 @@ public:
|
||||||
|
|
||||||
void eject_document(Genesys_Device* dev) const override;
|
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,
|
void send_shading_data(Genesys_Device* dev, const Genesys_Sensor& sensor, uint8_t* data,
|
||||||
int size) const override;
|
int size) const override;
|
||||||
|
|
||||||
|
|
|
@ -382,7 +382,6 @@ static void gl846_init_motor_regs_scan(Genesys_Device* dev,
|
||||||
}
|
}
|
||||||
|
|
||||||
reg->set24(REG_LINCNT, scan_lines);
|
reg->set24(REG_LINCNT, scan_lines);
|
||||||
DBG(DBG_io, "%s: lincnt=%d\n", __func__, scan_lines);
|
|
||||||
|
|
||||||
reg->set8(REG_0x02, 0);
|
reg->set8(REG_0x02, 0);
|
||||||
sanei_genesys_set_motor_power(*reg, true);
|
sanei_genesys_set_motor_power(*reg, true);
|
||||||
|
@ -718,7 +717,7 @@ ScanSession CommandSetGl846::calculate_scan_session(const Genesys_Device* dev,
|
||||||
if (settings.scan_method == ScanMethod::TRANSPARENCY ||
|
if (settings.scan_method == ScanMethod::TRANSPARENCY ||
|
||||||
settings.scan_method == ScanMethod::TRANSPARENCY_INFRARED)
|
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
|
// transparency adapter
|
||||||
if (!dev->ignore_offsets) {
|
if (!dev->ignore_offsets) {
|
||||||
move = dev->model->y_offset_ta - dev->model->y_offset_sensor_to_ta;
|
move = dev->model->y_offset_ta - dev->model->y_offset_sensor_to_ta;
|
||||||
|
@ -858,7 +857,7 @@ void CommandSetGl846::init_regs_for_shading(Genesys_Device* dev, const Genesys_S
|
||||||
if (dev->settings.scan_method == ScanMethod::TRANSPARENCY ||
|
if (dev->settings.scan_method == ScanMethod::TRANSPARENCY ||
|
||||||
dev->settings.scan_method == ScanMethod::TRANSPARENCY_INFRARED)
|
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
|
// transparency adapter
|
||||||
move = static_cast<int>(dev->model->y_offset_calib_white_ta - dev->model->y_offset_sensor_to_ta);
|
move = static_cast<int>(dev->model->y_offset_calib_white_ta - dev->model->y_offset_sensor_to_ta);
|
||||||
flags |= ScanFlag::USE_XPA;
|
flags |= ScanFlag::USE_XPA;
|
||||||
|
@ -893,33 +892,6 @@ void CommandSetGl846::init_regs_for_shading(Genesys_Device* dev, const Genesys_S
|
||||||
dev->calib_session = session;
|
dev->calib_session = session;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @brief set up registers for the actual scan
|
|
||||||
*/
|
|
||||||
void CommandSetGl846::init_regs_for_scan(Genesys_Device* dev, const Genesys_Sensor& sensor,
|
|
||||||
Genesys_Register_Set& regs) const
|
|
||||||
{
|
|
||||||
DBG_HELPER(dbg);
|
|
||||||
|
|
||||||
auto session = calculate_scan_session(dev, sensor, dev->settings);
|
|
||||||
|
|
||||||
/* Fast move to scan area:
|
|
||||||
|
|
||||||
We don't move fast the whole distance since it would involve computing
|
|
||||||
acceleration/deceleration distance for scan resolution. So leave a remainder for it so
|
|
||||||
scan makes the final move tuning
|
|
||||||
*/
|
|
||||||
if (dev->settings.get_channels() * dev->settings.yres >= 600 && session.params.starty > 700) {
|
|
||||||
scanner_move(*dev, dev->model->default_method,
|
|
||||||
static_cast<unsigned>(session.params.starty - 500),
|
|
||||||
Direction::FORWARD);
|
|
||||||
session.params.starty = 500;
|
|
||||||
}
|
|
||||||
compute_session(dev, session, sensor);
|
|
||||||
|
|
||||||
init_regs_for_scan_session(dev, sensor, ®s, session);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send shading calibration data. The buffer is considered to always hold values
|
* Send shading calibration data. The buffer is considered to always hold values
|
||||||
* for all the channels.
|
* for all the channels.
|
||||||
|
@ -1182,14 +1154,5 @@ void CommandSetGl846::eject_document(Genesys_Device* dev) const
|
||||||
throw SaneException("not implemented");
|
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 gl846
|
||||||
} // namespace genesys
|
} // namespace genesys
|
||||||
|
|
|
@ -65,9 +65,6 @@ public:
|
||||||
void init_regs_for_shading(Genesys_Device* dev, const Genesys_Sensor& sensor,
|
void init_regs_for_shading(Genesys_Device* dev, const Genesys_Sensor& sensor,
|
||||||
Genesys_Register_Set& regs) const override;
|
Genesys_Register_Set& regs) const override;
|
||||||
|
|
||||||
void init_regs_for_scan(Genesys_Device* dev, const Genesys_Sensor& sensor,
|
|
||||||
Genesys_Register_Set& regs) const override;
|
|
||||||
|
|
||||||
void init_regs_for_scan_session(Genesys_Device* dev, const Genesys_Sensor& sensor,
|
void init_regs_for_scan_session(Genesys_Device* dev, const Genesys_Sensor& sensor,
|
||||||
Genesys_Register_Set* reg,
|
Genesys_Register_Set* reg,
|
||||||
const ScanSession& session) const override;
|
const ScanSession& session) const override;
|
||||||
|
@ -108,8 +105,6 @@ public:
|
||||||
|
|
||||||
void eject_document(Genesys_Device* dev) const override;
|
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,
|
void send_shading_data(Genesys_Device* dev, const Genesys_Sensor& sensor, uint8_t* data,
|
||||||
int size) const override;
|
int size) const override;
|
||||||
|
|
||||||
|
|
|
@ -352,7 +352,6 @@ static void gl847_init_motor_regs_scan(Genesys_Device* dev,
|
||||||
}
|
}
|
||||||
|
|
||||||
reg->set24(REG_FEEDL, feedl);
|
reg->set24(REG_FEEDL, feedl);
|
||||||
DBG(DBG_io ,"%s: feedl=%d\n", __func__, feedl);
|
|
||||||
|
|
||||||
unsigned ccdlmt = (reg->get8(REG_0x0C) & REG_0x0C_CCDLMT) + 1;
|
unsigned ccdlmt = (reg->get8(REG_0x0C) & REG_0x0C_CCDLMT) + 1;
|
||||||
unsigned tgtime = 1 << (reg->get8(REG_0x1C) & REG_0x1C_TGTIME);
|
unsigned tgtime = 1 << (reg->get8(REG_0x1C) & REG_0x1C_TGTIME);
|
||||||
|
@ -604,7 +603,7 @@ ScanSession CommandSetGl847::calculate_scan_session(const Genesys_Device* dev,
|
||||||
if (settings.scan_method == ScanMethod::TRANSPARENCY ||
|
if (settings.scan_method == ScanMethod::TRANSPARENCY ||
|
||||||
settings.scan_method == ScanMethod::TRANSPARENCY_INFRARED)
|
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
|
// transparency adapter
|
||||||
if (!dev->ignore_offsets) {
|
if (!dev->ignore_offsets) {
|
||||||
move = dev->model->y_offset_ta - dev->model->y_offset_sensor_to_ta;
|
move = dev->model->y_offset_ta - dev->model->y_offset_sensor_to_ta;
|
||||||
|
@ -755,7 +754,7 @@ void CommandSetGl847::init_regs_for_shading(Genesys_Device* dev, const Genesys_S
|
||||||
if (dev->settings.scan_method == ScanMethod::TRANSPARENCY ||
|
if (dev->settings.scan_method == ScanMethod::TRANSPARENCY ||
|
||||||
dev->settings.scan_method == ScanMethod::TRANSPARENCY_INFRARED)
|
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
|
// transparency adapter
|
||||||
move = dev->model->y_offset_calib_white_ta - dev->model->y_offset_sensor_to_ta;
|
move = dev->model->y_offset_calib_white_ta - dev->model->y_offset_sensor_to_ta;
|
||||||
flags |= ScanFlag::USE_XPA;
|
flags |= ScanFlag::USE_XPA;
|
||||||
|
@ -790,33 +789,6 @@ void CommandSetGl847::init_regs_for_shading(Genesys_Device* dev, const Genesys_S
|
||||||
dev->calib_session = session;
|
dev->calib_session = session;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @brief set up registers for the actual scan
|
|
||||||
*/
|
|
||||||
void CommandSetGl847::init_regs_for_scan(Genesys_Device* dev, const Genesys_Sensor& sensor,
|
|
||||||
Genesys_Register_Set& regs) const
|
|
||||||
{
|
|
||||||
DBG_HELPER(dbg);
|
|
||||||
|
|
||||||
auto session = calculate_scan_session(dev, sensor, dev->settings);
|
|
||||||
|
|
||||||
/* Fast move to scan area:
|
|
||||||
|
|
||||||
We don't move fast the whole distance since it would involve computing
|
|
||||||
acceleration/deceleration distance for scan resolution. So leave a remainder for it so
|
|
||||||
scan makes the final move tuning
|
|
||||||
*/
|
|
||||||
if (dev->settings.get_channels() * dev->settings.yres >= 600 && session.params.starty > 700) {
|
|
||||||
scanner_move(*dev, dev->model->default_method,
|
|
||||||
static_cast<unsigned>(session.params.starty - 500),
|
|
||||||
Direction::FORWARD);
|
|
||||||
session.params.starty = 500;
|
|
||||||
}
|
|
||||||
compute_session(dev, session, sensor);
|
|
||||||
|
|
||||||
init_regs_for_scan_session(dev, sensor, ®s, session);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send shading calibration data. The buffer is considered to always hold values
|
* Send shading calibration data. The buffer is considered to always hold values
|
||||||
* for all the channels.
|
* for all the channels.
|
||||||
|
@ -1109,14 +1081,5 @@ void CommandSetGl847::eject_document(Genesys_Device* dev) const
|
||||||
throw SaneException("not implemented");
|
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 gl847
|
||||||
} // namespace genesys
|
} // namespace genesys
|
||||||
|
|
|
@ -65,9 +65,6 @@ public:
|
||||||
void init_regs_for_shading(Genesys_Device* dev, const Genesys_Sensor& sensor,
|
void init_regs_for_shading(Genesys_Device* dev, const Genesys_Sensor& sensor,
|
||||||
Genesys_Register_Set& regs) const override;
|
Genesys_Register_Set& regs) const override;
|
||||||
|
|
||||||
void init_regs_for_scan(Genesys_Device* dev, const Genesys_Sensor& sensor,
|
|
||||||
Genesys_Register_Set& regs) const override;
|
|
||||||
|
|
||||||
void init_regs_for_scan_session(Genesys_Device* dev, const Genesys_Sensor& sensor,
|
void init_regs_for_scan_session(Genesys_Device* dev, const Genesys_Sensor& sensor,
|
||||||
Genesys_Register_Set* reg,
|
Genesys_Register_Set* reg,
|
||||||
const ScanSession& session) const override;
|
const ScanSession& session) const override;
|
||||||
|
@ -108,8 +105,6 @@ public:
|
||||||
|
|
||||||
void eject_document(Genesys_Device* dev) const override;
|
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,
|
void send_shading_data(Genesys_Device* dev, const Genesys_Sensor& sensor, uint8_t* data,
|
||||||
int size) const override;
|
int size) const override;
|
||||||
|
|
||||||
|
|
|
@ -440,12 +440,12 @@ void genesys_init_usb_device_tables()
|
||||||
model.x_size_calib_mm = 241.3;
|
model.x_size_calib_mm = 241.3;
|
||||||
|
|
||||||
model.x_offset_ta = 115.0;
|
model.x_offset_ta = 115.0;
|
||||||
model.y_offset_ta = 60.0;
|
model.y_offset_ta = 37.0;
|
||||||
model.x_size_ta = 35.0;
|
model.x_size_ta = 35.0;
|
||||||
model.y_size_ta = 230.0;
|
model.y_size_ta = 230.0;
|
||||||
|
|
||||||
model.y_offset_sensor_to_ta = 46.0;
|
model.y_offset_sensor_to_ta = 23.0;
|
||||||
model.y_offset_calib_white_ta = 47.0;
|
model.y_offset_calib_white_ta = 24.0;
|
||||||
model.y_size_calib_ta_mm = 2.0;
|
model.y_size_calib_ta_mm = 2.0;
|
||||||
|
|
||||||
model.post_scan = 0.0;
|
model.post_scan = 0.0;
|
||||||
|
@ -578,12 +578,12 @@ void genesys_init_usb_device_tables()
|
||||||
model.x_size_calib_mm = 240.70734;
|
model.x_size_calib_mm = 240.70734;
|
||||||
|
|
||||||
model.x_offset_ta = 97.0;
|
model.x_offset_ta = 97.0;
|
||||||
model.y_offset_ta = 27.0;
|
model.y_offset_ta = 38.5;
|
||||||
model.x_size_ta = 70.0;
|
model.x_size_ta = 70.0;
|
||||||
model.y_size_ta = 230.0;
|
model.y_size_ta = 230.0;
|
||||||
|
|
||||||
model.y_offset_sensor_to_ta = 11.5;
|
model.y_offset_sensor_to_ta = 23.0;
|
||||||
model.y_offset_calib_white_ta = 14.0;
|
model.y_offset_calib_white_ta = 25.5;
|
||||||
model.y_size_calib_ta_mm = 3.0;
|
model.y_size_calib_ta_mm = 3.0;
|
||||||
|
|
||||||
model.post_scan = 0.0;
|
model.post_scan = 0.0;
|
||||||
|
|
Ładowanie…
Reference in New Issue