~noskcaj/ubuntu/trusty/argyll/merge

« back to all changes in this revision

Viewing changes to spectro/i1pro_imp.c

  • Committer: Bazaar Package Importer
  • Author(s): Roland Mas
  • Date: 2010-01-05 14:49:38 UTC
  • mfrom: (1.1.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20100105144938-8b123qj3xabjehzs
Tags: 1.1.0~rc3-1
* New upstream pre-release.
* Moved udev rules file to /lib/udev/rules.d.

Show diffs side-by-side

added added

removed removed

Lines of Context:
66
66
#define ENABLE_NONVCAL  /* Enable saving calibration state between program runs in a file */
67
67
#define CALTOUT (24 * 60 * 60)  /* Calibration timeout in seconds */
68
68
#define MAXSCANTIME 15.0        /* MAximum scan time in seconds */
 
69
#define SW_THREAD_TIMEOUT       (10 * 60.0)     /* Switch read thread timeout */
69
70
 
70
71
#undef SELF_CONT                /* Use self contained spectral->XYZ, else use xicc */
71
72
#define SINGLE_READ             /* Use a single USB read for scan to eliminate latency issues. */
274
275
                }
275
276
 
276
277
                /* i1pro_terminate_switch() seems to fail on a rev A & Rev C ?? */
277
 
 
278
278
                if (m->th != NULL) {            /* Terminate switch monitor thread */
279
279
                        m->th_term = 1;                 /* Tell thread to exit on error */
280
280
                        i1pro_terminate_switch(p);
5677
5677
                                double we;
5678
5678
 
5679
5679
                                cwl = m->wl_short2 + (double)j * (m->wl_long2 - m->wl_short2)/(m->nwav2-1.0);
5680
 
                                rwl = wl - cwl;                 /* relative wavelgth to filter */
 
5680
                                rwl = wl - cwl;                 /* relative wavelength to filter */
5681
5681
 
5682
5682
                                if (fabs(w1 - cwl) > fshmax && fabs(w2 - cwl) > fshmax)
5683
5683
                                        continue;               /* Doesn't fall into this filter */
5731
5731
 
5732
5732
                                coeff2[j][m->mtx_nocoef2[j]].ix = i;
5733
5733
                                coeff2[j][m->mtx_nocoef2[j]++].we = we; 
5734
 
//printf("~1 filter %d, cwl %f, rwl %f, ix %d, we %f\n",j,cwl,rwl,i,we);
 
5734
//printf("~1 filter %d, cwl %f, rwl %f, ix %d, we %f, nocoefs %d\n",j,cwl,rwl,i,we,m->mtx_nocoef2[j]-1);
5735
5735
                        }
5736
5736
                }
5737
5737
 
6330
6330
                vals[i].sp.spec_n = 0;
6331
6331
                vals[i].duration = 0.0;
6332
6332
        
6333
 
                vals[i].sp.norm = 1.0;
6334
6333
                vals[i].sp.spec_n = nwl;
6335
6334
                vals[i].sp.spec_wl_short = wl_short;
6336
6335
                vals[i].sp.spec_wl_long = m->wl_long;
6339
6338
                        for (j = six, k = 0; j < m->nwav; j++, k++) {
6340
6339
                                vals[i].sp.spec[k] = specrd[i][j] * sms;
6341
6340
                        }
 
6341
                        vals[i].sp.norm = 1.0;
6342
6342
                } else {
6343
6343
                        for (j = six, k = 0; j < m->nwav; j++, k++) {
6344
6344
                                vals[i].sp.spec[k] = 100.0 * specrd[i][j] * sms;
6345
6345
                        }
 
6346
                        vals[i].sp.norm = 100.0;
6346
6347
                }
6347
6348
 
6348
6349
                /* Set the XYZ */
6353
6354
                } else {
6354
6355
                        conv->convert(conv, vals[i].XYZ, &vals[i].sp);
6355
6356
                        vals[i].XYZ_v = 1;
 
6357
                        vals[i].XYZ[0] *= 100.0;
 
6358
                        vals[i].XYZ[1] *= 100.0;
 
6359
                        vals[i].XYZ[2] *= 100.0;
6356
6360
                }
6357
6361
 
6358
6362
#else   /* SELF_CONT */
6381
6385
                        for (norm = 0.0, j = 0; j < 36; j++) {
6382
6386
                                norm += obsv[0][1][j] * illum_D50[j];
6383
6387
                        }
6384
 
                        norm = 100.0/norm;
 
6388
                        norm = 100.0/norm;              /* Return value is 0 .. 100 */
6385
6389
                        
6386
6390
                        for (k = 0; k < 3; k++)
6387
6391
                                vals[i].XYZ[k] = 0.0;
6726
6730
        i1proimp *m = (i1proimp *)p->m;
6727
6731
        DBG((dbgo,"Switch thread started\n"))
6728
6732
        for (nfailed = 0;nfailed < 5;) {
6729
 
                rv = i1pro_waitfor_switch_th(p, 600.0);
 
6733
                rv = i1pro_waitfor_switch_th(p, SW_THREAD_TIMEOUT);
6730
6734
                if (m->th_term)
6731
6735
                        break;
6732
6736
                if (rv == I1PRO_INT_BUTTONTIMEOUT) {