kopia lustrzana https://gitlab.com/sane-project/backends
genesys: Simplify handling of motor step multiplier
rodzic
1d7adfcfc1
commit
48fd80d208
|
@ -491,7 +491,6 @@ static void gl124_init_motor_regs_scan(Genesys_Device* dev,
|
|||
|
||||
/* we never use fast fed since we do manual feed for the scans */
|
||||
use_fast_fed=0;
|
||||
unsigned step_multiplier = 1;
|
||||
|
||||
/* enforce motor minimal scan speed
|
||||
* @TODO extend motor struct for this value */
|
||||
|
@ -567,7 +566,7 @@ static void gl124_init_motor_regs_scan(Genesys_Device* dev,
|
|||
|
||||
/* scan and backtracking slope table */
|
||||
auto scan_table = sanei_genesys_slope_table(dev->model->asic_type, yres, scan_exposure_time,
|
||||
dev->motor.base_ydpi, step_multiplier,
|
||||
dev->motor.base_ydpi, 1,
|
||||
motor_profile);
|
||||
gl124_send_slope_table(dev, SCAN_TABLE, scan_table.table, scan_table.steps_count);
|
||||
gl124_send_slope_table(dev, BACKTRACK_TABLE, scan_table.table, scan_table.steps_count);
|
||||
|
@ -585,7 +584,7 @@ static void gl124_init_motor_regs_scan(Genesys_Device* dev,
|
|||
*/
|
||||
auto fast_table = sanei_genesys_slope_table(dev->model->asic_type, fast_dpi,
|
||||
scan_exposure_time, dev->motor.base_ydpi,
|
||||
step_multiplier, motor_profile);
|
||||
1, motor_profile);
|
||||
gl124_send_slope_table(dev, STOP_TABLE, fast_table.table, fast_table.steps_count);
|
||||
gl124_send_slope_table(dev, FAST_TABLE, fast_table.table, fast_table.steps_count);
|
||||
|
||||
|
|
|
@ -872,18 +872,11 @@ static void gl843_init_motor_regs_scan(Genesys_Device* dev,
|
|||
dev->motor.base_ydpi, step_multiplier,
|
||||
motor_profile);
|
||||
|
||||
gl843_send_slope_table(dev, SCAN_TABLE, scan_table.table,
|
||||
scan_table.steps_count * step_multiplier);
|
||||
gl843_send_slope_table(dev, BACKTRACK_TABLE, scan_table.table,
|
||||
scan_table.steps_count * step_multiplier);
|
||||
gl843_send_slope_table(dev, SCAN_TABLE, scan_table.table, scan_table.steps_count);
|
||||
gl843_send_slope_table(dev, BACKTRACK_TABLE, scan_table.table, scan_table.steps_count);
|
||||
|
||||
/* STEPNO */
|
||||
r = sanei_genesys_get_address(reg, REG_STEPNO);
|
||||
r->value = scan_table.steps_count;
|
||||
|
||||
/* FSHDEC */
|
||||
r = sanei_genesys_get_address(reg, REG_FSHDEC);
|
||||
r->value = scan_table.steps_count;
|
||||
reg->set8(REG_STEPNO, scan_table.steps_count / step_multiplier);
|
||||
reg->set8(REG_FSHDEC, scan_table.steps_count / step_multiplier);
|
||||
|
||||
/* fast table */
|
||||
// BUG: looks like for fast moves we use inconsistent step type
|
||||
|
@ -902,29 +895,21 @@ static void gl843_init_motor_regs_scan(Genesys_Device* dev,
|
|||
auto fast_table = sanei_genesys_slope_table(dev->model->asic_type, fast_yres, exposure,
|
||||
dev->motor.base_ydpi, step_multiplier,
|
||||
fast_motor_profile);
|
||||
gl843_send_slope_table(dev, STOP_TABLE, fast_table.table,
|
||||
fast_table.steps_count * step_multiplier);
|
||||
gl843_send_slope_table(dev, FAST_TABLE, fast_table.table,
|
||||
fast_table.steps_count * step_multiplier);
|
||||
gl843_send_slope_table(dev, HOME_TABLE, fast_table.table,
|
||||
fast_table.steps_count * step_multiplier);
|
||||
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, HOME_TABLE, fast_table.table, fast_table.steps_count);
|
||||
|
||||
/* FASTNO */
|
||||
r = sanei_genesys_get_address(reg, REG_FASTNO);
|
||||
r->value = fast_table.steps_count;
|
||||
|
||||
/* FMOVNO */
|
||||
r = sanei_genesys_get_address(reg, REG_FMOVNO);
|
||||
r->value = fast_table.steps_count;
|
||||
reg->set8(REG_FASTNO, fast_table.steps_count / step_multiplier);
|
||||
reg->set8(REG_FMOVNO, fast_table.steps_count / step_multiplier);
|
||||
|
||||
/* substract acceleration distance from feedl */
|
||||
feedl=feed_steps;
|
||||
feedl <<= static_cast<unsigned>(motor_profile.step_type);
|
||||
|
||||
dist = scan_table.steps_count;
|
||||
dist = scan_table.steps_count / step_multiplier;
|
||||
if (use_fast_fed)
|
||||
{
|
||||
dist += fast_table.steps_count*2;
|
||||
dist += (fast_table.steps_count / step_multiplier) * 2;
|
||||
}
|
||||
DBG(DBG_io2, "%s: acceleration distance=%d\n", __func__, dist);
|
||||
|
||||
|
@ -943,9 +928,9 @@ static void gl843_init_motor_regs_scan(Genesys_Device* dev,
|
|||
sanei_genesys_calculate_zmod(use_fast_fed,
|
||||
exposure,
|
||||
scan_table.table,
|
||||
scan_table.steps_count,
|
||||
scan_table.steps_count / step_multiplier,
|
||||
feedl,
|
||||
scan_table.steps_count,
|
||||
scan_table.steps_count / step_multiplier,
|
||||
&z1,
|
||||
&z2);
|
||||
if(scan_yres>600)
|
||||
|
@ -967,9 +952,8 @@ static void gl843_init_motor_regs_scan(Genesys_Device* dev,
|
|||
reg->set8_mask(REG_0x67, static_cast<unsigned>(motor_profile.step_type) << REG_0x67S_STEPSEL, 0xc0);
|
||||
reg->set8_mask(REG_0x68, static_cast<unsigned>(motor_profile.step_type) << REG_0x68S_FSTPSEL, 0xc0);
|
||||
|
||||
/* steps for STOP table */
|
||||
r = sanei_genesys_get_address(reg, REG_FMOVDEC);
|
||||
r->value = fast_table.steps_count;
|
||||
// steps for STOP table
|
||||
reg->set8(REG_FMOVDEC, fast_table.steps_count / step_multiplier);
|
||||
|
||||
/* Vref XXX STEF XXX : optical divider or step type ? */
|
||||
r = sanei_genesys_get_address (reg, 0x80);
|
||||
|
|
|
@ -387,10 +387,9 @@ static void gl846_init_motor_regs_scan(Genesys_Device* dev,
|
|||
auto scan_table = sanei_genesys_slope_table(dev->model->asic_type, scan_yres,
|
||||
scan_exposure_time, dev->motor.base_ydpi,
|
||||
step_multiplier, motor_profile);
|
||||
gl846_send_slope_table(dev, SCAN_TABLE, scan_table.table,
|
||||
scan_table.steps_count * step_multiplier);
|
||||
gl846_send_slope_table(dev, BACKTRACK_TABLE, scan_table.table,
|
||||
scan_table.steps_count * step_multiplier);
|
||||
|
||||
gl846_send_slope_table(dev, SCAN_TABLE, scan_table.table, scan_table.steps_count);
|
||||
gl846_send_slope_table(dev, BACKTRACK_TABLE, scan_table.table, scan_table.steps_count);
|
||||
|
||||
/* fast table */
|
||||
fast_dpi=sanei_genesys_get_lowest_ydpi(dev);
|
||||
|
@ -408,19 +407,16 @@ static void gl846_init_motor_regs_scan(Genesys_Device* dev,
|
|||
scan_exposure_time, dev->motor.base_ydpi,
|
||||
step_multiplier, fast_motor_profile);
|
||||
|
||||
gl846_send_slope_table(dev, STOP_TABLE, fast_table.table,
|
||||
fast_table.steps_count * step_multiplier);
|
||||
gl846_send_slope_table(dev, FAST_TABLE, fast_table.table,
|
||||
fast_table.steps_count * step_multiplier);
|
||||
gl846_send_slope_table(dev, HOME_TABLE, fast_table.table,
|
||||
fast_table.steps_count * step_multiplier);
|
||||
gl846_send_slope_table(dev, STOP_TABLE, fast_table.table, fast_table.steps_count);
|
||||
gl846_send_slope_table(dev, FAST_TABLE, fast_table.table, fast_table.steps_count);
|
||||
gl846_send_slope_table(dev, HOME_TABLE, fast_table.table, fast_table.steps_count);
|
||||
|
||||
/* correct move distance by acceleration and deceleration amounts */
|
||||
feedl=feed_steps;
|
||||
if (use_fast_fed)
|
||||
{
|
||||
feedl <<= static_cast<unsigned>(fast_step_type);
|
||||
dist = (scan_table.steps_count + 2 * fast_table.steps_count) * step_multiplier;
|
||||
dist = (scan_table.steps_count + 2 * fast_table.steps_count);
|
||||
/* TODO read and decode REG_0xAB */
|
||||
r = sanei_genesys_get_address (reg, 0x5e);
|
||||
dist += (r->value & 31);
|
||||
|
@ -431,12 +427,11 @@ static void gl846_init_motor_regs_scan(Genesys_Device* dev,
|
|||
else
|
||||
{
|
||||
feedl <<= static_cast<unsigned>(motor_profile.step_type);
|
||||
dist = scan_table.steps_count * step_multiplier;
|
||||
dist = scan_table.steps_count;
|
||||
if (has_flag(flags, MotorFlag::FEED)) {
|
||||
dist *= 2;
|
||||
}
|
||||
}
|
||||
DBG (DBG_io2, "%s: scan steps=%d\n", __func__, scan_table.steps_count);
|
||||
DBG (DBG_io2, "%s: acceleration distance=%d\n", __func__, dist);
|
||||
|
||||
/* check for overflow */
|
||||
|
@ -498,7 +493,7 @@ static void gl846_init_motor_regs_scan(Genesys_Device* dev,
|
|||
dev->interface->write_register(REG_0x7E, val);
|
||||
}
|
||||
|
||||
min_restep = scan_table.steps_count / 2 - 1;
|
||||
min_restep = (scan_table.steps_count / step_multiplier) / 2 - 1;
|
||||
if (min_restep < 1) {
|
||||
min_restep = 1;
|
||||
}
|
||||
|
@ -510,7 +505,7 @@ static void gl846_init_motor_regs_scan(Genesys_Device* dev,
|
|||
sanei_genesys_calculate_zmod(use_fast_fed,
|
||||
scan_exposure_time*ccdlmt*tgtime,
|
||||
scan_table.table,
|
||||
scan_table.steps_count * step_multiplier,
|
||||
scan_table.steps_count,
|
||||
feedl,
|
||||
min_restep * step_multiplier,
|
||||
&z1,
|
||||
|
@ -532,20 +527,11 @@ static void gl846_init_motor_regs_scan(Genesys_Device* dev,
|
|||
r = sanei_genesys_get_address(reg, REG_0x68);
|
||||
r->value = 0x7f;
|
||||
|
||||
r = sanei_genesys_get_address(reg, REG_STEPNO);
|
||||
r->value = scan_table.steps_count;
|
||||
|
||||
r = sanei_genesys_get_address(reg, REG_FASTNO);
|
||||
r->value = scan_table.steps_count;
|
||||
|
||||
r = sanei_genesys_get_address(reg, REG_FSHDEC);
|
||||
r->value = scan_table.steps_count;
|
||||
|
||||
r = sanei_genesys_get_address(reg, REG_FMOVNO);
|
||||
r->value = fast_table.steps_count;
|
||||
|
||||
r = sanei_genesys_get_address(reg, REG_FMOVDEC);
|
||||
r->value = fast_table.steps_count;
|
||||
reg->set8(REG_STEPNO, scan_table.steps_count / step_multiplier);
|
||||
reg->set8(REG_FASTNO, scan_table.steps_count / step_multiplier);
|
||||
reg->set8(REG_FSHDEC, scan_table.steps_count / step_multiplier);
|
||||
reg->set8(REG_FMOVNO, fast_table.steps_count / step_multiplier);
|
||||
reg->set8(REG_FMOVDEC, fast_table.steps_count / step_multiplier);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -419,10 +419,8 @@ static void gl847_init_motor_regs_scan(Genesys_Device* dev,
|
|||
auto scan_table = sanei_genesys_slope_table(dev->model->asic_type, scan_yres,
|
||||
scan_exposure_time, dev->motor.base_ydpi,
|
||||
step_multiplier, motor_profile);
|
||||
gl847_send_slope_table(dev, SCAN_TABLE, scan_table.table,
|
||||
scan_table.steps_count * step_multiplier);
|
||||
gl847_send_slope_table(dev, BACKTRACK_TABLE, scan_table.table,
|
||||
scan_table.steps_count * step_multiplier);
|
||||
gl847_send_slope_table(dev, SCAN_TABLE, scan_table.table, scan_table.steps_count);
|
||||
gl847_send_slope_table(dev, BACKTRACK_TABLE, scan_table.table, scan_table.steps_count);
|
||||
|
||||
/* fast table */
|
||||
fast_dpi=sanei_genesys_get_lowest_ydpi(dev);
|
||||
|
@ -438,19 +436,16 @@ static void gl847_init_motor_regs_scan(Genesys_Device* dev,
|
|||
scan_exposure_time, dev->motor.base_ydpi,
|
||||
step_multiplier, fast_motor_profile);
|
||||
|
||||
gl847_send_slope_table(dev, STOP_TABLE, fast_table.table,
|
||||
fast_table.steps_count * step_multiplier);
|
||||
gl847_send_slope_table(dev, FAST_TABLE, fast_table.table,
|
||||
fast_table.steps_count * step_multiplier);
|
||||
gl847_send_slope_table(dev, HOME_TABLE, fast_table.table,
|
||||
fast_table.steps_count * step_multiplier);
|
||||
gl847_send_slope_table(dev, STOP_TABLE, fast_table.table, fast_table.steps_count);
|
||||
gl847_send_slope_table(dev, FAST_TABLE, fast_table.table, fast_table.steps_count);
|
||||
gl847_send_slope_table(dev, HOME_TABLE, fast_table.table, fast_table.steps_count);
|
||||
|
||||
/* correct move distance by acceleration and deceleration amounts */
|
||||
feedl=feed_steps;
|
||||
if (use_fast_fed)
|
||||
{
|
||||
feedl <<= static_cast<unsigned>(fast_step_type);
|
||||
dist = (scan_table.steps_count + 2 * fast_table.steps_count) * step_multiplier;
|
||||
dist = (scan_table.steps_count + 2 * fast_table.steps_count);
|
||||
/* TODO read and decode REG_0xAB */
|
||||
r = sanei_genesys_get_address (reg, 0x5e);
|
||||
dist += (r->value & 31);
|
||||
|
@ -461,12 +456,11 @@ static void gl847_init_motor_regs_scan(Genesys_Device* dev,
|
|||
else
|
||||
{
|
||||
feedl <<= static_cast<unsigned>(motor_profile.step_type);
|
||||
dist = scan_table.steps_count * step_multiplier;
|
||||
dist = scan_table.steps_count;
|
||||
if (has_flag(flags, MotorFlag::FEED)) {
|
||||
dist *= 2;
|
||||
}
|
||||
}
|
||||
DBG(DBG_io2, "%s: scan steps=%d\n", __func__, scan_table.steps_count);
|
||||
DBG(DBG_io2, "%s: acceleration distance=%d\n", __func__, dist);
|
||||
|
||||
/* check for overflow */
|
||||
|
@ -504,7 +498,7 @@ static void gl847_init_motor_regs_scan(Genesys_Device* dev,
|
|||
val = effective | REG_0x6C_GPIO10;
|
||||
dev->interface->write_register(REG_0x6C, val);
|
||||
|
||||
min_restep = scan_table.steps_count / 2 - 1;
|
||||
min_restep = scan_table.steps_count / (2 * step_multiplier) - 1;
|
||||
if (min_restep < 1) {
|
||||
min_restep = 1;
|
||||
}
|
||||
|
@ -516,7 +510,7 @@ static void gl847_init_motor_regs_scan(Genesys_Device* dev,
|
|||
sanei_genesys_calculate_zmod(use_fast_fed,
|
||||
scan_exposure_time*ccdlmt*tgtime,
|
||||
scan_table.table,
|
||||
scan_table.steps_count * step_multiplier,
|
||||
scan_table.steps_count,
|
||||
feedl,
|
||||
min_restep * step_multiplier,
|
||||
&z1,
|
||||
|
@ -538,20 +532,11 @@ static void gl847_init_motor_regs_scan(Genesys_Device* dev,
|
|||
r = sanei_genesys_get_address(reg, REG_0x68);
|
||||
r->value = REG_0x68_FASTPWM;
|
||||
|
||||
r = sanei_genesys_get_address(reg, REG_STEPNO);
|
||||
r->value = scan_table.steps_count;
|
||||
|
||||
r = sanei_genesys_get_address(reg, REG_FASTNO);
|
||||
r->value = scan_table.steps_count;
|
||||
|
||||
r = sanei_genesys_get_address(reg, REG_FSHDEC);
|
||||
r->value = scan_table.steps_count;
|
||||
|
||||
r = sanei_genesys_get_address(reg, REG_FMOVNO);
|
||||
r->value = fast_table.steps_count;
|
||||
|
||||
r = sanei_genesys_get_address(reg, REG_FMOVDEC);
|
||||
r->value = fast_table.steps_count;
|
||||
reg->set8(REG_STEPNO, scan_table.steps_count / step_multiplier);
|
||||
reg->set8(REG_FASTNO, scan_table.steps_count / step_multiplier);
|
||||
reg->set8(REG_FSHDEC, scan_table.steps_count / step_multiplier);
|
||||
reg->set8(REG_FMOVNO, fast_table.steps_count / step_multiplier);
|
||||
reg->set8(REG_FMOVDEC, fast_table.steps_count / step_multiplier);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1768,7 +1768,6 @@ MotorSlopeTable sanei_genesys_slope_table(AsicType asic_type, int dpi, int expos
|
|||
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));
|
||||
table.steps_count /= step_multiplier;
|
||||
table.final_exposure = (table.final_exposure * base_dpi) / dpi;
|
||||
return table;
|
||||
}
|
||||
|
|
Ładowanie…
Reference in New Issue