add reverse parameter to gl124_feed

merge-requests/1/head
Stphane Voltz 2015-03-02 17:35:20 +01:00
rodzic debf0101f7
commit 0f990e4a99
2 zmienionych plików z 12 dodań i 6 usunięć

Wyświetl plik

@ -2202,12 +2202,13 @@ gl124_slow_back_home (Genesys_Device * dev, SANE_Bool wait_until_home)
/** @brief moves the slider to steps at motor base dpi /** @brief moves the slider to steps at motor base dpi
* @param dev device to work on * @param dev device to work on
* @param steps number of steps to move * @param steps number of steps to move
* @param reverse true is moving backward
* */ * */
#ifndef UNIT_TESTING #ifndef UNIT_TESTING
static static
#endif #endif
SANE_Status SANE_Status
gl124_feed (Genesys_Device * dev, unsigned int steps) gl124_feed (Genesys_Device * dev, unsigned int steps, int reverse)
{ {
Genesys_Register_Set local_reg[GENESYS_GL124_MAX_REGS]; Genesys_Register_Set local_reg[GENESYS_GL124_MAX_REGS];
SANE_Status status; SANE_Status status;
@ -2242,9 +2243,7 @@ gl124_feed (Genesys_Device * dev, unsigned int steps)
SCAN_FLAG_IGNORE_LINE_DISTANCE); SCAN_FLAG_IGNORE_LINE_DISTANCE);
if (status != SANE_STATUS_GOOD) if (status != SANE_STATUS_GOOD)
{ {
DBG (DBG_error, DBG (DBG_error, "%s: failed to set up registers: %s\n", __FUNCTION__, sane_strstatus (status));
"gl124_feed: failed to set up registers: %s\n",
sane_strstatus (status));
DBGCOMPLETED; DBGCOMPLETED;
return status; return status;
} }
@ -2262,6 +2261,13 @@ gl124_feed (Genesys_Device * dev, unsigned int steps)
r = sanei_genesys_get_address (local_reg, REG01); r = sanei_genesys_get_address (local_reg, REG01);
r->value &= ~REG01_SCAN; r->value &= ~REG01_SCAN;
/* set up for reverse if needed */
if(reverse)
{
r = sanei_genesys_get_address (local_reg, REG02);
r->value |= REG02_MTRREV;
}
/* send registers */ /* send registers */
RIE (dev->model->cmd_set->bulk_write_register (dev, local_reg, GENESYS_GL124_MAX_REGS)); RIE (dev->model->cmd_set->bulk_write_register (dev, local_reg, GENESYS_GL124_MAX_REGS));
@ -2653,7 +2659,7 @@ gl124_init_regs_for_scan (Genesys_Device * dev)
if(channels*dev->settings.yres>=600 && move>700) if(channels*dev->settings.yres>=600 && move>700)
{ {
status = gl124_feed (dev, move-500); status = gl124_feed (dev, move-500, SANE_FALSE);
if (status != SANE_STATUS_GOOD) if (status != SANE_STATUS_GOOD)
{ {
DBG (DBG_error, "%s: failed to move to scan area\n",__FUNCTION__); DBG (DBG_error, "%s: failed to move to scan area\n",__FUNCTION__);

Wyświetl plik

@ -710,7 +710,7 @@ SANE_Status gl124_send_shading_data (Genesys_Device * dev, uint8_t * data, int s
#ifndef UNIT_TESTING #ifndef UNIT_TESTING
static static
#endif #endif
SANE_Status gl124_feed (Genesys_Device * dev, unsigned int steps); SANE_Status gl124_feed (Genesys_Device * dev, unsigned int steps, int reverse);
GENESYS_STATIC SANE_Status GENESYS_STATIC SANE_Status
gl124_stop_action (Genesys_Device * dev); gl124_stop_action (Genesys_Device * dev);