kopia lustrzana https://gitlab.com/sane-project/backends
genesys: Use strong enum for motor step type
rodzic
719a0cf55c
commit
98b4742aab
|
@ -324,6 +324,14 @@ enum class MotorId : unsigned
|
|||
XP300,
|
||||
};
|
||||
|
||||
enum class StepType : unsigned
|
||||
{
|
||||
FULL = 0,
|
||||
HALF = 1,
|
||||
QUARTER = 2,
|
||||
EIGHTH = 3,
|
||||
};
|
||||
|
||||
enum class AsicType : unsigned
|
||||
{
|
||||
UNKNOWN = 0,
|
||||
|
|
|
@ -513,7 +513,7 @@ static void gl124_init_motor_regs_scan(Genesys_Device* dev,
|
|||
Genesys_Register_Set* reg,
|
||||
unsigned int scan_exposure_time,
|
||||
float scan_yres,
|
||||
int scan_step_type,
|
||||
StepType step_type,
|
||||
unsigned int scan_lines,
|
||||
unsigned int scan_dummy,
|
||||
unsigned int feed_steps,
|
||||
|
@ -532,9 +532,9 @@ static void gl124_init_motor_regs_scan(Genesys_Device* dev,
|
|||
int min_speed;
|
||||
unsigned int linesel;
|
||||
|
||||
DBG(DBG_info, "%s : scan_exposure_time=%d, scan_yres=%g, scan_step_type=%d, scan_lines=%d, "
|
||||
DBG(DBG_info, "%s : scan_exposure_time=%d, scan_yres=%g, step_type=%d, scan_lines=%d, "
|
||||
"scan_dummy=%d, feed_steps=%d, scan_mode=%d, flags=%x\n", __func__, scan_exposure_time,
|
||||
scan_yres, scan_step_type, scan_lines, scan_dummy, feed_steps,
|
||||
scan_yres, static_cast<unsigned>(step_type), scan_lines, scan_dummy, feed_steps,
|
||||
static_cast<unsigned>(scan_mode), flags);
|
||||
|
||||
/* we never use fast fed since we do manual feed for the scans */
|
||||
|
@ -616,7 +616,7 @@ static void gl124_init_motor_regs_scan(Genesys_Device* dev,
|
|||
yres,
|
||||
scan_exposure_time,
|
||||
dev->motor.base_ydpi,
|
||||
scan_step_type,
|
||||
step_type,
|
||||
factor,
|
||||
dev->model->motor_id,
|
||||
gl124_motor_profiles);
|
||||
|
@ -639,7 +639,7 @@ static void gl124_init_motor_regs_scan(Genesys_Device* dev,
|
|||
fast_dpi,
|
||||
scan_exposure_time,
|
||||
dev->motor.base_ydpi,
|
||||
scan_step_type,
|
||||
step_type,
|
||||
factor,
|
||||
dev->model->motor_id,
|
||||
gl124_motor_profiles);
|
||||
|
@ -652,7 +652,7 @@ static void gl124_init_motor_regs_scan(Genesys_Device* dev,
|
|||
|
||||
/* substract acceleration distance from feedl */
|
||||
feedl=feed_steps;
|
||||
feedl<<=scan_step_type;
|
||||
feedl <<= static_cast<unsigned>(step_type);
|
||||
|
||||
dist = scan_steps;
|
||||
if (flags & MOTOR_FLAG_FEED)
|
||||
|
@ -691,7 +691,8 @@ static void gl124_init_motor_regs_scan(Genesys_Device* dev,
|
|||
|
||||
/* LINESEL */
|
||||
reg->set8_mask(REG1D, linesel, REG1D_LINESEL);
|
||||
reg->set8(REGA0, (scan_step_type << REGA0S_STEPSEL) | (scan_step_type << REGA0S_FSTPSEL));
|
||||
reg->set8(REGA0, (static_cast<unsigned>(step_type) << REGA0S_STEPSEL) |
|
||||
(static_cast<unsigned>(step_type) << REGA0S_FSTPSEL));
|
||||
|
||||
reg->set16(REG_FMOVDEC, fast_steps);
|
||||
}
|
||||
|
@ -966,7 +967,7 @@ static void gl124_init_scan_regs(Genesys_Device* dev, const Genesys_Sensor& sens
|
|||
|
||||
int dummy = 0;
|
||||
int slope_dpi = 0;
|
||||
int scan_step_type = 1;
|
||||
StepType scan_step_type = StepType::HALF;
|
||||
|
||||
/* cis color scan is effectively a gray scan with 3 gray lines per color line and a FILTER of 0 */
|
||||
if (dev->model->is_cis) {
|
||||
|
@ -976,7 +977,7 @@ static void gl124_init_scan_regs(Genesys_Device* dev, const Genesys_Sensor& sens
|
|||
}
|
||||
|
||||
if(session.params.flags & SCAN_FLAG_FEEDING) {
|
||||
scan_step_type=0;
|
||||
scan_step_type = StepType::FULL;
|
||||
exposure_time=MOVE_EXPOSURE;
|
||||
}
|
||||
else
|
||||
|
@ -988,7 +989,7 @@ static void gl124_init_scan_regs(Genesys_Device* dev, const Genesys_Sensor& sens
|
|||
}
|
||||
|
||||
DBG(DBG_info, "%s : exposure_time=%d pixels\n", __func__, exposure_time);
|
||||
DBG(DBG_info, "%s : scan_step_type=%d\n", __func__, scan_step_type);
|
||||
DBG(DBG_info, "%s : scan_step_type=%d\n", __func__, static_cast<unsigned>(scan_step_type));
|
||||
|
||||
/* we enable true gray for cis scanners only, and just when doing
|
||||
* scan since color calibration is OK for this mode
|
||||
|
|
|
@ -415,12 +415,12 @@ static void gl646_setup_registers(Genesys_Device* dev,
|
|||
regs->find_reg(0x02).value &= ~REG02_STEPSEL;
|
||||
switch (motor->steptype)
|
||||
{
|
||||
case FULL_STEP:
|
||||
case StepType::FULL:
|
||||
break;
|
||||
case HALF_STEP:
|
||||
case StepType::HALF:
|
||||
regs->find_reg(0x02).value |= 1;
|
||||
break;
|
||||
case QUATER_STEP:
|
||||
case StepType::QUARTER:
|
||||
regs->find_reg(0x02).value |= 2;
|
||||
break;
|
||||
default:
|
||||
|
@ -629,18 +629,19 @@ static void gl646_setup_registers(Genesys_Device* dev,
|
|||
break;
|
||||
|
||||
/* theorical value */
|
||||
default:
|
||||
default: {
|
||||
unsigned step_shift = static_cast<unsigned>(motor->steptype);
|
||||
|
||||
if (motor->fastfed)
|
||||
{
|
||||
feedl =
|
||||
feedl - 2 * motor->steps2 -
|
||||
(motor->steps1 >> motor->steptype);
|
||||
{
|
||||
feedl = feedl - 2 * motor->steps2 - (motor->steps1 >> step_shift);
|
||||
}
|
||||
else
|
||||
{
|
||||
feedl = feedl - (motor->steps1 >> motor->steptype);
|
||||
feedl = feedl - (motor->steps1 >> step_shift);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
/* security */
|
||||
if (feedl < 0)
|
||||
|
|
|
@ -113,10 +113,6 @@ static void write_control(Genesys_Device* dev, const Genesys_Sensor& sensor, int
|
|||
*/
|
||||
static void gl646_init_regs (Genesys_Device * dev);
|
||||
|
||||
#define FULL_STEP 0
|
||||
#define HALF_STEP 1
|
||||
#define QUATER_STEP 2
|
||||
|
||||
#define CALIBRATION_LINES 10
|
||||
|
||||
/**
|
||||
|
@ -130,7 +126,7 @@ typedef struct
|
|||
unsigned channels;
|
||||
|
||||
/* settings */
|
||||
SANE_Int steptype; /* 0=full, 1=half, 2=quarter */
|
||||
StepType steptype;
|
||||
SANE_Bool fastmod; /* fast scanning 0/1 */
|
||||
SANE_Bool fastfed; /* fast fed slope tables */
|
||||
SANE_Int mtrpwm;
|
||||
|
@ -151,88 +147,88 @@ typedef struct
|
|||
*/
|
||||
static Motor_Master motor_master[] = {
|
||||
/* HP3670 motor settings */
|
||||
{MotorId::HP3670, 75, 3, FULL_STEP, SANE_FALSE, SANE_TRUE , 1, 200, 3429, 305, 192, 3399, 337, 0.3, 0.4, 192},
|
||||
{MotorId::HP3670, 100, 3, HALF_STEP, SANE_FALSE, SANE_TRUE , 1, 143, 2905, 187, 192, 3399, 337, 0.3, 0.4, 192},
|
||||
{MotorId::HP3670, 150, 3, HALF_STEP, SANE_FALSE, SANE_TRUE , 1, 73, 3429, 305, 192, 3399, 337, 0.3, 0.4, 192},
|
||||
{MotorId::HP3670, 300, 3, HALF_STEP, SANE_FALSE, SANE_TRUE , 1, 11, 1055, 563, 192, 3399, 337, 0.3, 0.4, 192},
|
||||
{MotorId::HP3670, 600, 3, FULL_STEP, SANE_FALSE, SANE_TRUE , 0, 3, 10687, 5126, 192, 3399, 337, 0.3, 0.4, 192},
|
||||
{MotorId::HP3670,1200, 3, HALF_STEP, SANE_FALSE, SANE_TRUE , 0, 3, 15937, 6375, 192, 3399, 337, 0.3, 0.4, 192},
|
||||
{MotorId::HP3670,2400, 3, HALF_STEP, SANE_FALSE, SANE_TRUE , 0, 3, 15937, 12750, 192, 3399, 337, 0.3, 0.4, 192},
|
||||
{MotorId::HP3670, 75, 1, FULL_STEP, SANE_FALSE, SANE_TRUE , 1, 200, 3429, 305, 192, 3399, 337, 0.3, 0.4, 192},
|
||||
{MotorId::HP3670, 100, 1, HALF_STEP, SANE_FALSE, SANE_TRUE , 1, 143, 2905, 187, 192, 3399, 337, 0.3, 0.4, 192},
|
||||
{MotorId::HP3670, 150, 1, HALF_STEP, SANE_FALSE, SANE_TRUE , 1, 73, 3429, 305, 192, 3399, 337, 0.3, 0.4, 192},
|
||||
{MotorId::HP3670, 300, 1, HALF_STEP, SANE_FALSE, SANE_TRUE , 1, 11, 1055, 563, 192, 3399, 337, 0.3, 0.4, 192},
|
||||
{MotorId::HP3670, 600, 1, FULL_STEP, SANE_FALSE, SANE_TRUE , 0, 3, 10687, 5126, 192, 3399, 337, 0.3, 0.4, 192},
|
||||
{MotorId::HP3670,1200, 1, HALF_STEP, SANE_FALSE, SANE_TRUE , 0, 3, 15937, 6375, 192, 3399, 337, 0.3, 0.4, 192},
|
||||
{MotorId::HP3670,2400, 3, HALF_STEP, SANE_FALSE, SANE_TRUE , 0, 3, 15937, 12750, 192, 3399, 337, 0.3, 0.4, 192},
|
||||
{MotorId::HP3670, 75, 3, StepType::FULL, SANE_FALSE, SANE_TRUE , 1, 200, 3429, 305, 192, 3399, 337, 0.3, 0.4, 192},
|
||||
{MotorId::HP3670, 100, 3, StepType::HALF, SANE_FALSE, SANE_TRUE , 1, 143, 2905, 187, 192, 3399, 337, 0.3, 0.4, 192},
|
||||
{MotorId::HP3670, 150, 3, StepType::HALF, SANE_FALSE, SANE_TRUE , 1, 73, 3429, 305, 192, 3399, 337, 0.3, 0.4, 192},
|
||||
{MotorId::HP3670, 300, 3, StepType::HALF, SANE_FALSE, SANE_TRUE , 1, 11, 1055, 563, 192, 3399, 337, 0.3, 0.4, 192},
|
||||
{MotorId::HP3670, 600, 3, StepType::FULL, SANE_FALSE, SANE_TRUE , 0, 3, 10687, 5126, 192, 3399, 337, 0.3, 0.4, 192},
|
||||
{MotorId::HP3670,1200, 3, StepType::HALF, SANE_FALSE, SANE_TRUE , 0, 3, 15937, 6375, 192, 3399, 337, 0.3, 0.4, 192},
|
||||
{MotorId::HP3670,2400, 3, StepType::HALF, SANE_FALSE, SANE_TRUE , 0, 3, 15937, 12750, 192, 3399, 337, 0.3, 0.4, 192},
|
||||
{MotorId::HP3670, 75, 1, StepType::FULL, SANE_FALSE, SANE_TRUE , 1, 200, 3429, 305, 192, 3399, 337, 0.3, 0.4, 192},
|
||||
{MotorId::HP3670, 100, 1, StepType::HALF, SANE_FALSE, SANE_TRUE , 1, 143, 2905, 187, 192, 3399, 337, 0.3, 0.4, 192},
|
||||
{MotorId::HP3670, 150, 1, StepType::HALF, SANE_FALSE, SANE_TRUE , 1, 73, 3429, 305, 192, 3399, 337, 0.3, 0.4, 192},
|
||||
{MotorId::HP3670, 300, 1, StepType::HALF, SANE_FALSE, SANE_TRUE , 1, 11, 1055, 563, 192, 3399, 337, 0.3, 0.4, 192},
|
||||
{MotorId::HP3670, 600, 1, StepType::FULL, SANE_FALSE, SANE_TRUE , 0, 3, 10687, 5126, 192, 3399, 337, 0.3, 0.4, 192},
|
||||
{MotorId::HP3670,1200, 1, StepType::HALF, SANE_FALSE, SANE_TRUE , 0, 3, 15937, 6375, 192, 3399, 337, 0.3, 0.4, 192},
|
||||
{MotorId::HP3670,2400, 3, StepType::HALF, SANE_FALSE, SANE_TRUE , 0, 3, 15937, 12750, 192, 3399, 337, 0.3, 0.4, 192},
|
||||
|
||||
/* HP2400/G2410 motor settings base motor dpi = 600 */
|
||||
{MotorId::HP2400, 50, 3, FULL_STEP, SANE_FALSE, SANE_TRUE , 63, 120, 8736, 601, 192, 4905, 337, 0.30, 0.4, 192},
|
||||
{MotorId::HP2400, 100, 3, HALF_STEP, SANE_FALSE, SANE_TRUE, 63, 120, 8736, 601, 192, 4905, 337, 0.30, 0.4, 192},
|
||||
{MotorId::HP2400, 150, 3, HALF_STEP, SANE_FALSE, SANE_TRUE , 63, 67, 15902, 902, 192, 4905, 337, 0.30, 0.4, 192},
|
||||
{MotorId::HP2400, 300, 3, HALF_STEP, SANE_FALSE, SANE_TRUE , 63, 32, 16703, 2188, 192, 4905, 337, 0.30, 0.4, 192},
|
||||
{MotorId::HP2400, 600, 3, FULL_STEP, SANE_FALSE, SANE_TRUE , 63, 3, 18761, 18761, 192, 4905, 627, 0.30, 0.4, 192},
|
||||
{MotorId::HP2400,1200, 3, HALF_STEP, SANE_FALSE, SANE_TRUE , 63, 3, 43501, 43501, 192, 4905, 627, 0.30, 0.4, 192},
|
||||
{MotorId::HP2400, 50, 1, FULL_STEP, SANE_FALSE, SANE_TRUE , 63, 120, 8736, 601, 192, 4905, 337, 0.30, 0.4, 192},
|
||||
{MotorId::HP2400, 100, 1, HALF_STEP, SANE_FALSE, SANE_TRUE, 63, 120, 8736, 601, 192, 4905, 337, 0.30, 0.4, 192},
|
||||
{MotorId::HP2400, 150, 1, HALF_STEP, SANE_FALSE, SANE_TRUE , 63, 67, 15902, 902, 192, 4905, 337, 0.30, 0.4, 192},
|
||||
{MotorId::HP2400, 300, 1, HALF_STEP, SANE_FALSE, SANE_TRUE , 63, 32, 16703, 2188, 192, 4905, 337, 0.30, 0.4, 192},
|
||||
{MotorId::HP2400, 600, 1, FULL_STEP, SANE_FALSE, SANE_TRUE , 63, 3, 18761, 18761, 192, 4905, 337, 0.30, 0.4, 192},
|
||||
{MotorId::HP2400,1200, 1, HALF_STEP, SANE_FALSE, SANE_TRUE , 63, 3, 43501, 43501, 192, 4905, 337, 0.30, 0.4, 192},
|
||||
{MotorId::HP2400, 50, 3, StepType::FULL, SANE_FALSE, SANE_TRUE , 63, 120, 8736, 601, 192, 4905, 337, 0.30, 0.4, 192},
|
||||
{MotorId::HP2400, 100, 3, StepType::HALF, SANE_FALSE, SANE_TRUE, 63, 120, 8736, 601, 192, 4905, 337, 0.30, 0.4, 192},
|
||||
{MotorId::HP2400, 150, 3, StepType::HALF, SANE_FALSE, SANE_TRUE , 63, 67, 15902, 902, 192, 4905, 337, 0.30, 0.4, 192},
|
||||
{MotorId::HP2400, 300, 3, StepType::HALF, SANE_FALSE, SANE_TRUE , 63, 32, 16703, 2188, 192, 4905, 337, 0.30, 0.4, 192},
|
||||
{MotorId::HP2400, 600, 3, StepType::FULL, SANE_FALSE, SANE_TRUE , 63, 3, 18761, 18761, 192, 4905, 627, 0.30, 0.4, 192},
|
||||
{MotorId::HP2400,1200, 3, StepType::HALF, SANE_FALSE, SANE_TRUE , 63, 3, 43501, 43501, 192, 4905, 627, 0.30, 0.4, 192},
|
||||
{MotorId::HP2400, 50, 1, StepType::FULL, SANE_FALSE, SANE_TRUE , 63, 120, 8736, 601, 192, 4905, 337, 0.30, 0.4, 192},
|
||||
{MotorId::HP2400, 100, 1, StepType::HALF, SANE_FALSE, SANE_TRUE, 63, 120, 8736, 601, 192, 4905, 337, 0.30, 0.4, 192},
|
||||
{MotorId::HP2400, 150, 1, StepType::HALF, SANE_FALSE, SANE_TRUE , 63, 67, 15902, 902, 192, 4905, 337, 0.30, 0.4, 192},
|
||||
{MotorId::HP2400, 300, 1, StepType::HALF, SANE_FALSE, SANE_TRUE , 63, 32, 16703, 2188, 192, 4905, 337, 0.30, 0.4, 192},
|
||||
{MotorId::HP2400, 600, 1, StepType::FULL, SANE_FALSE, SANE_TRUE , 63, 3, 18761, 18761, 192, 4905, 337, 0.30, 0.4, 192},
|
||||
{MotorId::HP2400,1200, 1, StepType::HALF, SANE_FALSE, SANE_TRUE , 63, 3, 43501, 43501, 192, 4905, 337, 0.30, 0.4, 192},
|
||||
|
||||
/* XP 200 motor settings */
|
||||
{MotorId::XP200, 75, 3, HALF_STEP, SANE_TRUE , SANE_FALSE, 0, 4, 6000, 2136, 8, 12000, 1200, 0.3, 0.5, 1},
|
||||
{MotorId::XP200, 100, 3, HALF_STEP, SANE_TRUE , SANE_FALSE, 0, 4, 6000, 2850, 8, 12000, 1200, 0.3, 0.5, 1},
|
||||
{MotorId::XP200, 200, 3, HALF_STEP, SANE_TRUE , SANE_FALSE, 0, 4, 6999, 5700, 8, 12000, 1200, 0.3, 0.5, 1},
|
||||
{MotorId::XP200, 250, 3, HALF_STEP, SANE_TRUE , SANE_FALSE, 0, 4, 6999, 6999, 8, 12000, 1200, 0.3, 0.5, 1},
|
||||
{MotorId::XP200, 300, 3, HALF_STEP, SANE_TRUE , SANE_FALSE, 0, 4, 13500, 13500, 8, 12000, 1200, 0.3, 0.5, 1},
|
||||
{MotorId::XP200, 600, 3, HALF_STEP, SANE_TRUE , SANE_TRUE, 0, 4, 31998, 31998, 2, 12000, 1200, 0.3, 0.5, 1},
|
||||
{MotorId::XP200, 75, 1, HALF_STEP, SANE_TRUE , SANE_FALSE, 0, 4, 6000, 2000, 8, 12000, 1200, 0.3, 0.5, 1},
|
||||
{MotorId::XP200, 100, 1, HALF_STEP, SANE_TRUE , SANE_FALSE, 0, 4, 6000, 1300, 8, 12000, 1200, 0.3, 0.5, 1},
|
||||
{MotorId::XP200, 200, 1, HALF_STEP, SANE_TRUE , SANE_TRUE, 0, 4, 6000, 3666, 8, 12000, 1200, 0.3, 0.5, 1},
|
||||
{MotorId::XP200, 300, 1, HALF_STEP, SANE_TRUE , SANE_FALSE, 0, 4, 6500, 6500, 8, 12000, 1200, 0.3, 0.5, 1},
|
||||
{MotorId::XP200, 600, 1, HALF_STEP, SANE_TRUE , SANE_TRUE, 0, 4, 24000, 24000, 2, 12000, 1200, 0.3, 0.5, 1},
|
||||
{MotorId::XP200, 75, 3, StepType::HALF, SANE_TRUE , SANE_FALSE, 0, 4, 6000, 2136, 8, 12000, 1200, 0.3, 0.5, 1},
|
||||
{MotorId::XP200, 100, 3, StepType::HALF, SANE_TRUE , SANE_FALSE, 0, 4, 6000, 2850, 8, 12000, 1200, 0.3, 0.5, 1},
|
||||
{MotorId::XP200, 200, 3, StepType::HALF, SANE_TRUE , SANE_FALSE, 0, 4, 6999, 5700, 8, 12000, 1200, 0.3, 0.5, 1},
|
||||
{MotorId::XP200, 250, 3, StepType::HALF, SANE_TRUE , SANE_FALSE, 0, 4, 6999, 6999, 8, 12000, 1200, 0.3, 0.5, 1},
|
||||
{MotorId::XP200, 300, 3, StepType::HALF, SANE_TRUE , SANE_FALSE, 0, 4, 13500, 13500, 8, 12000, 1200, 0.3, 0.5, 1},
|
||||
{MotorId::XP200, 600, 3, StepType::HALF, SANE_TRUE , SANE_TRUE, 0, 4, 31998, 31998, 2, 12000, 1200, 0.3, 0.5, 1},
|
||||
{MotorId::XP200, 75, 1, StepType::HALF, SANE_TRUE , SANE_FALSE, 0, 4, 6000, 2000, 8, 12000, 1200, 0.3, 0.5, 1},
|
||||
{MotorId::XP200, 100, 1, StepType::HALF, SANE_TRUE , SANE_FALSE, 0, 4, 6000, 1300, 8, 12000, 1200, 0.3, 0.5, 1},
|
||||
{MotorId::XP200, 200, 1, StepType::HALF, SANE_TRUE , SANE_TRUE, 0, 4, 6000, 3666, 8, 12000, 1200, 0.3, 0.5, 1},
|
||||
{MotorId::XP200, 300, 1, StepType::HALF, SANE_TRUE , SANE_FALSE, 0, 4, 6500, 6500, 8, 12000, 1200, 0.3, 0.5, 1},
|
||||
{MotorId::XP200, 600, 1, StepType::HALF, SANE_TRUE , SANE_TRUE, 0, 4, 24000, 24000, 2, 12000, 1200, 0.3, 0.5, 1},
|
||||
|
||||
/* HP scanjet 2300c */
|
||||
{MotorId::HP2300, 75, 3, FULL_STEP, SANE_FALSE, SANE_TRUE , 63, 120, 8139, 560, 120, 4905, 337, 0.3, 0.4, 16},
|
||||
{MotorId::HP2300, 150, 3, HALF_STEP, SANE_FALSE, SANE_TRUE , 63, 67, 7903, 543, 120, 4905, 337, 0.3, 0.4, 16},
|
||||
{MotorId::HP2300, 300, 3, HALF_STEP, SANE_FALSE, SANE_TRUE , 63, 3, 2175, 1087, 120, 4905, 337, 0.3, 0.4, 16},
|
||||
{MotorId::HP2300, 600, 3, HALF_STEP, SANE_FALSE, SANE_TRUE , 63, 3, 8700, 4350, 120, 4905, 337, 0.3, 0.4, 16},
|
||||
{MotorId::HP2300,1200, 3, HALF_STEP, SANE_FALSE, SANE_TRUE , 63, 3, 17400, 8700, 120, 4905, 337, 0.3, 0.4, 16},
|
||||
{MotorId::HP2300, 75, 1, FULL_STEP, SANE_FALSE, SANE_TRUE , 63, 120, 8139, 560, 120, 4905, 337, 0.3, 0.4, 16},
|
||||
{MotorId::HP2300, 150, 1, HALF_STEP, SANE_FALSE, SANE_TRUE , 63, 67, 7903, 543, 120, 4905, 337, 0.3, 0.4, 16},
|
||||
{MotorId::HP2300, 300, 1, HALF_STEP, SANE_FALSE, SANE_TRUE , 63, 3, 2175, 1087, 120, 4905, 337, 0.3, 0.4, 16},
|
||||
{MotorId::HP2300, 600, 1, HALF_STEP, SANE_FALSE, SANE_TRUE , 63, 3, 8700, 4350, 120, 4905, 337, 0.3, 0.4, 16},
|
||||
{MotorId::HP2300,1200, 1, HALF_STEP, SANE_FALSE, SANE_TRUE , 63, 3, 17400, 8700, 120, 4905, 337, 0.3, 0.4, 16},
|
||||
{MotorId::HP2300, 75, 3, StepType::FULL, SANE_FALSE, SANE_TRUE , 63, 120, 8139, 560, 120, 4905, 337, 0.3, 0.4, 16},
|
||||
{MotorId::HP2300, 150, 3, StepType::HALF, SANE_FALSE, SANE_TRUE , 63, 67, 7903, 543, 120, 4905, 337, 0.3, 0.4, 16},
|
||||
{MotorId::HP2300, 300, 3, StepType::HALF, SANE_FALSE, SANE_TRUE , 63, 3, 2175, 1087, 120, 4905, 337, 0.3, 0.4, 16},
|
||||
{MotorId::HP2300, 600, 3, StepType::HALF, SANE_FALSE, SANE_TRUE , 63, 3, 8700, 4350, 120, 4905, 337, 0.3, 0.4, 16},
|
||||
{MotorId::HP2300,1200, 3, StepType::HALF, SANE_FALSE, SANE_TRUE , 63, 3, 17400, 8700, 120, 4905, 337, 0.3, 0.4, 16},
|
||||
{MotorId::HP2300, 75, 1, StepType::FULL, SANE_FALSE, SANE_TRUE , 63, 120, 8139, 560, 120, 4905, 337, 0.3, 0.4, 16},
|
||||
{MotorId::HP2300, 150, 1, StepType::HALF, SANE_FALSE, SANE_TRUE , 63, 67, 7903, 543, 120, 4905, 337, 0.3, 0.4, 16},
|
||||
{MotorId::HP2300, 300, 1, StepType::HALF, SANE_FALSE, SANE_TRUE , 63, 3, 2175, 1087, 120, 4905, 337, 0.3, 0.4, 16},
|
||||
{MotorId::HP2300, 600, 1, StepType::HALF, SANE_FALSE, SANE_TRUE , 63, 3, 8700, 4350, 120, 4905, 337, 0.3, 0.4, 16},
|
||||
{MotorId::HP2300,1200, 1, StepType::HALF, SANE_FALSE, SANE_TRUE , 63, 3, 17400, 8700, 120, 4905, 337, 0.3, 0.4, 16},
|
||||
/* non half ccd settings for 300 dpi
|
||||
{MotorId::HP2300, 300, 3, HALF_STEP, SANE_FALSE, SANE_TRUE , 63, 44, 5386, 2175, 120, 4905, 337, 0.3, 0.4, 16},
|
||||
{MotorId::HP2300, 300, 1, HALF_STEP, SANE_FALSE, SANE_TRUE , 63, 44, 5386, 2175, 120, 4905, 337, 0.3, 0.4, 16},
|
||||
{MotorId::HP2300, 300, 3, StepType::HALF, SANE_FALSE, SANE_TRUE , 63, 44, 5386, 2175, 120, 4905, 337, 0.3, 0.4, 16},
|
||||
{MotorId::HP2300, 300, 1, StepType::HALF, SANE_FALSE, SANE_TRUE , 63, 44, 5386, 2175, 120, 4905, 337, 0.3, 0.4, 16},
|
||||
*/
|
||||
|
||||
/* MD5345/6471 motor settings */
|
||||
/* vfinal=(exposure/(1200/dpi))/step_type */
|
||||
{MotorId::MD_5345, 50, 3, HALF_STEP , SANE_FALSE, SANE_TRUE , 2, 255, 2500, 250, 255, 2000, 300, 0.3, 0.4, 64},
|
||||
{MotorId::MD_5345, 75, 3, HALF_STEP , SANE_FALSE, SANE_TRUE , 2, 255, 2500, 343, 255, 2000, 300, 0.3, 0.4, 64},
|
||||
{MotorId::MD_5345, 100, 3, HALF_STEP , SANE_FALSE, SANE_TRUE , 2, 255, 2500, 458, 255, 2000, 300, 0.3, 0.4, 64},
|
||||
{MotorId::MD_5345, 150, 3, HALF_STEP , SANE_FALSE, SANE_TRUE , 2, 255, 2500, 687, 255, 2000, 300, 0.3, 0.4, 64},
|
||||
{MotorId::MD_5345, 200, 3, HALF_STEP , SANE_FALSE, SANE_TRUE , 2, 255, 2500, 916, 255, 2000, 300, 0.3, 0.4, 64},
|
||||
{MotorId::MD_5345, 300, 3, HALF_STEP , SANE_FALSE, SANE_TRUE , 2, 255, 2500, 1375, 255, 2000, 300, 0.3, 0.4, 64},
|
||||
{MotorId::MD_5345, 400, 3, HALF_STEP , SANE_FALSE, SANE_TRUE , 0, 32, 2000, 1833, 255, 2000, 300, 0.3, 0.4, 32},
|
||||
{MotorId::MD_5345, 500, 3, HALF_STEP , SANE_FALSE, SANE_TRUE , 0, 32, 2291, 2291, 255, 2000, 300, 0.3, 0.4, 32},
|
||||
{MotorId::MD_5345, 600, 3, HALF_STEP , SANE_FALSE, SANE_TRUE , 0, 32, 2750, 2750, 255, 2000, 300, 0.3, 0.4, 32},
|
||||
{MotorId::MD_5345, 1200, 3, QUATER_STEP, SANE_FALSE, SANE_TRUE , 0, 16, 2750, 2750, 255, 2000, 300, 0.3, 0.4, 146},
|
||||
{MotorId::MD_5345, 2400, 3, QUATER_STEP, SANE_FALSE, SANE_TRUE , 0, 16, 5500, 5500, 255, 2000, 300, 0.3, 0.4, 146},
|
||||
{MotorId::MD_5345, 50, 1, HALF_STEP , SANE_FALSE, SANE_TRUE , 2, 255, 2500, 250, 255, 2000, 300, 0.3, 0.4, 64},
|
||||
{MotorId::MD_5345, 75, 1, HALF_STEP , SANE_FALSE, SANE_TRUE , 2, 255, 2500, 343, 255, 2000, 300, 0.3, 0.4, 64},
|
||||
{MotorId::MD_5345, 100, 1, HALF_STEP , SANE_FALSE, SANE_TRUE , 2, 255, 2500, 458, 255, 2000, 300, 0.3, 0.4, 64},
|
||||
{MotorId::MD_5345, 150, 1, HALF_STEP , SANE_FALSE, SANE_TRUE , 2, 255, 2500, 687, 255, 2000, 300, 0.3, 0.4, 64},
|
||||
{MotorId::MD_5345, 200, 1, HALF_STEP , SANE_FALSE, SANE_TRUE , 2, 255, 2500, 916, 255, 2000, 300, 0.3, 0.4, 64},
|
||||
{MotorId::MD_5345, 300, 1, HALF_STEP , SANE_FALSE, SANE_TRUE , 2, 255, 2500, 1375, 255, 2000, 300, 0.3, 0.4, 64},
|
||||
{MotorId::MD_5345, 400, 1, HALF_STEP , SANE_FALSE, SANE_TRUE , 0, 32, 2000, 1833, 255, 2000, 300, 0.3, 0.4, 32},
|
||||
{MotorId::MD_5345, 500, 1, HALF_STEP , SANE_FALSE, SANE_TRUE , 0, 32, 2291, 2291, 255, 2000, 300, 0.3, 0.4, 32},
|
||||
{MotorId::MD_5345, 600, 1, HALF_STEP , SANE_FALSE, SANE_TRUE , 0, 32, 2750, 2750, 255, 2000, 300, 0.3, 0.4, 32},
|
||||
{MotorId::MD_5345, 1200, 1, QUATER_STEP, SANE_FALSE, SANE_TRUE , 0, 16, 2750, 2750, 255, 2000, 300, 0.3, 0.4, 146},
|
||||
{MotorId::MD_5345, 2400, 1, QUATER_STEP, SANE_FALSE, SANE_TRUE , 0, 16, 5500, 5500, 255, 2000, 300, 0.3, 0.4, 146}, /* 5500 guessed */
|
||||
{MotorId::MD_5345, 50, 3, StepType::HALF , SANE_FALSE, SANE_TRUE , 2, 255, 2500, 250, 255, 2000, 300, 0.3, 0.4, 64},
|
||||
{MotorId::MD_5345, 75, 3, StepType::HALF , SANE_FALSE, SANE_TRUE , 2, 255, 2500, 343, 255, 2000, 300, 0.3, 0.4, 64},
|
||||
{MotorId::MD_5345, 100, 3, StepType::HALF , SANE_FALSE, SANE_TRUE , 2, 255, 2500, 458, 255, 2000, 300, 0.3, 0.4, 64},
|
||||
{MotorId::MD_5345, 150, 3, StepType::HALF , SANE_FALSE, SANE_TRUE , 2, 255, 2500, 687, 255, 2000, 300, 0.3, 0.4, 64},
|
||||
{MotorId::MD_5345, 200, 3, StepType::HALF , SANE_FALSE, SANE_TRUE , 2, 255, 2500, 916, 255, 2000, 300, 0.3, 0.4, 64},
|
||||
{MotorId::MD_5345, 300, 3, StepType::HALF , SANE_FALSE, SANE_TRUE , 2, 255, 2500, 1375, 255, 2000, 300, 0.3, 0.4, 64},
|
||||
{MotorId::MD_5345, 400, 3, StepType::HALF , SANE_FALSE, SANE_TRUE , 0, 32, 2000, 1833, 255, 2000, 300, 0.3, 0.4, 32},
|
||||
{MotorId::MD_5345, 500, 3, StepType::HALF , SANE_FALSE, SANE_TRUE , 0, 32, 2291, 2291, 255, 2000, 300, 0.3, 0.4, 32},
|
||||
{MotorId::MD_5345, 600, 3, StepType::HALF , SANE_FALSE, SANE_TRUE , 0, 32, 2750, 2750, 255, 2000, 300, 0.3, 0.4, 32},
|
||||
{MotorId::MD_5345, 1200, 3, StepType::QUARTER, SANE_FALSE, SANE_TRUE , 0, 16, 2750, 2750, 255, 2000, 300, 0.3, 0.4, 146},
|
||||
{MotorId::MD_5345, 2400, 3, StepType::QUARTER, SANE_FALSE, SANE_TRUE , 0, 16, 5500, 5500, 255, 2000, 300, 0.3, 0.4, 146},
|
||||
{MotorId::MD_5345, 50, 1, StepType::HALF , SANE_FALSE, SANE_TRUE , 2, 255, 2500, 250, 255, 2000, 300, 0.3, 0.4, 64},
|
||||
{MotorId::MD_5345, 75, 1, StepType::HALF , SANE_FALSE, SANE_TRUE , 2, 255, 2500, 343, 255, 2000, 300, 0.3, 0.4, 64},
|
||||
{MotorId::MD_5345, 100, 1, StepType::HALF , SANE_FALSE, SANE_TRUE , 2, 255, 2500, 458, 255, 2000, 300, 0.3, 0.4, 64},
|
||||
{MotorId::MD_5345, 150, 1, StepType::HALF , SANE_FALSE, SANE_TRUE , 2, 255, 2500, 687, 255, 2000, 300, 0.3, 0.4, 64},
|
||||
{MotorId::MD_5345, 200, 1, StepType::HALF , SANE_FALSE, SANE_TRUE , 2, 255, 2500, 916, 255, 2000, 300, 0.3, 0.4, 64},
|
||||
{MotorId::MD_5345, 300, 1, StepType::HALF , SANE_FALSE, SANE_TRUE , 2, 255, 2500, 1375, 255, 2000, 300, 0.3, 0.4, 64},
|
||||
{MotorId::MD_5345, 400, 1, StepType::HALF , SANE_FALSE, SANE_TRUE , 0, 32, 2000, 1833, 255, 2000, 300, 0.3, 0.4, 32},
|
||||
{MotorId::MD_5345, 500, 1, StepType::HALF , SANE_FALSE, SANE_TRUE , 0, 32, 2291, 2291, 255, 2000, 300, 0.3, 0.4, 32},
|
||||
{MotorId::MD_5345, 600, 1, StepType::HALF , SANE_FALSE, SANE_TRUE , 0, 32, 2750, 2750, 255, 2000, 300, 0.3, 0.4, 32},
|
||||
{MotorId::MD_5345, 1200, 1, StepType::QUARTER, SANE_FALSE, SANE_TRUE , 0, 16, 2750, 2750, 255, 2000, 300, 0.3, 0.4, 146},
|
||||
{MotorId::MD_5345, 2400, 1, StepType::QUARTER, SANE_FALSE, SANE_TRUE , 0, 16, 5500, 5500, 255, 2000, 300, 0.3, 0.4, 146}, /* 5500 guessed */
|
||||
};
|
||||
|
||||
class CommandSetGl646 : public CommandSet
|
||||
|
|
|
@ -858,21 +858,22 @@ static void gl843_init_motor_regs_scan(Genesys_Device* dev,
|
|||
Genesys_Register_Set* reg,
|
||||
unsigned int exposure,
|
||||
float scan_yres,
|
||||
int scan_step_type,
|
||||
StepType step_type,
|
||||
unsigned int scan_lines,
|
||||
unsigned int scan_dummy,
|
||||
unsigned int feed_steps,
|
||||
unsigned int flags)
|
||||
{
|
||||
DBG_HELPER_ARGS(dbg, "exposure=%d, scan_yres=%g, scan_step_type=%d, scan_lines=%d, scan_dummy=%d, "
|
||||
DBG_HELPER_ARGS(dbg, "exposure=%d, scan_yres=%g, step_type=%d, scan_lines=%d, scan_dummy=%d, "
|
||||
"feed_steps=%d, flags=%x",
|
||||
exposure, scan_yres, scan_step_type, scan_lines, scan_dummy, feed_steps, flags);
|
||||
exposure, scan_yres, static_cast<unsigned>(step_type), scan_lines, scan_dummy,
|
||||
feed_steps, flags);
|
||||
|
||||
int use_fast_fed, coeff;
|
||||
unsigned int lincnt;
|
||||
std::vector<uint16_t> scan_table;
|
||||
std::vector<uint16_t> fast_table;
|
||||
int scan_steps,fast_steps, fast_step_type;
|
||||
int scan_steps,fast_steps;
|
||||
unsigned int feedl,factor,dist;
|
||||
GenesysRegister *r;
|
||||
uint32_t z1, z2;
|
||||
|
@ -915,7 +916,7 @@ static void gl843_init_motor_regs_scan(Genesys_Device* dev,
|
|||
scan_yres,
|
||||
exposure,
|
||||
dev->motor.base_ydpi,
|
||||
scan_step_type,
|
||||
step_type,
|
||||
factor,
|
||||
dev->model->motor_id,
|
||||
gl843_motor_profiles);
|
||||
|
@ -931,11 +932,11 @@ static void gl843_init_motor_regs_scan(Genesys_Device* dev,
|
|||
r->value = scan_steps;
|
||||
|
||||
/* fast table */
|
||||
fast_step_type=0;
|
||||
if(scan_step_type<=fast_step_type)
|
||||
{
|
||||
fast_step_type=scan_step_type;
|
||||
StepType fast_step_type = StepType::FULL;
|
||||
if (static_cast<unsigned>(step_type) <= static_cast<unsigned>(fast_step_type)) {
|
||||
fast_step_type = step_type;
|
||||
}
|
||||
|
||||
sanei_genesys_slope_table(fast_table,
|
||||
&fast_steps,
|
||||
sanei_genesys_get_lowest_ydpi(dev),
|
||||
|
@ -959,7 +960,7 @@ static void gl843_init_motor_regs_scan(Genesys_Device* dev,
|
|||
|
||||
/* substract acceleration distance from feedl */
|
||||
feedl=feed_steps;
|
||||
feedl<<=scan_step_type;
|
||||
feedl <<= static_cast<unsigned>(step_type);
|
||||
|
||||
dist = scan_steps;
|
||||
if (use_fast_fed)
|
||||
|
@ -1005,10 +1006,11 @@ static void gl843_init_motor_regs_scan(Genesys_Device* dev,
|
|||
r->value |= scan_dummy; /* dummy lines */
|
||||
|
||||
r = sanei_genesys_get_address (reg, REG67);
|
||||
r->value = 0x3f | (scan_step_type << REG67S_STEPSEL);
|
||||
r->value = 0x3f | (static_cast<unsigned>(step_type) << REG67S_STEPSEL);
|
||||
|
||||
// BUG: here we are writing non-fast step type to fast step type register
|
||||
r = sanei_genesys_get_address (reg, REG68);
|
||||
r->value = 0x3f | (scan_step_type << REG68S_FSTPSEL);
|
||||
r->value = 0x3f | (static_cast<unsigned>(step_type) << REG68S_FSTPSEL);
|
||||
|
||||
/* steps for STOP table */
|
||||
r = sanei_genesys_get_address (reg, REG_FMOVDEC);
|
||||
|
@ -1255,7 +1257,6 @@ static void gl843_init_scan_regs(Genesys_Device* dev, const Genesys_Sensor& sens
|
|||
|
||||
int slope_dpi = 0;
|
||||
int dummy = 0;
|
||||
int scan_step_type = 1;
|
||||
|
||||
/* we enable true gray for cis scanners only, and just when doing
|
||||
* scan since color calibration is OK for this mode
|
||||
|
@ -1277,11 +1278,12 @@ static void gl843_init_scan_regs(Genesys_Device* dev, const Genesys_Sensor& sens
|
|||
if (exposure < 0) {
|
||||
throw std::runtime_error("Exposure not defined in sensor definition");
|
||||
}
|
||||
scan_step_type = sanei_genesys_compute_step_type(gl843_motor_profiles, dev->model->motor_id,
|
||||
exposure);
|
||||
StepType scan_step_type = sanei_genesys_compute_step_type(gl843_motor_profiles,
|
||||
dev->model->motor_id,
|
||||
exposure);
|
||||
|
||||
DBG(DBG_info, "%s : exposure=%d pixels\n", __func__, exposure);
|
||||
DBG(DBG_info, "%s : scan_step_type=%d\n", __func__, scan_step_type);
|
||||
DBG(DBG_info, "%s : scan_step_type=%d\n", __func__, static_cast<unsigned>(scan_step_type));
|
||||
|
||||
// now _LOGICAL_ optical values used are known, setup registers
|
||||
gl843_init_optical_regs_scan(dev, sensor, reg, exposure, session);
|
||||
|
|
|
@ -428,16 +428,16 @@ static void gl846_init_motor_regs_scan(Genesys_Device* dev,
|
|||
Genesys_Register_Set* reg,
|
||||
unsigned int scan_exposure_time,
|
||||
float scan_yres,
|
||||
int scan_step_type,
|
||||
StepType step_type,
|
||||
unsigned int scan_lines,
|
||||
unsigned int scan_dummy,
|
||||
unsigned int feed_steps,
|
||||
unsigned int flags)
|
||||
{
|
||||
DBG_HELPER_ARGS(dbg, "scan_exposure_time=%d, scan_yres=%g, scan_step_type=%d, scan_lines=%d, "
|
||||
DBG_HELPER_ARGS(dbg, "scan_exposure_time=%d, scan_yres=%g, step_type=%d, scan_lines=%d, "
|
||||
"scan_dummy=%d, feed_steps=%d, flags=%x",
|
||||
scan_exposure_time, scan_yres, scan_step_type, scan_lines, scan_dummy,
|
||||
feed_steps, flags);
|
||||
scan_exposure_time, scan_yres, static_cast<unsigned>(step_type), scan_lines,
|
||||
scan_dummy, feed_steps, flags);
|
||||
int use_fast_fed;
|
||||
unsigned int fast_dpi;
|
||||
std::vector<uint16_t> scan_table;
|
||||
|
@ -448,7 +448,6 @@ static void gl846_init_motor_regs_scan(Genesys_Device* dev,
|
|||
uint32_t z1, z2;
|
||||
unsigned int min_restep = 0x20;
|
||||
uint8_t val;
|
||||
int fast_step_type;
|
||||
unsigned int ccdlmt,tgtime;
|
||||
|
||||
/* get step multiplier */
|
||||
|
@ -491,7 +490,7 @@ static void gl846_init_motor_regs_scan(Genesys_Device* dev,
|
|||
scan_yres,
|
||||
scan_exposure_time,
|
||||
dev->motor.base_ydpi,
|
||||
scan_step_type,
|
||||
step_type,
|
||||
factor,
|
||||
dev->model->motor_id,
|
||||
gl846_motor_profiles);
|
||||
|
@ -500,10 +499,10 @@ static void gl846_init_motor_regs_scan(Genesys_Device* dev,
|
|||
|
||||
/* fast table */
|
||||
fast_dpi=sanei_genesys_get_lowest_ydpi(dev);
|
||||
fast_step_type=scan_step_type;
|
||||
if(scan_step_type>=2)
|
||||
{
|
||||
fast_step_type=2;
|
||||
|
||||
StepType fast_step_type = step_type;
|
||||
if (static_cast<unsigned>(step_type) >= static_cast<unsigned>(StepType::QUARTER)) {
|
||||
fast_step_type = StepType::QUARTER;
|
||||
}
|
||||
|
||||
sanei_genesys_slope_table(fast_table,
|
||||
|
@ -527,7 +526,7 @@ static void gl846_init_motor_regs_scan(Genesys_Device* dev,
|
|||
feedl=feed_steps;
|
||||
if (use_fast_fed)
|
||||
{
|
||||
feedl<<=fast_step_type;
|
||||
feedl <<= static_cast<unsigned>(fast_step_type);
|
||||
dist=(scan_steps+2*fast_steps)*factor;
|
||||
/* TODO read and decode REGAB */
|
||||
r = sanei_genesys_get_address (reg, 0x5e);
|
||||
|
@ -538,7 +537,7 @@ static void gl846_init_motor_regs_scan(Genesys_Device* dev,
|
|||
}
|
||||
else
|
||||
{
|
||||
feedl<<=scan_step_type;
|
||||
feedl <<= static_cast<unsigned>(step_type);
|
||||
dist=scan_steps*factor;
|
||||
if (flags & MOTOR_FLAG_FEED)
|
||||
dist *=2;
|
||||
|
@ -569,9 +568,9 @@ static void gl846_init_motor_regs_scan(Genesys_Device* dev,
|
|||
|
||||
/* if quarter step, bipolar Vref2 */
|
||||
/* XXX STEF XXX GPIO
|
||||
if (scan_step_type > 1)
|
||||
if (step_type > 1)
|
||||
{
|
||||
if (scan_step_type < 3)
|
||||
if (step_type < 3)
|
||||
{
|
||||
val = effective & ~REG6C_GPIO13;
|
||||
}
|
||||
|
@ -623,10 +622,10 @@ static void gl846_init_motor_regs_scan(Genesys_Device* dev,
|
|||
&z2);
|
||||
|
||||
DBG(DBG_info, "%s: z1 = %d\n", __func__, z1);
|
||||
reg->set24(REG60, z1 | (scan_step_type << (16 + REG60S_STEPSEL)));
|
||||
reg->set24(REG60, z1 | (static_cast<unsigned>(step_type) << (16 + REG60S_STEPSEL)));
|
||||
|
||||
DBG(DBG_info, "%s: z2 = %d\n", __func__, z2);
|
||||
reg->set24(REG63, z2 | (scan_step_type << (16 + REG63S_FSTPSEL)));
|
||||
reg->set24(REG63, z2 | (static_cast<unsigned>(step_type) << (16 + REG63S_FSTPSEL)));
|
||||
|
||||
r = sanei_genesys_get_address (reg, 0x1e);
|
||||
r->value &= 0xf0; /* 0 dummy lines */
|
||||
|
@ -842,7 +841,6 @@ static void gl846_init_scan_regs(Genesys_Device* dev, const Genesys_Sensor& sens
|
|||
|
||||
int slope_dpi = 0;
|
||||
int dummy = 0;
|
||||
int scan_step_type = 1;
|
||||
|
||||
dummy = 3-session.params.channels;
|
||||
|
||||
|
@ -859,11 +857,13 @@ static void gl846_init_scan_regs(Genesys_Device* dev, const Genesys_Sensor& sens
|
|||
|
||||
exposure_time = get_sensor_profile(dev->model->asic_type, sensor,
|
||||
session.params.xres, 1).exposure_lperiod;
|
||||
scan_step_type = sanei_genesys_compute_step_type(gl846_motor_profiles, dev->model->motor_id,
|
||||
exposure_time);
|
||||
StepType scan_step_type = sanei_genesys_compute_step_type(gl846_motor_profiles,
|
||||
dev->model->motor_id,
|
||||
exposure_time);
|
||||
|
||||
DBG(DBG_info, "%s : exposure_time=%d pixels\n", __func__, exposure_time);
|
||||
DBG(DBG_info, "%s : scan_step_type=%d\n", __func__, scan_step_type);
|
||||
DBG(DBG_info, "%s : scan_step_type=%d\n", __func__,
|
||||
static_cast<unsigned>(scan_step_type));
|
||||
|
||||
/* we enable true gray for cis scanners only, and just when doing
|
||||
* scan since color calibration is OK for this mode
|
||||
|
|
|
@ -462,16 +462,16 @@ static void gl847_init_motor_regs_scan(Genesys_Device* dev,
|
|||
Genesys_Register_Set* reg,
|
||||
unsigned int scan_exposure_time,
|
||||
float scan_yres,
|
||||
int scan_step_type,
|
||||
StepType step_type,
|
||||
unsigned int scan_lines,
|
||||
unsigned int scan_dummy,
|
||||
unsigned int feed_steps,
|
||||
unsigned int flags)
|
||||
{
|
||||
DBG_HELPER_ARGS(dbg, "scan_exposure_time=%d, can_yres=%g, scan_step_type=%d, scan_lines=%d, "
|
||||
DBG_HELPER_ARGS(dbg, "scan_exposure_time=%d, can_yres=%g, step_type=%d, scan_lines=%d, "
|
||||
"scan_dummy=%d, feed_steps=%d, flags=%x",
|
||||
scan_exposure_time, scan_yres, scan_step_type, scan_lines, scan_dummy,
|
||||
feed_steps, flags);
|
||||
scan_exposure_time, scan_yres, static_cast<unsigned>(step_type), scan_lines,
|
||||
scan_dummy, feed_steps, flags);
|
||||
int use_fast_fed;
|
||||
unsigned int fast_dpi;
|
||||
std::vector<uint16_t> scan_table;
|
||||
|
@ -482,7 +482,6 @@ static void gl847_init_motor_regs_scan(Genesys_Device* dev,
|
|||
uint32_t z1, z2;
|
||||
unsigned int min_restep = 0x20;
|
||||
uint8_t val;
|
||||
int fast_step_type;
|
||||
unsigned int ccdlmt,tgtime;
|
||||
|
||||
/* get step multiplier */
|
||||
|
@ -525,7 +524,7 @@ static void gl847_init_motor_regs_scan(Genesys_Device* dev,
|
|||
scan_yres,
|
||||
scan_exposure_time,
|
||||
dev->motor.base_ydpi,
|
||||
scan_step_type,
|
||||
step_type,
|
||||
factor,
|
||||
dev->model->motor_id,
|
||||
gl847_motor_profiles);
|
||||
|
@ -534,10 +533,9 @@ static void gl847_init_motor_regs_scan(Genesys_Device* dev,
|
|||
|
||||
/* fast table */
|
||||
fast_dpi=sanei_genesys_get_lowest_ydpi(dev);
|
||||
fast_step_type=scan_step_type;
|
||||
if(scan_step_type>=2)
|
||||
{
|
||||
fast_step_type=2;
|
||||
StepType fast_step_type = step_type;
|
||||
if (static_cast<unsigned>(step_type) >= static_cast<unsigned>(StepType::QUARTER)) {
|
||||
fast_step_type = StepType::QUARTER;
|
||||
}
|
||||
|
||||
sanei_genesys_slope_table(fast_table,
|
||||
|
@ -561,7 +559,7 @@ static void gl847_init_motor_regs_scan(Genesys_Device* dev,
|
|||
feedl=feed_steps;
|
||||
if (use_fast_fed)
|
||||
{
|
||||
feedl<<=fast_step_type;
|
||||
feedl <<= static_cast<unsigned>(fast_step_type);
|
||||
dist=(scan_steps+2*fast_steps)*factor;
|
||||
/* TODO read and decode REGAB */
|
||||
r = sanei_genesys_get_address (reg, 0x5e);
|
||||
|
@ -572,7 +570,7 @@ static void gl847_init_motor_regs_scan(Genesys_Device* dev,
|
|||
}
|
||||
else
|
||||
{
|
||||
feedl<<=scan_step_type;
|
||||
feedl <<= static_cast<unsigned>(step_type);
|
||||
dist=scan_steps*factor;
|
||||
if (flags & MOTOR_FLAG_FEED)
|
||||
dist *=2;
|
||||
|
@ -599,21 +597,14 @@ static void gl847_init_motor_regs_scan(Genesys_Device* dev,
|
|||
// hi res motor speed GPIO
|
||||
uint8_t effective = dev->read_register(REG6C);
|
||||
|
||||
/* if quarter step, bipolar Vref2 */
|
||||
if (scan_step_type > 1)
|
||||
{
|
||||
if (scan_step_type < 3)
|
||||
{
|
||||
val = effective & ~REG6C_GPIO13;
|
||||
}
|
||||
else
|
||||
{
|
||||
val = effective | REG6C_GPIO13;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
val = effective;
|
||||
// if quarter step, bipolar Vref2
|
||||
|
||||
if (step_type == StepType::QUARTER) {
|
||||
val = effective & ~REG6C_GPIO13;
|
||||
} else if (static_cast<unsigned>(step_type) > static_cast<unsigned>(StepType::QUARTER)) {
|
||||
val = effective | REG6C_GPIO13;
|
||||
} else {
|
||||
val = effective;
|
||||
}
|
||||
dev->write_register(REG6C, val);
|
||||
|
||||
|
@ -640,10 +631,10 @@ static void gl847_init_motor_regs_scan(Genesys_Device* dev,
|
|||
&z2);
|
||||
|
||||
DBG(DBG_info, "%s: z1 = %d\n", __func__, z1);
|
||||
reg->set24(REG60, z1 | (scan_step_type << (16+REG60S_STEPSEL)));
|
||||
reg->set24(REG60, z1 | (static_cast<unsigned>(step_type) << (16+REG60S_STEPSEL)));
|
||||
|
||||
DBG(DBG_info, "%s: z2 = %d\n", __func__, z2);
|
||||
reg->set24(REG63, z2 | (scan_step_type << (16+REG63S_FSTPSEL)));
|
||||
reg->set24(REG63, z2 | (static_cast<unsigned>(step_type) << (16+REG63S_FSTPSEL)));
|
||||
|
||||
r = sanei_genesys_get_address (reg, 0x1e);
|
||||
r->value &= 0xf0; /* 0 dummy lines */
|
||||
|
@ -857,7 +848,6 @@ static void gl847_init_scan_regs(Genesys_Device* dev, const Genesys_Sensor& sens
|
|||
|
||||
int slope_dpi = 0;
|
||||
int dummy = 0;
|
||||
int scan_step_type = 1;
|
||||
|
||||
dummy = 3 - session.params.channels;
|
||||
|
||||
|
@ -874,11 +864,12 @@ static void gl847_init_scan_regs(Genesys_Device* dev, const Genesys_Sensor& sens
|
|||
|
||||
exposure_time = get_sensor_profile(dev->model->asic_type, sensor,
|
||||
session.params.xres, 1).exposure_lperiod;
|
||||
scan_step_type = sanei_genesys_compute_step_type(gl847_motor_profiles, dev->model->motor_id,
|
||||
exposure_time);
|
||||
StepType scan_step_type = sanei_genesys_compute_step_type(gl847_motor_profiles,
|
||||
dev->model->motor_id,
|
||||
exposure_time);
|
||||
|
||||
DBG(DBG_info, "%s : exposure_time=%d pixels\n", __func__, exposure_time);
|
||||
DBG(DBG_info, "%s : scan_step_type=%d\n", __func__, scan_step_type);
|
||||
DBG(DBG_info, "%s : scan_step_type=%d\n", __func__, static_cast<unsigned>(scan_step_type));
|
||||
|
||||
/* we enable true gray for cis scanners only, and just when doing
|
||||
* scan since color calibration is OK for this mode
|
||||
|
|
|
@ -2117,8 +2117,7 @@ Motor_Profile* sanei_genesys_get_motor_profile(Motor_Profile *motors, MotorId mo
|
|||
* 2 for quarter step
|
||||
* 3 for eighth step
|
||||
*/
|
||||
int sanei_genesys_compute_step_type(Motor_Profile* motors, MotorId motor_id,
|
||||
int exposure)
|
||||
StepType sanei_genesys_compute_step_type(Motor_Profile* motors, MotorId motor_id, int exposure)
|
||||
{
|
||||
Motor_Profile *profile;
|
||||
|
||||
|
@ -2140,17 +2139,18 @@ Motor_Profile *profile;
|
|||
* @param motors motor profile database
|
||||
*/
|
||||
int sanei_genesys_slope_table(std::vector<uint16_t>& slope,
|
||||
int* steps, int dpi, int exposure, int base_dpi, int step_type,
|
||||
int* steps, int dpi, int exposure, int base_dpi, StepType step_type,
|
||||
int factor, MotorId motor_id, Motor_Profile* motors)
|
||||
{
|
||||
int sum, i;
|
||||
uint16_t target,current;
|
||||
Motor_Profile *profile;
|
||||
|
||||
unsigned step_shift = static_cast<unsigned>(step_type);
|
||||
slope.clear();
|
||||
|
||||
/* required speed */
|
||||
target=((exposure * dpi) / base_dpi)>>step_type;
|
||||
target = ((exposure * dpi) / base_dpi) >> step_shift;
|
||||
DBG (DBG_io2, "%s: exposure=%d, dpi=%d, target=%d\n", __func__, exposure, dpi, target);
|
||||
|
||||
/* fill result with target speed */
|
||||
|
@ -2171,7 +2171,7 @@ Motor_Profile *profile;
|
|||
slope[i]=current;
|
||||
sum+=slope[i];
|
||||
i++;
|
||||
current=profile->table[i]>>step_type;
|
||||
current = profile->table[i] >> step_shift;
|
||||
}
|
||||
|
||||
/* ensure last step is required speed in case profile doesn't contain it */
|
||||
|
|
|
@ -232,7 +232,7 @@ struct Motor_Profile
|
|||
{
|
||||
MotorId motor_id;
|
||||
int exposure; /**< exposure for the slope table */
|
||||
int step_type; /**< default step type for given exposure */
|
||||
StepType step_type; // default step type for given exposure
|
||||
uint32_t *table; // 0-terminated slope table at full step (i.e. step_type == 0)
|
||||
};
|
||||
|
||||
|
@ -241,11 +241,6 @@ extern Motor_Profile gl846_motor_profiles[];
|
|||
extern Motor_Profile gl847_motor_profiles[];
|
||||
extern Motor_Profile gl124_motor_profiles[];
|
||||
|
||||
#define FULL_STEP 0
|
||||
#define HALF_STEP 1
|
||||
#define QUARTER_STEP 2
|
||||
#define EIGHTH_STEP 3
|
||||
|
||||
#define SLOPE_TABLE_SIZE 1024
|
||||
|
||||
#define SCAN_TABLE 0 /* table 1 at 0x4000 for gl124 */
|
||||
|
@ -469,10 +464,10 @@ extern void sanei_genesys_asic_init(Genesys_Device* dev, SANE_Bool cold);
|
|||
Motor_Profile* sanei_genesys_get_motor_profile(Motor_Profile *motors, MotorId motor_id,
|
||||
int exposure);
|
||||
|
||||
int sanei_genesys_compute_step_type(Motor_Profile* motors, MotorId motor_id, int exposure);
|
||||
StepType sanei_genesys_compute_step_type(Motor_Profile* motors, MotorId motor_id, int exposure);
|
||||
|
||||
int sanei_genesys_slope_table(std::vector<uint16_t>& slope, int *steps, int dpi, int exposure,
|
||||
int base_dpi, int step_type, int factor, MotorId motor_id,
|
||||
int base_dpi, StepType step_type, int factor, MotorId motor_id,
|
||||
Motor_Profile *motors);
|
||||
|
||||
/** @brief find lowest motor resolution for the device.
|
||||
|
|
|
@ -748,17 +748,17 @@ static uint32_t motor_speeds_plustek_7200i_2[] = {
|
|||
};
|
||||
|
||||
Motor_Profile gl843_motor_profiles[] = {
|
||||
{ MotorId::KVSS080, 8000, 1, kvss080 },
|
||||
{ MotorId::G4050, 8016, 1, g4050_fast },
|
||||
{ MotorId::G4050, 11640, 1, cs4400f_fast },
|
||||
{ MotorId::G4050, 15624, 1, g4050_xpa },
|
||||
{ MotorId::G4050, 42752, 2, g4050_max },
|
||||
{ MotorId::G4050, 56064, 1, g4050_high },
|
||||
{ MotorId::CS8400F, 50000, 2, cs8400f_fast },
|
||||
{ MotorId::CS8600F, 0x59d8, 2, motor_speeds_cs8600f }, // FIXME: if the exposure is lower then we'll select another motor
|
||||
{ MotorId::PLUSTEK_7200I, 0x19c8, 1, motor_speeds_plustek_7200i_1},
|
||||
{ MotorId::PLUSTEK_7200I, 0x2538, 1, motor_speeds_plustek_7200i_2},
|
||||
{ MotorId::UNKNOWN, 0, 0, NULL },
|
||||
{ MotorId::KVSS080, 8000, StepType::HALF, kvss080 },
|
||||
{ MotorId::G4050, 8016, StepType::HALF, g4050_fast },
|
||||
{ MotorId::G4050, 11640, StepType::HALF, cs4400f_fast },
|
||||
{ MotorId::G4050, 15624, StepType::HALF, g4050_xpa },
|
||||
{ MotorId::G4050, 42752, StepType::QUARTER, g4050_max },
|
||||
{ MotorId::G4050, 56064, StepType::HALF, g4050_high },
|
||||
{ MotorId::CS8400F, 50000, StepType::QUARTER, cs8400f_fast },
|
||||
{ MotorId::CS8600F, 0x59d8, StepType::QUARTER, motor_speeds_cs8600f }, // FIXME: if the exposure is lower then we'll select another motor
|
||||
{ MotorId::PLUSTEK_7200I, 0x19c8, StepType::HALF, motor_speeds_plustek_7200i_1},
|
||||
{ MotorId::PLUSTEK_7200I, 0x2538, StepType::HALF, motor_speeds_plustek_7200i_2},
|
||||
{ MotorId::UNKNOWN, 0, StepType::FULL, NULL },
|
||||
};
|
||||
|
||||
/* base motor slopes in full step unit */
|
||||
|
@ -874,9 +874,9 @@ static uint32_t img101_high[] = {
|
|||
*/
|
||||
|
||||
Motor_Profile gl846_motor_profiles[] = {
|
||||
{ MotorId::IMG101, 11000, HALF_STEP, img101_high},
|
||||
{ MotorId::PLUSTEK3800, 11000, HALF_STEP, img101_high},
|
||||
{ MotorId::UNKNOWN, 0, 0, NULL},
|
||||
{ MotorId::IMG101, 11000, StepType::HALF, img101_high},
|
||||
{ MotorId::PLUSTEK3800, 11000, StepType::HALF, img101_high},
|
||||
{ MotorId::UNKNOWN, 0, StepType::FULL, NULL},
|
||||
};
|
||||
|
||||
/* base motor sopes in full step unit */
|
||||
|
@ -1027,26 +1027,26 @@ static uint32_t lide200_max[] = { 124992, 124992, 124992, 124992, 124992, 124992
|
|||
*/
|
||||
|
||||
Motor_Profile gl847_motor_profiles[] = {
|
||||
{ MotorId::CANONLIDE100, 2848, HALF_STEP , lide200_base },
|
||||
{ MotorId::CANONLIDE100, 1424, HALF_STEP , lide200_base },
|
||||
{ MotorId::CANONLIDE100, 1432, HALF_STEP , lide200_base },
|
||||
{ MotorId::CANONLIDE100, 2712, QUARTER_STEP, lide200_medium },
|
||||
{ MotorId::CANONLIDE100, 5280, EIGHTH_STEP , lide200_high },
|
||||
{ MotorId::CANONLIDE100, 2848, StepType::HALF , lide200_base },
|
||||
{ MotorId::CANONLIDE100, 1424, StepType::HALF , lide200_base },
|
||||
{ MotorId::CANONLIDE100, 1432, StepType::HALF , lide200_base },
|
||||
{ MotorId::CANONLIDE100, 2712, StepType::QUARTER, lide200_medium },
|
||||
{ MotorId::CANONLIDE100, 5280, StepType::EIGHTH , lide200_high },
|
||||
|
||||
{ MotorId::CANONLIDE200, 2848, HALF_STEP , lide200_base },
|
||||
{ MotorId::CANONLIDE200, 1424, HALF_STEP , lide200_base },
|
||||
{ MotorId::CANONLIDE200, 1432, HALF_STEP , lide200_base },
|
||||
{ MotorId::CANONLIDE200, 2712, QUARTER_STEP, lide200_medium },
|
||||
{ MotorId::CANONLIDE200, 5280, EIGHTH_STEP , lide200_high },
|
||||
{ MotorId::CANONLIDE200, 10416, EIGHTH_STEP , lide200_high },
|
||||
{ MotorId::CANONLIDE200, 2848, StepType::HALF , lide200_base },
|
||||
{ MotorId::CANONLIDE200, 1424, StepType::HALF , lide200_base },
|
||||
{ MotorId::CANONLIDE200, 1432, StepType::HALF , lide200_base },
|
||||
{ MotorId::CANONLIDE200, 2712, StepType::QUARTER, lide200_medium },
|
||||
{ MotorId::CANONLIDE200, 5280, StepType::EIGHTH , lide200_high },
|
||||
{ MotorId::CANONLIDE200, 10416, StepType::EIGHTH , lide200_high },
|
||||
|
||||
{ MotorId::CANONLIDE700, 2848, HALF_STEP , lide200_base },
|
||||
{ MotorId::CANONLIDE700, 1424, HALF_STEP , lide200_base },
|
||||
{ MotorId::CANONLIDE700, 1504, HALF_STEP , lide200_base },
|
||||
{ MotorId::CANONLIDE700, 2696, HALF_STEP , lide700_medium }, /* 2696 , 2838 */
|
||||
{ MotorId::CANONLIDE700, 10576, EIGHTH_STEP, lide700_high },
|
||||
{ MotorId::CANONLIDE700, 2848, StepType::HALF , lide200_base },
|
||||
{ MotorId::CANONLIDE700, 1424, StepType::HALF , lide200_base },
|
||||
{ MotorId::CANONLIDE700, 1504, StepType::HALF , lide200_base },
|
||||
{ MotorId::CANONLIDE700, 2696, StepType::HALF , lide700_medium }, /* 2696 , 2838 */
|
||||
{ MotorId::CANONLIDE700, 10576, StepType::EIGHTH, lide700_high },
|
||||
|
||||
{ MotorId::UNKNOWN, 0, 0, NULL},
|
||||
{ MotorId::UNKNOWN, 0, StepType::FULL, NULL},
|
||||
};
|
||||
|
||||
static uint32_t lide210_fast[] = {
|
||||
|
@ -1163,19 +1163,20 @@ static uint32_t lide210_max[] = { 62496, 31296, 20864, 10432, 0 };
|
|||
|
||||
// NEXT LPERIOD=PREVIOUS*2-192
|
||||
Motor_Profile gl124_motor_profiles[] = {
|
||||
{ MotorId::CANONLIDE110, 2768, 0, lide210_fast },
|
||||
{ MotorId::CANONLIDE110, 5360, 1, lide110_ok },
|
||||
{ MotorId::CANONLIDE110, 10528, 1, lide110_slow },
|
||||
{ MotorId::CANONLIDE110, 20864, 2, lide110_max },
|
||||
{ MotorId::CANONLIDE110, 2768, StepType::FULL, lide210_fast },
|
||||
{ MotorId::CANONLIDE110, 5360, StepType::HALF, lide110_ok },
|
||||
{ MotorId::CANONLIDE110, 10528, StepType::HALF, lide110_slow },
|
||||
{ MotorId::CANONLIDE110, 20864, StepType::QUARTER, lide110_max },
|
||||
|
||||
{ MotorId::CANONLIDE120, 4608, 0, lide120_fast },
|
||||
{ MotorId::CANONLIDE120, 5360, 1, lide120_ok },
|
||||
{ MotorId::CANONLIDE120, 10528, 2, lide120_slow },
|
||||
{ MotorId::CANONLIDE120, 20864, 2, lide120_max },
|
||||
{ MotorId::CANONLIDE120, 4608, StepType::FULL, lide120_fast },
|
||||
{ MotorId::CANONLIDE120, 5360, StepType::HALF, lide120_ok },
|
||||
{ MotorId::CANONLIDE120, 10528, StepType::QUARTER, lide120_slow },
|
||||
{ MotorId::CANONLIDE120, 20864, StepType::QUARTER, lide120_max },
|
||||
|
||||
{ MotorId::CANONLIDE210, 2768, 0, lide210_fast },
|
||||
{ MotorId::CANONLIDE210, 5360, 1, lide110_ok },
|
||||
{ MotorId::CANONLIDE210, 10528, 1, lide110_slow },
|
||||
{ MotorId::CANONLIDE210, 20864, 2, lide210_max },
|
||||
{ MotorId::UNKNOWN, 0, 0, NULL},
|
||||
{ MotorId::CANONLIDE210, 2768, StepType::FULL, lide210_fast },
|
||||
{ MotorId::CANONLIDE210, 5360, StepType::HALF, lide110_ok },
|
||||
{ MotorId::CANONLIDE210, 10528, StepType::HALF, lide110_slow },
|
||||
{ MotorId::CANONLIDE210, 20864, StepType::QUARTER, lide210_max },
|
||||
|
||||
{ MotorId::UNKNOWN, 0, StepType::FULL, NULL},
|
||||
};
|
||||
|
|
Ładowanie…
Reference in New Issue