kopia lustrzana https://gitlab.com/sane-project/backends
genesys: Simplify API of sanei_genesys_create_slope_table3()
rodzic
ce59a69224
commit
c6784d2f1d
|
@ -434,13 +434,13 @@ SANE_Int sanei_genesys_generate_slope_table(std::vector<uint16_t>& slope_table,
|
||||||
* @return Time for acceleration
|
* @return Time for acceleration
|
||||||
* @note all times in pixel time
|
* @note all times in pixel time
|
||||||
*/
|
*/
|
||||||
SANE_Int sanei_genesys_create_slope_table3(Genesys_Device * dev,
|
SANE_Int sanei_genesys_create_slope_table3(const Genesys_Motor& motor,
|
||||||
std::vector<uint16_t>& slope_table,
|
std::vector<uint16_t>& slope_table,
|
||||||
int max_step,
|
int max_step,
|
||||||
unsigned int use_steps,
|
unsigned int use_steps,
|
||||||
int step_type,
|
int step_type,
|
||||||
int exposure_time,
|
int exposure_time,
|
||||||
double yres,
|
unsigned yres,
|
||||||
unsigned int *used_steps,
|
unsigned int *used_steps,
|
||||||
unsigned int *final_exposure)
|
unsigned int *final_exposure)
|
||||||
{
|
{
|
||||||
|
@ -450,26 +450,18 @@ SANE_Int sanei_genesys_create_slope_table3(Genesys_Device * dev,
|
||||||
unsigned int vstart;
|
unsigned int vstart;
|
||||||
unsigned int vfinal;
|
unsigned int vfinal;
|
||||||
|
|
||||||
DBG(DBG_proc, "%s: step_type = %d, exposure_time = %d, yres = %g\n", __func__,
|
DBG(DBG_proc, "%s: step_type = %d, exposure_time = %d, yres = %d\n", __func__,
|
||||||
step_type, exposure_time, yres);
|
step_type, exposure_time, yres);
|
||||||
|
|
||||||
/* final speed */
|
/* final speed */
|
||||||
vtarget = static_cast<unsigned>((exposure_time * yres) / dev->motor.base_ydpi);
|
vtarget = (exposure_time * yres) / motor.base_ydpi;
|
||||||
|
|
||||||
vstart = dev->motor.slopes[step_type].maximum_start_speed;
|
vstart = motor.slopes[step_type].maximum_start_speed;
|
||||||
vend = dev->motor.slopes[step_type].maximum_speed;
|
vend = motor.slopes[step_type].maximum_speed;
|
||||||
|
|
||||||
vtarget >>= step_type;
|
vtarget = std::min(vtarget >> step_type, 65535u);
|
||||||
if (vtarget > 65535)
|
vstart = std::min(vstart >> step_type, 65535u);
|
||||||
vtarget = 65535;
|
vend = std::min(vend >> step_type, 65535u);
|
||||||
|
|
||||||
vstart >>= step_type;
|
|
||||||
if (vstart > 65535)
|
|
||||||
vstart = 65535;
|
|
||||||
|
|
||||||
vend >>= step_type;
|
|
||||||
if (vend > 65535)
|
|
||||||
vend = 65535;
|
|
||||||
|
|
||||||
sum_time = sanei_genesys_generate_slope_table (slope_table,
|
sum_time = sanei_genesys_generate_slope_table (slope_table,
|
||||||
max_step,
|
max_step,
|
||||||
|
@ -477,13 +469,13 @@ SANE_Int sanei_genesys_create_slope_table3(Genesys_Device * dev,
|
||||||
vtarget,
|
vtarget,
|
||||||
vstart,
|
vstart,
|
||||||
vend,
|
vend,
|
||||||
dev->motor.slopes[step_type].minimum_steps << step_type,
|
motor.slopes[step_type].minimum_steps << step_type,
|
||||||
dev->motor.slopes[step_type].g,
|
motor.slopes[step_type].g,
|
||||||
used_steps,
|
used_steps,
|
||||||
&vfinal);
|
&vfinal);
|
||||||
|
|
||||||
if (final_exposure) {
|
if (final_exposure) {
|
||||||
*final_exposure = static_cast<unsigned>((vfinal * dev->motor.base_ydpi) / yres);
|
*final_exposure = (vfinal * motor.base_ydpi) / yres;
|
||||||
}
|
}
|
||||||
|
|
||||||
DBG(DBG_proc, "%s: returns sum_time=%d, completed\n", __func__, sum_time);
|
DBG(DBG_proc, "%s: returns sum_time=%d, completed\n", __func__, sum_time);
|
||||||
|
|
|
@ -867,8 +867,7 @@ static void gl841_init_motor_regs(Genesys_Device* dev, const Genesys_Sensor& sen
|
||||||
fast_exposure = dev->motor.slopes[0].maximum_start_speed;
|
fast_exposure = dev->motor.slopes[0].maximum_start_speed;
|
||||||
}
|
}
|
||||||
|
|
||||||
sanei_genesys_create_slope_table3(
|
sanei_genesys_create_slope_table3(dev->motor,
|
||||||
dev,
|
|
||||||
fast_slope_table,
|
fast_slope_table,
|
||||||
256,
|
256,
|
||||||
fast_slope_steps,
|
fast_slope_steps,
|
||||||
|
@ -1031,8 +1030,7 @@ static void gl841_init_motor_regs_scan(Genesys_Device* dev, const Genesys_Sensor
|
||||||
how many steps we need for slow acceleration and how much steps we are
|
how many steps we need for slow acceleration and how much steps we are
|
||||||
allowed to use.
|
allowed to use.
|
||||||
*/
|
*/
|
||||||
slow_slope_time = sanei_genesys_create_slope_table3 (
|
slow_slope_time = sanei_genesys_create_slope_table3(dev->motor,
|
||||||
dev,
|
|
||||||
slow_slope_table, 256,
|
slow_slope_table, 256,
|
||||||
256,
|
256,
|
||||||
scan_step_type,
|
scan_step_type,
|
||||||
|
@ -1041,8 +1039,7 @@ static void gl841_init_motor_regs_scan(Genesys_Device* dev, const Genesys_Sensor
|
||||||
&slow_slope_steps,
|
&slow_slope_steps,
|
||||||
nullptr);
|
nullptr);
|
||||||
|
|
||||||
sanei_genesys_create_slope_table3 (
|
sanei_genesys_create_slope_table3(dev->motor,
|
||||||
dev,
|
|
||||||
back_slope_table, 256,
|
back_slope_table, 256,
|
||||||
256,
|
256,
|
||||||
scan_step_type,
|
scan_step_type,
|
||||||
|
@ -1067,8 +1064,7 @@ static void gl841_init_motor_regs_scan(Genesys_Device* dev, const Genesys_Sensor
|
||||||
DBG(DBG_info, "%s: Maximum allowed slope steps for fast slope: %d\n", __func__,
|
DBG(DBG_info, "%s: Maximum allowed slope steps for fast slope: %d\n", __func__,
|
||||||
fast_slope_steps);
|
fast_slope_steps);
|
||||||
|
|
||||||
fast_slope_time = sanei_genesys_create_slope_table3 (
|
fast_slope_time = sanei_genesys_create_slope_table3(dev->motor,
|
||||||
dev,
|
|
||||||
fast_slope_table, 256,
|
fast_slope_table, 256,
|
||||||
fast_slope_steps,
|
fast_slope_steps,
|
||||||
0,
|
0,
|
||||||
|
|
|
@ -345,11 +345,11 @@ SANE_Int sanei_genesys_generate_slope_table(std::vector<uint16_t>& slope_table,
|
||||||
unsigned int steps, double g,
|
unsigned int steps, double g,
|
||||||
unsigned int *used_steps, unsigned int *vfinal);
|
unsigned int *used_steps, unsigned int *vfinal);
|
||||||
|
|
||||||
SANE_Int sanei_genesys_create_slope_table3(Genesys_Device * dev,
|
SANE_Int sanei_genesys_create_slope_table3(const Genesys_Motor& motor,
|
||||||
std::vector<uint16_t>& slope_table, int max_step,
|
std::vector<uint16_t>& slope_table, int max_step,
|
||||||
unsigned int use_steps,
|
unsigned int use_steps,
|
||||||
int step_type, int exposure_time,
|
int step_type, int exposure_time,
|
||||||
double yres,
|
unsigned yres,
|
||||||
unsigned int *used_steps,
|
unsigned int *used_steps,
|
||||||
unsigned int *final_exposure);
|
unsigned int *final_exposure);
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue