kopia lustrzana https://gitlab.com/sane-project/backends
genesys: Implement support for fast movement curves in the motor table
rodzic
91d5235d4b
commit
a5d63baf3d
|
@ -800,6 +800,7 @@ void CommandSetGl843::set_fe(Genesys_Device* dev, const Genesys_Sensor& sensor,
|
||||||
|
|
||||||
static void gl843_init_motor_regs_scan(Genesys_Device* dev,
|
static void gl843_init_motor_regs_scan(Genesys_Device* dev,
|
||||||
const Genesys_Sensor& sensor,
|
const Genesys_Sensor& sensor,
|
||||||
|
const ScanSession& session,
|
||||||
Genesys_Register_Set* reg,
|
Genesys_Register_Set* reg,
|
||||||
const MotorProfile& motor_profile,
|
const MotorProfile& motor_profile,
|
||||||
unsigned int exposure,
|
unsigned int exposure,
|
||||||
|
@ -863,7 +864,9 @@ static void gl843_init_motor_regs_scan(Genesys_Device* dev,
|
||||||
r->value &= ~REG_0x02_MTRREV;
|
r->value &= ~REG_0x02_MTRREV;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* scan and backtracking slope table */
|
|
||||||
|
|
||||||
|
// scan and backtracking slope table
|
||||||
auto scan_table = sanei_genesys_slope_table(dev->model->asic_type, scan_yres, exposure,
|
auto scan_table = sanei_genesys_slope_table(dev->model->asic_type, scan_yres, exposure,
|
||||||
dev->motor.base_ydpi, step_multiplier,
|
dev->motor.base_ydpi, step_multiplier,
|
||||||
motor_profile);
|
motor_profile);
|
||||||
|
@ -875,10 +878,16 @@ static void gl843_init_motor_regs_scan(Genesys_Device* dev,
|
||||||
reg->set8(REG_FASTNO, scan_table.steps_count / step_multiplier);
|
reg->set8(REG_FASTNO, scan_table.steps_count / step_multiplier);
|
||||||
|
|
||||||
// fast table
|
// 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);
|
unsigned fast_yres = sanei_genesys_get_lowest_ydpi(dev);
|
||||||
auto fast_table = sanei_genesys_slope_table(dev->model->asic_type, fast_yres, exposure,
|
auto fast_table = sanei_genesys_slope_table(dev->model->asic_type, fast_yres, exposure,
|
||||||
dev->motor.base_ydpi, step_multiplier,
|
dev->motor.base_ydpi, step_multiplier,
|
||||||
motor_profile);
|
*fast_profile);
|
||||||
|
|
||||||
gl843_send_slope_table(dev, STOP_TABLE, fast_table.table, fast_table.steps_count);
|
gl843_send_slope_table(dev, STOP_TABLE, fast_table.table, fast_table.steps_count);
|
||||||
gl843_send_slope_table(dev, FAST_TABLE, fast_table.table, fast_table.steps_count);
|
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);
|
gl843_send_slope_table(dev, HOME_TABLE, fast_table.table, fast_table.steps_count);
|
||||||
|
@ -886,12 +895,12 @@ static void gl843_init_motor_regs_scan(Genesys_Device* dev,
|
||||||
reg->set8(REG_FSHDEC, fast_table.steps_count / step_multiplier);
|
reg->set8(REG_FSHDEC, fast_table.steps_count / step_multiplier);
|
||||||
reg->set8(REG_FMOVNO, fast_table.steps_count / step_multiplier);
|
reg->set8(REG_FMOVNO, fast_table.steps_count / step_multiplier);
|
||||||
|
|
||||||
if (motor_profile.motor_vref != -1) {
|
if (motor_profile.motor_vref != -1 && fast_profile->motor_vref != 1) {
|
||||||
std::uint8_t vref = 0;
|
std::uint8_t vref = 0;
|
||||||
vref |= (motor_profile.motor_vref << REG_0x80S_TABLE1_NORMAL) & REG_0x80_TABLE1_NORMAL;
|
vref |= (motor_profile.motor_vref << REG_0x80S_TABLE1_NORMAL) & REG_0x80_TABLE1_NORMAL;
|
||||||
vref |= (motor_profile.motor_vref << REG_0x80S_TABLE2_BACK) & REG_0x80_TABLE2_BACK;
|
vref |= (motor_profile.motor_vref << REG_0x80S_TABLE2_BACK) & REG_0x80_TABLE2_BACK;
|
||||||
vref |= (motor_profile.motor_vref << REG_0x80S_TABLE4_FAST) & REG_0x80_TABLE4_FAST;
|
vref |= (fast_profile->motor_vref << REG_0x80S_TABLE4_FAST) & REG_0x80_TABLE4_FAST;
|
||||||
vref |= (motor_profile.motor_vref << REG_0x80S_TABLE5_GO_HOME) & REG_0x80_TABLE5_GO_HOME;
|
vref |= (fast_profile->motor_vref << REG_0x80S_TABLE5_GO_HOME) & REG_0x80_TABLE5_GO_HOME;
|
||||||
reg->set8(REG_0x80, vref);
|
reg->set8(REG_0x80, vref);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1203,7 +1212,7 @@ void CommandSetGl843::init_regs_for_scan_session(Genesys_Device* dev, const Gene
|
||||||
mflags |= MotorFlag::REVERSE;
|
mflags |= MotorFlag::REVERSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
gl843_init_motor_regs_scan(dev, sensor, reg, motor_profile, exposure, slope_dpi,
|
gl843_init_motor_regs_scan(dev, sensor, session, reg, motor_profile, exposure, slope_dpi,
|
||||||
session.optical_line_count, dummy, session.params.starty, mflags);
|
session.optical_line_count, dummy, session.params.starty, mflags);
|
||||||
|
|
||||||
dev->read_buffer.clear();
|
dev->read_buffer.clear();
|
||||||
|
|
|
@ -185,7 +185,10 @@ std::ostream& operator<<(std::ostream& out, const Genesys_Motor& motor)
|
||||||
<< " optical_ydpi: " << motor.optical_ydpi << '\n'
|
<< " optical_ydpi: " << motor.optical_ydpi << '\n'
|
||||||
<< " profiles: "
|
<< " profiles: "
|
||||||
<< format_indent_braced_list(4, format_vector_indent_braced(4, "MotorProfile",
|
<< format_indent_braced_list(4, format_vector_indent_braced(4, "MotorProfile",
|
||||||
motor.profiles))
|
motor.profiles)) << '\n'
|
||||||
|
<< " fast_profiles: "
|
||||||
|
<< format_indent_braced_list(4, format_vector_indent_braced(4, "MotorProfile",
|
||||||
|
motor.fast_profiles)) << '\n'
|
||||||
<< '}';
|
<< '}';
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
|
@ -172,6 +172,8 @@ struct Genesys_Motor
|
||||||
int optical_ydpi = 0;
|
int optical_ydpi = 0;
|
||||||
// slopes to derive individual slopes from
|
// slopes to derive individual slopes from
|
||||||
std::vector<MotorProfile> profiles;
|
std::vector<MotorProfile> profiles;
|
||||||
|
// slopes to derive individual slopes from for fast moving
|
||||||
|
std::vector<MotorProfile> fast_profiles;
|
||||||
|
|
||||||
MotorSlope& get_slope_with_step_type(StepType step_type)
|
MotorSlope& get_slope_with_step_type(StepType step_type)
|
||||||
{
|
{
|
||||||
|
|
Ładowanie…
Reference in New Issue