diff --git a/backend/plustek-usb.h b/backend/plustek-usb.h index 4b68f813c..afa631392 100644 --- a/backend/plustek-usb.h +++ b/backend/plustek-usb.h @@ -31,8 +31,8 @@ * - 0.47 - cleanup work * - added gamma to struct HWDefault * - 0.48 - added DEVCAPSFLAG_LargeTPA - * - added min_ffstep to ClkMotorDef * - added _WAF_BIN_FROM_COLOR and _WAF_GRAY_FROM_COLOR + * - added dHighSpeed to struct HwDefault * . *
* This file is part of the SANE package. @@ -383,6 +383,7 @@ typedef struct HWDefault { double dMaxMotorSpeed; /* Inches/second, max. scan speed */ double dMaxMoveSpeed; /* Inches/second, max. move speed */ + double dHighSpeed; /* for speeding up the sensor */ double dIntegrationTimeLowLamp; double dIntegrationTimeHighLamp; u_short wMotorDpi; /* Full step DPI */ @@ -624,8 +625,7 @@ typedef struct { u_char pwm_fast; /**< PWM during fast movement */ u_char pwm_duty_fast; /**< PWM duty during fast movement */ u_char mclk_fast; /**< MCLK during fast movement */ - u_short min_ffstep; /**< minimal ffstep size for speedup, - 0xffff disables the stuff */ + /** * here we define some ranges for better supporting * non-Plustek devices with it's different hardware diff --git a/backend/plustek-usbdevs.c b/backend/plustek-usbdevs.c index e211b0e57..2f68bf914 100644 --- a/backend/plustek-usbdevs.c +++ b/backend/plustek-usbdevs.c @@ -709,6 +709,7 @@ static HWDef Hw0x07B3_0x0017_0 = { 1.5, /* dMaxMotorSpeed (Max_Speed) */ 1.2, /* dMaxMoveSpeed (Max_Speed) */ + 0.0, /* dHighSpeed */ 9, /* dIntegrationTimeLowLamp */ 9, /* dIntegrationTimeHighLamp */ 300, /* wMotorDpi (Full step DPI) */ @@ -773,7 +774,7 @@ static HWDef Hw0x07B3_0x0017_0 = */ static HWDef Hw0x07B3_0x0007_0 = { - 1.5, 1.2, + 1.5, 1.2, 0.0, 9, 9, 300, 512, @@ -818,7 +819,7 @@ static HWDef Hw0x07B3_0x0007_0 = */ static HWDef Hw0x07B3_0x0007_2 = { - 1.4, 1.2, + 1.4, 1.2, 0.0, 9, 9, 600, 512, @@ -863,7 +864,7 @@ static HWDef Hw0x07B3_0x0007_2 = */ static HWDef Hw0x07B3_0x0007_4 = { - 1.1, 0.9, + 1.1, 0.9, 0.0, 12, 12, 600, 2048, @@ -908,7 +909,7 @@ static HWDef Hw0x07B3_0x0007_4 = */ static HWDef Hw0x07B3_0x000F_0 = { - 1.5, 1.0, + 1.5, 1.0, 0.0, 9, 9, 300, 512, @@ -953,7 +954,7 @@ static HWDef Hw0x07B3_0x000F_0 = */ static HWDef Hw0x07B3_0x0013_0 = { - 1.5, 1.2, + 1.5, 1.2, 0.0, 9, 9, 300, 512, @@ -998,7 +999,7 @@ static HWDef Hw0x07B3_0x0013_0 = */ static HWDef Hw0x07B3_0x0013_4 = { - 1.0, 0.9, + 1.0, 0.9, 0.0, 12, 12, 600, 2048, @@ -1043,7 +1044,7 @@ static HWDef Hw0x07B3_0x0013_4 = */ static HWDef Hw0x07B3_0x000F_4 = { - 1.1, 0.9, + 1.1, 0.9, 0.0, 12, 12, 600, 2048, @@ -1088,7 +1089,7 @@ static HWDef Hw0x07B3_0x000F_4 = */ static HWDef Hw0x07B3_0x0016_4 = { - 1.0, 0.9, + 1.0, 0.9, 0.0, 12, 12, 600, 2048, @@ -1133,41 +1134,41 @@ static HWDef Hw0x07B3_0x0016_4 = */ static HWDef Hw0x07B3_0x0017_4 = { - 1.0, 0.9, - 12, 12, - 600, + 1.0, 0.9, 0.0, + 12, 12, + 600, 2048, - 8, 8, + 8, 8, 4095, 4095, - 0x06, 0x20, 0x2f, 0x2a, + 0x06, 0x20, 0x2f, 0x2a, {2, 7, 5, 6, 6, 7, 0, 0, 0, 5}, {20, 4, 13, 16, 19, 22, 0, 0, 23, 11}, _GREEN_CH, 0, - 1, + 1, /* illumination mode settings (not used for CCD devices) */ { 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0 }, 1, - 13, - 62, - 320, - 10684, + 13, + 62, + 320, + 10684, 0, 16383, 0, 0, 0, 16383, - 3, - 0, - 0x1e, - 0xa8, - 0, + 3, + 0, + 0x1e, + 0xa8, + 0, 0xff, - 10, - 48, - 0x0d, 0x22, 0x82, 0x88, + 10, + 48, + 0x0d, 0x22, 0x82, 0x88, 0, 0, 0, _LM9832, MODEL_KaoHsiung, @@ -1178,7 +1179,7 @@ static HWDef Hw0x07B3_0x0017_4 = */ static HWDef Hw0x07B3_0x0017_1 = { - 1.5, 1.5, + 1.5, 1.5, 0.0, 9, 9, 200, 2048, @@ -1223,26 +1224,26 @@ static HWDef Hw0x07B3_0x0017_1 = */ static HWDef Hw0x07B3_0x0012_0 = { - 1.5, 1.4, - 9, 9, - 600, - 2048, - 4, 5, - 3000, 4095, - 0x02, 0x04, 0x37, 0x13, - {2, 7, 0, 1, 0, 0, 0, 0, 4, 0}, - {5, 23, 1, 3, 0, 0, 0, 12, 10, 22}, + 1.5, 1.4, 0.0, + 9, 9, + 600, + 2048, + 4, 5, + 3000, 4095, + 0x02, 0x04, 0x37, 0x13, + {2, 7, 0, 1, 0, 0, 0, 0, 4, 0}, + {5, 23, 1, 3, 0, 0, 0, 12, 10, 22}, _GREEN_CH, 0, - 1, + 1, /* illumination mode settings (not used for CCD devices) */ { 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0 }, 1, - 14, - 62, - 110, - 5400, + 14, + 62, + 110, + 5400, 0, 16383, 0, @@ -1268,26 +1269,26 @@ static HWDef Hw0x07B3_0x0012_0 = */ static HWDef Hw0x07B3_0x0017_2 = { - 1.5, 1.2, - 9, 9, - 300, - 512, - 4, 5, - 3000, 4095, - 0x02, 0, 0x2f, 0x36, + 1.5, 1.2, 0.0, + 9, 9, + 300, + 512, + 4, 5, + 3000, 4095, + 0x02, 0, 0x2f, 0x36, {2, 7, 0, 1, 0, 0, 0, 0, 4, 0}, {5, 0, 1, 4, 7, 10, 0, 0, 12, 0}, _GREEN_CH, 0, - 1, + 1, /* illumination mode settings (not used for CCD devices) */ { 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0 }, 1, - 16, - 64, - 110, - 5416, + 16, + 64, + 110, + 5416, 0, 16383, 0, @@ -1313,37 +1314,37 @@ static HWDef Hw0x07B3_0x0017_2 = */ static HWDef Hw0x07B3_0x0017_3 = { - 1.5, 1.2, - 9, 9, - 300, + 1.5, 1.2, 0.0, + 9, 9, + 300, 512, - 4, 5, - 3000, 4095, - 0x02, 0x04, 0x37, 0x13, - {2, 7, 0, 1, 0, 0, 0, 0, 4, 0}, - {5, 23, 1, 4, 7, 10, 0, 0, 11, 23}, + 4, 5, + 3000, 4095, + 0x02, 0x04, 0x37, 0x13, + {2, 7, 0, 1, 0, 0, 0, 0, 4, 0}, + {5, 23, 1, 4, 7, 10, 0, 0, 11, 23}, _GREEN_CH, 0, - 1, + 1, /* illumination mode settings (not used for CCD devices) */ { 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0 }, 1, - 14, - 62, - 110, - 5400, + 14, + 62, + 110, + 5400, 0, 16383, 0, 0, 0, 16383, - 3, - 0, + 3, + 0, 0x1e, - 0xa8, - 0, + 0xa8, + 0, 0xff, 64, 20, @@ -1358,28 +1359,29 @@ static HWDef Hw0x07B3_0x0017_3 = */ static HWDef Hw0x03F0_0x0505 = { - 1.05, /* dMaxMotorSpeed (Max_Speed) */ - 1.05, /* dMaxMoveSpeed (Max_Speed) */ - 6, /* dIntegrationTimeLowLamp */ - 8, /* dIntegrationTimeHighLamp */ - 600, /* ok wMotorDpi (Full step DPI) */ - 512, /* wRAMSize (KB) */ - 6, /* dMinIntegrationTimeLowres (ms) */ - 6, /* dMinIntegrationTimeHighres (ms) */ - 0, /* wGreenPWMDutyCycleLow */ - 0, /* wGreenPWMDutyCycleHigh */ - 0x02, /* bSensorConfiguration (0x0b) */ - 0x00, /* bReg_0x0c */ - 0x2F, /* bReg_0x0d */ - 0x13, /* bReg_0x0e */ - /* bReg_0x0f_Mono[10] (0x0f to 0x18) */ + 1.05, /* dMaxMotorSpeed (Max_Speed) */ + 1.05, /* dMaxMoveSpeed (Max_Speed) */ + 0.0, /* dHighSpeed */ + 6, /* dIntegrationTimeLowLamp */ + 8, /* dIntegrationTimeHighLamp */ + 600, /* wMotorDpi (Full step DPI) */ + 512, /* wRAMSize (KB) */ + 6, /* dMinIntegrationTimeLowres (ms) */ + 6, /* dMinIntegrationTimeHighres (ms) */ + 0, /* wGreenPWMDutyCycleLow */ + 0, /* wGreenPWMDutyCycleHigh */ + 0x02, /* bSensorConfiguration (0x0b) */ + 0x00, /* bReg_0x0c */ + 0x2F, /* bReg_0x0d */ + 0x13, /* bReg_0x0e */ + /* bReg_0x0f_Mono[10] (0x0f to 0x18) */ { 0x02, 0x07, 0x01, 0x02, 0x02, 0x03, 0x00, 0x00, 0x04, 0x07 }, - /* bReg_0x0f_Color[10] (0x0f to 0x18) */ + /* bReg_0x0f_Color[10] (0x0f to 0x18) */ { 0x08, 0x17, 0x00, 0x03, 0x08, 0x0b, 0x00, 0x00, 0x0a, 0x14 }, - _GREEN_CH, /* bReg_0x26 color mode - bits 4 and 5 */ + _GREEN_CH, /* bReg_0x26 color mode - bits 4 and 5 */ 0, /* bReg 0x27 color mode */ 1, /* bReg 0x29 illumination mode */ @@ -1427,6 +1429,7 @@ static HWDef Hw0x03F0_0x0605 = { 1.05, /* dMaxMotorSpeed (Max_Speed) */ 1.05, /* dMaxMoveSpeed (Max_Speed) */ + 0.0, /* dHighSpeed */ 6, /* dIntegrationTimeLowLamp */ 8, /* dIntegrationTimeHighLamp */ 600, /* ok wMotorDpi (Full step DPI) */ @@ -1494,6 +1497,7 @@ static HWDef Hw0x0400_0x1000_0 = { 1.25, /* ok dMaxMotorSpeed (Max_Speed) */ 1.25, /* ok dMaxMoveSpeed (Max_Speed) */ + 0.0, /* ok dHighSpeed */ 12, /* ok dIntegrationTimeLowLamp */ 12, /* ok dIntegrationTimeHighLamp */ 600, /* ok wMotorDpi (Full step DPI) */ @@ -1552,6 +1556,7 @@ static HWDef Hw0x0400_0x1001_1 = { 1.25, /* ok dMaxMotorSpeed (Max_Speed) */ 1.25, /* ok dMaxMoveSpeed (Max_Speed) */ + 0.0, /* dHighSpeed */ 12, /* ok dIntegrationTimeLowLamp */ 12, /* ok dIntegrationTimeHighLamp */ 600, /* ok wMotorDpi (Full step DPI) */ @@ -1608,18 +1613,19 @@ static HWDef Hw0x0400_0x1001_1 = /** BearPaw 2400 */ static HWDef Hw0x0400_0x1001_0 = { -1.0 /* 1.8*/, /* ok dMaxMotorSpeed (Max_Speed) */ -0.9 /*1.8 */, /* ok dMaxMoveSpeed (Max_Speed) */ + 1.0/*1.8*/, /* ok dMaxMotorSpeed (Max_Speed) */ + 0.9/*1.8*/, /* ok dMaxMoveSpeed (Max_Speed) */ + 0.0, /* ok dHighSpeed */ 12, /* ok dIntegrationTimeLowLamp */ 12, /* ok dIntegrationTimeHighLamp */ -1200 /* 600*/ , /* ok wMotorDpi (Full step DPI) */ + 1200 /* 600*/ , /* ok wMotorDpi (Full step DPI) */ 2048, /* ok wRAMSize (KB) */ 9, /* ok dMinIntegrationTimeLowres (ms) */ 9, /* ok dMinIntegrationTimeHighres (ms) */ 1169, /* ok wGreenPWMDutyCycleLow (reg 0x2a + 0x2b) */ 1169, /* ok wGreenPWMDutyCycleHigh (reg 0x2a + 0x2b) */ -0x02 /* 0x06*/, /* ok bSensorConfiguration (0x0b) */ +0x02 /*0x06*/, /* ok bSensorConfiguration (0x0b) */ 0x3c, /* ok sensor control settings (reg 0x0c) */ 0x3f, /* ok sensor control settings (reg 0x0d) */ 0x11, /* ok sensor control settings (reg 0x0e) */ @@ -1673,6 +1679,7 @@ static HWDef Hw0x04B8_0x010F = { 0.8, /* dMaxMotorSpeed (Max_Speed) */ 0.8, /* dMaxMoveSpeed (Max_Speed) */ + 4.1, /* dHighSpeed */ 12, /* dIntegrationTimeLowLamp */ 12, /* dIntegrationTimeHighLamp */ 600, /* wMotorDpi (Full step DPI) */ @@ -1738,6 +1745,7 @@ static HWDef Hw0x04B8_0x011D = { 0.9, /* dMaxMotorSpeed (Max_Speed) */ 0.8, /* dMaxMoveSpeed (Max_Speed) */ + 4.1, /* dHighSpeed */ 12, /* dIntegrationTimeLowLamp */ 12, /* dIntegrationTimeHighLamp */ 600, /* wMotorDpi (Full step DPI) */ @@ -1803,6 +1811,7 @@ static HWDef Hw0x1606_0x0060 = { 1.5, /* dMaxMotorSpeed (Max_Speed) */ 0.8, /* dMaxMoveSpeed (Max_Speed) */ + 0.0, /* dHighSpeed */ 9, /* dIntegrationTimeLowLamp */ 9, /* dIntegrationTimeHighLamp */ 600, /* wMotorDpi (Full step DPI) */ @@ -1869,6 +1878,7 @@ static HWDef Hw0x1606_0x0160 = { 1.1, /* dMaxMotorSpeed (Max_Speed) */ 0.9, /* dMaxMoveSpeed (Max_Speed) */ + 0.0, /* dHighSpeed */ 9, /* dIntegrationTimeLowLamp */ 9, /* dIntegrationTimeHighLamp */ 600, /* wMotorDpi (Full step DPI) */ @@ -1933,9 +1943,10 @@ static HWDef Hw0x1606_0x0160 = /** Canon 650/656 */ static HWDef Hw0x04A9_0x2206 = { - 0.86, /* dMaxMotorSpeed (Max_Speed) */ - 0.243, /* dMaxMoveSpeed (Max_Speed) */ - 100, /* dIntegrationTimeLowLamp */ + 0.86, /* dMaxMotorSpeed (Max_Speed) */ + 0.243, /* dMaxMoveSpeed (Max_Speed) */ + 0.0, /* dHighSpeed */ + 100, /* dIntegrationTimeLowLamp */ 100, /* dIntegrationTimeHighLamp */ 1200, /* wMotorDpi (Full step DPI) */ 512, /* wRAMSize (KB) */ @@ -2003,6 +2014,7 @@ static HWDef Hw0x04A9_0x2207 = { 0.72, /* dMaxMotorSpeed (Max_Speed) */ 0.36, /* dMaxMoveSpeed (Max_Speed) */ + 0.0, /* dHighSpeed */ 100, /* wIntegrationTimeLowLamp */ 100, /* wIntegrationTimeHighLamp */ 1200, /* wMotorDpi (Full step DPI) */ @@ -2068,76 +2080,75 @@ static HWDef Hw0x04A9_0x2207 = /** Canon D660U */ static HWDef Hw0x04A9_0x2208 = { - 1.2, /* dMaxMotorSpeed (Max_Speed) */ - 1.1, /* dMaxMoveSpeed (Max_Speed) */ - 9, /* dIntegrationTimeLowLamp */ - 9, /* dIntegrationTimeHighLamp */ - 300, /* wMotorDpi (Full step DPI) */ - 512, /* wRAMSize (KB) */ - 8, /* dMinIntegrationTimeLowres (ms) */ - 8, /* dMinIntegrationTimeHighres (ms) */ - 4095, /* wGreenPWMDutyCycleLow (reg 0x2a + 0x2b) */ - 4095, /* wGreenPWMDutyCycleHigh (reg 0x2a + 0x2b) */ + 1.2, /* dMaxMotorSpeed (Max_Speed) */ + 1.1, /* dMaxMoveSpeed (Max_Speed) */ + 3.5, /* dHighSpeed */ + 9, /* dIntegrationTimeLowLamp */ + 9, /* dIntegrationTimeHighLamp */ + 300, /* wMotorDpi (Full step DPI) */ + 512, /* wRAMSize (KB) */ + 8, /* dMinIntegrationTimeLowres (ms) */ + 8, /* dMinIntegrationTimeHighres (ms) */ + 4095, /* wGreenPWMDutyCycleLow (reg 0x2a + 0x2b) */ + 4095, /* wGreenPWMDutyCycleHigh (reg 0x2a + 0x2b) */ - 0x02, /* bSensorConfiguration (0x0b) */ - 0x60, /* sensor control settings (reg 0x0c) */ - 0x2f, /* sensor control settings (reg 0x0d) */ - 0x13, /* sensor control settings (reg 0x0e) */ + 0x02, /* bSensorConfiguration (0x0b) */ + 0x60, /* sensor control settings (reg 0x0c) */ + 0x2f, /* sensor control settings (reg 0x0d) */ + 0x13, /* sensor control settings (reg 0x0e) */ -#if 0 - {0x02, 0x07, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x0b }, -#endif - {0x06, 0x17, 0x01, 0x03, 0x05, 0x07, 0x00, 0x00, 0x0b }, - {0x06, 0x17, 0x01, 0x03, 0x05, 0x07, 0x00, 0x00, 0x0b }, - _GREEN_CH, - 0, /* bReg 0x27 color mode */ - 1, /* bReg 0x29 illumination mode */ + {0x06, 0x17, 0x01, 0x03, 0x05, 0x07, 0x00, 0x00, 0x0b }, + {0x06, 0x17, 0x01, 0x03, 0x05, 0x07, 0x00, 0x00, 0x0b }, + _GREEN_CH, + 0, /* bReg 0x27 color mode */ + 1, /* bReg 0x29 illumination mode */ - /* illumination mode settings (not used for CCD devices) */ - { 0, 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0, 0 }, + /* illumination mode settings (not used for CCD devices) */ + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, - 0, /* StepperPhaseCorrection (reg 0x1a + 0x1b) */ - 13, /* bOpticBlackStart (reg 0x1c) */ - 33, /* bOpticBlackEnd (reg 0x1d) */ - 64, /* wActivePixelsStart (reg 0x1e + 0x1f) */ - 5440, /* wLineEnd (reg 0x20 + 0x21) */ + 0, /* StepperPhaseCorrection (reg 0x1a + 0x1b) */ + 13, /* bOpticBlackStart (reg 0x1c) */ + 33, /* bOpticBlackEnd (reg 0x1d) */ + 64, /* wActivePixelsStart (reg 0x1e + 0x1f) */ + 5440, /* wLineEnd (reg 0x20 + 0x21) */ - 16383, /* red lamp on (reg 0x2c + 0x2d) */ - 1, /* red lamp off (reg 0x2e + 0x2f) */ - 0, /* green lamp on (reg 0x30 + 0x31) */ - 0, /* green lamp off (reg 0x32 + 0x33) */ - 0, /* blue lamp on (reg 0x34 + 0x35) */ - 0, /* blue lamp off (reg 0x36 + 0x37) */ + 16383, /* red lamp on (reg 0x2c + 0x2d) */ + 1, /* red lamp off (reg 0x2e + 0x2f) */ + 0, /* green lamp on (reg 0x30 + 0x31) */ + 0, /* green lamp off (reg 0x32 + 0x33) */ + 0, /* blue lamp on (reg 0x34 + 0x35) */ + 0, /* blue lamp off (reg 0x36 + 0x37) */ - 3, /* stepper motor control (reg 0x45) */ - 0, /* wStepsAfterPaperSensor2 (reg 0x4c + 0x4d) */ - 0x20, /* steps to reverse when buffer is full reg 0x50) */ - 0xfc, /* acceleration profile (reg 0x51) */ - 0, /* lines to process (reg 0x54) */ - 0, /* kickstart (reg 0x55) */ - 0x02, /* pwm freq (reg 0x56) */ - 0x1f, /* pwm duty cycle (reg 0x57) */ - 0x05, /* Paper sense (reg 0x58) */ - 0x44, /* misc io12 (reg 0x59) */ - 0x14, /* misc io34 (reg 0x5a) */ - 0x11, /* misc io56 (reg 0x5b) */ - 0, /* test mode ADC Output CODE MSB (reg 0x5c) */ - 0, /* test mode ADC Output CODE LSB (reg 0x5d) */ - 0, /* test mode (reg 0x5e) */ - _LM9832, - MODEL_CANONCCD1200, - 1.5 + 3, /* stepper motor control (reg 0x45) */ + 0, /* wStepsAfterPaperSensor2 (reg 0x4c + 0x4d) */ + 0x20, /* steps to reverse when buffer is full reg 0x50) */ + 0xfc, /* acceleration profile (reg 0x51) */ + 0, /* lines to process (reg 0x54) */ + 0, /* kickstart (reg 0x55) */ + 0x02, /* pwm freq (reg 0x56) */ + 0x1f, /* pwm duty cycle (reg 0x57) */ + 0x05, /* Paper sense (reg 0x58) */ + 0x44, /* misc io12 (reg 0x59) */ + 0x14, /* misc io34 (reg 0x5a) */ + 0x11, /* misc io56 (reg 0x5b) */ + 0, /* test mode ADC Output CODE MSB (reg 0x5c) */ + 0, /* test mode ADC Output CODE LSB (reg 0x5d) */ + 0, /* test mode (reg 0x5e) */ + _LM9832, + MODEL_CANONCCD1200, + 1.5 }; /** Canon 670/676/LiDE20 */ static HWDef Hw0x04A9_0x220D = { - 0.86, /* dMaxMotorSpeed (Max_Speed) */ - 0.243, /* dMaxMoveSpeed (Max_Speed) */ - 100, /* dIntegrationTimeLowLamp */ - 100, /* dIntegrationTimeHighLamp */ - 1200, /* wMotorDpi (Full step DPI) */ + 0.86, /* dMaxMotorSpeed (Max_Speed) */ + 0.243, /* dMaxMoveSpeed (Max_Speed) */ + 0.0, /* dHighSpeed */ + 100, /* dIntegrationTimeLowLamp */ + 100, /* dIntegrationTimeHighLamp */ + 1200, /* wMotorDpi (Full step DPI) */ 512, /* wRAMSize (KB) */ 3.75, /* dMinIntegrationTimeLowres (ms) */ 5.75, /* dMinIntegrationTimeHighres (ms) */ @@ -2203,6 +2214,7 @@ static HWDef Hw0x04A9_0x220E = { 0.72, /* dMaxMotorSpeed (Max_Speed) */ 0.36, /* dMaxMoveSpeed (Max_Speed) */ + 0.0, /* dHighSpeed */ 100, /* wIntegrationTimeLowLamp */ 100, /* wIntegrationTimeHighLamp */ 1200, /* wMotorDpi (Full step DPI) */ @@ -2369,7 +2381,7 @@ static SetDef Settings[] = static ClkMotorDef Motors[] = { { MODEL_KaoHsiung, - 64, 20, 6, 0xffff, /* PWM, PWM_Duty, MCLK for fast move, ffstep */ + 64, 20, 6, /* PWM, PWM_Duty, MCLK for fast move */ /* Motor settings (PWM and PWM_Duty) */ {{ 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, @@ -2382,7 +2394,7 @@ static ClkMotorDef Motors[] = { { 2, 2, 2, 2, 2, 3, 3, 3, 3, 3 } }, - { MODEL_HuaLien, 64, 20, 6, 0xffff, + { MODEL_HuaLien, 64, 20, 6, /* Motor settings (PWM and PWM_Duty) */ {{ 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }}, @@ -2394,7 +2406,7 @@ static ClkMotorDef Motors[] = { { 2, 2, 2, 2, 2, 3, 3, 3, 3, 3 } }, - { MODEL_Tokyo600, 4, 4, 6, 0xffff, + { MODEL_Tokyo600, 4, 4, 6, /* Motor settings (PWM and PWM_Duty) */ {{ 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }}, @@ -2406,7 +2418,7 @@ static ClkMotorDef Motors[] = { { 2, 2, 2, 2, 2, 3, 3, 3, 3, 3 } }, - { MODEL_MUSTEK600, 4, 4, 6, 0xffff, + { MODEL_MUSTEK600, 4, 4, 6, /* Motor settings (PWM and PWM_Duty) */ {{ 16, 4, 1 }, { 16, 4, 1 }, { 16, 4, 1 }, { 16, 4, 1 }, { 16, 4, 1 }, { 16, 4, 1 }, { 16, 4, 1 }, { 16, 4, 1 }, { 16, 4, 1 }, { 16, 4, 1 }}, @@ -2418,7 +2430,7 @@ static ClkMotorDef Motors[] = { { 10.5, 10.5, 10.5, 10.5, 10.5, 10.5, 11.5, 11.5, 11.5, 11.5 } }, - { MODEL_MUSTEK1200, 2, 32, 3, 0xffff, + { MODEL_MUSTEK1200, 2, 32, 3, /* Motor settings (PWM and PWM_Duty) */ /* <=75dpi <=100dpi <=150dpi <=200dpi <=300dpi */ {{ 2, 32, 1 }, { 2, 32, 1 }, { 2, 32, 1 }, { 2, 32, 1 }, { 2, 32, 1 }, @@ -2434,7 +2446,7 @@ static ClkMotorDef Motors[] = { }, /* settings good for the HP models (tested with 2200)*/ - { MODEL_HP, 8, 60, 6, 0xffff, + { MODEL_HP, 8, 60, 6, /* Motor settings (PWM and PWM_Duty) */ {{ 8, 60, 1 }, { 8, 60, 1 }, { 8, 60, 1 }, { 8, 60, 1 }, { 8, 60, 1 }, { 8, 60, 1 }, { 8, 60, 1 }, { 8, 60, 1 }, { 8, 60, 1 }, { 8, 60, 1 }}, @@ -2448,7 +2460,7 @@ static ClkMotorDef Motors[] = { { 8.0, 8.0, 8.0, 8.0, 8.0, 13.0, 13.0, 13.0, 13.0, 13.0 } }, - { MODEL_CANON600, 8, 51, 6, 0xffff, + { MODEL_CANON600, 8, 51, 6, /* Motor settings (PWM and PWM_Duty) */ /* <=75dpi <=100dpi <=150dpi <=200dpi <=300dpi */ {{ 8, 31, 1 }, { 8, 31, 1 }, { 8, 31, 1 }, { 8, 31, 1 }, { 8, 31, 1 }, @@ -2464,7 +2476,7 @@ static ClkMotorDef Motors[] = { { 12.5, 12.0, 12.0, 12.0, 12.0, 12.0, 12.0, 12.0, 12.0, 12.0 } }, - { MODEL_CANON1200, 8, 51, 3, 0x0150, + { MODEL_CANON1200, 8, 51, 3, /* Motor settings (PWM and PWM_Duty) */ /* <=75dpi <=100dpi <=150dpi <=200dpi <=300dpi */ {{ 8, 31, 1 }, { 8, 31, 1 }, { 8, 31, 1 }, { 8, 31, 1 }, { 8, 31, 1 }, @@ -2480,7 +2492,7 @@ static ClkMotorDef Motors[] = { }, /* settings good for the UMAX models (tested with 3400) */ - { MODEL_UMAX, 16, 4, 6, 0xffff, + { MODEL_UMAX, 16, 4, 6, /* Motor settings (PWM and PWM_Duty) */ {{ 16, 4, 1 }, { 16, 4, 1 }, { 16, 4, 1 }, { 16, 4, 1 }, { 16, 4, 1 }, { 16, 4, 1 }, { 16, 4, 1 }, { 16, 4, 1 }, { 16, 4, 1 }, { 16, 4, 1 }}, @@ -2492,7 +2504,7 @@ static ClkMotorDef Motors[] = { { 10.5, 10.5, 10.5, 10.5, 10.5, 10.5, 10.5, 10.5, 10.5, 10.5 } }, - { MODEL_UMAX1200, 16, 4, 6, 0xffff /*0x0c0*/, + { MODEL_UMAX1200, 16, 4, 6, /* Motor settings (PWM and PWM_Duty) */ {{ 16, 4, 1 }, { 16, 4, 1 }, { 16, 4, 1 }, { 16, 4, 1 }, { 16, 4, 1 }, { 16, 4, 1 }, { 16, 4, 1 }, { 16, 4, 1 }, { 16, 4, 1 }, { 16, 4, 1 }}, @@ -2505,7 +2517,7 @@ static ClkMotorDef Motors[] = { }, /* settings good for the EPSON models */ - { MODEL_EPSON, 2, 1, 6, 0x0065, + { MODEL_EPSON, 2, 1, 6, /* Motor settings (PWM and PWM_Duty) */ /* <=75dpi <=100dpi <=150dpi <=200dpi <=300dpi */ {{ 2, 1, 1 }, { 2, 1, 1 }, { 2, 1, 1 }, { 2, 1, 1 }, { 2, 1, 1 }, @@ -2520,7 +2532,7 @@ static ClkMotorDef Motors[] = { { 6.0, 6.0, 6.0, 6.0, 6.0, 8.0, 9.0, 9.0, 18.0, 18.0 } }, - { MODEL_CANONCCD1200, 2, 31, 6, 0x0120, + { MODEL_CANONCCD1200, 2, 31, 6, /* Motor settings (PWM and PWM_Duty) */ /* <=75dpi <=100dpi <=150dpi <=200dpi <=300dpi */ {{ 2, 31, 1 }, { 2, 31, 1 }, { 2, 31, 1 }, { 2, 31, 1 }, { 2, 31, 1 }, diff --git a/backend/plustek-usbhw.c b/backend/plustek-usbhw.c index eb3bf2447..6d15fcb4b 100644 --- a/backend/plustek-usbhw.c +++ b/backend/plustek-usbhw.c @@ -239,20 +239,56 @@ static SANE_Bool usb_SensorPaper( int handle ) static SANE_Bool usb_WaitPos( Plustek_Device *dev, u_long to, SANE_Bool stay ) { SANE_Bool retval; - u_char value; - u_short ffs, step; + u_char value, mclk_div, mch; + u_short ffs, step, min_ffs; long dwTicks; - double fac; - struct timeval start_time, t2; - pClkMotorDef clk = usb_GetMotorSet( dev->usbDev.HwSetting.motorModel ); + double maxf, fac, speed; + struct timeval start_time, t2; + + HWDef *hw = &dev->usbDev.HwSetting; + + /* get current master clock divider */ + usbio_ReadReg( dev->fd, 0x08, &value ); + mclk_div = (value >> 1) + 1; + + /* get current channel mode */ + usbio_ReadReg( dev->fd, 0x26, &value ); + mch = ((value & 0x07) > 1) ? 1:3; + + /* calculate the current speed */ + ffs = a_bRegs[0x48] * 256 + a_bRegs[0x49]; + speed = ((double)dwCrystalFrequency) /(double)((u_long)mclk_div * 32UL * + (u_long)mch * (u_long)ffs * hw->wMotorDpi); + + DBG( _DBG_INFO2, ">>>> CURRENT MCLK_DIV= %u\n", mclk_div ); + DBG( _DBG_INFO2, ">>>> MCH = %u\n", mch ); + DBG( _DBG_INFO2, ">>>> FFS = %u\n", ffs ); + DBG( _DBG_INFO2, ">>>> FASTSPEED = %.3f (%.3f)\n", speed, + hw->dMaxMotorSpeed); + + /* disabled ? */ + if( hw->dHighSpeed == 0.0 ) { + min_ffs = 0xffff; + maxf = 0.0; + if( !stay ) + return SANE_TRUE; + + } else { + min_ffs = (u_short)(dwCrystalFrequency /((u_long)mclk_div * 32UL * + (u_long)mch * hw->dHighSpeed * hw->wMotorDpi)); + maxf = (ffs - min_ffs)/4; + if( maxf > 100.0 ) + maxf = 100.0; + if( maxf < 5.0 ) + maxf = 5.0; + } + DBG( _DBG_INFO2, ">>>> MIN_FFS = %u (%.3f)\n", min_ffs, maxf); gettimeofday( &start_time, NULL ); - dwTicks = start_time.tv_sec + to; - step = 1; - ffs = a_bRegs[0x48] * 256 + a_bRegs[0x49]; + step = 1; + retval = SANE_FALSE; - retval = SANE_FALSE; for(;;) { usleep( 1000 ); @@ -265,31 +301,41 @@ static SANE_Bool usb_WaitPos( Plustek_Device *dev, u_long to, SANE_Bool stay ) if( t2.tv_sec > dwTicks ) break; - fac = 100.0/step; - if((u_short)fac < ffs ) - ffs -= fac; - else - ffs = 0; - - if( ffs > clk->min_ffstep ) { - - if((int)fac > 25 ) - usleep( 150 * 1000 ); - - a_bRegs[0x48] = (u_char)((u_short)ffs >> 8); - a_bRegs[0x49] = (u_char)((u_short)ffs & 0xFF); - sanei_lm983x_write(dev->fd, 0x48, &a_bRegs[0x48], 2, SANE_TRUE); - } else { - - if( !stay ) { - retval = SANE_TRUE; - break; + if( min_ffs != 0xffff ) { + + fac = maxf/step; + if( ffs ) { + if((u_short)fac < ffs ) { + ffs -= fac; + if( ffs < min_ffs ) + ffs = min_ffs; + } else { + if(ffs != min_ffs ) + ffs = min_ffs; + else + ffs = 0; + } } - } - step++; + if( ffs >= min_ffs ) { + if((int)fac > 25 ) + usleep( 150 * 1000 ); + + a_bRegs[0x48] = (u_char)(ffs >> 8); + a_bRegs[0x49] = (u_char)(ffs & 0xFF); + sanei_lm983x_write(dev->fd, 0x48, &a_bRegs[0x48], 2, SANE_TRUE); + if(ffs == min_ffs ) + ffs = 0; + } else { + + if( !stay ) { + retval = SANE_TRUE; + break; + } + } + step++; + } } - DBG( _DBG_INFO2, "# FSS=%u (0x%04x) - %u steps\n", ffs, ffs, step ); return retval; } @@ -358,22 +404,11 @@ static SANE_Bool usb_ModuleMove( Plustek_Device *dev, usbio_WriteReg( dev->fd, 0x0a, 0 ); /* Compute fast feed step size, use equation 3 and equation 8 */ - if( bAction == MOVE_ToShading ) { + dMaxMoveSpeed = hw->dMaxMoveSpeed; - double dToShadingSpeed = 0.0; /* HEINER: check callRegistry.GetToShadingSpeed(); */ - - if( dToShadingSpeed != 0.0 ) - dMaxMoveSpeed = dToShadingSpeed; - else { - - if( hw->dMaxMoveSpeed > 0.5 ) - dMaxMoveSpeed = hw->dMaxMoveSpeed - 0.5; - else - dMaxMoveSpeed = hw->dMaxMoveSpeed; - } - } else { - - dMaxMoveSpeed = hw->dMaxMoveSpeed; + if( bAction == MOVE_ToShading ) { + if( hw->dMaxMoveSpeed > 0.5 ) + dMaxMoveSpeed = hw->dMaxMoveSpeed - 0.5; } clk = usb_GetMotorSet( hw->motorModel ); @@ -381,8 +416,8 @@ static SANE_Bool usb_ModuleMove( Plustek_Device *dev, mclk_div = clk->mclk_fast; wFastFeedStepSize = (u_short)(dwCrystalFrequency / - ((u_long)mclk_div * 8UL * 1 * - dMaxMoveSpeed * 4 * hw->wMotorDpi)); + ((u_long)mclk_div * 8UL * 1 * + dMaxMoveSpeed * 4 * hw->wMotorDpi)); a_bRegs[0x48] = (u_char)(wFastFeedStepSize >> 8); a_bRegs[0x49] = (u_char)(wFastFeedStepSize & 0xFF); @@ -515,11 +550,6 @@ static SANE_Bool usb_ModuleToHome( Plustek_Device *dev, SANE_Bool fWait ) usbio_WriteReg( dev->fd, 0x58, hw->bReg_0x58 ); usbio_ReadReg ( dev->fd, 2, &value ); - /* check current position... */ -#if 0 - _UIO(usbio_ReadReg( dev->fd, 2, &value )); -#endif - if( value & 1 ) { fModuleFirstHome = SANE_FALSE; return SANE_TRUE; @@ -540,13 +570,11 @@ static SANE_Bool usb_ModuleToHome( Plustek_Device *dev, SANE_Bool fWait ) if( hw->motorModel == MODEL_Tokyo600 ) { usbio_WriteReg( dev->fd, 0x07, 0 ); - } else { - + } else { _UIO( usbio_ResetLM983x( dev )); - usleep(200*1000); } - + if(!_IS_PLUSTEKMOTOR(hw->motorModel)) { pClkMotorDef clk; @@ -672,8 +700,8 @@ static SANE_Bool usb_ModuleToHome( Plustek_Device *dev, SANE_Bool fWait ) } wFastFeedStepSize = (WORD)(dwCrystalFrequency / (6UL * 8UL * 1 * Device.HwSetting.dMaxMotorSpeed * 4 * Device.HwSetting.wMotorDpi) * 60 / 78); - a_bRegs [0x48] = (BYTE)(wFastFeedStepSize >> 8); - a_bRegs [0x49] = (BYTE)(wFastFeedStepSize & 0xFF); + a_bRegs[0x48] = (u_char)(wFastFeedStepSize >> 8); + a_bRegs[0x49] = (u_char)(wFastFeedStepSize & 0xFF); WriteRegisters(0x48, &a_bRegs[0x48], 2); } #endif diff --git a/backend/plustek-usbscan.c b/backend/plustek-usbscan.c index 4e7247623..a2b526030 100644 --- a/backend/plustek-usbscan.c +++ b/backend/plustek-usbscan.c @@ -1082,8 +1082,6 @@ static SANE_Bool usb_SetScanParameters( Plustek_Device *dev, pScanParam pParam ) /* Assume we will not use ITA */ a_bRegs[0x19] = m_bIntTimeAdjust = 0; - /* Initiate variables */ - /* Get variables from calculation algorithms */ if(!(pParam->bCalibration == PARAM_Scan && pParam->bSource == SOURCE_ADF && fLastScanIsAdf )) { @@ -1101,8 +1099,8 @@ static SANE_Bool usb_SetScanParameters( Plustek_Device *dev, pScanParam pParam ) m_dMCLKDivider = 1.0; m_wFastFeedStepSize = (u_short)(dwCrystalFrequency / - (m_dMCLKDivider * 8 * m_bCM * hw->dMaxMoveSpeed * - 4 * hw->wMotorDpi)); + (m_dMCLKDivider * 8 * m_bCM * hw->dMaxMoveSpeed * + 4 * hw->wMotorDpi)); /* CIS special ;-) */ if((hw->bReg_0x26 & _ONE_CH_COLOR) && (m_bCM == 1)) { DBG( _DBG_INFO2, "* CIS FFStep-Speedup\n" ); @@ -1184,9 +1182,8 @@ static SANE_Bool usb_ScanBegin( Plustek_Device *dev, SANE_Bool auto_park ) { u_char value; u_short inches; - pHWDef hw = &dev->usbDev.HwSetting; - pDCapsDef sc = &dev->usbDev.Caps; - pClkMotorDef clk = usb_GetMotorSet( hw->motorModel ); + pHWDef hw = &dev->usbDev.HwSetting; + pDCapsDef sc = &dev->usbDev.Caps; DBG( _DBG_INFO, "usb_ScanBegin()\n" ); @@ -1252,7 +1249,7 @@ static SANE_Bool usb_ScanBegin( Plustek_Device *dev, SANE_Bool auto_park ) inches = (u_short)((m_pParam->Origin.y *300UL)/hw->wMotorDpi); DBG( _DBG_INFO2, ">>> INC=%u, DOY=%u\n", inches, sc->Normal.DataOrigin.y ); - if((inches > sc->Normal.DataOrigin.y ) && (clk->min_ffstep != 0xffff)) + if( inches > sc->Normal.DataOrigin.y ) usb_WaitPos( dev, 150, SANE_FALSE ); return SANE_TRUE; } @@ -1468,8 +1465,8 @@ static void usb_GetImageInfo( Plustek_Device *dev, pImgDef pInfo, pWinInfo pSize */ static void usb_SaveImageInfo( Plustek_Device *dev, pImgDef pInfo ) { - pHWDef hw = &dev->usbDev.HwSetting; - pScanParam pParam = &dev->scanning.sParam; + HWDef *hw = &dev->usbDev.HwSetting; + ScanParam *pParam = &dev->scanning.sParam; DBG( _DBG_INFO, "usb_SaveImageInfo()\n" );