kopia lustrzana https://gitlab.com/sane-project/backends
genesys: Use enum class for motor flags
rodzic
0b4165b27f
commit
50149e9064
|
@ -463,6 +463,39 @@ inline void serialize(std::ostream& str, ScanFlag& x)
|
|||
|
||||
std::ostream& operator<<(std::ostream& out, ScanFlag flags);
|
||||
|
||||
|
||||
|
||||
enum class MotorFlag : unsigned
|
||||
{
|
||||
NONE = 0,
|
||||
AUTO_GO_HOME = 1 << 0,
|
||||
DISABLE_BUFFER_FULL_MOVE = 1 << 2,
|
||||
FEED = 1 << 3,
|
||||
USE_XPA = 1 << 4,
|
||||
};
|
||||
|
||||
inline MotorFlag operator|(MotorFlag left, MotorFlag right)
|
||||
{
|
||||
return static_cast<MotorFlag>(static_cast<unsigned>(left) | static_cast<unsigned>(right));
|
||||
}
|
||||
|
||||
inline MotorFlag& operator|=(MotorFlag& left, MotorFlag right)
|
||||
{
|
||||
left = left | right;
|
||||
return left;
|
||||
}
|
||||
|
||||
inline MotorFlag operator&(MotorFlag left, MotorFlag right)
|
||||
{
|
||||
return static_cast<MotorFlag>(static_cast<unsigned>(left) & static_cast<unsigned>(right));
|
||||
}
|
||||
|
||||
inline bool has_flag(MotorFlag flags, MotorFlag which)
|
||||
{
|
||||
return (flags & which) == which;
|
||||
}
|
||||
|
||||
|
||||
} // namespace genesys
|
||||
|
||||
#endif // BACKEND_GENESYS_ENUMS_H
|
||||
|
|
|
@ -491,7 +491,7 @@ static void gl124_init_motor_regs_scan(Genesys_Device* dev,
|
|||
unsigned int scan_dummy,
|
||||
unsigned int feed_steps,
|
||||
ScanColorMode scan_mode,
|
||||
unsigned int flags)
|
||||
MotorFlag flags)
|
||||
{
|
||||
DBG_HELPER(dbg);
|
||||
int use_fast_fed;
|
||||
|
@ -506,7 +506,8 @@ static void gl124_init_motor_regs_scan(Genesys_Device* dev,
|
|||
DBG(DBG_info, "%s : scan_exposure_time=%d, scan_yres=%d, step_type=%d, scan_lines=%d, "
|
||||
"scan_dummy=%d, feed_steps=%d, scan_mode=%d, flags=%x\n", __func__, scan_exposure_time,
|
||||
scan_yres, static_cast<unsigned>(motor_profile.step_type), scan_lines, scan_dummy,
|
||||
feed_steps, static_cast<unsigned>(scan_mode), flags);
|
||||
feed_steps, static_cast<unsigned>(scan_mode),
|
||||
static_cast<unsigned>(flags));
|
||||
|
||||
/* we never use fast fed since we do manual feed for the scans */
|
||||
use_fast_fed=0;
|
||||
|
@ -567,11 +568,11 @@ static void gl124_init_motor_regs_scan(Genesys_Device* dev,
|
|||
r02 &= ~REG_0x02_FASTFED;
|
||||
}
|
||||
|
||||
if (flags & MOTOR_FLAG_AUTO_GO_HOME)
|
||||
if (has_flag(flags, MotorFlag::AUTO_GO_HOME)) {
|
||||
r02 |= REG_0x02_AGOHOME;
|
||||
}
|
||||
|
||||
if ((flags & MOTOR_FLAG_DISABLE_BUFFER_FULL_MOVE)
|
||||
||(yres>=sensor.optical_res))
|
||||
if (has_flag(flags, MotorFlag::DISABLE_BUFFER_FULL_MOVE) || (yres >= sensor.optical_res))
|
||||
{
|
||||
r02 |= REG_0x02_ACDCDIS;
|
||||
}
|
||||
|
@ -612,7 +613,7 @@ static void gl124_init_motor_regs_scan(Genesys_Device* dev,
|
|||
feedl <<= static_cast<unsigned>(motor_profile.step_type);
|
||||
|
||||
dist = scan_table.scan_steps;
|
||||
if (flags & MOTOR_FLAG_FEED) {
|
||||
if (has_flag(flags, MotorFlag::FEED)) {
|
||||
dist *= 2;
|
||||
}
|
||||
if (use_fast_fed) {
|
||||
|
@ -889,7 +890,6 @@ static void gl124_init_scan_regs(Genesys_Device* dev, const Genesys_Sensor& sens
|
|||
session.assert_computed();
|
||||
|
||||
int move;
|
||||
unsigned int mflags;
|
||||
int exposure_time;
|
||||
|
||||
int dummy = 0;
|
||||
|
@ -926,12 +926,12 @@ static void gl124_init_scan_regs(Genesys_Device* dev, const Genesys_Sensor& sens
|
|||
move = session.params.starty;
|
||||
DBG(DBG_info, "%s: move=%d steps\n", __func__, move);
|
||||
|
||||
mflags = 0;
|
||||
MotorFlag mflags = MotorFlag::NONE;
|
||||
if (has_flag(session.params.flags, ScanFlag::DISABLE_BUFFER_FULL_MOVE)) {
|
||||
mflags |= MOTOR_FLAG_DISABLE_BUFFER_FULL_MOVE;
|
||||
mflags |= MotorFlag::DISABLE_BUFFER_FULL_MOVE;
|
||||
}
|
||||
if (has_flag(session.params.flags, ScanFlag::FEEDING)) {
|
||||
mflags |= MOTOR_FLAG_FEED;
|
||||
mflags |= MotorFlag::FEED;
|
||||
}
|
||||
gl124_init_motor_regs_scan(dev, sensor, reg, motor_profile, exposure_time, slope_dpi,
|
||||
dev->model->is_cis ? session.output_line_count * session.params.channels :
|
||||
|
|
|
@ -836,9 +836,10 @@ uint8_t *table;
|
|||
static void gl841_init_motor_regs(Genesys_Device* dev, const Genesys_Sensor& sensor,
|
||||
Genesys_Register_Set* reg, unsigned int feed_steps,/*1/base_ydpi*/
|
||||
/*maybe float for half/quarter step resolution?*/
|
||||
unsigned int action, unsigned int flags)
|
||||
unsigned int action, MotorFlag flags)
|
||||
{
|
||||
DBG_HELPER_ARGS(dbg, "feed_steps=%d, action=%d, flags=%x", feed_steps, action, flags);
|
||||
DBG_HELPER_ARGS(dbg, "feed_steps=%d, action=%d, flags=%x", feed_steps, action,
|
||||
static_cast<unsigned>(flags));
|
||||
unsigned int fast_exposure = 0;
|
||||
int use_fast_fed = 0;
|
||||
std::vector<uint16_t> fast_slope_table;
|
||||
|
@ -893,7 +894,7 @@ SCAN:
|
|||
flags \ use_fast_fed ! 0 1
|
||||
------------------------\--------------------
|
||||
0 ! 0,1,2 0,1,2,3
|
||||
MOTOR_FLAG_AUTO_GO_HOME ! 0,1,2,4 0,1,2,3,4
|
||||
MotorFlag::AUTO_GO_HOME ! 0,1,2,4 0,1,2,3,4
|
||||
OFF: none
|
||||
FEED: 3
|
||||
GO_HOME: 3
|
||||
|
@ -948,10 +949,11 @@ HOME_FREE: 3
|
|||
else
|
||||
r->value &= ~0x08;
|
||||
|
||||
if (flags & MOTOR_FLAG_AUTO_GO_HOME)
|
||||
r->value |= 0x20;
|
||||
else
|
||||
r->value &= ~0x20;
|
||||
if (has_flag(flags, MotorFlag::AUTO_GO_HOME)) {
|
||||
r->value |= 0x20;
|
||||
} else {
|
||||
r->value &= ~0x20;
|
||||
}
|
||||
|
||||
r->value &= ~0x40;
|
||||
|
||||
|
@ -989,12 +991,12 @@ static void gl841_init_motor_regs_scan(Genesys_Device* dev, const Genesys_Sensor
|
|||
// number of scan lines to add in a scan_lines line
|
||||
unsigned int feed_steps,/*1/base_ydpi*/
|
||||
// maybe float for half/quarter step resolution?
|
||||
unsigned int flags)
|
||||
MotorFlag flags)
|
||||
{
|
||||
DBG_HELPER_ARGS(dbg, "scan_exposure_time=%d, scan_yres=%d, scan_step_type=%d, scan_lines=%d,"
|
||||
" scan_dummy=%d, feed_steps=%d, flags=%x",
|
||||
scan_exposure_time, scan_yres, static_cast<unsigned>(scan_step_type),
|
||||
scan_lines, scan_dummy, feed_steps, flags);
|
||||
scan_lines, scan_dummy, feed_steps, static_cast<unsigned>(flags));
|
||||
unsigned int fast_exposure;
|
||||
int use_fast_fed = 0;
|
||||
unsigned int fast_time;
|
||||
|
@ -1136,7 +1138,7 @@ SCAN:
|
|||
flags \ use_fast_fed ! 0 1
|
||||
------------------------\--------------------
|
||||
0 ! 0,1,2 0,1,2,3
|
||||
MOTOR_FLAG_AUTO_GO_HOME ! 0,1,2,4 0,1,2,3,4
|
||||
MotorFlag::AUTO_GO_HOME ! 0,1,2,4 0,1,2,3,4
|
||||
OFF: none
|
||||
FEED: 3
|
||||
GO_HOME: 3
|
||||
|
@ -1187,15 +1189,16 @@ HOME_FREE: 3
|
|||
else
|
||||
r->value &= ~0x08;
|
||||
|
||||
if (flags & MOTOR_FLAG_AUTO_GO_HOME)
|
||||
if (has_flag(flags, MotorFlag::AUTO_GO_HOME))
|
||||
r->value |= 0x20;
|
||||
else
|
||||
r->value &= ~0x20;
|
||||
|
||||
if (flags & MOTOR_FLAG_DISABLE_BUFFER_FULL_MOVE)
|
||||
r->value |= 0x40;
|
||||
else
|
||||
r->value &= ~0x40;
|
||||
if (has_flag(flags, MotorFlag::DISABLE_BUFFER_FULL_MOVE)) {
|
||||
r->value |= 0x40;
|
||||
} else {
|
||||
r->value &= ~0x40;
|
||||
}
|
||||
|
||||
gl841_send_slope_table(dev, 0, slow_slope_table, 256);
|
||||
|
||||
|
@ -1207,7 +1210,7 @@ HOME_FREE: 3
|
|||
gl841_send_slope_table(dev, 3, fast_slope_table, 256);
|
||||
}
|
||||
|
||||
if (flags & MOTOR_FLAG_AUTO_GO_HOME) {
|
||||
if (has_flag(flags, MotorFlag::AUTO_GO_HOME)) {
|
||||
gl841_send_slope_table(dev, 4, fast_slope_table, 256);
|
||||
}
|
||||
|
||||
|
@ -1646,12 +1649,13 @@ dummy \ scanned lines
|
|||
gl841_init_motor_regs_off(reg, dev->model->is_cis ? session.output_line_count * session.params.channels
|
||||
: session.output_line_count);
|
||||
} else {
|
||||
auto motor_flag = has_flag(session.params.flags, ScanFlag::DISABLE_BUFFER_FULL_MOVE) ?
|
||||
MotorFlag::DISABLE_BUFFER_FULL_MOVE : MotorFlag::NONE;
|
||||
|
||||
gl841_init_motor_regs_scan(dev, sensor, reg, exposure_time, slope_dpi, scan_step_type,
|
||||
dev->model->is_cis ? session.output_line_count * session.params.channels
|
||||
: session.output_line_count,
|
||||
dummy, move,
|
||||
has_flag(session.params.flags, ScanFlag::DISABLE_BUFFER_FULL_MOVE) ?
|
||||
MOTOR_FLAG_DISABLE_BUFFER_FULL_MOVE : 0);
|
||||
dummy, move, motor_flag);
|
||||
}
|
||||
|
||||
dev->read_buffer.clear();
|
||||
|
@ -1955,8 +1959,7 @@ void CommandSetGl841::eject_document(Genesys_Device* dev) const
|
|||
gl841_init_optical_regs_off(&local_reg);
|
||||
|
||||
const auto& sensor = sanei_genesys_find_sensor_any(dev);
|
||||
gl841_init_motor_regs(dev, sensor, &local_reg,
|
||||
65536,MOTOR_ACTION_FEED,0);
|
||||
gl841_init_motor_regs(dev, sensor, &local_reg, 65536, MOTOR_ACTION_FEED, MotorFlag::NONE);
|
||||
|
||||
dev->interface->write_registers(local_reg);
|
||||
|
||||
|
@ -2195,7 +2198,7 @@ static void gl841_feed(Genesys_Device* dev, int steps)
|
|||
|
||||
gl841_init_optical_regs_off(&local_reg);
|
||||
|
||||
gl841_init_motor_regs(dev, sensor, &local_reg, steps,MOTOR_ACTION_FEED,0);
|
||||
gl841_init_motor_regs(dev, sensor, &local_reg, steps, MOTOR_ACTION_FEED, MotorFlag::NONE);
|
||||
|
||||
dev->interface->write_registers(local_reg);
|
||||
|
||||
|
@ -2305,7 +2308,7 @@ void CommandSetGl841::slow_back_home(Genesys_Device* dev, bool wait_until_home)
|
|||
|
||||
const auto& sensor = sanei_genesys_find_sensor_any(dev);
|
||||
|
||||
gl841_init_motor_regs(dev, sensor, &local_reg, 65536,MOTOR_ACTION_GO_HOME,0);
|
||||
gl841_init_motor_regs(dev, sensor, &local_reg, 65536, MOTOR_ACTION_GO_HOME, MotorFlag::NONE);
|
||||
|
||||
/* set up for reverse and no scan */
|
||||
r = sanei_genesys_get_address(&local_reg, REG_0x02);
|
||||
|
|
|
@ -823,12 +823,12 @@ static void gl843_init_motor_regs_scan(Genesys_Device* dev,
|
|||
unsigned int scan_lines,
|
||||
unsigned int scan_dummy,
|
||||
unsigned int feed_steps,
|
||||
unsigned int flags)
|
||||
MotorFlag flags)
|
||||
{
|
||||
DBG_HELPER_ARGS(dbg, "exposure=%d, scan_yres=%d, step_type=%d, scan_lines=%d, scan_dummy=%d, "
|
||||
"feed_steps=%d, flags=%x",
|
||||
exposure, scan_yres, static_cast<unsigned>(motor_profile.step_type), scan_lines, scan_dummy,
|
||||
feed_steps, flags);
|
||||
exposure, scan_yres, static_cast<unsigned>(motor_profile.step_type),
|
||||
scan_lines, scan_dummy, feed_steps, static_cast<unsigned>(flags));
|
||||
|
||||
int use_fast_fed, coeff;
|
||||
unsigned int lincnt;
|
||||
|
@ -841,8 +841,9 @@ static void gl843_init_motor_regs_scan(Genesys_Device* dev,
|
|||
|
||||
use_fast_fed = 0;
|
||||
|
||||
if((scan_yres>=300 && feed_steps>900) || (flags & MOTOR_FLAG_FEED))
|
||||
use_fast_fed=1;
|
||||
if ((scan_yres >= 300 && feed_steps > 900) || (has_flag(flags, MotorFlag::FEED))) {
|
||||
use_fast_fed = 1;
|
||||
}
|
||||
|
||||
lincnt=scan_lines;
|
||||
reg->set24(REG_LINCNT, lincnt);
|
||||
|
@ -860,12 +861,12 @@ static void gl843_init_motor_regs_scan(Genesys_Device* dev,
|
|||
}
|
||||
|
||||
/* in case of automatic go home, move until home sensor */
|
||||
if (flags & MOTOR_FLAG_AUTO_GO_HOME) {
|
||||
if (has_flag(flags, MotorFlag::AUTO_GO_HOME)) {
|
||||
r->value |= REG_0x02_AGOHOME | REG_0x02_NOTHOME;
|
||||
}
|
||||
|
||||
/* disable backtracking */
|
||||
if ((flags & MOTOR_FLAG_DISABLE_BUFFER_FULL_MOVE)
|
||||
if (has_flag(flags, MotorFlag::DISABLE_BUFFER_FULL_MOVE)
|
||||
||(scan_yres>=2400)
|
||||
||(scan_yres>=sensor.optical_res))
|
||||
{
|
||||
|
@ -1172,7 +1173,6 @@ static void gl843_init_scan_regs(Genesys_Device* dev, const Genesys_Sensor& sens
|
|||
DBG_HELPER(dbg);
|
||||
session.assert_computed();
|
||||
|
||||
unsigned int mflags;
|
||||
int exposure;
|
||||
|
||||
int slope_dpi = 0;
|
||||
|
@ -1210,15 +1210,15 @@ static void gl843_init_scan_regs(Genesys_Device* dev, const Genesys_Sensor& sens
|
|||
gl843_init_optical_regs_scan(dev, sensor, reg, exposure, session);
|
||||
|
||||
/*** motor parameters ***/
|
||||
mflags = 0;
|
||||
MotorFlag mflags = MotorFlag::NONE;
|
||||
if (has_flag(session.params.flags, ScanFlag::DISABLE_BUFFER_FULL_MOVE)) {
|
||||
mflags |= MOTOR_FLAG_DISABLE_BUFFER_FULL_MOVE;
|
||||
mflags |= MotorFlag::DISABLE_BUFFER_FULL_MOVE;
|
||||
}
|
||||
if (has_flag(session.params.flags, ScanFlag::FEEDING)) {
|
||||
mflags |= MOTOR_FLAG_FEED;
|
||||
mflags |= MotorFlag::FEED;
|
||||
}
|
||||
if (has_flag(session.params.flags, ScanFlag::USE_XPA)) {
|
||||
mflags |= MOTOR_FLAG_USE_XPA;
|
||||
mflags |= MotorFlag::USE_XPA;
|
||||
}
|
||||
|
||||
unsigned scan_lines = dev->model->is_cis ? session.output_line_count * session.params.channels
|
||||
|
|
|
@ -377,12 +377,12 @@ static void gl846_init_motor_regs_scan(Genesys_Device* dev,
|
|||
unsigned int scan_lines,
|
||||
unsigned int scan_dummy,
|
||||
unsigned int feed_steps,
|
||||
unsigned int flags)
|
||||
MotorFlag flags)
|
||||
{
|
||||
DBG_HELPER_ARGS(dbg, "scan_exposure_time=%d, scan_yres=%d, step_type=%d, scan_lines=%d, "
|
||||
"scan_dummy=%d, feed_steps=%d, flags=%x",
|
||||
scan_exposure_time, scan_yres, static_cast<unsigned>(motor_profile.step_type),
|
||||
scan_lines, scan_dummy, feed_steps, flags);
|
||||
scan_lines, scan_dummy, feed_steps, static_cast<unsigned>(flags));
|
||||
int use_fast_fed;
|
||||
unsigned int fast_dpi;
|
||||
int factor;
|
||||
|
@ -398,10 +398,8 @@ static void gl846_init_motor_regs_scan(Genesys_Device* dev,
|
|||
|
||||
use_fast_fed=0;
|
||||
/* no fast fed since feed works well */
|
||||
if(dev->settings.yres==4444 && feed_steps>100
|
||||
&& ((flags & MOTOR_FLAG_FEED)==0))
|
||||
{
|
||||
use_fast_fed=1;
|
||||
if (dev->settings.yres == 4444 && feed_steps > 100 && !has_flag(flags, MotorFlag::FEED)) {
|
||||
use_fast_fed = 1;
|
||||
}
|
||||
DBG (DBG_io, "%s: use_fast_fed=%d\n", __func__, use_fast_fed);
|
||||
|
||||
|
@ -418,12 +416,11 @@ static void gl846_init_motor_regs_scan(Genesys_Device* dev,
|
|||
else
|
||||
r->value &= ~REG_0x02_FASTFED;
|
||||
|
||||
if (flags & MOTOR_FLAG_AUTO_GO_HOME)
|
||||
if (has_flag(flags, MotorFlag::AUTO_GO_HOME)) {
|
||||
r->value |= REG_0x02_AGOHOME | REG_0x02_NOTHOME;
|
||||
}
|
||||
|
||||
if ((flags & MOTOR_FLAG_DISABLE_BUFFER_FULL_MOVE)
|
||||
||(scan_yres>=sensor.optical_res))
|
||||
{
|
||||
if (has_flag(flags, MotorFlag::DISABLE_BUFFER_FULL_MOVE) ||(scan_yres>=sensor.optical_res)) {
|
||||
r->value |= REG_0x02_ACDCDIS;
|
||||
}
|
||||
|
||||
|
@ -472,7 +469,7 @@ static void gl846_init_motor_regs_scan(Genesys_Device* dev,
|
|||
{
|
||||
feedl <<= static_cast<unsigned>(motor_profile.step_type);
|
||||
dist=scan_table.scan_steps*factor;
|
||||
if (flags & MOTOR_FLAG_FEED)
|
||||
if (has_flag(flags, MotorFlag::FEED))
|
||||
dist *=2;
|
||||
}
|
||||
DBG (DBG_io2, "%s: scan steps=%d\n", __func__, scan_table.scan_steps);
|
||||
|
@ -742,7 +739,6 @@ static void gl846_init_scan_regs(Genesys_Device* dev, const Genesys_Sensor& sens
|
|||
session.assert_computed();
|
||||
|
||||
int move;
|
||||
unsigned int mflags; /**> motor flags */
|
||||
int exposure_time;
|
||||
|
||||
int slope_dpi = 0;
|
||||
|
@ -782,12 +778,12 @@ static void gl846_init_scan_regs(Genesys_Device* dev, const Genesys_Sensor& sens
|
|||
move = session.params.starty;
|
||||
DBG(DBG_info, "%s: move=%d steps\n", __func__, move);
|
||||
|
||||
mflags = 0;
|
||||
MotorFlag mflags = MotorFlag::NONE;
|
||||
if (has_flag(session.params.flags, ScanFlag::DISABLE_BUFFER_FULL_MOVE)) {
|
||||
mflags |= MOTOR_FLAG_DISABLE_BUFFER_FULL_MOVE;
|
||||
mflags |= MotorFlag::DISABLE_BUFFER_FULL_MOVE;
|
||||
}
|
||||
if (has_flag(session.params.flags, ScanFlag::FEEDING)) {
|
||||
mflags |= MOTOR_FLAG_FEED;
|
||||
mflags |= MotorFlag::FEED;
|
||||
}
|
||||
|
||||
gl846_init_motor_regs_scan(dev, sensor, reg, motor_profile, exposure_time, slope_dpi,
|
||||
|
|
|
@ -411,12 +411,12 @@ static void gl847_init_motor_regs_scan(Genesys_Device* dev,
|
|||
unsigned int scan_lines,
|
||||
unsigned int scan_dummy,
|
||||
unsigned int feed_steps,
|
||||
unsigned int flags)
|
||||
MotorFlag flags)
|
||||
{
|
||||
DBG_HELPER_ARGS(dbg, "scan_exposure_time=%d, can_yres=%d, step_type=%d, scan_lines=%d, "
|
||||
"scan_dummy=%d, feed_steps=%d, flags=%x",
|
||||
scan_exposure_time, scan_yres, static_cast<unsigned>(motor_profile.step_type),
|
||||
scan_lines, scan_dummy, feed_steps, flags);
|
||||
scan_lines, scan_dummy, feed_steps, static_cast<unsigned>(flags));
|
||||
int use_fast_fed;
|
||||
unsigned int fast_dpi;
|
||||
int factor;
|
||||
|
@ -432,8 +432,7 @@ static void gl847_init_motor_regs_scan(Genesys_Device* dev,
|
|||
|
||||
use_fast_fed=0;
|
||||
/* no fast fed since feed works well */
|
||||
if(dev->settings.yres==4444 && feed_steps>100
|
||||
&& ((flags & MOTOR_FLAG_FEED)==0))
|
||||
if (dev->settings.yres==4444 && feed_steps > 100 && (!has_flag(flags, MotorFlag::FEED)))
|
||||
{
|
||||
use_fast_fed=1;
|
||||
}
|
||||
|
@ -447,15 +446,17 @@ static void gl847_init_motor_regs_scan(Genesys_Device* dev,
|
|||
r->value = 0x00;
|
||||
sanei_genesys_set_motor_power(*reg, true);
|
||||
|
||||
if (use_fast_fed)
|
||||
r->value |= REG_0x02_FASTFED;
|
||||
else
|
||||
r->value &= ~REG_0x02_FASTFED;
|
||||
if (use_fast_fed) {
|
||||
r->value |= REG_0x02_FASTFED;
|
||||
} else {
|
||||
r->value &= ~REG_0x02_FASTFED;
|
||||
}
|
||||
|
||||
if (flags & MOTOR_FLAG_AUTO_GO_HOME)
|
||||
r->value |= REG_0x02_AGOHOME | REG_0x02_NOTHOME;
|
||||
if (has_flag(flags, MotorFlag::AUTO_GO_HOME)) {
|
||||
r->value |= REG_0x02_AGOHOME | REG_0x02_NOTHOME;
|
||||
}
|
||||
|
||||
if ((flags & MOTOR_FLAG_DISABLE_BUFFER_FULL_MOVE)
|
||||
if (has_flag(flags, MotorFlag::DISABLE_BUFFER_FULL_MOVE)
|
||||
||(scan_yres>=sensor.optical_res))
|
||||
{
|
||||
r->value |= REG_0x02_ACDCDIS;
|
||||
|
@ -504,8 +505,9 @@ static void gl847_init_motor_regs_scan(Genesys_Device* dev,
|
|||
{
|
||||
feedl <<= static_cast<unsigned>(motor_profile.step_type);
|
||||
dist=scan_table.scan_steps*factor;
|
||||
if (flags & MOTOR_FLAG_FEED)
|
||||
dist *=2;
|
||||
if (has_flag(flags, MotorFlag::FEED)) {
|
||||
dist *= 2;
|
||||
}
|
||||
}
|
||||
DBG(DBG_io2, "%s: scan steps=%d\n", __func__, scan_table.scan_steps);
|
||||
DBG(DBG_io2, "%s: acceleration distance=%d\n", __func__, dist);
|
||||
|
@ -752,7 +754,6 @@ static void gl847_init_scan_regs(Genesys_Device* dev, const Genesys_Sensor& sens
|
|||
session.assert_computed();
|
||||
|
||||
int move;
|
||||
unsigned int mflags; /**> motor flags */
|
||||
int exposure_time;
|
||||
|
||||
int slope_dpi = 0;
|
||||
|
@ -789,12 +790,12 @@ static void gl847_init_scan_regs(Genesys_Device* dev, const Genesys_Sensor& sens
|
|||
move = session.params.starty;
|
||||
DBG(DBG_info, "%s: move=%d steps\n", __func__, move);
|
||||
|
||||
mflags=0;
|
||||
MotorFlag mflags = MotorFlag::NONE;
|
||||
if (has_flag(session.params.flags, ScanFlag::DISABLE_BUFFER_FULL_MOVE)) {
|
||||
mflags |= MOTOR_FLAG_DISABLE_BUFFER_FULL_MOVE;
|
||||
mflags |= MotorFlag::DISABLE_BUFFER_FULL_MOVE;
|
||||
}
|
||||
if (has_flag(session.params.flags, ScanFlag::FEEDING)) {
|
||||
mflags |= MOTOR_FLAG_FEED;
|
||||
mflags |= MotorFlag::FEED;
|
||||
}
|
||||
|
||||
gl847_init_motor_regs_scan(dev, sensor, reg, motor_profile, exposure_time, slope_dpi,
|
||||
|
|
|
@ -242,11 +242,6 @@ extern StaticInit<std::vector<Motor_Profile>> gl124_motor_profiles;
|
|||
|
||||
constexpr unsigned SLOPE_TABLE_SIZE = 1024;
|
||||
|
||||
#define MOTOR_FLAG_AUTO_GO_HOME 0x01
|
||||
#define MOTOR_FLAG_DISABLE_BUFFER_FULL_MOVE 0x02
|
||||
#define MOTOR_FLAG_FEED 0x04
|
||||
#define MOTOR_FLAG_USE_XPA 0x08
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
/* common functions needed by low level specific functions */
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
|
Ładowanie…
Reference in New Issue