kopia lustrzana https://gitlab.com/sane-project/backends
genesys; Rename create_slope_table{=>_speed}()
rodzic
4605d379bb
commit
fe3677b68f
|
@ -358,8 +358,8 @@ MotorSlopeTable sanei_genesys_create_slope_table3(AsicType asic_type, const Gene
|
|||
{
|
||||
unsigned target_speed_w = (exposure_time * yres) / motor.base_ydpi;
|
||||
|
||||
return create_slope_table(motor.get_slope_with_step_type(step_type), target_speed_w,
|
||||
step_type, 1, 1, get_slope_table_max_size(asic_type));
|
||||
return create_slope_table_for_speed(motor.get_slope_with_step_type(step_type), target_speed_w,
|
||||
step_type, 1, 1, get_slope_table_max_size(asic_type));
|
||||
}
|
||||
|
||||
/** @brief computes gamma table
|
||||
|
|
|
@ -502,10 +502,12 @@ void CommandSetGl646::init_regs_for_scan_session(Genesys_Device* dev, const Gene
|
|||
scanner_setup_sensor(*dev, sensor, *regs);
|
||||
|
||||
/* now generate slope tables : we are not using generate_slope_table3 yet */
|
||||
auto slope_table1 = create_slope_table(motor->slope1, motor->slope1.max_speed_w, StepType::FULL,
|
||||
1, 4, get_slope_table_max_size(AsicType::GL646));
|
||||
auto slope_table2 = create_slope_table(motor->slope2, motor->slope2.max_speed_w, StepType::FULL,
|
||||
1, 4, get_slope_table_max_size(AsicType::GL646));
|
||||
auto slope_table1 = create_slope_table_for_speed(motor->slope1, motor->slope1.max_speed_w,
|
||||
StepType::FULL, 1, 4,
|
||||
get_slope_table_max_size(AsicType::GL646));
|
||||
auto slope_table2 = create_slope_table_for_speed(motor->slope2, motor->slope2.max_speed_w,
|
||||
StepType::FULL, 1, 4,
|
||||
get_slope_table_max_size(AsicType::GL646));
|
||||
|
||||
/* R01 */
|
||||
/* now setup other registers for final scan (ie with shading enabled) */
|
||||
|
@ -1436,9 +1438,9 @@ void CommandSetGl646::load_document(Genesys_Device* dev) const
|
|||
regs.init_reg(0x24, 4);
|
||||
|
||||
/* generate slope table 2 */
|
||||
auto slope_table = create_slope_table(MotorSlope::create_from_steps(6000, 2400, 50), 2400,
|
||||
StepType::FULL, 1, 4,
|
||||
get_slope_table_max_size(AsicType::GL646));
|
||||
auto slope_table = create_slope_table_for_speed(MotorSlope::create_from_steps(6000, 2400, 50),
|
||||
2400, StepType::FULL, 1, 4,
|
||||
get_slope_table_max_size(AsicType::GL646));
|
||||
// document loading:
|
||||
// send regs
|
||||
// start motor
|
||||
|
@ -1593,9 +1595,9 @@ void CommandSetGl646::eject_document(Genesys_Device* dev) const
|
|||
regs.init_reg(0x24, 4);
|
||||
|
||||
/* generate slope table 2 */
|
||||
auto slope_table = create_slope_table(MotorSlope::create_from_steps(10000, 1600, 60), 1600,
|
||||
StepType::FULL, 1, 4,
|
||||
get_slope_table_max_size(AsicType::GL646));
|
||||
auto slope_table = create_slope_table_for_speed(MotorSlope::create_from_steps(10000, 1600, 60),
|
||||
1600, StepType::FULL, 1, 4,
|
||||
get_slope_table_max_size(AsicType::GL646));
|
||||
// document eject:
|
||||
// send regs
|
||||
// start motor
|
||||
|
|
|
@ -1710,19 +1710,20 @@ MotorSlopeTable sanei_genesys_slope_table(AsicType asic_type, int dpi, int expos
|
|||
{
|
||||
unsigned target_speed_w = ((exposure * dpi) / base_dpi);
|
||||
|
||||
auto table = create_slope_table(motor_profile.slope, target_speed_w, motor_profile.step_type,
|
||||
step_multiplier, 2 * step_multiplier,
|
||||
get_slope_table_max_size(asic_type));
|
||||
auto table = create_slope_table_for_speed(motor_profile.slope, target_speed_w,
|
||||
motor_profile.step_type,
|
||||
step_multiplier, 2 * step_multiplier,
|
||||
get_slope_table_max_size(asic_type));
|
||||
return table;
|
||||
}
|
||||
|
||||
MotorSlopeTable create_slope_table_fastest(AsicType asic_type, unsigned step_multiplier,
|
||||
const MotorProfile& motor_profile)
|
||||
{
|
||||
return create_slope_table(motor_profile.slope, motor_profile.slope.max_speed_w,
|
||||
motor_profile.step_type,
|
||||
step_multiplier, 2 * step_multiplier,
|
||||
get_slope_table_max_size(asic_type));
|
||||
return create_slope_table_for_speed(motor_profile.slope, motor_profile.slope.max_speed_w,
|
||||
motor_profile.step_type,
|
||||
step_multiplier, 2 * step_multiplier,
|
||||
get_slope_table_max_size(asic_type));
|
||||
}
|
||||
|
||||
/** @brief returns the lowest possible ydpi for the device
|
||||
|
|
|
@ -104,9 +104,9 @@ unsigned get_slope_table_max_size(AsicType asic_type)
|
|||
}
|
||||
}
|
||||
|
||||
MotorSlopeTable create_slope_table(const MotorSlope& slope, unsigned target_speed_w,
|
||||
StepType step_type, unsigned steps_alignment,
|
||||
unsigned min_size, unsigned max_size)
|
||||
MotorSlopeTable create_slope_table_for_speed(const MotorSlope& slope, unsigned target_speed_w,
|
||||
StepType step_type, unsigned steps_alignment,
|
||||
unsigned min_size, unsigned max_size)
|
||||
{
|
||||
DBG_HELPER_ARGS(dbg, "target_speed_w: %d, step_type: %d, steps_alignment: %d, min_size: %d",
|
||||
target_speed_w, static_cast<unsigned>(step_type), steps_alignment, min_size);
|
||||
|
|
|
@ -134,9 +134,9 @@ struct MotorSlopeTable
|
|||
|
||||
unsigned get_slope_table_max_size(AsicType asic_type);
|
||||
|
||||
MotorSlopeTable create_slope_table(const MotorSlope& slope, unsigned target_speed_w,
|
||||
StepType step_type, unsigned steps_alignment,
|
||||
unsigned min_size, unsigned max_size);
|
||||
MotorSlopeTable create_slope_table_for_speed(const MotorSlope& slope, unsigned target_speed_w,
|
||||
StepType step_type, unsigned steps_alignment,
|
||||
unsigned min_size, unsigned max_size);
|
||||
|
||||
std::ostream& operator<<(std::ostream& out, const MotorSlope& slope);
|
||||
|
||||
|
|
|
@ -135,7 +135,7 @@ void test_create_slope_table_small_full_step()
|
|||
slope.max_speed_w = 2632;
|
||||
slope.acceleration = 1.2e-8;
|
||||
|
||||
auto table = create_slope_table(slope, 5000, StepType::FULL, 4, 8, max_table_size);
|
||||
auto table = create_slope_table_for_speed(slope, 5000, StepType::FULL, 4, 8, max_table_size);
|
||||
|
||||
std::vector<std::uint16_t> expected_table = {
|
||||
62464, 62464, 6420, 5000
|
||||
|
@ -146,7 +146,7 @@ void test_create_slope_table_small_full_step()
|
|||
ASSERT_EQ(table.pixeltime_sum, 156348u);
|
||||
|
||||
|
||||
table = create_slope_table(slope, 3000, StepType::FULL, 4, 8, max_table_size);
|
||||
table = create_slope_table_for_speed(slope, 3000, StepType::FULL, 4, 8, max_table_size);
|
||||
|
||||
expected_table = {
|
||||
62464, 62464, 6420, 4552, 3720, 3223, 3000
|
||||
|
@ -167,7 +167,7 @@ void test_create_slope_table_small_full_step_target_speed_too_high()
|
|||
slope.max_speed_w = 2632;
|
||||
slope.acceleration = 1.2e-8;
|
||||
|
||||
auto table = create_slope_table(slope, 2000, StepType::FULL, 4, 8, max_table_size);
|
||||
auto table = create_slope_table_for_speed(slope, 2000, StepType::FULL, 4, 8, max_table_size);
|
||||
|
||||
std::vector<std::uint16_t> expected_table = {
|
||||
62464, 62464, 6420, 4552, 3720, 3223, 2883, 2632
|
||||
|
@ -188,7 +188,7 @@ void test_create_slope_table_small_half_step()
|
|||
slope.max_speed_w = 2632;
|
||||
slope.acceleration = 1.2e-8;
|
||||
|
||||
auto table = create_slope_table(slope, 5000, StepType::HALF, 4, 8, max_table_size);
|
||||
auto table = create_slope_table_for_speed(slope, 5000, StepType::HALF, 4, 8, max_table_size);
|
||||
|
||||
std::vector<std::uint16_t> expected_table = {
|
||||
31232, 31232, 3210, 2500
|
||||
|
@ -199,7 +199,7 @@ void test_create_slope_table_small_half_step()
|
|||
ASSERT_EQ(table.pixeltime_sum, 78174u);
|
||||
|
||||
|
||||
table = create_slope_table(slope, 3000, StepType::HALF, 4, 8, max_table_size);
|
||||
table = create_slope_table_for_speed(slope, 3000, StepType::HALF, 4, 8, max_table_size);
|
||||
|
||||
expected_table = {
|
||||
31232, 31232, 3210, 2276, 1860, 1611, 1500
|
||||
|
@ -243,7 +243,7 @@ void test_create_slope_table_large_full_step()
|
|||
slope.max_speed_w = 1500;
|
||||
slope.acceleration = 1.013948e-9;
|
||||
|
||||
auto table = create_slope_table(slope, 3000, StepType::FULL, 4, 8, max_table_size);
|
||||
auto table = create_slope_table_for_speed(slope, 3000, StepType::FULL, 4, 8, max_table_size);
|
||||
|
||||
std::vector<std::uint16_t> expected_table = {
|
||||
54612, 54612, 20570, 15090, 12481, 10880, 9770, 8943, 8295, 7771,
|
||||
|
@ -259,7 +259,7 @@ void test_create_slope_table_large_full_step()
|
|||
ASSERT_EQ(table.pixeltime_sum, 412616u);
|
||||
|
||||
|
||||
table = create_slope_table(slope, 1500, StepType::FULL, 4, 8, max_table_size);
|
||||
table = create_slope_table_for_speed(slope, 1500, StepType::FULL, 4, 8, max_table_size);
|
||||
|
||||
expected_table = {
|
||||
54612, 54612, 20570, 15090, 12481, 10880, 9770, 8943, 8295, 7771,
|
||||
|
@ -303,7 +303,7 @@ void test_create_slope_table_large_half_step()
|
|||
slope.max_speed_w = 1500;
|
||||
slope.acceleration = 1.013948e-9;
|
||||
|
||||
auto table = create_slope_table(slope, 3000, StepType::HALF, 4, 8, max_table_size);
|
||||
auto table = create_slope_table_for_speed(slope, 3000, StepType::HALF, 4, 8, max_table_size);
|
||||
|
||||
std::vector<std::uint16_t> expected_table = {
|
||||
27306, 27306, 10285, 7545, 6240, 5440, 4885, 4471, 4147, 3885,
|
||||
|
@ -319,7 +319,7 @@ void test_create_slope_table_large_half_step()
|
|||
ASSERT_EQ(table.pixeltime_sum, 206294u);
|
||||
|
||||
|
||||
table = create_slope_table(slope, 1500, StepType::HALF, 4, 8, max_table_size);
|
||||
table = create_slope_table_for_speed(slope, 1500, StepType::HALF, 4, 8, max_table_size);
|
||||
|
||||
expected_table = {
|
||||
27306, 27306, 10285, 7545, 6240, 5440, 4885, 4471, 4147, 3885,
|
||||
|
|
Ładowanie…
Reference in New Issue