[argyllcms] [Possible bug in Spyd2.c] Inconsistant readings from Spyder3

Hello again!

As I wrote in the last post I have found a possible bug in Spyd2.c.
Spyder3 has problems with reading a very dark patch and can sometimes
return garbage:
To confirm the bug try reading a completely black patch a few (10?)
times with spotread and you will see that the results are something
like (for X axis):0.2, 0.19,0.2, 0.17 [so far OK], 0.01 [Stupid reading!],
0.2, 0.19 [etc.]. The problem is IMHO caused by too small reading time in 
spyd2.c. When I
added (file: Spyd2.c):

                if (i > 0)
                        break;                  /* Done adaptive */
                /* Decide whether to go around again */
                /* --- BEGIN CHANGE --- */
                if (bxyz < 1.0) {
                        nframes *= 16;
                        if (p->debug) fprintf(stderr,"Integration time is 16 
times longer\n");
                } else
                /* --- END CHANGE ---/*
                if (bxyz < 5.0) {
                        nframes *= 2;                                 /* 
Tripple total intergration time */
                        if (p->debug) fprintf(stderr,"Tripling integration 
                } else if (bxyz < 10.0) {
                        nframes *= 1;                                 /* Double 
total intergration time */
                        if (p->debug) fprintf(stderr,"Doubling integration 
                } else if (bxyz < 20.0) {
                        nframes = ((nframes * 1))/2;          /* 1.5 times 
intergration time */
                        if (p->debug) fprintf(stderr,"Extra 50%% integration 
                } else {
                        break;                  /* No need for another readign 
#else /* !DO_ADAPTIVE */
                fprintf(stderr,"!!!! Spyder 2 DO_ADAPTIVE is off !!!!\n");
#endif /* !DO_ADAPTIVE */

the problem seems to disappear and readings seem to be slightly

Could anyone test the current implementation? Is it possible to add
the test to detect such readings (e.g. by reading the same patch twice
and discarding both results if the difference is too large) and redo
the measurement (returning an average of 2 readings to increase

The problem manifests itself only for very dark patches (or at least I
was unable to reproduce it for lighter ones).

Other related posts: