diff --git a/ChangeLog b/ChangeLog index 4571c8e0a..8edd07645 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2004-04-15 Marian Eichholz + + * backend/sm3600.h backend/sm3600-scanmtek.c + backend/sm3600-color.c backend/sm3600-gray.c + backend/sm3600-homerun.c: Many fixes for MacOS-X problems pointed + out by Mattias Ellert, thanks: Waiting longer for DoJog() command + completion, new function for transmitting the line gain correction + data with correct endianess, Chassis-Gray-Level lowered. + 2004-04-14 Karl Heinz Kremer * backend/epson.conf: Added "usb" entry for libusb diff --git a/backend/sm3600-color.c b/backend/sm3600-color.c index b128d39d1..9b4a17f13 100644 --- a/backend/sm3600-color.c +++ b/backend/sm3600-color.c @@ -271,23 +271,8 @@ TState StartScanColor(TInstance *this) UploadGammaTable(this,0x4000,this->agammaB); INST_ASSERT(); -#ifndef SM3600_NO_GAIN_CORRECTION - RegWrite(this,0x3D,1,0x0F | 0x80); /* 10XXXXXX : one offset table */ - RegWrite(this,0x3F,1,0x18); /* 16KB gain at 0x06000 */ - { - unsigned short uwGain[8192]; - int i,iOff; - - /* - Oopsi: correction data starts at the left of the scanning window! - */ - iOff=this->param.x/2+this->calibration.xMargin; - for (i=iOff; icalibration.achStripeY[i]<<4; - for (i=0; i<0x4000; i+=0x1000) - MemWriteArray(this,(0x6000+i)>>1,0x1000,(unsigned char*)&uwGain[i>>1]); - } -#endif + UploadGainCorrection(this); + INST_ASSERT(); /* enough for 1/100 inch sensor distance */ this->state.cBacklog=1+2*this->state.ySensorSkew; diff --git a/backend/sm3600-gray.c b/backend/sm3600-gray.c index 223384584..195258b9b 100644 --- a/backend/sm3600-gray.c +++ b/backend/sm3600-gray.c @@ -346,23 +346,8 @@ TState StartScanGray(TInstance *this) RegWrite(this,0x40,1,0x20); /* FIFO at 0x08000 */ UploadGammaTable(this,0,this->agammaY); INST_ASSERT(); -#ifndef SM3600_NO_GAIN_CORRECTION - RegWrite(this,0x3D,1,0x0F | 0x80); /* 10XXXXXX : one offset table */ - RegWrite(this,0x3F,1,0x08); /* 16KB gain at 0x02000 */ - { - unsigned short uwGain[8192]; - int i,iOff; - - /* - Oopsi: correction data starts at the left of the scanning window! - */ - iOff=this->param.x/2+this->calibration.xMargin; - for (i=iOff; icalibration.achStripeY[i]<<4; - for (i=0; i<0x4000; i+=0x1000) - MemWriteArray(this,(0x2000+i)>>1,0x1000,(unsigned char*)&uwGain[i>>1]); - } -#endif + UploadGainCorrection(this); + INST_ASSERT(); /* for halftone dithering we need one history line */ this->state.pchBuf=malloc(USB_CHUNK_SIZE); diff --git a/backend/sm3600-homerun.c b/backend/sm3600-homerun.c index 321238791..fe647efe6 100644 --- a/backend/sm3600-homerun.c +++ b/backend/sm3600-homerun.c @@ -56,9 +56,11 @@ slider movement /* tuning constants for DoOriginate */ #define CCH_BONSAI 60 #define BLACK_HOLE_GRAY 30 -#define CHASSIS_GRAY_LEVEL 100 #define BLACK_BED_LEVEL 10 +/* changed by user request from 100, there are probably darker stripes */ +#define CHASSIS_GRAY_LEVEL 75 + typedef enum { ltHome, ltUnknown, ltBed, ltError } TLineType; #define INST_ASSERT2() { if (this->nErrorState) return ltError; } @@ -492,6 +494,6 @@ TState DoJog(TInstance *this, int nDistance) } INST_ASSERT(); usleep(100); - return WaitWhileBusy(this,100); + return WaitWhileBusy(this,1000); /* thanks Mattias Ellert */ } diff --git a/backend/sm3600-scanmtek.c b/backend/sm3600-scanmtek.c index e0fd316b7..5297efabc 100644 --- a/backend/sm3600-scanmtek.c +++ b/backend/sm3600-scanmtek.c @@ -272,3 +272,41 @@ TState UploadGammaTable(TInstance *this, int iByteAddress, SANE_Int *pnGamma) free(puchGamma); return rc; } + +/* ********************************************************************** + +UploadGainCorrection() + +********************************************************************** */ + +__SM3600EXPORT__ +TState UploadGainCorrection(TInstance *this) +{ +#ifndef SM3600_NO_GAIN_CORRECTION + RegWrite(this,0x3D,1,0x0F | 0x80); /* 10XXXXXX : one offset table */ + RegWrite(this,0x3F,1,0x18); /* 16KB gain at 0x06000 */ + { + struct TGain { + unsigned char uchLow; + unsigned char uchHigh; + } aGain[8192]; + int i,iOff; + unsigned short uwGain; + + /* + Oopsi: correction data starts at the left of the scanning window! + */ + iOff=this->param.x/2+this->calibration.xMargin; + memset(aGain,0,sizeof(aGain)); + for (i=iOff; icalibration.achStripeY[i]<<4; + aGain[i-iOff].uchLow =(unsigned char)(uwGain&0xFF); + aGain[i-iOff].uchHigh=(unsigned char)(uwGain>>8); + } + for (i=0; i<0x2000; i+=0x1000) + MemWriteArray(this,(0x6000+i)>>1,0x1000,(unsigned char*)(aGain+i)); + } +#endif + return SANE_STATUS_GOOD; +} diff --git a/backend/sm3600.c b/backend/sm3600.c index e8c9de7dc..70cbb3910 100644 --- a/backend/sm3600.c +++ b/backend/sm3600.c @@ -683,7 +683,7 @@ sane_get_parameters (SANE_Handle handle, SANE_Parameters *p) GetAreaSize(this); p->pixels_per_line=this->state.cxPixel; /* TODO: we need a more stable cyPixel prediction */ - p->lines=this->state.cyPixel+1; + p->lines=this->state.cyPixel; p->last_frame=SANE_TRUE; switch (this->mode) { diff --git a/backend/sm3600.h b/backend/sm3600.h index 0dd8a6a38..1dec46805 100644 --- a/backend/sm3600.h +++ b/backend/sm3600.h @@ -283,6 +283,7 @@ __SM3600EXPORT__ TState DoLampSwitch(TInstance *this,int nPattern); #endif __SM3600EXPORT__ TState DoCalibration(TInstance *this); __SM3600EXPORT__ TState UploadGammaTable(TInstance *this, int iByteAddress, SANE_Int *pnGamma); +__SM3600EXPORT__ TState UploadGainCorrection(TInstance *this); /* sm3600-scanusb.c */ __SM3600EXPORT__ TState RegWrite(TInstance *this,int iRegister, int cb, unsigned long ulValue);