Merge branch 'genesys-cleanup-motor-dpi' into 'master'

genesys: Merge motor optical_ydpi to base_ydpi

See merge request sane-project/backends!417
merge-requests/418/head
Povilas Kanapickas 2020-04-22 20:09:23 +00:00
commit a70beba79c
7 zmienionych plików z 16 dodań i 54 usunięć

Wyświetl plik

@ -207,7 +207,7 @@ struct Genesys_Model
// Amount of feeding needed to eject document after finishing scanning in mm
float eject_feed = 0;
// Line-distance correction (in pixel at optical_ydpi) for CCD scanners
// Line-distance correction (in pixel at motor base_ydpi) for CCD scanners
SANE_Int ld_shift_r = 0;
SANE_Int ld_shift_g = 0;
SANE_Int ld_shift_b = 0;

Wyświetl plik

@ -731,8 +731,8 @@ void CommandSetGl646::init_regs_for_scan_session(Genesys_Device* dev, const Gene
feedl = move;
if (session.num_staggered_lines + session.max_color_shift_lines > 0 && feedl != 0) {
int feed_offset = ((session.max_color_shift_lines + session.num_staggered_lines) * dev->motor.optical_ydpi) /
motor->dpi;
unsigned total_lines = session.max_color_shift_lines + session.num_staggered_lines;
int feed_offset = (total_lines * dev->motor.base_ydpi) / motor->dpi;
if (feedl > feed_offset) {
feedl = feedl - feed_offset;
}
@ -1997,7 +1997,6 @@ static ScanSession setup_for_scan(Genesys_Device* dev,
// compute distance to move
float move = 0;
// XXX STEF XXX MD5345 -> optical_ydpi, other base_ydpi => half/full step ? */
if (!split) {
if (!dev->model->is_sheetfed) {
if (ycorrection) {
@ -2013,7 +2012,7 @@ static ScanSession setup_for_scan(Genesys_Device* dev,
move = 0;
}
}
move = static_cast<float>((move * dev->motor.optical_ydpi) / MM_PER_INCH);
move = static_cast<float>((move * dev->motor.base_ydpi) / MM_PER_INCH);
DBG(DBG_info, "%s: move=%f steps\n", __func__, move);
float start = settings.tl_x;
@ -3419,7 +3418,6 @@ ScanSession CommandSetGl646::calculate_scan_session(const Genesys_Device* dev,
{
// compute distance to move
float move = 0;
// XXX STEF XXX MD5345 -> optical_ydpi, other base_ydpi => half/full step ? */
if (!dev->model->is_sheetfed) {
move = dev->model->y_offset;
// add tl_y to base movement
@ -3431,7 +3429,7 @@ ScanSession CommandSetGl646::calculate_scan_session(const Genesys_Device* dev,
move = 0;
}
move = static_cast<float>((move * dev->motor.optical_ydpi) / MM_PER_INCH);
move = static_cast<float>((move * dev->motor.base_ydpi) / MM_PER_INCH);
float start = settings.tl_x;
if (settings.scan_method == ScanMethod::FLATBED) {
start += dev->model->x_offset;

Wyświetl plik

@ -182,7 +182,6 @@ std::ostream& operator<<(std::ostream& out, const Genesys_Motor& motor)
out << "Genesys_Motor{\n"
<< " id: " << motor.id << '\n'
<< " base_ydpi: " << motor.base_ydpi << '\n'
<< " optical_ydpi: " << motor.optical_ydpi << '\n'
<< " profiles: "
<< format_indent_braced_list(4, format_vector_indent_braced(4, "MotorProfile",
motor.profiles)) << '\n'

Wyświetl plik

@ -169,8 +169,6 @@ struct Genesys_Motor
MotorId id = MotorId::UNKNOWN;
// motor base steps. Unit: 1/inch
int base_ydpi = 0;
// maximum resolution in y-direction. Unit: 1/inch
int optical_ydpi = 0;
// slopes to derive individual slopes from
std::vector<MotorProfile> profiles;
// slopes to derive individual slopes from for fast moving

Wyświetl plik

@ -1194,8 +1194,8 @@ void genesys_init_usb_device_tables()
model.post_scan = 0.0;
model.eject_feed = 0.0;
model.ld_shift_r = 16;
model.ld_shift_g = 8;
model.ld_shift_r = 32;
model.ld_shift_g = 16;
model.ld_shift_b = 0;
model.line_mode_color_order = ColorOrder::RGB;
@ -1502,8 +1502,8 @@ void genesys_init_usb_device_tables()
model.post_scan = 0.0;
model.eject_feed = 0.0;
model.ld_shift_r = 48;
model.ld_shift_g = 24;
model.ld_shift_r = 96;
model.ld_shift_g = 48;
model.ld_shift_b = 0;
model.line_mode_color_order = ColorOrder::RGB;
@ -2066,8 +2066,8 @@ void genesys_init_usb_device_tables()
model.post_scan = 0.0;
model.eject_feed = 0.0;
model.ld_shift_r = 48;
model.ld_shift_g = 24;
model.ld_shift_r = 96;
model.ld_shift_g = 48;
model.ld_shift_b = 0;
model.line_mode_color_order = ColorOrder::RGB;
@ -2122,8 +2122,8 @@ void genesys_init_usb_device_tables()
model.post_scan = 0.0;
model.eject_feed = 0.0;
model.ld_shift_r = 48;
model.ld_shift_g = 24;
model.ld_shift_r = 96;
model.ld_shift_g = 48;
model.ld_shift_b = 0;
model.line_mode_color_order = ColorOrder::RGB;

Wyświetl plik

@ -57,8 +57,7 @@ void genesys_init_motor_tables()
Genesys_Motor motor;
motor.id = MotorId::UMAX;
motor.base_ydpi = 1200;
motor.optical_ydpi = 2400;
motor.base_ydpi = 2400;
motor.profiles.push_back({MotorSlope::create_from_steps(11000, 3000, 128), StepType::FULL, 0});
motor.profiles.push_back({MotorSlope::create_from_steps(11000, 3000, 128), StepType::HALF, 0});
s_motors->push_back(std::move(motor));
@ -66,8 +65,7 @@ void genesys_init_motor_tables()
motor = Genesys_Motor();
motor.id = MotorId::MD_5345; // MD5345/6228/6471
motor.base_ydpi = 1200;
motor.optical_ydpi = 2400;
motor.base_ydpi = 2400;
motor.profiles.push_back({MotorSlope::create_from_steps(2000, 1375, 128), StepType::FULL, 0});
motor.profiles.push_back({MotorSlope::create_from_steps(2000, 1375, 128), StepType::HALF, 0});
s_motors->push_back(std::move(motor));
@ -76,7 +74,6 @@ void genesys_init_motor_tables()
motor = Genesys_Motor();
motor.id = MotorId::ST24;
motor.base_ydpi = 2400;
motor.optical_ydpi = 2400;
motor.profiles.push_back({MotorSlope::create_from_steps(2289, 2100, 128), StepType::FULL, 0});
motor.profiles.push_back({MotorSlope::create_from_steps(2289, 2100, 128), StepType::HALF, 0});
s_motors->push_back(std::move(motor));
@ -85,7 +82,6 @@ void genesys_init_motor_tables()
motor = Genesys_Motor();
motor.id = MotorId::HP3670;
motor.base_ydpi = 1200;
motor.optical_ydpi = 1200;
motor.profiles.push_back({MotorSlope::create_from_steps(11000, 3000, 128), StepType::FULL, 0});
motor.profiles.push_back({MotorSlope::create_from_steps(11000, 3000, 128), StepType::HALF, 0});
s_motors->push_back(std::move(motor));
@ -94,7 +90,6 @@ void genesys_init_motor_tables()
motor = Genesys_Motor();
motor.id = MotorId::HP2400;
motor.base_ydpi = 1200;
motor.optical_ydpi = 1200;
motor.profiles.push_back({MotorSlope::create_from_steps(11000, 3000, 128), StepType::FULL, 0});
motor.profiles.push_back({MotorSlope::create_from_steps(11000, 3000, 128), StepType::HALF, 0});
s_motors->push_back(std::move(motor));
@ -102,8 +97,7 @@ void genesys_init_motor_tables()
motor = Genesys_Motor();
motor.id = MotorId::HP2300;
motor.base_ydpi = 600;
motor.optical_ydpi = 1200;
motor.base_ydpi = 1200;
motor.profiles.push_back({MotorSlope::create_from_steps(3200, 1200, 128), StepType::FULL, 0});
motor.profiles.push_back({MotorSlope::create_from_steps(3200, 1200, 128), StepType::HALF, 0});
s_motors->push_back(std::move(motor));
@ -112,7 +106,6 @@ void genesys_init_motor_tables()
motor = Genesys_Motor();
motor.id = MotorId::CANON_LIDE_35;
motor.base_ydpi = 1200;
motor.optical_ydpi = 2400;
motor.profiles.push_back({MotorSlope::create_from_steps(3500, 1300, 60), StepType::FULL, 0});
motor.profiles.push_back({MotorSlope::create_from_steps(3500, 1400, 60), StepType::HALF, 0});
s_motors->push_back(std::move(motor));
@ -121,7 +114,6 @@ void genesys_init_motor_tables()
motor = Genesys_Motor();
motor.id = MotorId::XP200;
motor.base_ydpi = 600;
motor.optical_ydpi = 600;
motor.profiles.push_back({MotorSlope::create_from_steps(3500, 1300, 60), StepType::FULL, 0});
motor.profiles.push_back({MotorSlope::create_from_steps(3500, 1300, 60), StepType::HALF, 0});
s_motors->push_back(std::move(motor));
@ -130,7 +122,6 @@ void genesys_init_motor_tables()
motor = Genesys_Motor();
motor.id = MotorId::XP300;
motor.base_ydpi = 300;
motor.optical_ydpi = 600;
// works best with GPIO10, GPIO14 off
motor.profiles.push_back({MotorSlope::create_from_steps(3700, 3700, 2), StepType::FULL, 0});
motor.profiles.push_back({MotorSlope::create_from_steps(11000, 11000, 2), StepType::HALF, 0});
@ -140,7 +131,6 @@ void genesys_init_motor_tables()
motor = Genesys_Motor();
motor.id = MotorId::DP665;
motor.base_ydpi = 750;
motor.optical_ydpi = 1500;
motor.profiles.push_back({MotorSlope::create_from_steps(3000, 2500, 10), StepType::FULL, 0});
motor.profiles.push_back({MotorSlope::create_from_steps(11000, 11000, 2), StepType::HALF, 0});
s_motors->push_back(std::move(motor));
@ -149,7 +139,6 @@ void genesys_init_motor_tables()
motor = Genesys_Motor();
motor.id = MotorId::ROADWARRIOR;
motor.base_ydpi = 750;
motor.optical_ydpi = 1500;
motor.profiles.push_back({MotorSlope::create_from_steps(3000, 2600, 10), StepType::FULL, 0});
motor.profiles.push_back({MotorSlope::create_from_steps(11000, 11000, 2), StepType::HALF, 0});
s_motors->push_back(std::move(motor));
@ -158,7 +147,6 @@ void genesys_init_motor_tables()
motor = Genesys_Motor();
motor.id = MotorId::DSMOBILE_600;
motor.base_ydpi = 750;
motor.optical_ydpi = 1500;
motor.profiles.push_back({MotorSlope::create_from_steps(6666, 3700, 8), StepType::FULL, 0});
motor.profiles.push_back({MotorSlope::create_from_steps(6666, 3700, 8), StepType::HALF, 0});
s_motors->push_back(std::move(motor));
@ -167,7 +155,6 @@ void genesys_init_motor_tables()
motor = Genesys_Motor();
motor.id = MotorId::CANON_LIDE_100;
motor.base_ydpi = 1200;
motor.optical_ydpi = 6400;
motor.profiles.push_back({MotorSlope::create_from_steps(46876, 864, 255),
StepType::HALF, 1432});
motor.profiles.push_back({MotorSlope::create_from_steps(46876, 864, 279),
@ -180,7 +167,6 @@ void genesys_init_motor_tables()
motor = Genesys_Motor();
motor.id = MotorId::CANON_LIDE_200;
motor.base_ydpi = 1200;
motor.optical_ydpi = 6400;
motor.profiles.push_back({MotorSlope::create_from_steps(46876, 864, 255),
StepType::HALF, 1432});
motor.profiles.push_back({MotorSlope::create_from_steps(46876, 864, 279),
@ -195,7 +181,6 @@ void genesys_init_motor_tables()
motor = Genesys_Motor();
motor.id = MotorId::CANON_LIDE_700;
motor.base_ydpi = 1200;
motor.optical_ydpi = 6400;
motor.profiles.push_back({MotorSlope::create_from_steps(46876, 534, 255),
StepType::HALF, 1424});
motor.profiles.push_back({MotorSlope::create_from_steps(46876, 534, 255),
@ -212,7 +197,6 @@ void genesys_init_motor_tables()
motor = Genesys_Motor();
motor.id = MotorId::KVSS080;
motor.base_ydpi = 1200;
motor.optical_ydpi = 1200;
motor.profiles.push_back({MotorSlope::create_from_steps(44444, 500, 489),
StepType::HALF, 8000});
s_motors->push_back(std::move(motor));
@ -221,7 +205,6 @@ void genesys_init_motor_tables()
motor = Genesys_Motor();
motor.id = MotorId::G4050;
motor.base_ydpi = 2400;
motor.optical_ydpi = 9600;
motor.profiles.push_back({MotorSlope::create_from_steps(7842, 320, 602),
StepType::HALF, 8016});
motor.profiles.push_back({MotorSlope::create_from_steps(9422, 254, 1004),
@ -236,7 +219,6 @@ void genesys_init_motor_tables()
motor = Genesys_Motor();
motor.id = MotorId::CANON_4400F;
motor.base_ydpi = 2400;
motor.optical_ydpi = 9600;
profile = MotorProfile();
profile.slope = MotorSlope::create_from_steps(28597 * 2, 727 * 2, 200);
@ -264,7 +246,6 @@ void genesys_init_motor_tables()
motor = Genesys_Motor();
motor.id = MotorId::CANON_8400F;
motor.base_ydpi = 1600;
motor.optical_ydpi = 6400;
profile = MotorProfile();
profile.slope = MotorSlope::create_from_steps(20202 * 4, 333 * 4, 100);
@ -296,7 +277,6 @@ void genesys_init_motor_tables()
motor = Genesys_Motor();
motor.id = MotorId::CANON_8600F;
motor.base_ydpi = 2400;
motor.optical_ydpi = 9600;
profile = MotorProfile();
profile.slope = MotorSlope::create_from_steps(54612, 1500, 219);
@ -361,7 +341,6 @@ void genesys_init_motor_tables()
motor = Genesys_Motor();
motor.id = MotorId::CANON_LIDE_110;
motor.base_ydpi = 4800;
motor.optical_ydpi = 9600;
motor.profiles.push_back({MotorSlope::create_from_steps(62496, 335, 255),
StepType::FULL, 2768});
motor.profiles.push_back({MotorSlope::create_from_steps(62496, 335, 469),
@ -376,7 +355,6 @@ void genesys_init_motor_tables()
motor = Genesys_Motor();
motor.id = MotorId::CANON_LIDE_120;
motor.base_ydpi = 4800;
motor.optical_ydpi = 9600;
motor.profiles.push_back({MotorSlope::create_from_steps(62496, 864, 127),
StepType::FULL, 4608});
motor.profiles.push_back({MotorSlope::create_from_steps(62496, 2010, 63),
@ -391,7 +369,6 @@ void genesys_init_motor_tables()
motor = Genesys_Motor();
motor.id = MotorId::CANON_LIDE_210;
motor.base_ydpi = 4800;
motor.optical_ydpi = 9600;
motor.profiles.push_back({MotorSlope::create_from_steps(62496, 335, 255),
StepType::FULL, 2768});
motor.profiles.push_back({MotorSlope::create_from_steps(62496, 335, 469),
@ -408,7 +385,6 @@ void genesys_init_motor_tables()
motor = Genesys_Motor();
motor.id = MotorId::PLUSTEK_OPTICPRO_3600;
motor.base_ydpi = 1200;
motor.optical_ydpi = 2400;
motor.profiles.push_back({MotorSlope::create_from_steps(3500, 1300, 60), StepType::FULL, 0});
motor.profiles.push_back({MotorSlope::create_from_steps(3500, 3250, 60), StepType::HALF, 0});
s_motors->push_back(std::move(motor));
@ -417,7 +393,6 @@ void genesys_init_motor_tables()
motor = Genesys_Motor();
motor.id = MotorId::PLUSTEK_OPTICFILM_7200I;
motor.base_ydpi = 3600;
motor.optical_ydpi = 3600;
profile = MotorProfile();
profile.slope = MotorSlope::create_from_steps(34722 * 2, 454 * 2, 40);
@ -437,7 +412,6 @@ void genesys_init_motor_tables()
motor = Genesys_Motor();
motor.id = MotorId::PLUSTEK_OPTICFILM_7300;
motor.base_ydpi = 3600;
motor.optical_ydpi = 3600;
profile = MotorProfile();
profile.slope = MotorSlope::create_from_steps(56818 * 4, 454 * 4, 30);
@ -457,7 +431,6 @@ void genesys_init_motor_tables()
motor = Genesys_Motor();
motor.id = MotorId::PLUSTEK_OPTICFILM_7400;
motor.base_ydpi = 3600;
motor.optical_ydpi = 3600;
profile = MotorProfile();
profile.slope = MotorSlope::create_from_steps(64102 * 4, 400 * 4, 30);
@ -471,7 +444,6 @@ void genesys_init_motor_tables()
motor = Genesys_Motor();
motor.id = MotorId::PLUSTEK_OPTICFILM_7500I;
motor.base_ydpi = 3600;
motor.optical_ydpi = 3600;
profile = MotorProfile();
profile.slope = MotorSlope::create_from_steps(56818 * 4, 454 * 4, 30);
@ -491,7 +463,6 @@ void genesys_init_motor_tables()
motor = Genesys_Motor();
motor.id = MotorId::PLUSTEK_OPTICFILM_8200I;
motor.base_ydpi = 3600;
motor.optical_ydpi = 3600;
profile = MotorProfile();
profile.slope = MotorSlope::create_from_steps(64102 * 4, 400 * 4, 100);
@ -505,7 +476,6 @@ void genesys_init_motor_tables()
motor = Genesys_Motor();
motor.id = MotorId::IMG101;
motor.base_ydpi = 600;
motor.optical_ydpi = 1200;
motor.profiles.push_back({MotorSlope::create_from_steps(22000, 1000, 1017),
StepType::HALF, 11000});
s_motors->push_back(std::move(motor));
@ -514,7 +484,6 @@ void genesys_init_motor_tables()
motor = Genesys_Motor();
motor.id = MotorId::PLUSTEK_OPTICBOOK_3800;
motor.base_ydpi = 600;
motor.optical_ydpi = 1200;
motor.profiles.push_back({MotorSlope::create_from_steps(22000, 1000, 1017),
StepType::HALF, 11000});
s_motors->push_back(std::move(motor));
@ -523,7 +492,6 @@ void genesys_init_motor_tables()
motor = Genesys_Motor();
motor.id = MotorId::CANON_LIDE_80;
motor.base_ydpi = 2400;
motor.optical_ydpi = 4800; // 9600
motor.profiles.push_back({MotorSlope::create_from_steps(9560, 1912, 31), StepType::FULL, 0});
s_motors->push_back(std::move(motor));
}

Wyświetl plik

@ -39,7 +39,6 @@ void test_create_slope_table3()
Genesys_Motor motor;
motor.id = MotorId::CANON_LIDE_200;
motor.base_ydpi = 1200;
motor.optical_ydpi = 6400;
motor.profiles.push_back({MotorSlope::create_from_steps(10000, 1000, 20), StepType::FULL, 0});
motor.profiles.push_back({MotorSlope::create_from_steps(10000, 1000, 20), StepType::HALF, 0});
motor.profiles.push_back({MotorSlope::create_from_steps(10000, 1000, 16),