Merge branch 'genesys-improve-motor-tables' into 'master'

genesys: Improve motor tables

See merge request sane-project/backends!319
merge-requests/320/head
Povilas Kanapickas 2020-02-01 12:47:38 +00:00
commit 50788b3827
2 zmienionych plików z 164 dodań i 28 usunięć

Wyświetl plik

@ -402,11 +402,11 @@ gl843_init_registers (Genesys_Device * dev)
// STEPSEL[0:1]. Motor movement step mode selection for tables 1-3 in
// scanning mode.
// MTRPWM[0:5]. Motor phase PWM duty cycle setting for tables 1-3
dev->reg.init_reg(0x67, 0x7f);
dev->reg.init_reg(0x67, 0x7f); // MOTOR_PROFILE
// FSTPSEL[0:1]: Motor movement step mode selection for tables 4-5 in
// command mode.
// FASTPWM[5:0]: Motor phase PWM duty cycle setting for tables 4-5
dev->reg.init_reg(0x68, 0x7f);
dev->reg.init_reg(0x68, 0x7f); // MOTOR_PROFILE
if (dev->model->model_id == ModelId::PLUSTEK_OPTICFILM_7300) {
dev->reg.init_reg(0x67, 0x80);
@ -415,17 +415,11 @@ gl843_init_registers (Genesys_Device * dev)
// FSHDEC[0:7]: The number of deceleration steps after scanning is finished
// (table 3)
dev->reg.init_reg(0x69, 0x01);
if (dev->model->model_id == ModelId::CANON_8600F) {
dev->reg.init_reg(0x69, 64);
}
dev->reg.init_reg(0x69, 0x01); // MOTOR_PROFILE
// FMOVNO[0:7] The number of acceleration or deceleration steps for fast
// moving (table 4)
dev->reg.init_reg(0x6a, 0x04);
if (dev->model->model_id == ModelId::CANON_8600F) {
dev->reg.init_reg(0x69, 64);
}
dev->reg.init_reg(0x6a, 0x04); // MOTOR_PROFILE
// GPIO-related register bits
dev->reg.init_reg(0x6b, 0x30);
@ -516,7 +510,7 @@ gl843_init_registers (Genesys_Device * dev)
// VRHOME, VRMOVE, VRBACK, VRSCAN: Vref settings of the motor driver IC for
// moving in various situations.
dev->reg.init_reg(0x80, 0x00);
dev->reg.init_reg(0x80, 0x00); // MOTOR_PROFILE
if (dev->model->model_id == ModelId::CANON_4400F) {
dev->reg.init_reg(0x80, 0x0c);
}
@ -797,6 +791,19 @@ void CommandSetGl843::set_fe(Genesys_Device* dev, const Genesys_Sensor& sensor,
}
}
static bool should_use_new_fast_table(const Genesys_Device& dev)
{
switch (dev.model->model_id) {
case ModelId::CANON_8600F:
case ModelId::CANON_8400F:
case ModelId::PLUSTEK_OPTICFILM_7200I:
case ModelId::PLUSTEK_OPTICFILM_7300:
case ModelId::PLUSTEK_OPTICFILM_7500I:
return true;
default:
return false;
}
}
static void gl843_init_motor_regs_scan(Genesys_Device* dev,
const Genesys_Sensor& sensor,
@ -877,22 +884,38 @@ static void gl843_init_motor_regs_scan(Genesys_Device* dev,
reg->set8(REG_STEPNO, scan_table.steps_count / step_multiplier);
reg->set8(REG_FASTNO, scan_table.steps_count / step_multiplier);
if (should_use_new_fast_table(*dev)) {
// FIXME: move all models to the 8600F behavior
gl843_send_slope_table(dev, STOP_TABLE, scan_table.table, scan_table.steps_count);
reg->set8(REG_FSHDEC, scan_table.steps_count / step_multiplier);
}
// fast table
const auto* fast_profile = get_motor_profile_ptr(dev->motor.fast_profiles, 0, session);
if (fast_profile == nullptr) {
fast_profile = &motor_profile;
}
unsigned fast_yres = sanei_genesys_get_lowest_ydpi(dev);
auto fast_table = sanei_genesys_slope_table(dev->model->asic_type, fast_yres, exposure,
dev->motor.base_ydpi, step_multiplier,
*fast_profile);
MotorSlopeTable fast_table;
gl843_send_slope_table(dev, STOP_TABLE, fast_table.table, fast_table.steps_count);
if (should_use_new_fast_table(*dev)) {
fast_table = create_slope_table_fastest(dev->model->asic_type, step_multiplier,
*fast_profile);
} else {
unsigned fast_yres = sanei_genesys_get_lowest_ydpi(dev);
fast_table = sanei_genesys_slope_table(dev->model->asic_type, fast_yres, exposure,
dev->motor.base_ydpi, step_multiplier,
*fast_profile);
}
if (!should_use_new_fast_table(*dev)) {
// FIXME: move all models to the 8600F behavior
gl843_send_slope_table(dev, STOP_TABLE, fast_table.table, fast_table.steps_count);
reg->set8(REG_FSHDEC, fast_table.steps_count / step_multiplier);
}
gl843_send_slope_table(dev, FAST_TABLE, fast_table.table, fast_table.steps_count);
gl843_send_slope_table(dev, HOME_TABLE, fast_table.table, fast_table.steps_count);
reg->set8(REG_FSHDEC, fast_table.steps_count / step_multiplier);
reg->set8(REG_FMOVNO, fast_table.steps_count / step_multiplier);
if (motor_profile.motor_vref != -1 && fast_profile->motor_vref != 1) {

Wyświetl plik

@ -53,6 +53,8 @@ void genesys_init_motor_tables()
{
s_motors.init();
MotorProfile profile;
Genesys_Motor motor;
motor.id = MotorId::UMAX;
motor.base_ydpi = 1200;
@ -252,8 +254,31 @@ void genesys_init_motor_tables()
motor.id = MotorId::CANON_8400F;
motor.base_ydpi = 1600;
motor.optical_ydpi = 6400;
motor.profiles.push_back({MotorSlope::create_from_steps(8743, 300, 794),
StepType::QUARTER, 50000});
profile = MotorProfile();
profile.slope = MotorSlope::create_from_steps(20202 * 4, 900 * 4, 50);
profile.step_type = StepType::QUARTER;
profile.motor_vref = 0;
profile.resolutions = ResolutionFilter::ANY;
profile.scan_methods = { ScanMethod::FLATBED };
motor.profiles.push_back(std::move(profile));
profile = MotorProfile();
profile.slope = MotorSlope::create_from_steps(65535 * 4, 900 * 4, 100);
profile.step_type = StepType::QUARTER;
profile.motor_vref = 2;
profile.resolutions = ResolutionFilter::ANY;
profile.scan_methods = { ScanMethod::TRANSPARENCY, ScanMethod::TRANSPARENCY_INFRARED };
motor.profiles.push_back(std::move(profile));
profile = MotorProfile();
profile.slope = MotorSlope::create_from_steps(65535 * 4, 333 * 4, 200);
profile.step_type = StepType::QUARTER;
profile.motor_vref = 2;
profile.resolutions = ResolutionFilter::ANY;
profile.scan_methods = ScanMethodFilter::ANY;
motor.fast_profiles.push_back(std::move(profile));
s_motors->push_back(std::move(motor));
@ -261,10 +286,64 @@ void genesys_init_motor_tables()
motor.id = MotorId::CANON_8600F;
motor.base_ydpi = 2400;
motor.optical_ydpi = 9600;
// BUG: this is a fallback slope that was selected previously and preserved for compatibility
motor.profiles.push_back({MotorSlope::create_from_steps(44444, 500, 489), StepType::HALF, 0});
motor.profiles.push_back({MotorSlope::create_from_steps(54612, 1500, 219),
StepType::QUARTER, 23000});
profile = MotorProfile();
profile.slope = MotorSlope::create_from_steps(54612, 1500, 219);
profile.step_type = StepType::QUARTER;
profile.motor_vref = 3;
profile.resolutions = { 300, 600 };
profile.scan_methods = { ScanMethod::FLATBED };
motor.profiles.push_back(std::move(profile));
profile = MotorProfile();
profile.slope = MotorSlope::create_from_steps(54612, 1500, 219);
profile.step_type = StepType::HALF;
profile.motor_vref = 2;
profile.resolutions = { 1200, 2400 };
profile.scan_methods = { ScanMethod::FLATBED };
motor.profiles.push_back(std::move(profile));
profile = MotorProfile();
profile.slope = MotorSlope::create_from_steps(54612, 1500, 219);
profile.step_type = StepType::QUARTER;
profile.motor_vref = 2;
profile.resolutions = { 4800 };
profile.scan_methods = { ScanMethod::FLATBED };
motor.profiles.push_back(std::move(profile));
profile = MotorProfile();
profile.slope = MotorSlope::create_from_steps(54612, 1500, 219);
profile.step_type = StepType::QUARTER;
profile.motor_vref = 2;
profile.resolutions = { 300, 600 };
profile.scan_methods = { ScanMethod::TRANSPARENCY,
ScanMethod::TRANSPARENCY_INFRARED };
motor.profiles.push_back(std::move(profile));
profile = MotorProfile();
profile.slope = MotorSlope::create_from_steps(54612, 1500, 219);
profile.step_type = StepType::HALF;
profile.motor_vref = 1;
profile.resolutions = { 1200, 2400 };
profile.scan_methods = { ScanMethod::TRANSPARENCY,
ScanMethod::TRANSPARENCY_INFRARED };
motor.profiles.push_back(std::move(profile));
profile = MotorProfile();
profile.slope = MotorSlope::create_from_steps(54612, 1500, 219);
profile.step_type = StepType::QUARTER;
profile.motor_vref = 0;
profile.resolutions = { 4800 };
profile.scan_methods = { ScanMethod::TRANSPARENCY,
ScanMethod::TRANSPARENCY_INFRARED };
motor.profiles.push_back(std::move(profile));
profile = MotorProfile();
profile.slope = MotorSlope::create_from_steps(59240, 582, 1020);
profile.step_type = StepType::HALF;
profile.motor_vref = 2;
motor.fast_profiles.push_back(std::move(profile));
s_motors->push_back(std::move(motor));
@ -326,7 +405,19 @@ void genesys_init_motor_tables()
motor.id = MotorId::PLUSTEK_OPTICFILM_7200I;
motor.base_ydpi = 3600;
motor.optical_ydpi = 3600;
motor.profiles.push_back({MotorSlope::create_from_steps(39682, 1191, 15), StepType::HALF, 0});
profile = MotorProfile();
profile.slope = MotorSlope::create_from_steps(34722 * 2, 454 * 2, 40);
profile.step_type = StepType::HALF;
profile.motor_vref = 3;
motor.profiles.push_back(std::move(profile));
profile = MotorProfile();
profile.slope = MotorSlope::create_from_steps(34722 * 2, 454 * 2, 40);
profile.step_type = StepType::HALF;
profile.motor_vref = 0;
motor.fast_profiles.push_back(std::move(profile));
s_motors->push_back(std::move(motor));
@ -334,8 +425,19 @@ void genesys_init_motor_tables()
motor.id = MotorId::PLUSTEK_OPTICFILM_7300;
motor.base_ydpi = 3600;
motor.optical_ydpi = 3600;
motor.profiles.push_back({MotorSlope::create_from_steps(31250, 1512, 6),
StepType::QUARTER, 12100});
profile = MotorProfile();
profile.slope = MotorSlope::create_from_steps(56818 * 4, 454 * 4, 30);
profile.step_type = StepType::QUARTER;
profile.motor_vref = 3;
motor.profiles.push_back(std::move(profile));
profile = MotorProfile();
profile.slope = MotorSlope::create_from_steps(56818 * 4, 454 * 4, 30);
profile.step_type = StepType::QUARTER;
profile.motor_vref = 0;
motor.fast_profiles.push_back(std::move(profile));
s_motors->push_back(std::move(motor));
@ -343,8 +445,19 @@ void genesys_init_motor_tables()
motor.id = MotorId::PLUSTEK_OPTICFILM_7500I;
motor.base_ydpi = 3600;
motor.optical_ydpi = 3600;
motor.profiles.push_back({MotorSlope::create_from_steps(31250, 1375, 7),
StepType::QUARTER, 0});
profile = MotorProfile();
profile.slope = MotorSlope::create_from_steps(56818 * 4, 454 * 4, 30);
profile.step_type = StepType::QUARTER;
profile.motor_vref = 3;
motor.profiles.push_back(std::move(profile));
profile = MotorProfile();
profile.slope = MotorSlope::create_from_steps(56818 * 4, 454 * 4, 30);
profile.step_type = StepType::QUARTER;
profile.motor_vref = 0;
motor.fast_profiles.push_back(std::move(profile));
s_motors->push_back(std::move(motor));