kopia lustrzana https://gitlab.com/sane-project/backends
genesys: Return MotorSlopeTable out of sanei_genesys_slope_table()
rodzic
63b0366b43
commit
9cd373fe6c
|
@ -496,9 +496,7 @@ static void gl124_init_motor_regs_scan(Genesys_Device* dev,
|
||||||
DBG_HELPER(dbg);
|
DBG_HELPER(dbg);
|
||||||
int use_fast_fed;
|
int use_fast_fed;
|
||||||
unsigned int lincnt, fast_dpi;
|
unsigned int lincnt, fast_dpi;
|
||||||
std::vector<uint16_t> scan_table;
|
int factor;
|
||||||
std::vector<uint16_t> fast_table;
|
|
||||||
int scan_steps,fast_steps,factor;
|
|
||||||
unsigned int feedl,dist;
|
unsigned int feedl,dist;
|
||||||
uint32_t z1, z2;
|
uint32_t z1, z2;
|
||||||
unsigned yres;
|
unsigned yres;
|
||||||
|
@ -584,17 +582,12 @@ static void gl124_init_motor_regs_scan(Genesys_Device* dev,
|
||||||
reg->set16(REG_SCANFED, 4);
|
reg->set16(REG_SCANFED, 4);
|
||||||
|
|
||||||
/* scan and backtracking slope table */
|
/* scan and backtracking slope table */
|
||||||
sanei_genesys_slope_table(scan_table,
|
auto scan_table = sanei_genesys_slope_table(yres, scan_exposure_time,
|
||||||
&scan_steps,
|
dev->motor.base_ydpi, factor, motor_profile);
|
||||||
yres,
|
gl124_send_slope_table(dev, SCAN_TABLE, scan_table.table, scan_table.scan_steps);
|
||||||
scan_exposure_time,
|
gl124_send_slope_table(dev, BACKTRACK_TABLE, scan_table.table, scan_table.scan_steps);
|
||||||
dev->motor.base_ydpi,
|
|
||||||
factor,
|
|
||||||
motor_profile);
|
|
||||||
gl124_send_slope_table(dev, SCAN_TABLE, scan_table, scan_steps);
|
|
||||||
gl124_send_slope_table(dev, BACKTRACK_TABLE, scan_table, scan_steps);
|
|
||||||
|
|
||||||
reg->set16(REG_STEPNO, scan_steps);
|
reg->set16(REG_STEPNO, scan_table.scan_steps);
|
||||||
|
|
||||||
/* fast table */
|
/* fast table */
|
||||||
fast_dpi=yres;
|
fast_dpi=yres;
|
||||||
|
@ -605,30 +598,25 @@ static void gl124_init_motor_regs_scan(Genesys_Device* dev,
|
||||||
fast_dpi*=3;
|
fast_dpi*=3;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
sanei_genesys_slope_table(fast_table,
|
auto fast_table = sanei_genesys_slope_table(fast_dpi, scan_exposure_time, dev->motor.base_ydpi,
|
||||||
&fast_steps,
|
factor, motor_profile);
|
||||||
fast_dpi,
|
gl124_send_slope_table(dev, STOP_TABLE, fast_table.table, fast_table.scan_steps);
|
||||||
scan_exposure_time,
|
gl124_send_slope_table(dev, FAST_TABLE, fast_table.table, fast_table.scan_steps);
|
||||||
dev->motor.base_ydpi,
|
|
||||||
factor,
|
|
||||||
motor_profile);
|
|
||||||
gl124_send_slope_table(dev, STOP_TABLE, fast_table, fast_steps);
|
|
||||||
gl124_send_slope_table(dev, FAST_TABLE, fast_table, fast_steps);
|
|
||||||
|
|
||||||
reg->set16(REG_FASTNO, fast_steps);
|
reg->set16(REG_FASTNO, fast_table.scan_steps);
|
||||||
reg->set16(REG_FSHDEC, fast_steps);
|
reg->set16(REG_FSHDEC, fast_table.scan_steps);
|
||||||
reg->set16(REG_FMOVNO, fast_steps);
|
reg->set16(REG_FMOVNO, fast_table.scan_steps);
|
||||||
|
|
||||||
/* substract acceleration distance from feedl */
|
/* substract acceleration distance from feedl */
|
||||||
feedl=feed_steps;
|
feedl=feed_steps;
|
||||||
feedl <<= static_cast<unsigned>(motor_profile.step_type);
|
feedl <<= static_cast<unsigned>(motor_profile.step_type);
|
||||||
|
|
||||||
dist = scan_steps;
|
dist = scan_table.scan_steps;
|
||||||
if (flags & MOTOR_FLAG_FEED)
|
if (flags & MOTOR_FLAG_FEED) {
|
||||||
dist *= 2;
|
dist *= 2;
|
||||||
if (use_fast_fed)
|
}
|
||||||
{
|
if (use_fast_fed) {
|
||||||
dist += fast_steps*2;
|
dist += fast_table.scan_steps * 2;
|
||||||
}
|
}
|
||||||
DBG (DBG_io2, "%s: acceleration distance=%d\n", __func__, dist);
|
DBG (DBG_io2, "%s: acceleration distance=%d\n", __func__, dist);
|
||||||
|
|
||||||
|
@ -645,10 +633,10 @@ static void gl124_init_motor_regs_scan(Genesys_Device* dev,
|
||||||
/* doesn't seem to matter that much */
|
/* doesn't seem to matter that much */
|
||||||
sanei_genesys_calculate_zmod(use_fast_fed,
|
sanei_genesys_calculate_zmod(use_fast_fed,
|
||||||
scan_exposure_time,
|
scan_exposure_time,
|
||||||
scan_table,
|
scan_table.table,
|
||||||
scan_steps,
|
scan_table.scan_steps,
|
||||||
feedl,
|
feedl,
|
||||||
scan_steps,
|
scan_table.scan_steps,
|
||||||
&z1,
|
&z1,
|
||||||
&z2);
|
&z2);
|
||||||
|
|
||||||
|
@ -663,7 +651,7 @@ static void gl124_init_motor_regs_scan(Genesys_Device* dev,
|
||||||
reg->set8(REG_0xA0, (static_cast<unsigned>(motor_profile.step_type) << REG_0xA0S_STEPSEL) |
|
reg->set8(REG_0xA0, (static_cast<unsigned>(motor_profile.step_type) << REG_0xA0S_STEPSEL) |
|
||||||
(static_cast<unsigned>(motor_profile.step_type) << REG_0xA0S_FSTPSEL));
|
(static_cast<unsigned>(motor_profile.step_type) << REG_0xA0S_FSTPSEL));
|
||||||
|
|
||||||
reg->set16(REG_FMOVDEC, fast_steps);
|
reg->set16(REG_FMOVDEC, fast_table.scan_steps);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -832,9 +832,6 @@ static void gl843_init_motor_regs_scan(Genesys_Device* dev,
|
||||||
|
|
||||||
int use_fast_fed, coeff;
|
int use_fast_fed, coeff;
|
||||||
unsigned int lincnt;
|
unsigned int lincnt;
|
||||||
std::vector<uint16_t> scan_table;
|
|
||||||
std::vector<uint16_t> fast_table;
|
|
||||||
int scan_steps,fast_steps;
|
|
||||||
unsigned int feedl,factor,dist;
|
unsigned int feedl,factor,dist;
|
||||||
GenesysRegister *r;
|
GenesysRegister *r;
|
||||||
uint32_t z1, z2;
|
uint32_t z1, z2;
|
||||||
|
@ -876,23 +873,19 @@ static void gl843_init_motor_regs_scan(Genesys_Device* dev,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* scan and backtracking slope table */
|
/* scan and backtracking slope table */
|
||||||
sanei_genesys_slope_table(scan_table,
|
auto scan_table = sanei_genesys_slope_table(scan_yres, exposure, dev->motor.base_ydpi,
|
||||||
&scan_steps,
|
factor, motor_profile);
|
||||||
scan_yres,
|
|
||||||
exposure,
|
gl843_send_slope_table(dev, SCAN_TABLE, scan_table.table, scan_table.scan_steps * factor);
|
||||||
dev->motor.base_ydpi,
|
gl843_send_slope_table(dev, BACKTRACK_TABLE, scan_table.table, scan_table.scan_steps * factor);
|
||||||
factor,
|
|
||||||
motor_profile);
|
|
||||||
gl843_send_slope_table(dev, SCAN_TABLE, scan_table, scan_steps * factor);
|
|
||||||
gl843_send_slope_table(dev, BACKTRACK_TABLE, scan_table, scan_steps * factor);
|
|
||||||
|
|
||||||
/* STEPNO */
|
/* STEPNO */
|
||||||
r = sanei_genesys_get_address(reg, REG_STEPNO);
|
r = sanei_genesys_get_address(reg, REG_STEPNO);
|
||||||
r->value = scan_steps;
|
r->value = scan_table.scan_steps;
|
||||||
|
|
||||||
/* FSHDEC */
|
/* FSHDEC */
|
||||||
r = sanei_genesys_get_address(reg, REG_FSHDEC);
|
r = sanei_genesys_get_address(reg, REG_FSHDEC);
|
||||||
r->value = scan_steps;
|
r->value = scan_table.scan_steps;
|
||||||
|
|
||||||
/* fast table */
|
/* fast table */
|
||||||
// BUG: looks like for fast moves we use inconsistent step type
|
// BUG: looks like for fast moves we use inconsistent step type
|
||||||
|
@ -908,33 +901,28 @@ static void gl843_init_motor_regs_scan(Genesys_Device* dev,
|
||||||
if (dev->model->model_id == ModelId::CANON_4400F) {
|
if (dev->model->model_id == ModelId::CANON_4400F) {
|
||||||
fast_yres = scan_yres;
|
fast_yres = scan_yres;
|
||||||
}
|
}
|
||||||
sanei_genesys_slope_table(fast_table,
|
auto fast_table = sanei_genesys_slope_table(fast_yres, exposure, dev->motor.base_ydpi,
|
||||||
&fast_steps,
|
factor, fast_motor_profile);
|
||||||
fast_yres,
|
gl843_send_slope_table(dev, STOP_TABLE, fast_table.table, fast_table.scan_steps * factor);
|
||||||
exposure,
|
gl843_send_slope_table(dev, FAST_TABLE, fast_table.table, fast_table.scan_steps * factor);
|
||||||
dev->motor.base_ydpi,
|
gl843_send_slope_table(dev, HOME_TABLE, fast_table.table, fast_table.scan_steps * factor);
|
||||||
factor,
|
|
||||||
fast_motor_profile);
|
|
||||||
gl843_send_slope_table(dev, STOP_TABLE, fast_table, fast_steps * factor);
|
|
||||||
gl843_send_slope_table(dev, FAST_TABLE, fast_table, fast_steps * factor);
|
|
||||||
gl843_send_slope_table(dev, HOME_TABLE, fast_table, fast_steps * factor);
|
|
||||||
|
|
||||||
/* FASTNO */
|
/* FASTNO */
|
||||||
r = sanei_genesys_get_address(reg, REG_FASTNO);
|
r = sanei_genesys_get_address(reg, REG_FASTNO);
|
||||||
r->value = fast_steps;
|
r->value = fast_table.scan_steps;
|
||||||
|
|
||||||
/* FMOVNO */
|
/* FMOVNO */
|
||||||
r = sanei_genesys_get_address(reg, REG_FMOVNO);
|
r = sanei_genesys_get_address(reg, REG_FMOVNO);
|
||||||
r->value = fast_steps;
|
r->value = fast_table.scan_steps;
|
||||||
|
|
||||||
/* substract acceleration distance from feedl */
|
/* substract acceleration distance from feedl */
|
||||||
feedl=feed_steps;
|
feedl=feed_steps;
|
||||||
feedl <<= static_cast<unsigned>(motor_profile.step_type);
|
feedl <<= static_cast<unsigned>(motor_profile.step_type);
|
||||||
|
|
||||||
dist = scan_steps;
|
dist = scan_table.scan_steps;
|
||||||
if (use_fast_fed)
|
if (use_fast_fed)
|
||||||
{
|
{
|
||||||
dist += fast_steps*2;
|
dist += fast_table.scan_steps*2;
|
||||||
}
|
}
|
||||||
DBG(DBG_io2, "%s: acceleration distance=%d\n", __func__, dist);
|
DBG(DBG_io2, "%s: acceleration distance=%d\n", __func__, dist);
|
||||||
|
|
||||||
|
@ -952,10 +940,10 @@ static void gl843_init_motor_regs_scan(Genesys_Device* dev,
|
||||||
/* doesn't seem to matter that much */
|
/* doesn't seem to matter that much */
|
||||||
sanei_genesys_calculate_zmod(use_fast_fed,
|
sanei_genesys_calculate_zmod(use_fast_fed,
|
||||||
exposure,
|
exposure,
|
||||||
scan_table,
|
scan_table.table,
|
||||||
scan_steps,
|
scan_table.scan_steps,
|
||||||
feedl,
|
feedl,
|
||||||
scan_steps,
|
scan_table.scan_steps,
|
||||||
&z1,
|
&z1,
|
||||||
&z2);
|
&z2);
|
||||||
if(scan_yres>600)
|
if(scan_yres>600)
|
||||||
|
@ -979,7 +967,7 @@ static void gl843_init_motor_regs_scan(Genesys_Device* dev,
|
||||||
|
|
||||||
/* steps for STOP table */
|
/* steps for STOP table */
|
||||||
r = sanei_genesys_get_address(reg, REG_FMOVDEC);
|
r = sanei_genesys_get_address(reg, REG_FMOVDEC);
|
||||||
r->value = fast_steps;
|
r->value = fast_table.scan_steps;
|
||||||
|
|
||||||
/* Vref XXX STEF XXX : optical divider or step type ? */
|
/* Vref XXX STEF XXX : optical divider or step type ? */
|
||||||
r = sanei_genesys_get_address (reg, 0x80);
|
r = sanei_genesys_get_address (reg, 0x80);
|
||||||
|
|
|
@ -385,9 +385,7 @@ static void gl846_init_motor_regs_scan(Genesys_Device* dev,
|
||||||
scan_lines, scan_dummy, feed_steps, flags);
|
scan_lines, scan_dummy, feed_steps, flags);
|
||||||
int use_fast_fed;
|
int use_fast_fed;
|
||||||
unsigned int fast_dpi;
|
unsigned int fast_dpi;
|
||||||
std::vector<uint16_t> scan_table;
|
int factor;
|
||||||
std::vector<uint16_t> fast_table;
|
|
||||||
int scan_steps, fast_steps, factor;
|
|
||||||
unsigned int feedl, dist;
|
unsigned int feedl, dist;
|
||||||
GenesysRegister *r;
|
GenesysRegister *r;
|
||||||
uint32_t z1, z2;
|
uint32_t z1, z2;
|
||||||
|
@ -430,15 +428,10 @@ static void gl846_init_motor_regs_scan(Genesys_Device* dev,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* scan and backtracking slope table */
|
/* scan and backtracking slope table */
|
||||||
sanei_genesys_slope_table(scan_table,
|
auto scan_table = sanei_genesys_slope_table(scan_yres, scan_exposure_time, dev->motor.base_ydpi,
|
||||||
&scan_steps,
|
factor, motor_profile);
|
||||||
scan_yres,
|
gl846_send_slope_table(dev, SCAN_TABLE, scan_table.table, scan_table.scan_steps * factor);
|
||||||
scan_exposure_time,
|
gl846_send_slope_table(dev, BACKTRACK_TABLE, scan_table.table, scan_table.scan_steps * factor);
|
||||||
dev->motor.base_ydpi,
|
|
||||||
factor,
|
|
||||||
motor_profile);
|
|
||||||
gl846_send_slope_table(dev, SCAN_TABLE, scan_table, scan_steps * factor);
|
|
||||||
gl846_send_slope_table(dev, BACKTRACK_TABLE, scan_table, scan_steps * factor);
|
|
||||||
|
|
||||||
/* fast table */
|
/* fast table */
|
||||||
fast_dpi=sanei_genesys_get_lowest_ydpi(dev);
|
fast_dpi=sanei_genesys_get_lowest_ydpi(dev);
|
||||||
|
@ -452,27 +445,22 @@ static void gl846_init_motor_regs_scan(Genesys_Device* dev,
|
||||||
Motor_Profile fast_motor_profile = motor_profile;
|
Motor_Profile fast_motor_profile = motor_profile;
|
||||||
fast_motor_profile.step_type = fast_step_type;
|
fast_motor_profile.step_type = fast_step_type;
|
||||||
|
|
||||||
sanei_genesys_slope_table(fast_table,
|
auto fast_table = sanei_genesys_slope_table(fast_dpi, scan_exposure_time, dev->motor.base_ydpi,
|
||||||
&fast_steps,
|
factor, fast_motor_profile);
|
||||||
fast_dpi,
|
|
||||||
scan_exposure_time,
|
|
||||||
dev->motor.base_ydpi,
|
|
||||||
factor,
|
|
||||||
fast_motor_profile);
|
|
||||||
|
|
||||||
/* manual override of high start value */
|
// manual override of high start value
|
||||||
fast_table[0]=fast_table[1];
|
fast_table.table[0] = fast_table.table[1];
|
||||||
|
|
||||||
gl846_send_slope_table(dev, STOP_TABLE, fast_table, fast_steps * factor);
|
gl846_send_slope_table(dev, STOP_TABLE, fast_table.table, fast_table.scan_steps * factor);
|
||||||
gl846_send_slope_table(dev, FAST_TABLE, fast_table, fast_steps * factor);
|
gl846_send_slope_table(dev, FAST_TABLE, fast_table.table, fast_table.scan_steps * factor);
|
||||||
gl846_send_slope_table(dev, HOME_TABLE, fast_table, fast_steps * factor);
|
gl846_send_slope_table(dev, HOME_TABLE, fast_table.table, fast_table.scan_steps * factor);
|
||||||
|
|
||||||
/* correct move distance by acceleration and deceleration amounts */
|
/* correct move distance by acceleration and deceleration amounts */
|
||||||
feedl=feed_steps;
|
feedl=feed_steps;
|
||||||
if (use_fast_fed)
|
if (use_fast_fed)
|
||||||
{
|
{
|
||||||
feedl <<= static_cast<unsigned>(fast_step_type);
|
feedl <<= static_cast<unsigned>(fast_step_type);
|
||||||
dist=(scan_steps+2*fast_steps)*factor;
|
dist = (scan_table.scan_steps + 2 * fast_table.scan_steps) * factor;
|
||||||
/* TODO read and decode REG_0xAB */
|
/* TODO read and decode REG_0xAB */
|
||||||
r = sanei_genesys_get_address (reg, 0x5e);
|
r = sanei_genesys_get_address (reg, 0x5e);
|
||||||
dist += (r->value & 31);
|
dist += (r->value & 31);
|
||||||
|
@ -483,11 +471,11 @@ static void gl846_init_motor_regs_scan(Genesys_Device* dev,
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
feedl <<= static_cast<unsigned>(motor_profile.step_type);
|
feedl <<= static_cast<unsigned>(motor_profile.step_type);
|
||||||
dist=scan_steps*factor;
|
dist=scan_table.scan_steps*factor;
|
||||||
if (flags & MOTOR_FLAG_FEED)
|
if (flags & MOTOR_FLAG_FEED)
|
||||||
dist *=2;
|
dist *=2;
|
||||||
}
|
}
|
||||||
DBG (DBG_io2, "%s: scan steps=%d\n", __func__, scan_steps);
|
DBG (DBG_io2, "%s: scan steps=%d\n", __func__, scan_table.scan_steps);
|
||||||
DBG (DBG_io2, "%s: acceleration distance=%d\n", __func__, dist);
|
DBG (DBG_io2, "%s: acceleration distance=%d\n", __func__, dist);
|
||||||
|
|
||||||
/* check for overflow */
|
/* check for overflow */
|
||||||
|
@ -549,7 +537,7 @@ static void gl846_init_motor_regs_scan(Genesys_Device* dev,
|
||||||
dev->interface->write_register(REG_0x7E, val);
|
dev->interface->write_register(REG_0x7E, val);
|
||||||
}
|
}
|
||||||
|
|
||||||
min_restep=scan_steps/2-1;
|
min_restep = scan_table.scan_steps / 2 - 1;
|
||||||
if (min_restep < 1) {
|
if (min_restep < 1) {
|
||||||
min_restep = 1;
|
min_restep = 1;
|
||||||
}
|
}
|
||||||
|
@ -560,8 +548,8 @@ static void gl846_init_motor_regs_scan(Genesys_Device* dev,
|
||||||
|
|
||||||
sanei_genesys_calculate_zmod(use_fast_fed,
|
sanei_genesys_calculate_zmod(use_fast_fed,
|
||||||
scan_exposure_time*ccdlmt*tgtime,
|
scan_exposure_time*ccdlmt*tgtime,
|
||||||
scan_table,
|
scan_table.table,
|
||||||
scan_steps*factor,
|
scan_table.scan_steps*factor,
|
||||||
feedl,
|
feedl,
|
||||||
min_restep*factor,
|
min_restep*factor,
|
||||||
&z1,
|
&z1,
|
||||||
|
@ -584,19 +572,19 @@ static void gl846_init_motor_regs_scan(Genesys_Device* dev,
|
||||||
r->value = 0x7f;
|
r->value = 0x7f;
|
||||||
|
|
||||||
r = sanei_genesys_get_address(reg, REG_STEPNO);
|
r = sanei_genesys_get_address(reg, REG_STEPNO);
|
||||||
r->value = scan_steps;
|
r->value = scan_table.scan_steps;
|
||||||
|
|
||||||
r = sanei_genesys_get_address(reg, REG_FASTNO);
|
r = sanei_genesys_get_address(reg, REG_FASTNO);
|
||||||
r->value = scan_steps;
|
r->value = scan_table.scan_steps;
|
||||||
|
|
||||||
r = sanei_genesys_get_address(reg, REG_FSHDEC);
|
r = sanei_genesys_get_address(reg, REG_FSHDEC);
|
||||||
r->value = scan_steps;
|
r->value = scan_table.scan_steps;
|
||||||
|
|
||||||
r = sanei_genesys_get_address(reg, REG_FMOVNO);
|
r = sanei_genesys_get_address(reg, REG_FMOVNO);
|
||||||
r->value = fast_steps;
|
r->value = fast_table.scan_steps;
|
||||||
|
|
||||||
r = sanei_genesys_get_address(reg, REG_FMOVDEC);
|
r = sanei_genesys_get_address(reg, REG_FMOVDEC);
|
||||||
r->value = fast_steps;
|
r->value = fast_table.scan_steps;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -419,9 +419,7 @@ static void gl847_init_motor_regs_scan(Genesys_Device* dev,
|
||||||
scan_lines, scan_dummy, feed_steps, flags);
|
scan_lines, scan_dummy, feed_steps, flags);
|
||||||
int use_fast_fed;
|
int use_fast_fed;
|
||||||
unsigned int fast_dpi;
|
unsigned int fast_dpi;
|
||||||
std::vector<uint16_t> scan_table;
|
int factor;
|
||||||
std::vector<uint16_t> fast_table;
|
|
||||||
int scan_steps, fast_steps, factor;
|
|
||||||
unsigned int feedl, dist;
|
unsigned int feedl, dist;
|
||||||
GenesysRegister *r;
|
GenesysRegister *r;
|
||||||
uint32_t z1, z2;
|
uint32_t z1, z2;
|
||||||
|
@ -464,15 +462,10 @@ static void gl847_init_motor_regs_scan(Genesys_Device* dev,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* scan and backtracking slope table */
|
/* scan and backtracking slope table */
|
||||||
sanei_genesys_slope_table(scan_table,
|
auto scan_table = sanei_genesys_slope_table(scan_yres, scan_exposure_time, dev->motor.base_ydpi,
|
||||||
&scan_steps,
|
factor, motor_profile);
|
||||||
scan_yres,
|
gl847_send_slope_table(dev, SCAN_TABLE, scan_table.table, scan_table.scan_steps * factor);
|
||||||
scan_exposure_time,
|
gl847_send_slope_table(dev, BACKTRACK_TABLE, scan_table.table, scan_table.scan_steps * factor);
|
||||||
dev->motor.base_ydpi,
|
|
||||||
factor,
|
|
||||||
motor_profile);
|
|
||||||
gl847_send_slope_table(dev, SCAN_TABLE, scan_table, scan_steps * factor);
|
|
||||||
gl847_send_slope_table(dev, BACKTRACK_TABLE, scan_table, scan_steps * factor);
|
|
||||||
|
|
||||||
/* fast table */
|
/* fast table */
|
||||||
fast_dpi=sanei_genesys_get_lowest_ydpi(dev);
|
fast_dpi=sanei_genesys_get_lowest_ydpi(dev);
|
||||||
|
@ -484,27 +477,22 @@ static void gl847_init_motor_regs_scan(Genesys_Device* dev,
|
||||||
Motor_Profile fast_motor_profile = motor_profile;
|
Motor_Profile fast_motor_profile = motor_profile;
|
||||||
fast_motor_profile.step_type = fast_step_type;
|
fast_motor_profile.step_type = fast_step_type;
|
||||||
|
|
||||||
sanei_genesys_slope_table(fast_table,
|
auto fast_table = sanei_genesys_slope_table(fast_dpi, scan_exposure_time, dev->motor.base_ydpi,
|
||||||
&fast_steps,
|
factor, fast_motor_profile);
|
||||||
fast_dpi,
|
|
||||||
scan_exposure_time,
|
|
||||||
dev->motor.base_ydpi,
|
|
||||||
factor,
|
|
||||||
fast_motor_profile);
|
|
||||||
|
|
||||||
/* manual override of high start value */
|
// manual override of high start value
|
||||||
fast_table[0]=fast_table[1];
|
fast_table.table[0] = fast_table.table[1];
|
||||||
|
|
||||||
gl847_send_slope_table(dev, STOP_TABLE, fast_table, fast_steps * factor);
|
gl847_send_slope_table(dev, STOP_TABLE, fast_table.table, fast_table.scan_steps * factor);
|
||||||
gl847_send_slope_table(dev, FAST_TABLE, fast_table, fast_steps * factor);
|
gl847_send_slope_table(dev, FAST_TABLE, fast_table.table, fast_table.scan_steps * factor);
|
||||||
gl847_send_slope_table(dev, HOME_TABLE, fast_table, fast_steps * factor);
|
gl847_send_slope_table(dev, HOME_TABLE, fast_table.table, fast_table.scan_steps * factor);
|
||||||
|
|
||||||
/* correct move distance by acceleration and deceleration amounts */
|
/* correct move distance by acceleration and deceleration amounts */
|
||||||
feedl=feed_steps;
|
feedl=feed_steps;
|
||||||
if (use_fast_fed)
|
if (use_fast_fed)
|
||||||
{
|
{
|
||||||
feedl <<= static_cast<unsigned>(fast_step_type);
|
feedl <<= static_cast<unsigned>(fast_step_type);
|
||||||
dist=(scan_steps+2*fast_steps)*factor;
|
dist = (scan_table.scan_steps + 2 * fast_table.scan_steps) * factor;
|
||||||
/* TODO read and decode REG_0xAB */
|
/* TODO read and decode REG_0xAB */
|
||||||
r = sanei_genesys_get_address (reg, 0x5e);
|
r = sanei_genesys_get_address (reg, 0x5e);
|
||||||
dist += (r->value & 31);
|
dist += (r->value & 31);
|
||||||
|
@ -515,11 +503,11 @@ static void gl847_init_motor_regs_scan(Genesys_Device* dev,
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
feedl <<= static_cast<unsigned>(motor_profile.step_type);
|
feedl <<= static_cast<unsigned>(motor_profile.step_type);
|
||||||
dist=scan_steps*factor;
|
dist=scan_table.scan_steps*factor;
|
||||||
if (flags & MOTOR_FLAG_FEED)
|
if (flags & MOTOR_FLAG_FEED)
|
||||||
dist *=2;
|
dist *=2;
|
||||||
}
|
}
|
||||||
DBG(DBG_io2, "%s: scan steps=%d\n", __func__, scan_steps);
|
DBG(DBG_io2, "%s: scan steps=%d\n", __func__, scan_table.scan_steps);
|
||||||
DBG(DBG_io2, "%s: acceleration distance=%d\n", __func__, dist);
|
DBG(DBG_io2, "%s: acceleration distance=%d\n", __func__, dist);
|
||||||
|
|
||||||
/* check for overflow */
|
/* check for overflow */
|
||||||
|
@ -557,7 +545,7 @@ static void gl847_init_motor_regs_scan(Genesys_Device* dev,
|
||||||
val = effective | REG_0x6C_GPIO10;
|
val = effective | REG_0x6C_GPIO10;
|
||||||
dev->interface->write_register(REG_0x6C, val);
|
dev->interface->write_register(REG_0x6C, val);
|
||||||
|
|
||||||
min_restep=scan_steps/2-1;
|
min_restep = scan_table.scan_steps / 2 - 1;
|
||||||
if (min_restep < 1) {
|
if (min_restep < 1) {
|
||||||
min_restep = 1;
|
min_restep = 1;
|
||||||
}
|
}
|
||||||
|
@ -568,8 +556,8 @@ static void gl847_init_motor_regs_scan(Genesys_Device* dev,
|
||||||
|
|
||||||
sanei_genesys_calculate_zmod(use_fast_fed,
|
sanei_genesys_calculate_zmod(use_fast_fed,
|
||||||
scan_exposure_time*ccdlmt*tgtime,
|
scan_exposure_time*ccdlmt*tgtime,
|
||||||
scan_table,
|
scan_table.table,
|
||||||
scan_steps*factor,
|
scan_table.scan_steps*factor,
|
||||||
feedl,
|
feedl,
|
||||||
min_restep*factor,
|
min_restep*factor,
|
||||||
&z1,
|
&z1,
|
||||||
|
@ -592,19 +580,19 @@ static void gl847_init_motor_regs_scan(Genesys_Device* dev,
|
||||||
r->value = REG_0x68_FASTPWM;
|
r->value = REG_0x68_FASTPWM;
|
||||||
|
|
||||||
r = sanei_genesys_get_address(reg, REG_STEPNO);
|
r = sanei_genesys_get_address(reg, REG_STEPNO);
|
||||||
r->value = scan_steps;
|
r->value = scan_table.scan_steps;
|
||||||
|
|
||||||
r = sanei_genesys_get_address(reg, REG_FASTNO);
|
r = sanei_genesys_get_address(reg, REG_FASTNO);
|
||||||
r->value = scan_steps;
|
r->value = scan_table.scan_steps;
|
||||||
|
|
||||||
r = sanei_genesys_get_address(reg, REG_FSHDEC);
|
r = sanei_genesys_get_address(reg, REG_FSHDEC);
|
||||||
r->value = scan_steps;
|
r->value = scan_table.scan_steps;
|
||||||
|
|
||||||
r = sanei_genesys_get_address(reg, REG_FMOVNO);
|
r = sanei_genesys_get_address(reg, REG_FMOVNO);
|
||||||
r->value = fast_steps;
|
r->value = fast_table.scan_steps;
|
||||||
|
|
||||||
r = sanei_genesys_get_address(reg, REG_FMOVDEC);
|
r = sanei_genesys_get_address(reg, REG_FMOVDEC);
|
||||||
r->value = fast_steps;
|
r->value = fast_table.scan_steps;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1695,22 +1695,22 @@ const Motor_Profile& sanei_genesys_get_motor_profile(const std::vector<Motor_Pro
|
||||||
* @param factor shrink factor for the slope
|
* @param factor shrink factor for the slope
|
||||||
* @param motor_profile motor profile
|
* @param motor_profile motor profile
|
||||||
*/
|
*/
|
||||||
int sanei_genesys_slope_table(std::vector<uint16_t>& slope,
|
MotorSlopeTable sanei_genesys_slope_table(int dpi, int exposure, int base_dpi,
|
||||||
int* steps, int dpi, int exposure, int base_dpi,
|
|
||||||
int factor, const Motor_Profile& motor_profile)
|
int factor, const Motor_Profile& motor_profile)
|
||||||
{
|
{
|
||||||
|
MotorSlopeTable table;
|
||||||
int sum, i;
|
int sum, i;
|
||||||
uint16_t target,current;
|
uint16_t target,current;
|
||||||
|
|
||||||
unsigned step_shift = static_cast<unsigned>(motor_profile.step_type);
|
unsigned step_shift = static_cast<unsigned>(motor_profile.step_type);
|
||||||
slope.clear();
|
table.table.clear();
|
||||||
|
|
||||||
/* required speed */
|
/* required speed */
|
||||||
target = ((exposure * dpi) / base_dpi) >> step_shift;
|
target = ((exposure * dpi) / base_dpi) >> step_shift;
|
||||||
DBG (DBG_io2, "%s: exposure=%d, dpi=%d, target=%d\n", __func__, exposure, dpi, target);
|
DBG (DBG_io2, "%s: exposure=%d, dpi=%d, target=%d\n", __func__, exposure, dpi, target);
|
||||||
|
|
||||||
/* fill result with target speed */
|
/* fill result with target speed */
|
||||||
slope.resize(SLOPE_TABLE_SIZE, target);
|
table.table.resize(SLOPE_TABLE_SIZE, target);
|
||||||
|
|
||||||
/* use profile to build table */
|
/* use profile to build table */
|
||||||
i=0;
|
i=0;
|
||||||
|
@ -1721,8 +1721,8 @@ uint16_t target,current;
|
||||||
|
|
||||||
// loop on profile copying and apply step type
|
// loop on profile copying and apply step type
|
||||||
while (motor_profile.table[i] != 0 && current >= target) {
|
while (motor_profile.table[i] != 0 && current >= target) {
|
||||||
slope[i]=current;
|
table.table[i]=current;
|
||||||
sum+=slope[i];
|
sum += table.table[i];
|
||||||
i++;
|
i++;
|
||||||
current = motor_profile.table[i] >> step_shift;
|
current = motor_profile.table[i] >> step_shift;
|
||||||
}
|
}
|
||||||
|
@ -1730,8 +1730,8 @@ uint16_t target,current;
|
||||||
/* ensure last step is required speed in case profile doesn't contain it */
|
/* ensure last step is required speed in case profile doesn't contain it */
|
||||||
if(current!=0 && current<target)
|
if(current!=0 && current<target)
|
||||||
{
|
{
|
||||||
slope[i]=target;
|
table.table[i] = target;
|
||||||
sum+=slope[i];
|
sum += table.table[i];
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1747,22 +1747,23 @@ uint16_t target,current;
|
||||||
/* align on factor */
|
/* align on factor */
|
||||||
while(i%factor!=0)
|
while(i%factor!=0)
|
||||||
{
|
{
|
||||||
slope[i+1]=slope[i];
|
table.table[i+1] = table.table[i];
|
||||||
sum+=slope[i];
|
sum += table.table[i];
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ensure minimal slope size */
|
/* ensure minimal slope size */
|
||||||
while(i<2*factor)
|
while(i<2*factor)
|
||||||
{
|
{
|
||||||
slope[i+1]=slope[i];
|
table.table[i+1] = table.table[i];
|
||||||
sum+=slope[i];
|
sum += table.table[i];
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// return used steps and taken time
|
// return used steps and taken time
|
||||||
*steps=i/factor;
|
table.scan_steps = i / factor;
|
||||||
return sum;
|
table.pixeltime_sum = sum;
|
||||||
|
return table;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @brief returns the lowest possible ydpi for the device
|
/** @brief returns the lowest possible ydpi for the device
|
||||||
|
|
|
@ -425,8 +425,8 @@ extern void sanei_genesys_asic_init(Genesys_Device* dev, bool cold);
|
||||||
const Motor_Profile& sanei_genesys_get_motor_profile(const std::vector<Motor_Profile>& motors,
|
const Motor_Profile& sanei_genesys_get_motor_profile(const std::vector<Motor_Profile>& motors,
|
||||||
MotorId motor_id, int exposure);
|
MotorId motor_id, int exposure);
|
||||||
|
|
||||||
int sanei_genesys_slope_table(std::vector<uint16_t>& slope, int *steps, int dpi, int exposure,
|
MotorSlopeTable sanei_genesys_slope_table(int dpi, int exposure, int base_dpi,
|
||||||
int base_dpi, int factor, const Motor_Profile& motor_profile);
|
int factor, const Motor_Profile& motor_profile);
|
||||||
|
|
||||||
/** @brief find lowest motor resolution for the device.
|
/** @brief find lowest motor resolution for the device.
|
||||||
* Parses the resolution list for motor and
|
* Parses the resolution list for motor and
|
||||||
|
|
Ładowanie…
Reference in New Issue