diff options
Diffstat (limited to 'spectro')
37 files changed, 107 insertions, 918 deletions
diff --git a/spectro/aglob.c b/spectro/aglob.c index dbf9157..2ba37d5 100644 --- a/spectro/aglob.c +++ b/spectro/aglob.c @@ -42,7 +42,6 @@ # include <pthread.h> #endif -#include <ctype.h> #include <sys/types.h> #include <sys/stat.h> #include <stdio.h> diff --git a/spectro/ccxxmake.c b/spectro/ccxxmake.c index 418affc..4202c67 100644 --- a/spectro/ccxxmake.c +++ b/spectro/ccxxmake.c @@ -27,9 +27,6 @@ /* TTBD: - Would be nice to have a way of not changing the target - instruments absolute calibration. - Would be nice to have a veryify option that produces a fit report of a matrix vs. the input files. @@ -37,7 +34,7 @@ (See post from umberto.guidali@tiscali.it) Would be nice to be able to use an i1D3 to correct other instruments, - or an i1D3 created .ti3 as the reference. (can do this with .ti3 files). + or an i1D3 created .ti3 as the reference. Would be nice to have an option of providing two ICC profiles, instead of using .ti3 files (?? How well would it work though ?) diff --git a/spectro/chartread.c b/spectro/chartread.c index 9cf6c22..0fc7646 100644 --- a/spectro/chartread.c +++ b/spectro/chartread.c @@ -198,7 +198,6 @@ alphix *paix, /* Pass (row) index generators */ alphix *saix, /* Step (patch) index generators */ int ixord, /* Index order, 0 = pass then step */ int rstart, /* Random start/chart id */ -int rand, /* Random order used - can do auto strip ID & Bi-Dir */ int hex, /* Hexagon test patches */ icompath *ipath, /* Instrument path to open */ flow_control fc, /* flow control */ @@ -1390,7 +1389,7 @@ a1log *log /* verb, debug & error log */ int xbdir; /* Expected pass overall pass direction */ double xwerror = 0.0; /* Expected pass worst error in best strip */ - if (rand && disbidi == 0 && (cap2 & inst2_bidi_scan)) + if (disbidi == 0 && (cap2 & inst2_bidi_scan)) dirrg = 2; /* Enable bi-directional strip recognition */ /* DTP51 has a nasty habit of misaligning test squares by +/- 1 */ @@ -1464,7 +1463,7 @@ a1log *log /* verb, debug & error log */ } } } - if (emit_warnings != 0 && rand && boroi != oroi) { /* Looks like the wrong strip */ + if (emit_warnings != 0 && boroi != oroi) { /* Looks like the wrong strip */ char *mm = NULL; mm = paix->aix(paix, boroi); #ifdef DEBUG @@ -2111,7 +2110,6 @@ int main(int argc, char *argv[]) { alphix *paix, *saix; /* Pass and Step index generators */ int ixord = 0; /* Index order, 0 = pass then step */ int rstart = 0; /* Random start/chart id */ - int rand = 0; /* Random patch order, - can use auto strip ID and Bi-Di */ int hex = 0; /* Hexagon pattern layout */ time_t clk = time(0); struct tm *tsp = localtime(&clk); @@ -2474,13 +2472,10 @@ int main(int argc, char *argv[]) { ixord = 1; } - if ((ti = icg->find_kword(icg, 0, "RANDOM_START")) >= 0) { + if ((ti = icg->find_kword(icg, 0, "RANDOM_START")) >= 0) rstart = atoi(icg->t[0].kdata[ti]); - rand = 1; - } else if ((ti = icg->find_kword(icg, 0, "CHART_ID")) >= 0) { + else if ((ti = icg->find_kword(icg, 0, "CHART_ID")) >= 0) rstart = atoi(icg->t[0].kdata[ti]); - rand = 0; - } if ((ti = icg->find_kword(icg, 0, "HEXAGON_PATCHES")) >= 0) hex = 1; @@ -2508,10 +2503,6 @@ int main(int argc, char *argv[]) { tlen = atof(icg->t[0].kdata[ti]); } - if (itype != instDTP20 && !rand && disbidi == 0) { - warning("Can't do bi-directional strip recognition without randomize patch locations"); - } - if (verb) { printf("Steps in each Pass = %d\n",stipa); printf("Passes in each Strip = "); @@ -2847,7 +2838,7 @@ int main(int argc, char *argv[]) { /* Read all of the strips in */ if (read_strips(itype, scols, &atype, npat, totpa, stipa, pis, paix, - saix, ixord, rstart, rand, hex, ipath, fc, plen, glen, tlen, + saix, ixord, rstart, hex, ipath, fc, plen, glen, tlen, trans, emis, displ, dtype, fe, nocal, disbidi, highres, ccxxname, obType, scan_tol, pbypatch, xtern, spectral, uvmode, accurate_expd, emit_warnings, g_log) == 0) { diff --git a/spectro/colorhug.c b/spectro/colorhug.c index 7397314..1b2a56d 100644 --- a/spectro/colorhug.c +++ b/spectro/colorhug.c @@ -825,7 +825,6 @@ colorhug_del(inst *pp) { if (p->icom != NULL) p->icom->del(p->icom); inst_del_disptype_list(p->dtlist, p->ndtlist); - p->vdel(pp); free(p); } } diff --git a/spectro/conv.c b/spectro/conv.c index 94023db..1a8c78b 100644 --- a/spectro/conv.c +++ b/spectro/conv.c @@ -68,7 +68,6 @@ //#include <stdbool.h> #include <sys/sysctl.h> #include <sys/param.h> -#include <Carbon/Carbon.h> #include <CoreFoundation/CoreFoundation.h> #include <IOKit/IOKitLib.h> #include <IOKit/serial/IOSerialKeys.h> @@ -264,14 +263,12 @@ static int beep_msec; /* Delayed beep handler */ static int delayed_beep(void *pp) { msec_sleep(beep_delay); - a1logd(g_log,8, "msec_beep activate\n"); Beep(beep_freq, beep_msec); return 0; } /* Activate the system beeper */ void msec_beep(int delay, int freq, int msec) { - a1logd(g_log,8, "msec_beep %d msec\n",msec); if (delay > 0) { if (beep_thread != NULL) beep_thread->del(beep_thread); @@ -281,7 +278,6 @@ void msec_beep(int delay, int freq, int msec) { if ((beep_thread = new_athread(delayed_beep, NULL)) == NULL) a1logw(g_log, "msec_beep: Delayed beep failed to create thread\n"); } else { - a1logd(g_log,8, "msec_beep activate\n"); Beep(freq, msec); } } @@ -553,8 +549,6 @@ void empty_con_chars(void) { } /* Sleep for the given number of msec */ -/* (Note that OS X 10.9+ App Nap can wreck this, unless */ -/* it is turned off.) */ void msec_sleep(unsigned int msec) { #ifdef NEVER if (msec > 1000) { @@ -785,7 +779,6 @@ static int beep_msec; /* Delayed beep handler */ static int delayed_beep(void *pp) { msec_sleep(beep_delay); - a1logd(g_log,8, "msec_beep activate\n"); #ifdef __APPLE__ # if __MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 AudioServicesPlayAlertSound(kUserPreferredAlert); @@ -801,7 +794,6 @@ static int delayed_beep(void *pp) { /* Activate the system beeper */ void msec_beep(int delay, int freq, int msec) { - a1logd(g_log,8, "msec_beep %d msec\n",msec); if (delay > 0) { if (beep_thread != NULL) beep_thread->del(beep_thread); @@ -811,7 +803,6 @@ void msec_beep(int delay, int freq, int msec) { if ((beep_thread = new_athread(delayed_beep, NULL)) == NULL) a1logw(g_log, "msec_beep: Delayed beep failed to create thread\n"); } else { - a1logd(g_log,8, "msec_beep activate\n"); #ifdef __APPLE__ # if __MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 AudioServicesPlayAlertSound(kUserPreferredAlert); diff --git a/spectro/dispwin.c b/spectro/dispwin.c index fffbaee..69536f3 100644 --- a/spectro/dispwin.c +++ b/spectro/dispwin.c @@ -3624,9 +3624,6 @@ static void create_my_win(NSRect rect, osx_cntx_t *cx) { [cx->view setCntx:(void *)cx]; [cx->window setContentView: cx->view]; - /* Moves the window to the front of the screen list within its level, */ - /* and show the window (i.e. make it "key") */ - /* Trigger crash on OS X 10.11 El Capitan ? */ [cx->window makeKeyAndOrderFront: nil]; /* Use a null color transform to ensure device values */ @@ -6454,7 +6451,7 @@ main(int argc, char *argv[]) { /* Try darkening it */ for (j = 0; j < 3; j++) { for (i = 0; i < dw->r->nent; i++) { - dw->r->v[j][i] = pow(dw->or->v[j][i], 1.6); + dw->r->v[j][i] = pow(dw->or->v[j][i], 2.0); } } printf("Darkening screen\n"); @@ -6467,7 +6464,7 @@ main(int argc, char *argv[]) { /* Try lightening it */ for (j = 0; j < 3; j++) { for (i = 0; i < dw->r->nent; i++) { - dw->r->v[j][i] = pow(dw->or->v[j][i], 0.625); + dw->r->v[j][i] = pow(dw->or->v[j][i], 0.5); } } printf("Lightening screen\n"); diff --git a/spectro/dtp20.c b/spectro/dtp20.c index 6af2484..a504803 100644 --- a/spectro/dtp20.c +++ b/spectro/dtp20.c @@ -217,7 +217,7 @@ double top) { /* Timout in seconds */ } /* Establish communications with a DTP20 */ -/* Return DTP20_COMS_FAIL on failure to establish communications */ +/* Return DTP_COMS_FAIL on failure to establish communications */ static inst_code dtp20_init_coms(inst *pp, baud_rate br, flow_control fc, double tout) { dtp20 *p = (dtp20 *)pp; @@ -1402,8 +1402,7 @@ dtp20_del(inst *pp) { dtp20 *p = (dtp20 *)pp; if (p->icom != NULL) p->icom->del(p->icom); - p->vdel(pp); - free(p); + free (p); } /* Set the instrument capabilities */ diff --git a/spectro/dtp22.c b/spectro/dtp22.c index 2cb3634..d332ffc 100644 --- a/spectro/dtp22.c +++ b/spectro/dtp22.c @@ -164,7 +164,7 @@ dtp22_command(dtp22 *p, char *in, char *out, int bsize, double to) { /* Establish communications with a DTP22 */ /* If it's a serial port, use the baud rate given, and timeout in to secs */ -/* Return DTP22_COMS_FAIL on failure to establish communications */ +/* Return DTP_COMS_FAIL on failure to establish communications */ static inst_code dtp22_init_coms(inst *pp, baud_rate br, flow_control fc, double tout) { dtp22 *p = (dtp22 *) pp; @@ -930,7 +930,6 @@ dtp22_del(inst *pp) { dtp22 *p = (dtp22 *)pp; if (p->icom != NULL) p->icom->del(p->icom); - p->vdel(pp); free(p); } diff --git a/spectro/dtp41.c b/spectro/dtp41.c index 44ac6c6..5c3361c 100644 --- a/spectro/dtp41.c +++ b/spectro/dtp41.c @@ -145,7 +145,7 @@ dtp41_command(dtp41 *p, char *in, char *out, int bsize, double to) { /* Establish communications with a DTP41 */ /* Use the baud rate given, and timeout in to secs */ -/* Return DTP41_COMS_FAIL on failure to establish communications */ +/* Return DTP_COMS_FAIL on failure to establish communications */ static inst_code dtp41_init_coms(inst *pp, baud_rate br, flow_control fc, double tout) { dtp41 *p = (dtp41 *)pp; @@ -1085,8 +1085,7 @@ dtp41_del(inst *pp) { dtp41 *p = (dtp41 *)pp; if (p->icom != NULL) p->icom->del(p->icom); - p->vdel(pp); - free(p); + free (p); } /* Interogate the device to discover its capabilities */ diff --git a/spectro/dtp51.c b/spectro/dtp51.c index ab1999d..cfd1265 100644 --- a/spectro/dtp51.c +++ b/spectro/dtp51.c @@ -180,7 +180,7 @@ double to) { /* Timout in seconts */ /* Establish communications with a DTP51 */ /* Use the baud rate given, and timeout in to secs */ -/* Return DTP51_COMS_FAIL on failure to establish communications */ +/* Return DTP_COMS_FAIL on failure to establish communications */ static inst_code dtp51_init_coms(inst *pp, baud_rate br, flow_control fc, double tout) { dtp51 *p = (dtp51 *)pp; @@ -787,7 +787,6 @@ dtp51_del(inst *pp) { dtp51 *p = (dtp51 *)pp; if (p->icom != NULL) p->icom->del(p->icom); - p->vdel(pp); free(p); } diff --git a/spectro/dtp92.c b/spectro/dtp92.c index 3b6dacd..1ed9bc1 100644 --- a/spectro/dtp92.c +++ b/spectro/dtp92.c @@ -169,7 +169,7 @@ dtp92_command(dtp92 *p, char *in, char *out, int bsize, double to) { /* Establish communications with a DTP92 */ /* If it's a serial port, use the baud rate given, and timeout in to secs */ -/* Return DTP92_COMS_FAIL on failure to establish communications */ +/* Return DTP_COMS_FAIL on failure to establish communications */ static inst_code dtp92_init_coms(inst *pp, baud_rate br, flow_control fc, double tout) { dtp92 *p = (dtp92 *) pp; @@ -1023,7 +1023,6 @@ dtp92_del(inst *pp) { if (p->icom != NULL) p->icom->del(p->icom); inst_del_disptype_list(p->dtlist, p->ndtlist); - p->vdel(pp); free(p); } diff --git a/spectro/ex1.c b/spectro/ex1.c index b336cbc..93d0a31 100644 --- a/spectro/ex1.c +++ b/spectro/ex1.c @@ -147,10 +147,6 @@ static int ex1_set_boxcar(ex1 *p, int nobox); static int ex1_measure(ex1 *p, double *raw); -static int ex1_save_calibration(ex1 *p); -static int ex1_restore_calibration(ex1 *p); -static int ex1_touch_calibration(ex1 *p); - /* ----------------------------------------------------------------- */ /* Establish communications with a ex1 */ @@ -1042,7 +1038,6 @@ ex1_del(inst *pp) { if (p->conv != NULL) p->conv->del(p->conv); - p->vdel(pp); free(p); } } @@ -1239,7 +1234,7 @@ extern ex1 *new_ex1(icoms *icom, instType itype) { /* =============================================================================== */ /* Calibration info save/restore */ -static int ex1_save_calibration(ex1 *p) { +int ex1_save_calibration(ex1 *p) { int ev = EX1_OK; int i; char fname[100]; /* Name */ @@ -1285,7 +1280,7 @@ static int ex1_save_calibration(ex1 *p) { } /* Restore the all modes calibration from the local system */ -static int ex1_restore_calibration(ex1 *p) { +int ex1_restore_calibration(ex1 *p) { int ev = EX1_OK; int i, j; char fname[100]; /* Name */ @@ -1358,7 +1353,7 @@ static int ex1_restore_calibration(ex1 *p) { return ev; } -static int ex1_touch_calibration(ex1 *p) { +int ex1_touch_calibration(ex1 *p) { int ev = EX1_OK; char fname[100]; /* Name */ int rv; diff --git a/spectro/hcfr.c b/spectro/hcfr.c index a6c457e..d0a8261 100644 --- a/spectro/hcfr.c +++ b/spectro/hcfr.c @@ -637,7 +637,6 @@ hcfr_del(inst *pp) { if (p->icom != NULL) p->icom->del(p->icom); inst_del_disptype_list(p->dtlist, p->ndtlist); - p->vdel(pp); free(p); } diff --git a/spectro/huey.c b/spectro/huey.c index b09ed2c..79f8089 100644 --- a/spectro/huey.c +++ b/spectro/huey.c @@ -159,7 +159,7 @@ static char *inst_desc(int cc) { /* The Huey is set up as an HID device, which can ease the need */ /* for providing a kernel driver on MSWindows systems, */ /* but it doesn't seem to actually be used as an HID device. */ -/* We allow for communicating via usbio, or an HID driver. */ +/* We allow for communicating via libusb, or an HID driver. */ static inst_code huey_command( huey *p, /* huey object */ @@ -1026,7 +1026,7 @@ static inst_code set_default_disp_type(huey *p); /* Establish communications with a HUEY */ /* If it's a serial port, use the baud rate given, and timeout in to secs */ -/* Return HUEY_COMS_FAIL on failure to establish communications */ +/* Return DTP_COMS_FAIL on failure to establish communications */ static inst_code huey_init_coms(inst *pp, baud_rate br, flow_control fc, double tout) { huey *p = (huey *) pp; @@ -1400,7 +1400,6 @@ huey_del(inst *pp) { if (p->icom != NULL) p->icom->del(p->icom); inst_del_disptype_list(p->dtlist, p->ndtlist); - p->vdel(pp); free(p); } diff --git a/spectro/i1d3.c b/spectro/i1d3.c index df7d3f0..689f328 100644 --- a/spectro/i1d3.c +++ b/spectro/i1d3.c @@ -34,10 +34,6 @@ and agreed to support. */ -/* TTBD: - -*/ - #include <stdio.h> #include <stdlib.h> #include <ctype.h> @@ -74,8 +70,6 @@ #define I1D3_MEAS_TIMEOUT 40.0 /* Longest reading timeout in seconds */ /* Typically 20.0 is the maximum needed. */ -#define I1D3_SAT_FREQ 100000.0 /* L2F sensor frequency limit */ - static inst_code i1d3_interp_code(inst *pp, int ec); static inst_code i1d3_check_unlock(i1d3 *p); @@ -111,12 +105,6 @@ static int icoms2i1d3_err(int se, int torc) { /* and byte 1 is the sub code for command 0x00 . The response is byte 0 */ /* error code, byte 1 echoing the major command number. */ /* Major code 00 works when locked ? */ -/* Response codes: - - 00 OK - 83 After pulse count measure in low light. Means ??? - - */ typedef enum { i1d3_getinfo = 0x0000, /* Product name + Firmware version + Firmware Date string */ i1d3_status = 0x0001, /* status number ?? */ @@ -186,7 +174,7 @@ static char *inst_desc(i1Disp3CC cc) { /* The i1d3 is set up as an HID device, which can ease the need */ /* for providing a kernel driver on MSWindows systems, */ /* but it doesn't seem to actually be used as an HID device. */ -/* We allow for communicating via usbio, or an HID driver. */ +/* We allow for communicating via libusb, or an HID driver. */ static inst_code i1d3_command( i1d3 *p, /* i1d3 object */ @@ -277,21 +265,6 @@ i1d3_command( rv = i1d3_interp_code((inst *)p, I1D3_BAD_RD_LENGTH); } - /* Hmm. Not sure about this bug workaround. Is this a rev B thing ? */ - /* May get status 0x83 on i1d3_measure2 when there are no transitions ? */ - /* If so, ignore the error. */ - if (rv == inst_ok && cc == i1d3_measure2 && recv[1] == 0x02 && recv[0] == 0x83) { - int i; - for (i = 2; i < 14; i++) { - if (recv[i] != 0) - break; - } - if (i >= 14) { /* returned all zero's */ - if (!nd) a1logd(p->log, 1, "i1d3_command: ignoring status byte = 0x%x\n",recv[0]); - recv[0] = 0x00; /* Fudge OK status */ - } - } - /* The first byte returned seems to be a command result error code. */ if (rv == inst_ok && recv[0] != 0x00) { if (!nd) a1logd(p->log, 1, "i1d3_command: status byte != 00 = 0x%x\n",recv[0]); @@ -783,7 +756,7 @@ static inst_code i1d3_freq_measure( i1d3 *p, /* Object */ double *inttime, /* Integration time in seconds. (Return clock rounded) */ - double rgb[3] /* Return the RGB count values */ + double rgb[3] /* Return the RGB values */ ) { int intclks; unsigned char todev[64]; @@ -1595,11 +1568,6 @@ i1d3_take_emis_measurement( } a1logd(p->log,3,"Got %f %f %f raw, %f %f %f Hz\n",rmeas[0],rmeas[1],rmeas[2],rgb[0],rgb[1],rgb[2]); - - for (i = 0; i < 3; i++) { - if (rgb[i] > I1D3_SAT_FREQ) - return i1d3_interp_code((inst *)p, I1D3_TOOBRIGHT); - } } /* If some period measurement will be done */ @@ -1895,11 +1863,6 @@ i1d3_take_emis_measurement( a1logd(p->log,3,"Got %f %f %f raw, %f %f %f Hz after re-measure\n",rmeas[0],rmeas[1],rmeas[2],rgb[0],rgb[1],rgb[2]); - for (i = 0; i < 3; i++) { - if (rgb[i] > I1D3_SAT_FREQ) - return i1d3_interp_code((inst *)p, I1D3_TOOBRIGHT); - } - } else { /* Use period measurement of the target number of edges */ /* (Note that if the patch isn't constant and drops compared to */ @@ -1944,11 +1907,6 @@ i1d3_take_emis_measurement( } a1logd(p->log,3,"Cooked RGB = %f %f %f\n",rgb[0],rgb[1],rgb[2]); - - for (i = 0; i < 3; i++) { - if (rgb[i] > I1D3_SAT_FREQ) - return i1d3_interp_code((inst *)p, I1D3_TOOBRIGHT); - } return inst_ok; } @@ -2025,7 +1983,7 @@ static inst_code i1d3_decode_intEE( p->serial_no[20] = '\000'; strncpy(p->vers_no, (char *)buf + 0x2C, 10); - p->vers_no[10] = '\000'; + p->serial_no[10] = '\000'; /* Read the black level offset */ for (i = 0; i < 3; i++) { @@ -2437,7 +2395,7 @@ i1d3_set_cal(i1d3 *p) { /* ------------------------------------------------------------------------ */ /* Establish communications with a I1D3 */ -/* Return I1D3_COMS_FAIL on failure to establish communications */ +/* Return DTP_COMS_FAIL on failure to establish communications */ static inst_code i1d3_init_coms(inst *pp, baud_rate br, flow_control fc, double tout) { i1d3 *p = (i1d3 *) pp; @@ -3329,9 +3287,6 @@ i1d3_interp_error(inst *pp, int ec) { case I1D3_INT_THREADFAILED: return "Starting diffuser position thread failed"; - case I1D3_TOOBRIGHT: - return "Too bright to read accuractly"; - case I1D3_NO_COMS: return "Communications hasn't been established";; case I1D3_NOT_INITED: @@ -3400,13 +3355,11 @@ i1d3_interp_code(inst *pp, int ec) { case I1D3_BAD_EX_CHSUM: return inst_hardware_fail | ec; - case I1D3_TOOBRIGHT: - return inst_misread | ec; - /* Unused: inst_notify inst_warning inst_unknown_model + inst_misread inst_nonesaved inst_nochmatch inst_needs_cal @@ -3458,7 +3411,6 @@ i1d3_del(inst *pp) { if (p->samples != NULL) free(p->samples); amutex_del(p->lock); - p->vdel(pp); free(p); } } diff --git a/spectro/i1d3.h b/spectro/i1d3.h index bb239df..47f3858 100644 --- a/spectro/i1d3.h +++ b/spectro/i1d3.h @@ -63,7 +63,6 @@ #define I1D3_BAD_RET_STAT 0x13 #define I1D3_BAD_RET_CMD 0x14 #define I1D3_NOT_INITED 0x15 -#define I1D3_TOOBRIGHT 0x16 /* Internal errors */ #define I1D3_BAD_MEM_ADDRESS 0x20 diff --git a/spectro/i1disp.c b/spectro/i1disp.c index 489c6cd..437e1fa 100644 --- a/spectro/i1disp.c +++ b/spectro/i1disp.c @@ -1737,7 +1737,7 @@ i1disp_compute_factors( /* Establish communications with a I1DISP */ /* If it's a serial port, use the baud rate given, and timeout in to secs */ -/* Return I1DISP_COMS_FAIL on failure to establish communications */ +/* Return DTP_COMS_FAIL on failure to establish communications */ static inst_code i1disp_init_coms(inst *pp, baud_rate br, flow_control fc, double tout) { i1disp *p = (i1disp *) pp; @@ -2240,7 +2240,6 @@ i1disp_del(inst *pp) { if (p->icom != NULL) p->icom->del(p->icom); inst_del_disptype_list(p->dtlist, p->ndtlist); - p->vdel(pp); free(p); } diff --git a/spectro/i1pro.c b/spectro/i1pro.c index 816aee5..96335cc 100644 --- a/spectro/i1pro.c +++ b/spectro/i1pro.c @@ -79,7 +79,7 @@ static inst_code i1pro_interp_code(i1pro *p, i1pro_code ec); /* Establish communications with a I1DISP */ /* If it's a serial port, use the baud rate given, and timeout in to secs */ -/* Return I1PRO_COMS_FAIL on failure to establish communications */ +/* Return DTP_COMS_FAIL on failure to establish communications */ static inst_code i1pro_init_coms(inst *pp, baud_rate br, flow_control fc, double tout) { i1pro *p = (i1pro *) pp; @@ -806,7 +806,6 @@ i1pro_del(inst *pp) { del_i1proimp(p); if (p->icom != NULL) p->icom->del(p->icom); - p->vdel(pp); free(p); } diff --git a/spectro/i1pro_imp.c b/spectro/i1pro_imp.c index 8577f8c..0b6fc69 100644 --- a/spectro/i1pro_imp.c +++ b/spectro/i1pro_imp.c @@ -149,8 +149,6 @@ /* Should be good up to 275 cd/m^2 */ #define DISP_INTT3 0.3 /* High brightness display spot mode seconds per reading, */ /* Should be good up to 700 cd/m^2 */ -#define DISP_INTT4 0.1 /* Very high brightness display spot mode seconds per reading, */ - /* Should be good up to 2000 cd/m^2 ? */ #define ADARKINT_MAX 2.0 /* Max cal time for adaptive dark cal */ #define ADARKINT_MAX2 4.0 /* Max cal time for adaptive dark cal Rev E or no high gain */ @@ -400,7 +398,6 @@ void del_i1proimp(i1pro *p) { free_dvector(s->dark_data, -1, m->nraw-1); free_dvector(s->dark_data2, -1, m->nraw-1); free_dvector(s->dark_data3, -1, m->nraw-1); - free_dvector(s->dark_data4, -1, m->nraw-1); free_dvector(s->white_data, -1, m->nraw-1); free_dmatrix(s->idark_data, 0, 3, -1, m->nraw-1); @@ -961,7 +958,6 @@ i1pro_code i1pro_imp_init(i1pro *p) { s->dark_data = dvectorz(-1, m->nraw-1); s->dark_data2 = dvectorz(-1, m->nraw-1); s->dark_data3 = dvectorz(-1, m->nraw-1); - s->dark_data4 = dvectorz(-1, m->nraw-1); s->cal_valid = 0; /* Scale cal invalid */ s->cal_factor[0] = dvectorz(0, m->nwav[0]-1); @@ -976,7 +972,6 @@ i1pro_code i1pro_imp_init(i1pro *p) { s->dark_int_time = DISP_INTT; /* 2.0 */ s->dark_int_time2 = DISP_INTT2; /* 0.8 */ s->dark_int_time3 = DISP_INTT3; /* 0.3 */ - s->dark_int_time4 = DISP_INTT4; /* 0.1 */ s->idark_int_time[0] = s->idark_int_time[2] = m->min_int_time; if (p->itype == instI1Pro2) { @@ -1062,14 +1057,12 @@ i1pro_code i1pro_imp_init(i1pro *p) { s->dark_int_time = s->inttime; s->dark_int_time2 = DISP_INTT2; /* Alternate disp integration time (ie. 0.8) */ s->dark_int_time3 = DISP_INTT3; /* Alternate disp integration time (ie. 0.3) */ - s->dark_int_time4 = DISP_INTT4; /* Alternate disp integration time (ie. 0.1) */ s->dadaptime = 0.0; s->wadaptime = 0.10; s->dcaltime = DISP_INTT; /* ie. determines number of measurements */ s->dcaltime2 = DISP_INTT2 * 2; /* Make it 1.6 seconds (ie, 2 x 0.8 seconds) */ s->dcaltime3 = DISP_INTT3 * 3; /* Make it 0.9 seconds (ie, 3 x 0.3 seconds) */ - s->dcaltime4 = DISP_INTT4 * 3; /* Make it 0.3 seconds (ie, 3 x 0.1 seconds) */ s->wcaltime = 0.0; s->dreadtime = 0.0; s->wreadtime = DISP_INTT; @@ -1627,10 +1620,10 @@ i1pro_code i1pro_imp_calibrate( || (s->emiss && !s->adaptive && !s->scan) || (s->trans && !s->adaptive))) { int stm; - int usesdct234 = 0; /* Is a mode that uses dcaltime2, 3 & 4 */ + int usesdct23 = 0; /* Is a mode that uses dcaltime2 & 3 */ if (s->emiss && !s->adaptive && !s->scan) - usesdct234 = 1; + usesdct23 = 1; nummeas = i1pro_comp_nummeas(p, s->dcaltime, s->inttime); @@ -1644,7 +1637,7 @@ i1pro_code i1pro_imp_calibrate( a1logd(p->log,2,"Execution time of dark calib time %f sec = %d msec\n",s->inttime,msec_time() - stm); /* Special display mode alternate integration time black measurement */ - if (usesdct234) { + if (usesdct23) { nummeas = i1pro_comp_nummeas(p, s->dcaltime2, s->dark_int_time2); a1logd(p->log,2,"Doing 2nd initial black calibration with dcaltime2 %f, dark_int_time2 %f, nummeas %d, gainmode %d\n", s->dcaltime2, s->dark_int_time2, nummeas, s->gainmode); stm = msec_time(); @@ -1665,17 +1658,6 @@ i1pro_code i1pro_imp_calibrate( return ev; } a1logd(p->log,2,"Execution time of 3rd dark calib time %f sec = %d msec\n",s->inttime,msec_time() - stm); - - nummeas = i1pro_comp_nummeas(p, s->dcaltime4, s->dark_int_time4); - a1logd(p->log,2,"Doing 4th initial black calibration with dcaltime4 %f, dark_int_time4 %f, nummeas %d, gainmode %d\n", s->dcaltime4, s->dark_int_time4, nummeas, s->gainmode); - nummeas = i1pro_comp_nummeas(p, s->dcaltime4, s->dark_int_time4); - stm = msec_time(); - if ((ev = i1pro_dark_measure(p, s->dark_data4, - nummeas, &s->dark_int_time4, s->gainmode)) != I1PRO_OK) { - m->mmode = mmode; /* Restore actual mode */ - return ev; - } - a1logd(p->log,2,"Execution time of 4rd dark calib time %f sec = %d msec\n",s->inttime,msec_time() - stm); } s->dark_valid = 1; s->want_dcalib = 0; @@ -1704,15 +1686,13 @@ i1pro_code i1pro_imp_calibrate( ss->dark_gain_mode = s->dark_gain_mode; for (k = -1; k < m->nraw; k++) ss->dark_data[k] = s->dark_data[k]; - /* If this is a mode with dark_data2/3/4, tranfer it too */ - if (usesdct234 && ss->emiss && !ss->adaptive && !ss->scan) { + /* If this is a mode with dark_data2/3, tranfer it too */ + if (usesdct23 && ss->emiss && !ss->adaptive && !ss->scan) { ss->dark_int_time2 = s->dark_int_time2; - ss->dark_int_time3 = s->dark_int_time3; - ss->dark_int_time4 = s->dark_int_time4; + ss->dark_int_time3 = s->dark_int_time2; for (k = -1; k < m->nraw; k++) { ss->dark_data2[k] = s->dark_data2[k]; ss->dark_data3[k] = s->dark_data3[k]; - ss->dark_data4[k] = s->dark_data4[k]; } } } @@ -2296,9 +2276,6 @@ i1pro_code i1pro_imp_calibrate( } else if (s->dispswap == 2) { tv = s->inttime; s->inttime = s->dark_int_time3; s->dark_int_time3 = tv; tt = s->dark_data; s->dark_data = s->dark_data3; s->dark_data3 = tt; - } else if (s->dispswap == 3) { - tv = s->inttime; s->inttime = s->dark_int_time4; s->dark_int_time4 = tv; - tt = s->dark_data; s->dark_data = s->dark_data4; s->dark_data4 = tt; } s->dispswap = 0; @@ -2307,43 +2284,30 @@ i1pro_code i1pro_imp_calibrate( nummeas = i1pro_comp_nummeas(p, s->wreadtime, s->inttime); ev = i1pro_whitemeasure(p, NULL, NULL, data , &scale, nummeas, &s->inttime, s->gainmode, s->targoscale, 0); + /* Switch to the alternate if things are too bright */ + /* We do this simply by swapping the alternate values in. */ if (ev == I1PRO_RD_SENSORSATURATED || scale < 1.0) { - a1logd(p->log,2,"Switching to 2nd display integration time %f seconds\n",s->dark_int_time2); - /* swap in 2nd display integration time */ + a1logd(p->log,2,"Switching to alternate display integration time %f seconds\n",s->dark_int_time2); tv = s->inttime; s->inttime = s->dark_int_time2; s->dark_int_time2 = tv; tt = s->dark_data; s->dark_data = s->dark_data2; s->dark_data2 = tt; s->dispswap = 1; /* Do another measurement of the full display white, and if it's close to */ - /* saturation, switch to the 3rd display integration time */ + /* saturation, switch to the 3rd alternate display integration time */ nummeas = i1pro_comp_nummeas(p, s->wreadtime, s->inttime); ev = i1pro_whitemeasure(p, NULL, NULL, data , &scale, nummeas, &s->inttime, s->gainmode, s->targoscale, 0); + /* Switch to the 3rd alternate if things are too bright */ + /* We do this simply by swapping the alternate values in. */ if (ev == I1PRO_RD_SENSORSATURATED || scale < 1.0) { - a1logd(p->log,2,"Switching to 3rd display integration time %f seconds\n",s->dark_int_time3); + a1logd(p->log,2,"Switching to 3rd alternate display integration time %f seconds\n",s->dark_int_time3); /* Undo previous swap */ tv = s->inttime; s->inttime = s->dark_int_time2; s->dark_int_time2 = tv; tt = s->dark_data; s->dark_data = s->dark_data2; s->dark_data2 = tt; - /* swap in 3rd time */ + /* swap in 2nd alternate */ tv = s->inttime; s->inttime = s->dark_int_time3; s->dark_int_time3 = tv; tt = s->dark_data; s->dark_data = s->dark_data3; s->dark_data3 = tt; s->dispswap = 2; - - /* Do another measurement of the full display white, and if it's close to */ - /* saturation, switch to the 4th display integration time */ - nummeas = i1pro_comp_nummeas(p, s->wreadtime, s->inttime); - ev = i1pro_whitemeasure(p, NULL, NULL, data , &scale, nummeas, - &s->inttime, s->gainmode, s->targoscale, 0); - if (ev == I1PRO_RD_SENSORSATURATED || scale < 1.0) { - a1logd(p->log,2,"Switching to 4th display integration time %f seconds\n",s->dark_int_time3); - /* Undo previous swap */ - tv = s->inttime; s->inttime = s->dark_int_time3; s->dark_int_time3 = tv; - tt = s->dark_data; s->dark_data = s->dark_data3; s->dark_data3 = tt; - /* swap in 4th time */ - tv = s->inttime; s->inttime = s->dark_int_time4; s->dark_int_time4 = tv; - tt = s->dark_data; s->dark_data = s->dark_data4; s->dark_data4 = tt; - s->dispswap = 3; - } } } free_dvector(data, -1, m->nraw-1); @@ -2983,16 +2947,16 @@ i1pro_code i1pro_imp_measure( /* and try again. */ if (s->emiss && !s->scan && !s->adaptive && ev == I1PRO_RD_SENSORSATURATED - && s->dispswap < 3) { + && s->dispswap < 2) { double *tt, tv; if (s->dispswap == 0) { - a1logd(p->log,2,"Switching to 2nd display integration time %f seconds\n",s->dark_int_time2); + a1logd(p->log,2,"Switching to alternate display integration time %f seconds\n",s->dark_int_time2); tv = s->inttime; s->inttime = s->dark_int_time2; s->dark_int_time2 = tv; tt = s->dark_data; s->dark_data = s->dark_data2; s->dark_data2 = tt; s->dispswap = 1; } else if (s->dispswap == 1) { - a1logd(p->log,2,"Switching to 3rd display integration time %f seconds\n",s->dark_int_time3); + a1logd(p->log,2,"Switching to 2nd alternate display integration time %f seconds\n",s->dark_int_time3); /* Undo first swap */ tv = s->inttime; s->inttime = s->dark_int_time2; s->dark_int_time2 = tv; tt = s->dark_data; s->dark_data = s->dark_data2; s->dark_data2 = tt; @@ -3000,15 +2964,6 @@ i1pro_code i1pro_imp_measure( tv = s->inttime; s->inttime = s->dark_int_time3; s->dark_int_time3 = tv; tt = s->dark_data; s->dark_data = s->dark_data3; s->dark_data3 = tt; s->dispswap = 2; - } else if (s->dispswap == 2) { - a1logd(p->log,2,"Switching to 4th display integration time %f seconds\n",s->dark_int_time4); - /* Undo 2nd swap */ - tv = s->inttime; s->inttime = s->dark_int_time3; s->dark_int_time3 = tv; - tt = s->dark_data; s->dark_data = s->dark_data3; s->dark_data3 = tt; - /* Do 3rd swap */ - tv = s->inttime; s->inttime = s->dark_int_time4; s->dark_int_time4 = tv; - tt = s->dark_data; s->dark_data = s->dark_data4; s->dark_data4 = tt; - s->dispswap = 3; } /* Recompute number of measurements and realloc measurement buffer */ free(mbuf); @@ -4190,8 +4145,6 @@ i1pro_code i1pro_save_calibration(i1pro *p) { write_doubles(&x, fp, s->dark_data2-1, m->nraw+1); write_doubles(&x, fp, &s->dark_int_time3, 1); write_doubles(&x, fp, s->dark_data3-1, m->nraw+1); - write_doubles(&x, fp, &s->dark_int_time4, 1); - write_doubles(&x, fp, s->dark_data4-1, m->nraw+1); write_ints(&x, fp, &s->dark_gain_mode, 1); if (!s->emiss) { @@ -4335,10 +4288,7 @@ i1pro_code i1pro_restore_calibration(i1pro *p) { read_doubles(&x, fp, &dd, 1); for (j = -1; j < m->nraw; j++) read_doubles(&x, fp, &dd, 1); - read_doubles(&x, fp, &dd, 1); /* dark_data3 */ - for (j = -1; j < m->nraw; j++) - read_doubles(&x, fp, &dd, 1); - read_doubles(&x, fp, &dd, 1); /* dark_data4 */ + read_doubles(&x, fp, &dd, 1); for (j = -1; j < m->nraw; j++) read_doubles(&x, fp, &dd, 1); read_ints(&x, fp, &di, 1); @@ -4388,7 +4338,6 @@ i1pro_code i1pro_restore_calibration(i1pro *p) { ts.dark_data = dvectorz(-1, m->nraw-1); ts.dark_data2 = dvectorz(-1, m->nraw-1); ts.dark_data3 = dvectorz(-1, m->nraw-1); - ts.dark_data4 = dvectorz(-1, m->nraw-1); ts.cal_factor[0] = dvectorz(0, m->nwav[0]-1); ts.cal_factor[1] = dvectorz(0, m->nwav[1]-1); ts.white_data = dvectorz(-1, m->nraw-1); @@ -4435,8 +4384,6 @@ i1pro_code i1pro_restore_calibration(i1pro *p) { read_doubles(&x, fp, ts.dark_data2-1, m->nraw+1); read_doubles(&x, fp, &ts.dark_int_time3, 1); read_doubles(&x, fp, ts.dark_data3-1, m->nraw+1); - read_doubles(&x, fp, &ts.dark_int_time4, 1); - read_doubles(&x, fp, ts.dark_data4-1, m->nraw+1); read_ints(&x, fp, &ts.dark_gain_mode, 1); if (!ts.emiss) { @@ -4472,7 +4419,6 @@ i1pro_code i1pro_restore_calibration(i1pro *p) { && (s->adaptive || fabs(s->dark_int_time - ts.dark_int_time) < 0.01) && (s->adaptive || fabs(s->dark_int_time2 - ts.dark_int_time2) < 0.01) && (s->adaptive || fabs(s->dark_int_time3 - ts.dark_int_time3) < 0.01) - && (s->adaptive || fabs(s->dark_int_time4 - ts.dark_int_time4) < 0.01) && (!s->adaptive || fabs(s->idark_int_time[0] - ts.idark_int_time[0]) < 0.01) && (!s->adaptive || fabs(s->idark_int_time[1] - ts.idark_int_time[1]) < 0.01) && (!s->adaptive || fabs(s->idark_int_time[2] - ts.idark_int_time[2]) < 0.01) @@ -4505,9 +4451,6 @@ i1pro_code i1pro_restore_calibration(i1pro *p) { s->dark_int_time3 = ts.dark_int_time3; for (j = -1; j < m->nraw; j++) s->dark_data3[j] = ts.dark_data3[j]; - s->dark_int_time4 = ts.dark_int_time4; - for (j = -1; j < m->nraw; j++) - s->dark_data4[j] = ts.dark_data4[j]; s->dark_gain_mode = ts.dark_gain_mode; if (!ts.emiss) { s->cal_valid = ts.cal_valid; @@ -4537,7 +4480,7 @@ i1pro_code i1pro_restore_calibration(i1pro *p) { a1logd(p->log,2,"emis = %d : %d, trans = %d : %d, ref = %d : %d\n",s->emiss,ts.emiss,s->trans,ts.trans,s->reflective,ts.reflective); a1logd(p->log,2,"scan = %d : %d, flash = %d : %d, ambi = %d : %d, adapt = %d : %d\n",s->scan,ts.scan,s->flash,ts.flash,s->ambient,ts.ambient,s->adaptive,ts.adaptive); a1logd(p->log,2,"inttime = %f : %f\n",s->inttime,ts.inttime); - a1logd(p->log,2,"darkit1 = %f : %f, 2 = %f : %f, 3 = %f : %f, 4 = %f : %f\n",s->dark_int_time,ts.dark_int_time,s->dark_int_time2,ts.dark_int_time2,s->dark_int_time3,ts.dark_int_time3,s->dark_int_time4,ts.dark_int_time4); + a1logd(p->log,2,"darkit1 = %f : %f, 2 = %f : %f, 3 = %f : %f\n",s->dark_int_time,ts.dark_int_time,s->dark_int_time2,ts.dark_int_time2,s->dark_int_time3,ts.dark_int_time3); a1logd(p->log,2,"idarkit0 = %f : %f, 1 = %f : %f, 2 = %f : %f, 3 = %f : %f\n",s->idark_int_time[0],ts.idark_int_time[0],s->idark_int_time[1],ts.idark_int_time[1],s->idark_int_time[2],ts.idark_int_time[2],s->idark_int_time[3],ts.idark_int_time[3]); } } @@ -4546,7 +4489,6 @@ i1pro_code i1pro_restore_calibration(i1pro *p) { free_dvector(ts.dark_data, -1, m->nraw-1); free_dvector(ts.dark_data2, -1, m->nraw-1); free_dvector(ts.dark_data3, -1, m->nraw-1); - free_dvector(ts.dark_data4, -1, m->nraw-1); free_dvector(ts.white_data, -1, m->nraw-1); free_dmatrix(ts.idark_data, 0, 3, -1, m->nraw-1); @@ -4607,8 +4549,6 @@ i1pro_establish_high_power(i1pro *p) { if ((ev = i1pro_getmisc(p, &m->fwrev, NULL, &m->maxpve, NULL, &m->powmode)) != I1PRO_OK) return ev; - a1logd(p->log,2,"CPLD rev = %d\n",m->cpldrev); - if (m->powmode != 8) { /* In high power mode */ if ((ev = i1pro_reset(p, 0x1f)) != I1PRO_OK) return ev; @@ -10784,14 +10724,14 @@ i1pro_readEEProm( 0xC4, 0, 0, pbuf, len, 2.0); if ((rv = icoms2i1pro_err(se)) != I1PRO_OK) { - a1logd(p->log,1,"i1pro_readEEProm: read failed with ICOM err 0x%x (%d msec)\n",se, msec_time()-stime); + a1logd(p->log,1,"i1pro_readEEProm: read failed with ICOM err 0x%x\n",se); return rv; } /* Now read the bytes */ se = p->icom->usb_read(p->icom, NULL, 0x82, buf, size, &rwbytes, 5.0); if ((rv = icoms2i1pro_err(se)) != I1PRO_OK) { - a1logd(p->log,1,"i1pro_readEEProm: read failed with ICOM err 0x%x (%d msec)\n",se, msec_time()-stime); + a1logd(p->log,1,"i1pro_readEEProm: read failed with ICOM err 0x%x\n",se); return rv; } @@ -10872,7 +10812,7 @@ i1pro_writeEEProm( 0xC3, 0, 0, pbuf, len, 2.0); if ((rv = icoms2i1pro_err(se)) != I1PRO_OK) { - a1logd(p->log,2,"i1pro_writeEEProm: write failed with ICOM err 0x%x (%d msec)\n",se, msec_time()-stime); + a1logd(p->log,2,"i1pro_writeEEProm: write failed with ICOM err 0x%x\n",se); return rv; } @@ -10880,7 +10820,7 @@ i1pro_writeEEProm( se = p->icom->usb_write(p->icom, NULL, 0x03, buf, size, &rwbytes, 5.0); if ((rv = icoms2i1pro_err(se)) != I1PRO_OK) { - a1logd(p->log,1,"i1pro_writeEEProm: failed with ICOM err 0x%x (%d msec)\n",se, msec_time()-stime); + a1logd(p->log,1,"i1pro_writeEEProm: failed with ICOM err 0x%x\n",se); return rv; } @@ -10897,7 +10837,7 @@ i1pro_writeEEProm( se = p->icom->usb_write(p->icom, NULL, 0x03, pbuf, 1, &rwbytes, 5.0); if ((rv = icoms2i1pro_err(se)) != I1PRO_OK) { - a1logd(p->log,1,"i1pro_writeEEProm: write failed with ICOM err 0x%x (%d msec)\n",se, msec_time()-stime); + a1logd(p->log,1,"i1pro_writeEEProm: write failed with ICOM err 0x%x\n",se); return rv; } @@ -10949,7 +10889,7 @@ i1pro_getmisc( 0xC9, 0, 0, pbuf, 8, 2.0); if ((rv = icoms2i1pro_err(se)) != I1PRO_OK) { - a1logd(p->log,1,"i1pro_getmisc: failed with ICOM err 0x%x (%d msec)\n",se, msec_time()-stime); + a1logd(p->log,1,"i1pro_getmisc: failed with ICOM err 0x%x\n",se); return rv; } @@ -10997,7 +10937,7 @@ i1pro_getmeasparams( 0xC2, 0, 0, pbuf, 8, 2.0); if ((rv = icoms2i1pro_err(se)) != I1PRO_OK) { - a1logd(p->log,1,"i1pro_getmeasparams: failed with ICOM err 0x%x (%d msec)\n",se, msec_time()-stime); + a1logd(p->log,1,"i1pro_getmeasparams: failed with ICOM err 0x%x\n",se); return rv; } @@ -11062,7 +11002,7 @@ i1pro_setmeasparams( 0xC1, 0, 0, pbuf, 8, 2.0); if ((rv = icoms2i1pro_err(se)) != I1PRO_OK) { - a1logd(p->log,1,"i1pro_setmeasparams: failed with ICOM err 0x%x (%d msec)\n",se, msec_time()-stime); + a1logd(p->log,1,"i1pro_setmeasparams: failed with ICOM err 0x%x\n",se); return rv; } @@ -11378,13 +11318,10 @@ i1pro_setmcmode( 0xCF, 0, 0, pbuf, 1, 2.0); if ((rv = icoms2i1pro_err(se)) != I1PRO_OK) { - a1logd(p->log,1,"i1pro_setmcmode: failed with ICOM err 0x%x (%d msec)\n",se, msec_time()-stime); + a1logd(p->log,1,"i1pro_setmcmode: failed with ICOM err 0x%x\n",se); return rv; } - /* Hmm. Give the instrument a little time to reconfigure itself. */ - msec_sleep(10); - a1logd(p->log,2,"i1pro_setmcmode: done, ICOM err 0x%x (%d msec)\n", se, msec_time()-stime); return rv; @@ -11421,7 +11358,7 @@ i1pro_getmcmode( 0xD1, 0, 0, pbuf, 6, 2.0); if ((rv = icoms2i1pro_err(se)) != I1PRO_OK) { - a1logd(p->log,1,"i1pro_getmcmode: failed with ICOM err 0x%x (%d msec)\n",se, msec_time()-stime); + a1logd(p->log,1,"i1pro_getmcmode: failed with ICOM err 0x%x\n",se); return rv; } @@ -11466,7 +11403,7 @@ i1pro_code i1pro_waitfor_switch(i1pro *p, double top) { } if ((rv = icoms2i1pro_err(se)) != I1PRO_OK) { - a1logd(p->log,1,"i1pro_waitfor_switch: failed with ICOM err 0x%x (%d msec)\n",se, msec_time()-stime); + a1logd(p->log,1,"i1pro_waitfor_switch: failed with ICOM err 0x%x\n",se); return rv; } diff --git a/spectro/i1pro_imp.h b/spectro/i1pro_imp.h index 5a2cef2..6bf8de4 100644 --- a/spectro/i1pro_imp.h +++ b/spectro/i1pro_imp.h @@ -127,7 +127,6 @@ struct _i1pro_state { /* Display mode calibration state (emmis && !scan && !adaptive) */ int dispswap; /* 0 = default time, 1 = dark_int_time2, 2 = dark_int_time3 */ - /* 3 = dark_int_time4 */ double done_dintsel; /* A display integration time selection has been done */ time_t diseldate; /* Date/time of last display integration time selection */ double dcaltime2; /* Target dark calibration time - sets number of readings */ @@ -136,9 +135,6 @@ struct _i1pro_state { double dcaltime3; /* Target dark calibration time - sets number of readings */ double dark_int_time3; /* Integration time used for dark data 3 */ double *dark_data3; /* [-1 nraw] of dark level to subtract for dark_int_time3. */ - double dcaltime4; /* Target dark calibration time - sets number of readings */ - double dark_int_time4; /* Integration time used for dark data 4 */ - double *dark_data4; /* [-1 nraw] of dark level to subtract for dark_int_time4. */ }; typedef struct _i1pro_state i1pro_state; @@ -204,8 +200,8 @@ struct _i1proimp { /* Values read from GetMisc() */ int fwrev; /* int - Firmware revision number, from getmisc() */ /* Used for internal switching ?? */ - /* 101 = Rev A, 202 = Rev A update, 302 = Rev B, */ - /* 502, 505, 631 = Rev D, 629 = Rev E (i1pro2) */ + /* 101 = Rev A, 202 = Rev A update, 302 = Rev B, 502 = Rev D */ + /* 629 = Rev E (i1pro2) */ int cpldrev; /* int - CPLD revision number in EEProm */ /* Not used internaly ???? */ diff --git a/spectro/inst.c b/spectro/inst.c index 8976669..949e34f 100644 --- a/spectro/inst.c +++ b/spectro/inst.c @@ -581,18 +581,6 @@ static inst_config config_enum(inst *p, int ec) { } /* ---------------------------------------------- */ - -/* Delete things set/done by new_inst() */ -static inst_code virtual_del(inst *p) { - -#if defined(__APPLE__) - osx_latencycritical_end(); -#endif - - return inst_ok; -} - - /* Virtual constructor. */ /* Return NULL for unknown instrument, */ /* or serial instrument if nocoms == 0. */ @@ -714,8 +702,6 @@ void *cntx /* Context for callback */ return NULL; } - p->vdel = virtual_del; - /* Add default methods if constructor did not supply them */ if (p->init_coms == NULL) p->init_coms = init_coms; @@ -799,10 +785,6 @@ void *cntx /* Context for callback */ /* Set the provided user interaction callback */ p->set_uicallback(p, uicallback, cntx); -#if defined(__APPLE__) - osx_latencycritical_start(); -#endif - return p; } diff --git a/spectro/inst.h b/spectro/inst.h index 736a879..d47f7ea 100644 --- a/spectro/inst.h +++ b/spectro/inst.h @@ -643,10 +643,6 @@ typedef enum { void (*eventcallback)(void *cntx, inst_event_type event); \ void *event_cntx; /* Event callback function */ \ \ - /* Virtual delete. Cleans up things done by new_inst(). */ \ - inst_code (*vdel)( \ - struct _inst *p); \ - \ /* Establish communications at the indicated baud rate. */ \ /* (Serial parameters are ignored for USB instrument) */ \ /* Timout in to seconds, and return non-zero error code */ \ diff --git a/spectro/instappsup.c b/spectro/instappsup.c index d2ce7ff..0762bbe 100644 --- a/spectro/instappsup.c +++ b/spectro/instappsup.c @@ -401,7 +401,7 @@ inst_code inst_handle_calibrate( printf("\n"); /* If optional calib. and user wants to skip it */ /* Loop back to calibrate() with inst_calc_optional_flag still set */ - if ((calc & inst_calc_optional_flag) != 0 && (ch == 's' || ch == 'S')) { + if ((calc & inst_calc_optional_flag) != 0 && ch == 's' || ch == 'S') { printf("Skipped\n"); goto oloop; } diff --git a/spectro/kleink10.c b/spectro/kleink10.c index 9599972..461cb28 100644 --- a/spectro/kleink10.c +++ b/spectro/kleink10.c @@ -62,7 +62,7 @@ #undef HIGH_SPEED /* [und] Use high speed flicker measure for refresh rate etc. */ #define AUTO_AVERAGE /* [def] Automatically average more readings for low light */ -#define RETRY_RANGE_ERROR 4 /* [4] Retry range error readings 4 times */ +#define RETRY_RANGE_ERROR 3 /* [3] Retry range error readings 3 times */ #undef PLOT_REFRESH /* [und] Plot refresh rate measurement info */ #undef PLOT_UPDELAY /* [und] Plot update delay measurement info */ @@ -81,7 +81,6 @@ static inst_code k10_read_flicker_samples(kleink10 *p, double duration, double * /* Decode a K10 error letter */ static int decodeK10err(char c) { -//printf("~1 decoding error code 0x%x\n",c); if (c == '0') { return K10_OK; } else if (c == 'B') { @@ -126,34 +125,28 @@ extract_ec(char *s, int *nlength, int bread) { if (*p == '>') break; } - if (p < s) { -//printf("p %d < s %d ? %d\n", p, s, p < s); + if (p < s) return K10_BAD_RETVAL; - } //printf("trailing is at %d '%s'\n",p - s, p); /* Find the leading '<' */ for (f = p-1; f >= (p-MAXECHARS-1) && f >= s; f--) { if (*f == '<') break; - /* Turns out the error code may be non-text */ -#ifdef NEVER if ((*f < '0' || *f > '9') && (*f < 'a' || *f > 'z') && (*f < 'A' || *f > 'Z')) return K10_BAD_RETVAL; -#endif /* NEVER */ } if (f < s || f < (p-MAXECHARS-1) || (p-f) <= 1) { -//printf("f < s ? %d, f < (p-MAXECHARS-1) ? %d, (p-f) <= 1 ? %d\n", f < s, f < (p-10), (p-f) <= 1); +//printf("f < s ? %d, f < (p-MAXECHARS-1) ? %d, (p-f) <= 1 ? %d\n", +//f < s, f < (p-10), (p-f) <= 1); return K10_BAD_RETVAL; } //printf("leading is at %d '%s'\n",f - s, f); - if (p-f-1 <= 0) { -//printf("p-f-1 %d <= 0 ? %d\n", p-f-1, p-f-1 <= 0); + if (p-f-1 <= 0) return K10_BAD_RETVAL; - } strncpy(tt, f+1, p-f-1); tt[p-f-1] = '\000'; @@ -162,7 +155,7 @@ extract_ec(char *s, int *nlength, int bread) { /* Interpret the error character(s) */ /* It's not clear if more than one error can be returned. */ /* We are only looking at the first character - we should */ - /* really prioritize them if more than one can occur. */ + /* really prioritize them id more than one can occur. */ for (p = tt; *p != '\000'; p++) { rv = decodeK10err(*p); break; @@ -474,15 +467,7 @@ k10_init_inst(inst *pp) { amutex_lock(p->lock); /* Make sure the target lights are off */ - if ((ev = k10_command(p, "L0\r", buf, MAX_MES_SIZE, NULL, 2+3, ec_ec, 1.0)) != inst_ok - /* Strangely the L0/1 command mat return irrelevant error codes... */ - && (ev & inst_imask) != K10_UNKNOWN - && (ev & inst_imask) != K10_BLACK_EXCESS - && (ev & inst_imask) != K10_BLACK_OVERDRIVE - && (ev & inst_imask) != K10_BLACK_ZERO - && (ev & inst_imask) != K10_OVER_HIGH_RANGE - && (ev & inst_imask) != K10_TOP_OVER_RANGE - && (ev & inst_imask) != K10_BOT_UNDER_RANGE) { + if ((ev = k10_command(p, "L0\r", buf, MAX_MES_SIZE, NULL, 2+3, ec_ec, 1.0)) != inst_ok) { amutex_unlock(p->lock); return ev; } @@ -525,20 +510,14 @@ k10_init_inst(inst *pp) { if (p->log->verb) { char *model = "Unknown"; switch (p->model) { - case k10_k1: - model = "K-1"; - break; - case k10_k8: - model = "K-8"; - break; case k10_k10: - model = "K-10"; + model = "K10"; break; case k10_k10a: - model = "K-10A"; + model = "K10-A"; break; case k10_kv10a: - model = "KV-10A"; + model = "KV10-A"; break; } a1logv(p->log, 1, " Model: '%s'\n",model); @@ -907,7 +886,7 @@ kleink10 *p) { /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ -static void abort_flicker(kleink10 *p, int isnew, double *retbuf) { +static abort_flicker(kleink10 *p, int isnew, double *retbuf) { char buf[MAX_MES_SIZE]; int bread; @@ -997,15 +976,7 @@ int usefast /* If nz use fast rate is possible */ /* Make sure the target lights are off */ if (p->lights) { int se; - if ((ev = k10_command(p, "L0\r", buf, MAX_MES_SIZE, NULL, 2+3, ec_ec, 0.5)) != inst_ok - /* Strangely the L0/1 command mat return irrelevant error codes... */ - && (ev & inst_imask) != K10_UNKNOWN - && (ev & inst_imask) != K10_BLACK_EXCESS - && (ev & inst_imask) != K10_BLACK_OVERDRIVE - && (ev & inst_imask) != K10_BLACK_ZERO - && (ev & inst_imask) != K10_OVER_HIGH_RANGE - && (ev & inst_imask) != K10_TOP_OVER_RANGE - && (ev & inst_imask) != K10_BOT_UNDER_RANGE) { + if ((ev = k10_command(p, "L0\r", buf, MAX_MES_SIZE, NULL, 2+3, ec_ec, 0.5)) != inst_ok) { amutex_unlock(p->lock); free(retbuf); a1logd(p->log, 1, "k10_read_flicker: L0 failed\n"); @@ -1211,9 +1182,9 @@ instClamping clamp) { /* NZ if clamp XYZ/Lab to be +ve */ int user_trig = 0; int bsize; inst_code rv = inst_protocol_error; - int range[3]; /* Range for RGB sensor values */ - int i, tries, ntav = 1; /* Number of readings to average */ - double v, vv; + int range[3]; /* Range for RGB sensor values */ + int i, tries,ntav = 1; /* Number of readings to average */ + double v, vv, XYZ[3]; if (!p->gotcoms) return inst_no_coms; @@ -1259,15 +1230,7 @@ instClamping clamp) { /* NZ if clamp XYZ/Lab to be +ve */ /* Make sure the target lights are off */ if (p->lights) { - if ((rv = k10_command(p, "L0\r", buf, MAX_MES_SIZE, NULL, 2+3, ec_ec, 1.0)) != inst_ok - /* Strangely the L0/1 command mat return irrelevant error codes... */ - && (rv & inst_imask) != K10_UNKNOWN - && (rv & inst_imask) != K10_BLACK_EXCESS - && (rv & inst_imask) != K10_BLACK_OVERDRIVE - && (rv & inst_imask) != K10_BLACK_ZERO - && (rv & inst_imask) != K10_OVER_HIGH_RANGE - && (rv & inst_imask) != K10_TOP_OVER_RANGE - && (rv & inst_imask) != K10_BOT_UNDER_RANGE) { + if ((rv = k10_command(p, "L0\r", buf, MAX_MES_SIZE, NULL, 2+3, ec_ec, 1.0)) != inst_ok) { amutex_unlock(p->lock); a1logd(p->log, 1, "k10_read_sample: L0 failed\n"); return rv; @@ -1293,7 +1256,7 @@ instClamping clamp) { /* NZ if clamp XYZ/Lab to be +ve */ if (rv == inst_ok || ( (rv & inst_imask) != K10_TOP_OVER_RANGE && (rv & inst_imask) != K10_BOT_UNDER_RANGE)) - break; + break; } if (rv == inst_ok) @@ -1310,6 +1273,7 @@ instClamping clamp) { /* NZ if clamp XYZ/Lab to be +ve */ if (val->XYZ[2] > v) v = val->XYZ[2]; + ntav = 1; #ifdef AUTO_AVERAGE if (!IMODETST(p->mode, inst_mode_emis_nonadaptive)) { /* Decide how many extra readings to average into result. */ @@ -1328,26 +1292,13 @@ instClamping clamp) { /* NZ if clamp XYZ/Lab to be +ve */ vv = 1.0 - (v - thr[2]) / (thr[3] - thr[2]); vv = vv * vv * vv; ntav = (int)(vv * (nav[2] - nav[3]) + nav[3] + 0.5); - } /* else default 1 */ + } } #endif - /* Measure extras up to ntav */ for (i = 1; i < ntav; i++) { - double XYZ[3]; - - for (tries = 0; tries < RETRY_RANGE_ERROR; tries++) { - rv = k10_command(p, "N5\r", buf, MAX_MES_SIZE, &bsize, 15, ec_ec, 2.0); - if (rv == inst_ok - || ( (rv & inst_imask) != K10_TOP_OVER_RANGE - && (rv & inst_imask) != K10_BOT_UNDER_RANGE)) - break; - } - - if (rv != inst_ok) { // An error, or retry failed + if ((rv = k10_command(p, "N5\r", buf, MAX_MES_SIZE, &bsize, 15, ec_ec, 2.0)) != inst_ok) break; - } - if ((rv = decodeN5(p, XYZ, range, buf, bsize)) != inst_ok) break; @@ -1370,6 +1321,10 @@ instClamping clamp) { /* NZ if clamp XYZ/Lab to be +ve */ amutex_unlock(p->lock); + if ((rv = decodeN5(p, val->XYZ, range, buf, bsize)) != inst_ok) { + return rv; + } + /* Apply the calibration correction matrix */ icmMulBy3x3(val->XYZ, p->ccmat, val->XYZ); @@ -2441,7 +2396,6 @@ k10_del(inst *pp) { if (p->icom != NULL) p->icom->del(p->icom); amutex_del(p->lock); - p->vdel(pp); free(p); } } @@ -2787,30 +2741,14 @@ k10_get_set_opt(inst *pp, inst_opt_type m, ...) } if (state == 1) { /* Turn on */ - if ((ev = k10_command(p, "L1\r", buf, MAX_MES_SIZE, NULL, 2+3, ec_ec, 0.5)) != inst_ok - /* Strangely the L0/1 command mat return irrelevant error codes... */ - && (ev & inst_imask) != K10_UNKNOWN - && (ev & inst_imask) != K10_BLACK_EXCESS - && (ev & inst_imask) != K10_BLACK_OVERDRIVE - && (ev & inst_imask) != K10_BLACK_ZERO - && (ev & inst_imask) != K10_OVER_HIGH_RANGE - && (ev & inst_imask) != K10_TOP_OVER_RANGE - && (ev & inst_imask) != K10_BOT_UNDER_RANGE) { + if ((ev = k10_command(p, "L1\r", buf, MAX_MES_SIZE, NULL, 2+3, ec_ec, 0.5)) != inst_ok) { amutex_unlock(p->lock); a1logd(p->log, 1, "k10_get_set_opt: L1 failed\n"); return ev; } p->lights = 1; } else if (state == 0) { /* Turn off */ - if ((ev = k10_command(p, "L0\r", buf, MAX_MES_SIZE, NULL, 2+3, ec_ec, 0.5)) != inst_ok - /* Strangely the L0/1 command mat return irrelevant error codes... */ - && (ev & inst_imask) != K10_UNKNOWN - && (ev & inst_imask) != K10_BLACK_EXCESS - && (ev & inst_imask) != K10_BLACK_OVERDRIVE - && (ev & inst_imask) != K10_BLACK_ZERO - && (ev & inst_imask) != K10_OVER_HIGH_RANGE - && (ev & inst_imask) != K10_TOP_OVER_RANGE - && (ev & inst_imask) != K10_BOT_UNDER_RANGE) { + if ((ev = k10_command(p, "L0\r", buf, MAX_MES_SIZE, NULL, 2+3, ec_ec, 0.5)) != inst_ok) { amutex_unlock(p->lock); a1logd(p->log, 1, "k10_get_set_opt: L0 failed\n"); return ev; diff --git a/spectro/linear.cal b/spectro/linear.cal deleted file mode 100644 index 9c88605..0000000 --- a/spectro/linear.cal +++ /dev/null @@ -1,272 +0,0 @@ -CAL - -DESCRIPTOR "Argyll Device Calibration Curves" -ORIGINATOR "Argyll synthcal" -CREATED "Mon Oct 26 01:10:48 2015" -DEVICE_CLASS "DISPLAY" -COLOR_REP "RGB" - -NUMBER_OF_FIELDS 4 -BEGIN_DATA_FORMAT -RGB_I RGB_R RGB_G RGB_B -END_DATA_FORMAT - -NUMBER_OF_SETS 256 -BEGIN_DATA -0.00000 0.00000 0.00000 0.00000 -0.00392157 0.00392157 0.00392157 0.00392157 -0.00784314 0.00784314 0.00784314 0.00784314 -0.0117647 0.0117647 0.0117647 0.0117647 -0.0156863 0.0156863 0.0156863 0.0156863 -0.0196078 0.0196078 0.0196078 0.0196078 -0.0235294 0.0235294 0.0235294 0.0235294 -0.0274510 0.0274510 0.0274510 0.0274510 -0.0313725 0.0313725 0.0313725 0.0313725 -0.0352941 0.0352941 0.0352941 0.0352941 -0.0392157 0.0392157 0.0392157 0.0392157 -0.0431373 0.0431373 0.0431373 0.0431373 -0.0470588 0.0470588 0.0470588 0.0470588 -0.0509804 0.0509804 0.0509804 0.0509804 -0.0549020 0.0549020 0.0549020 0.0549020 -0.0588235 0.0588235 0.0588235 0.0588235 -0.0627451 0.0627451 0.0627451 0.0627451 -0.0666667 0.0666667 0.0666667 0.0666667 -0.0705882 0.0705882 0.0705882 0.0705882 -0.0745098 0.0745098 0.0745098 0.0745098 -0.0784314 0.0784314 0.0784314 0.0784314 -0.0823529 0.0823529 0.0823529 0.0823529 -0.0862745 0.0862745 0.0862745 0.0862745 -0.0901961 0.0901961 0.0901961 0.0901961 -0.0941176 0.0941176 0.0941176 0.0941176 -0.0980392 0.0980392 0.0980392 0.0980392 -0.101961 0.101961 0.101961 0.101961 -0.105882 0.105882 0.105882 0.105882 -0.109804 0.109804 0.109804 0.109804 -0.113725 0.113725 0.113725 0.113725 -0.117647 0.117647 0.117647 0.117647 -0.121569 0.121569 0.121569 0.121569 -0.125490 0.125490 0.125490 0.125490 -0.129412 0.129412 0.129412 0.129412 -0.133333 0.133333 0.133333 0.133333 -0.137255 0.137255 0.137255 0.137255 -0.141176 0.141176 0.141176 0.141176 -0.145098 0.145098 0.145098 0.145098 -0.149020 0.149020 0.149020 0.149020 -0.152941 0.152941 0.152941 0.152941 -0.156863 0.156863 0.156863 0.156863 -0.160784 0.160784 0.160784 0.160784 -0.164706 0.164706 0.164706 0.164706 -0.168627 0.168627 0.168627 0.168627 -0.172549 0.172549 0.172549 0.172549 -0.176471 0.176471 0.176471 0.176471 -0.180392 0.180392 0.180392 0.180392 -0.184314 0.184314 0.184314 0.184314 -0.188235 0.188235 0.188235 0.188235 -0.192157 0.192157 0.192157 0.192157 -0.196078 0.196078 0.196078 0.196078 -0.200000 0.200000 0.200000 0.200000 -0.203922 0.203922 0.203922 0.203922 -0.207843 0.207843 0.207843 0.207843 -0.211765 0.211765 0.211765 0.211765 -0.215686 0.215686 0.215686 0.215686 -0.219608 0.219608 0.219608 0.219608 -0.223529 0.223529 0.223529 0.223529 -0.227451 0.227451 0.227451 0.227451 -0.231373 0.231373 0.231373 0.231373 -0.235294 0.235294 0.235294 0.235294 -0.239216 0.239216 0.239216 0.239216 -0.243137 0.243137 0.243137 0.243137 -0.247059 0.247059 0.247059 0.247059 -0.250980 0.250980 0.250980 0.250980 -0.254902 0.254902 0.254902 0.254902 -0.258824 0.258824 0.258824 0.258824 -0.262745 0.262745 0.262745 0.262745 -0.266667 0.266667 0.266667 0.266667 -0.270588 0.270588 0.270588 0.270588 -0.274510 0.274510 0.274510 0.274510 -0.278431 0.278431 0.278431 0.278431 -0.282353 0.282353 0.282353 0.282353 -0.286275 0.286275 0.286275 0.286275 -0.290196 0.290196 0.290196 0.290196 -0.294118 0.294118 0.294118 0.294118 -0.298039 0.298039 0.298039 0.298039 -0.301961 0.301961 0.301961 0.301961 -0.305882 0.305882 0.305882 0.305882 -0.309804 0.309804 0.309804 0.309804 -0.313725 0.313725 0.313725 0.313725 -0.317647 0.317647 0.317647 0.317647 -0.321569 0.321569 0.321569 0.321569 -0.325490 0.325490 0.325490 0.325490 -0.329412 0.329412 0.329412 0.329412 -0.333333 0.333333 0.333333 0.333333 -0.337255 0.337255 0.337255 0.337255 -0.341176 0.341176 0.341176 0.341176 -0.345098 0.345098 0.345098 0.345098 -0.349020 0.349020 0.349020 0.349020 -0.352941 0.352941 0.352941 0.352941 -0.356863 0.356863 0.356863 0.356863 -0.360784 0.360784 0.360784 0.360784 -0.364706 0.364706 0.364706 0.364706 -0.368627 0.368627 0.368627 0.368627 -0.372549 0.372549 0.372549 0.372549 -0.376471 0.376471 0.376471 0.376471 -0.380392 0.380392 0.380392 0.380392 -0.384314 0.384314 0.384314 0.384314 -0.388235 0.388235 0.388235 0.388235 -0.392157 0.392157 0.392157 0.392157 -0.396078 0.396078 0.396078 0.396078 -0.400000 0.400000 0.400000 0.400000 -0.403922 0.403922 0.403922 0.403922 -0.407843 0.407843 0.407843 0.407843 -0.411765 0.411765 0.411765 0.411765 -0.415686 0.415686 0.415686 0.415686 -0.419608 0.419608 0.419608 0.419608 -0.423529 0.423529 0.423529 0.423529 -0.427451 0.427451 0.427451 0.427451 -0.431373 0.431373 0.431373 0.431373 -0.435294 0.435294 0.435294 0.435294 -0.439216 0.439216 0.439216 0.439216 -0.443137 0.443137 0.443137 0.443137 -0.447059 0.447059 0.447059 0.447059 -0.450980 0.450980 0.450980 0.450980 -0.454902 0.454902 0.454902 0.454902 -0.458824 0.458824 0.458824 0.458824 -0.462745 0.462745 0.462745 0.462745 -0.466667 0.466667 0.466667 0.466667 -0.470588 0.470588 0.470588 0.470588 -0.474510 0.474510 0.474510 0.474510 -0.478431 0.478431 0.478431 0.478431 -0.482353 0.482353 0.482353 0.482353 -0.486275 0.486275 0.486275 0.486275 -0.490196 0.490196 0.490196 0.490196 -0.494118 0.494118 0.494118 0.494118 -0.498039 0.498039 0.498039 0.498039 -0.501961 0.501961 0.501961 0.501961 -0.505882 0.505882 0.505882 0.505882 -0.509804 0.509804 0.509804 0.509804 -0.513725 0.513725 0.513725 0.513725 -0.517647 0.517647 0.517647 0.517647 -0.521569 0.521569 0.521569 0.521569 -0.525490 0.525490 0.525490 0.525490 -0.529412 0.529412 0.529412 0.529412 -0.533333 0.533333 0.533333 0.533333 -0.537255 0.537255 0.537255 0.537255 -0.541176 0.541176 0.541176 0.541176 -0.545098 0.545098 0.545098 0.545098 -0.549020 0.549020 0.549020 0.549020 -0.552941 0.552941 0.552941 0.552941 -0.556863 0.556863 0.556863 0.556863 -0.560784 0.560784 0.560784 0.560784 -0.564706 0.564706 0.564706 0.564706 -0.568627 0.568627 0.568627 0.568627 -0.572549 0.572549 0.572549 0.572549 -0.576471 0.576471 0.576471 0.576471 -0.580392 0.580392 0.580392 0.580392 -0.584314 0.584314 0.584314 0.584314 -0.588235 0.588235 0.588235 0.588235 -0.592157 0.592157 0.592157 0.592157 -0.596078 0.596078 0.596078 0.596078 -0.600000 0.600000 0.600000 0.600000 -0.603922 0.603922 0.603922 0.603922 -0.607843 0.607843 0.607843 0.607843 -0.611765 0.611765 0.611765 0.611765 -0.615686 0.615686 0.615686 0.615686 -0.619608 0.619608 0.619608 0.619608 -0.623529 0.623529 0.623529 0.623529 -0.627451 0.627451 0.627451 0.627451 -0.631373 0.631373 0.631373 0.631373 -0.635294 0.635294 0.635294 0.635294 -0.639216 0.639216 0.639216 0.639216 -0.643137 0.643137 0.643137 0.643137 -0.647059 0.647059 0.647059 0.647059 -0.650980 0.650980 0.650980 0.650980 -0.654902 0.654902 0.654902 0.654902 -0.658824 0.658824 0.658824 0.658824 -0.662745 0.662745 0.662745 0.662745 -0.666667 0.666667 0.666667 0.666667 -0.670588 0.670588 0.670588 0.670588 -0.674510 0.674510 0.674510 0.674510 -0.678431 0.678431 0.678431 0.678431 -0.682353 0.682353 0.682353 0.682353 -0.686275 0.686275 0.686275 0.686275 -0.690196 0.690196 0.690196 0.690196 -0.694118 0.694118 0.694118 0.694118 -0.698039 0.698039 0.698039 0.698039 -0.701961 0.701961 0.701961 0.701961 -0.705882 0.705882 0.705882 0.705882 -0.709804 0.709804 0.709804 0.709804 -0.713725 0.713725 0.713725 0.713725 -0.717647 0.717647 0.717647 0.717647 -0.721569 0.721569 0.721569 0.721569 -0.725490 0.725490 0.725490 0.725490 -0.729412 0.729412 0.729412 0.729412 -0.733333 0.733333 0.733333 0.733333 -0.737255 0.737255 0.737255 0.737255 -0.741176 0.741176 0.741176 0.741176 -0.745098 0.745098 0.745098 0.745098 -0.749020 0.749020 0.749020 0.749020 -0.752941 0.752941 0.752941 0.752941 -0.756863 0.756863 0.756863 0.756863 -0.760784 0.760784 0.760784 0.760784 -0.764706 0.764706 0.764706 0.764706 -0.768627 0.768627 0.768627 0.768627 -0.772549 0.772549 0.772549 0.772549 -0.776471 0.776471 0.776471 0.776471 -0.780392 0.780392 0.780392 0.780392 -0.784314 0.784314 0.784314 0.784314 -0.788235 0.788235 0.788235 0.788235 -0.792157 0.792157 0.792157 0.792157 -0.796078 0.796078 0.796078 0.796078 -0.800000 0.800000 0.800000 0.800000 -0.803922 0.803922 0.803922 0.803922 -0.807843 0.807843 0.807843 0.807843 -0.811765 0.811765 0.811765 0.811765 -0.815686 0.815686 0.815686 0.815686 -0.819608 0.819608 0.819608 0.819608 -0.823529 0.823529 0.823529 0.823529 -0.827451 0.827451 0.827451 0.827451 -0.831373 0.831373 0.831373 0.831373 -0.835294 0.835294 0.835294 0.835294 -0.839216 0.839216 0.839216 0.839216 -0.843137 0.843137 0.843137 0.843137 -0.847059 0.847059 0.847059 0.847059 -0.850980 0.850980 0.850980 0.850980 -0.854902 0.854902 0.854902 0.854902 -0.858824 0.858824 0.858824 0.858824 -0.862745 0.862745 0.862745 0.862745 -0.866667 0.866667 0.866667 0.866667 -0.870588 0.870588 0.870588 0.870588 -0.874510 0.874510 0.874510 0.874510 -0.878431 0.878431 0.878431 0.878431 -0.882353 0.882353 0.882353 0.882353 -0.886275 0.886275 0.886275 0.886275 -0.890196 0.890196 0.890196 0.890196 -0.894118 0.894118 0.894118 0.894118 -0.898039 0.898039 0.898039 0.898039 -0.901961 0.901961 0.901961 0.901961 -0.905882 0.905882 0.905882 0.905882 -0.909804 0.909804 0.909804 0.909804 -0.913725 0.913725 0.913725 0.913725 -0.917647 0.917647 0.917647 0.917647 -0.921569 0.921569 0.921569 0.921569 -0.925490 0.925490 0.925490 0.925490 -0.929412 0.929412 0.929412 0.929412 -0.933333 0.933333 0.933333 0.933333 -0.937255 0.937255 0.937255 0.937255 -0.941176 0.941176 0.941176 0.941176 -0.945098 0.945098 0.945098 0.945098 -0.949020 0.949020 0.949020 0.949020 -0.952941 0.952941 0.952941 0.952941 -0.956863 0.956863 0.956863 0.956863 -0.960784 0.960784 0.960784 0.960784 -0.964706 0.964706 0.964706 0.964706 -0.968627 0.968627 0.968627 0.968627 -0.972549 0.972549 0.972549 0.972549 -0.976471 0.976471 0.976471 0.976471 -0.980392 0.980392 0.980392 0.980392 -0.984314 0.984314 0.984314 0.984314 -0.988235 0.988235 0.988235 0.988235 -0.992157 0.992157 0.992157 0.992157 -0.996078 0.996078 0.996078 0.996078 -1.000000 1.000000 1.000000 1.000000 -END_DATA diff --git a/spectro/munki.c b/spectro/munki.c index df54cd9..57f5ce8 100644 --- a/spectro/munki.c +++ b/spectro/munki.c @@ -66,7 +66,7 @@ static inst_code munki_interp_code(munki *p, munki_code ec); /* Establish communications with a Munki */ /* If it's a serial port, use the baud rate given, and timeout in to secs */ -/* Return MUNKI_COMS_FAIL on failure to establish communications */ +/* Return DTP_COMS_FAIL on failure to establish communications */ static inst_code munki_init_coms(inst *pp, baud_rate br, flow_control fc, double tout) { munki *p = (munki *) pp; @@ -937,7 +937,6 @@ munki_del(inst *pp) { del_munkiimp(p); if (p->icom != NULL) p->icom->del(p->icom); - p->vdel(pp); free(p); } diff --git a/spectro/rspec.c b/spectro/rspec.c index e0e0194..49d725b 100644 --- a/spectro/rspec.c +++ b/spectro/rspec.c @@ -43,7 +43,6 @@ #include "sa_config.h" #include "numsup.h" #endif /* !SALONEINSTLIB */ -#include "plot.h" #include "xspect.h" #include "insttypes.h" #include "conv.h" @@ -153,6 +152,9 @@ double rspec_raw2nm(rspec_inf *inf, double rix) { if (inf->nwlcal == 0) error("rspec_raw2nm: nwlcal == 0"); +// ~~~~9999 test fudge +// rix += 15; + /* Compute polinomial */ for (wl = inf->wlcal[inf->nwlcal-1], k = inf->nwlcal-2; k >= 0; k--) wl = wl * rix + inf->wlcal[k]; diff --git a/spectro/rspec.h b/spectro/rspec.h index 0cbee58..bc5d427 100644 --- a/spectro/rspec.h +++ b/spectro/rspec.h @@ -33,12 +33,12 @@ /* - - - - - - - - - - - - - */ /* Collection of raw samples */ typedef enum { - rspec_sensor, /* Includes shielded/temperature values */ + rspec_sensor, /* Includes shielded/temperaturee values */ rspec_raw, /* Potential light values */ rspec_wav /* Valid wavelength values */ } rspec_type; -/* The order the state is changed in, is device workflow dependent */ +/* The order the state is changed in is device workflow dependent */ typedef enum { rspec_none = 0x0000, /* No processing */ rspec_shld = 0x0002, /* Shielded cell corrected */ @@ -136,7 +136,7 @@ struct _rspec_inf { /* Completely clear an rspec_inf. */ void clear_rspec_inf(rspec_inf *inf); -/* Completely free contents of rspec_inf. */ +/* Completely free contesnt of rspec_inf. */ void free_rspec_inf(rspec_inf *inf); /* return the number of samples for the given spectral type */ diff --git a/spectro/smcube.c b/spectro/smcube.c index 8a788ec..1618447 100644 --- a/spectro/smcube.c +++ b/spectro/smcube.c @@ -140,12 +140,6 @@ static inst_code smcube_measure(smcube *p, double *XYZ); static void cube_rgb2XYZ(double *xyz, double *irgb); -int static smcube_save_calibration(smcube *p); -int static smcube_touch_calibration(smcube *p); -int static smcube_restore_calibration(smcube *p); - -/* ------------------------------------------------- */ - /* Do a full command/response echange with the smcube */ /* (This level is not multi-thread safe) */ /* Return the smcube error code. */ @@ -855,7 +849,6 @@ smcube_del(inst *pp) { if (p->icom != NULL) p->icom->del(p->icom); amutex_del(p->lock); - p->vdel(pp); free(p); } } @@ -2016,7 +2009,7 @@ static void cube_rgb2XYZ(double *xyz, double *irgb) { /* The cube doesn't have an easily accessible serial number :-( */ /* So if you have more than one, you'll be sharing the same calibration !! */ -int static smcube_save_calibration(smcube *p) { +int smcube_save_calibration(smcube *p) { int ev = SMCUBE_OK; int i; char fname[100]; /* Name */ @@ -2074,7 +2067,7 @@ int static smcube_save_calibration(smcube *p) { } /* Restore the all modes calibration from the local system */ -int static smcube_restore_calibration(smcube *p) { +int smcube_restore_calibration(smcube *p) { int ev = SMCUBE_OK; int i, j; char fname[100]; /* Name */ @@ -2176,7 +2169,7 @@ int static smcube_restore_calibration(smcube *p) { return ev; } -int static smcube_touch_calibration(smcube *p) { +int smcube_touch_calibration(smcube *p) { int ev = SMCUBE_OK; char fname[100]; /* Name */ int rv; diff --git a/spectro/spec2cie.c b/spectro/spec2cie.c index 322ab05..aa91ebb 100644 --- a/spectro/spec2cie.c +++ b/spectro/spec2cie.c @@ -389,7 +389,7 @@ main(int argc, char *argv[]) if (illum == icxIT_none) illum = icxIT_D50; - if (observ == icxOT_none) + if (observ = icxOT_none) observ = icxOT_CIE_1931_2; /* Figure out what sort of device it is */ diff --git a/spectro/specbos.c b/spectro/specbos.c index 491fe97..e819c06 100644 --- a/spectro/specbos.c +++ b/spectro/specbos.c @@ -1434,7 +1434,6 @@ specbos_del(inst *pp) { if (p->icom != NULL) p->icom->del(p->icom); amutex_del(p->lock); - p->vdel(pp); free(p); } } diff --git a/spectro/spyd2.c b/spectro/spyd2.c index 6833e89..b546f6b 100644 --- a/spectro/spyd2.c +++ b/spectro/spyd2.c @@ -642,13 +642,12 @@ spyd2_GetReading_ll( int value; int index; int flag; - int retr; + int nords, retr; unsigned char buf1[8]; /* send bytes */ unsigned char buf2[9 * 8]; /* return bytes read */ int rvals[3][8]; /* Raw values */ int _maxtcnt = 0; /* Maximum transition count */ int _mintcnt = 0x7fffffff; /* Minumum transition count */ - double maxfreq = 0.0; /* Maximum sensor frequency found */ int i, j, k; a1logd(p->log, 3, "spyd2_GetReading_ll: clocks = %d, minfc = %d, maxfc = %d\n",*clocks,*minfclks,*maxfclks); @@ -692,7 +691,7 @@ spyd2_GetReading_ll( } /* The Spyder comms seems especially flakey... */ - for (retr = 0; ; retr++) { + for (retr = 0, nords = 1; ; retr++, nords++) { //int start = msec_time(); @@ -889,14 +888,13 @@ spyd2_GetReading_ll( } else { /* We discard 0'th L2F transion to give transitions */ /* over the time period. */ if (sensv != NULL) - sensv[k] = ((double)transcnt - 1.0) * (double)CLKRATE / (double)intclks; + sensv[k] = ((double)transcnt - 1.0) * (double)CLKRATE + / ((double)nords * (double)intclks); if (transcnt > _maxtcnt) _maxtcnt = transcnt; if (transcnt < _mintcnt) _mintcnt = transcnt; } - if (sensv != NULL && sensv[k] > maxfreq) - maxfreq = sensv[k]; if (p->log->debug >= 4 && sensv != NULL) a1logd(p->log, 4, "%d: initial senv %f from transcnt %d and intclls %d\n", k,sensv[k],transcnt,intclks); @@ -969,8 +967,6 @@ spyd2_GetReading_ll( if (transcnt < _mintcnt) _mintcnt = transcnt; } - if (sensv != NULL && (8.125 * sensv[k]) > maxfreq) - maxfreq = 8.125 * sensv[k]; if (p->log->debug >= 4 && sensv != NULL) a1logd(p->log, 4, "%d: initial senv %f from transcnt %d and intclls %d\n", k,sensv[k],transcnt,intclks); @@ -982,16 +978,6 @@ spyd2_GetReading_ll( if (mintcnt != NULL) *mintcnt = _mintcnt; - if (p->log->debug >= 4 && sensv != NULL) - a1logd(p->log, 4, "Maximum sensor frequency = %f\n",maxfreq); - - /* Problem is that the HW starts loosing count above a certain */ - /* frequency, so we depend on one less bright sensor acting as a canary, */ - /* so we can't make the threshold too low. */ - if (maxfreq > 500000.0) { - return spyd2_interp_code((inst *)p, SPYD2_TOOBRIGHT); - } - return rv; } @@ -2857,7 +2843,7 @@ spyd4_load_cal(spyd2 *p) { /* Establish communications with a SPYD2 */ /* If it's a serial port, use the baud rate given, and timeout in to secs */ -/* Return SPYD2_COMS_FAIL on failure to establish communications */ +/* Return DTP_COMS_FAIL on failure to establish communications */ static inst_code spyd2_init_coms(inst *pp, baud_rate br, flow_control fc, double tout) { spyd2 *p = (spyd2 *) pp; @@ -2880,7 +2866,7 @@ spyd2_init_coms(inst *pp, baud_rate br, flow_control fc, double tout) { /* (and Spyder 2 hangs if a reset ep is done on MSWin.) */ /* The spyder 2 doesn't work well with the winusb driver either, */ /* it needs icomuf_resetep_before_read to work at all, and */ - /* gets retries anyway. So we use the libusb-win32 driver for it. */ + /* gets retries anyway. So we use the libusb0 driver for it. */ #if defined(NT) if (p->itype == instSpyder3) { usbflags |= icomuf_resetep_before_read; /* The spyder USB is buggy ? */ @@ -3405,8 +3391,6 @@ spyd2_interp_error(inst *pp, int ec) { return "Display device selection out of range"; /* User error */ - case SPYD2_TOOBRIGHT: - return "Too bright to read accuractly"; case SPYD2_NO_REFRESH_DET: return "Unable to detect & measure refresh rate"; @@ -3461,7 +3445,6 @@ spyd2_interp_code(inst *pp, int ec) { case SPYD2_DISP_SEL_RANGE: return inst_wrong_setup | ec; - case SPYD2_TOOBRIGHT: case SPYD2_NO_REFRESH_DET: return inst_misread | ec; @@ -3478,7 +3461,6 @@ spyd2_del(inst *pp) { inst_del_disptype_list(p->dtlist, p->ndtlist); if (p->samples != NULL) free(p->samples); - p->vdel(pp); free(p); } diff --git a/spectro/spyd2.h b/spectro/spyd2.h index 0588b9b..923234f 100644 --- a/spectro/spyd2.h +++ b/spectro/spyd2.h @@ -56,7 +56,6 @@ #define SPYD2_TRIGTIMEOUT 0x04 #define SPYD2_OVERALLTIMEOUT 0x05 #define SPYD2_BAD_EE_CRC 0x06 -#define SPYD2_TOOBRIGHT 0x07 /* Internal software errors */ #define SPYD2_BAD_EE_ADDRESS 0x21 diff --git a/spectro/ss.c b/spectro/ss.c index 837e264..90720ca 100644 --- a/spectro/ss.c +++ b/spectro/ss.c @@ -131,7 +131,7 @@ static void check_calcount(ss *p, int atstart) { /* Establish communications with a Spectrolino/Spectroscan */ /* Use the baud rate given, and timeout in to secs */ -/* Return SS_COMS_FAIL on failure to establish communications */ +/* Return DTP_COMS_FAIL on failure to establish communications */ static inst_code ss_init_coms(inst *pp, baud_rate br, flow_control fc, double tout) { ss *p = (ss *)pp; @@ -2037,7 +2037,6 @@ ss_del(inst *pp) { if (p->icom != NULL) p->icom->del(p->icom); - p->vdel(pp); free (p); } diff --git a/spectro/strange.cal b/spectro/strange.cal deleted file mode 100644 index 5f2e94d..0000000 --- a/spectro/strange.cal +++ /dev/null @@ -1,272 +0,0 @@ -CAL - -DESCRIPTOR "Argyll Device Calibration Curves" -ORIGINATOR "Argyll synthcal" -CREATED "Mon Oct 26 01:10:48 2015" -DEVICE_CLASS "DISPLAY" -COLOR_REP "RGB" - -NUMBER_OF_FIELDS 4 -BEGIN_DATA_FORMAT -RGB_I RGB_R RGB_G RGB_B -END_DATA_FORMAT - -NUMBER_OF_SETS 256 -BEGIN_DATA -0.00000 0.00000 0.00000 0.00000 -0.00392157 0.0000567518 0.0118787 0.0186065 -0.00784314 0.000184387 0.0206820 0.0302263 -0.0117647 0.000367355 0.0286065 0.0401466 -0.0156863 0.000599076 0.0360094 0.0491028 -0.0196078 0.000875445 0.0430471 0.0574042 -0.0235294 0.00119354 0.0498068 0.0652184 -0.0274510 0.00155112 0.0563438 0.0726496 -0.0313725 0.00194640 0.0626960 0.0797678 -0.0352941 0.00237789 0.0688909 0.0866232 -0.0392157 0.00284433 0.0749493 0.0932533 -0.0431373 0.00334462 0.0808876 0.0996872 -0.0470588 0.00387782 0.0867187 0.105948 -0.0509804 0.00444307 0.0924533 0.112053 -0.0549020 0.00503962 0.0981003 0.118020 -0.0588235 0.00566676 0.103667 0.123859 -0.0627451 0.00632388 0.109160 0.129583 -0.0666667 0.00701040 0.114585 0.135201 -0.0705882 0.00772579 0.119946 0.140720 -0.0745098 0.00846956 0.125248 0.146148 -0.0784314 0.00924125 0.130494 0.151490 -0.0823529 0.0100404 0.135689 0.156754 -0.0862745 0.0108667 0.140834 0.161942 -0.0901961 0.0117197 0.145932 0.167061 -0.0941176 0.0125991 0.150986 0.172112 -0.0980392 0.0135045 0.155998 0.177102 -0.101961 0.0144356 0.160971 0.182031 -0.105882 0.0153921 0.165905 0.186904 -0.109804 0.0163738 0.170803 0.191723 -0.113725 0.0173803 0.175665 0.196491 -0.117647 0.0184114 0.180495 0.201210 -0.121569 0.0194668 0.185292 0.205882 -0.125490 0.0205464 0.190059 0.210508 -0.129412 0.0216498 0.194796 0.215092 -0.133333 0.0227769 0.199504 0.219634 -0.137255 0.0239274 0.204184 0.224136 -0.141176 0.0251012 0.208838 0.228600 -0.145098 0.0262980 0.213466 0.233027 -0.149020 0.0275177 0.218069 0.237418 -0.152941 0.0287600 0.222648 0.241774 -0.156863 0.0300249 0.227204 0.246097 -0.160784 0.0313121 0.231737 0.250388 -0.164706 0.0326215 0.236248 0.254647 -0.168627 0.0339528 0.240737 0.258876 -0.172549 0.0353061 0.245205 0.263076 -0.176471 0.0366810 0.249654 0.267247 -0.180392 0.0380775 0.254082 0.271391 -0.184314 0.0394954 0.258491 0.275507 -0.188235 0.0409345 0.262882 0.279597 -0.192157 0.0423948 0.267254 0.283662 -0.196078 0.0438762 0.271609 0.287702 -0.200000 0.0453784 0.275946 0.291718 -0.203922 0.0469014 0.280266 0.295710 -0.207843 0.0484450 0.284570 0.299680 -0.211765 0.0500091 0.288857 0.303627 -0.215686 0.0515937 0.293128 0.307552 -0.219608 0.0531985 0.297384 0.311455 -0.223529 0.0548235 0.301625 0.315338 -0.227451 0.0564686 0.305851 0.319201 -0.231373 0.0581337 0.310063 0.323043 -0.235294 0.0598187 0.314260 0.326866 -0.239216 0.0615234 0.318443 0.330670 -0.243137 0.0632478 0.322613 0.334456 -0.247059 0.0649918 0.326769 0.338223 -0.250980 0.0667553 0.330911 0.341972 -0.254902 0.0685382 0.335041 0.345703 -0.258824 0.0703403 0.339159 0.349418 -0.262745 0.0721617 0.343264 0.353115 -0.266667 0.0740022 0.347356 0.356797 -0.270588 0.0758618 0.351437 0.360461 -0.274510 0.0777403 0.355505 0.364110 -0.278431 0.0796377 0.359563 0.367744 -0.282353 0.0815539 0.363608 0.371362 -0.286275 0.0834889 0.367643 0.374965 -0.290196 0.0854424 0.371666 0.378553 -0.294118 0.0874146 0.375679 0.382127 -0.298039 0.0894052 0.379681 0.385686 -0.301961 0.0914143 0.383672 0.389231 -0.305882 0.0934417 0.387653 0.392763 -0.309804 0.0954873 0.391624 0.396281 -0.313725 0.0975512 0.395585 0.399786 -0.317647 0.0996332 0.399536 0.403277 -0.321569 0.101733 0.403477 0.406756 -0.325490 0.103851 0.407409 0.410222 -0.329412 0.105987 0.411331 0.413676 -0.333333 0.108141 0.415244 0.417117 -0.337255 0.110313 0.419147 0.420546 -0.341176 0.112503 0.423042 0.423963 -0.345098 0.114710 0.426927 0.427368 -0.349020 0.116935 0.430804 0.430762 -0.352941 0.119177 0.434672 0.434144 -0.356863 0.121437 0.438532 0.437515 -0.360784 0.123714 0.442383 0.440875 -0.364706 0.126009 0.446225 0.444224 -0.368627 0.128321 0.450060 0.447563 -0.372549 0.130650 0.453886 0.450890 -0.376471 0.132997 0.457704 0.454207 -0.380392 0.135360 0.461514 0.457514 -0.384314 0.137741 0.465317 0.460811 -0.388235 0.140139 0.469111 0.464097 -0.392157 0.142554 0.472898 0.467374 -0.396078 0.144986 0.476678 0.470641 -0.400000 0.147435 0.480450 0.473898 -0.403922 0.149900 0.484214 0.477145 -0.407843 0.152383 0.487972 0.480383 -0.411765 0.154882 0.491722 0.483612 -0.415686 0.157398 0.495465 0.486831 -0.419608 0.159931 0.499200 0.490042 -0.423529 0.162480 0.502929 0.493243 -0.427451 0.165046 0.506651 0.496436 -0.431373 0.167628 0.510366 0.499619 -0.435294 0.170227 0.514075 0.502794 -0.439216 0.172842 0.517776 0.505961 -0.443137 0.175474 0.521472 0.509119 -0.447059 0.178122 0.525160 0.512269 -0.450980 0.180787 0.528842 0.515410 -0.454902 0.183467 0.532518 0.518543 -0.458824 0.186164 0.536187 0.521668 -0.462745 0.188877 0.539850 0.524785 -0.466667 0.191606 0.543507 0.527895 -0.470588 0.194351 0.547158 0.530996 -0.474510 0.197113 0.550803 0.534090 -0.478431 0.199890 0.554441 0.537176 -0.482353 0.202684 0.558074 0.540254 -0.486275 0.205493 0.561701 0.543325 -0.490196 0.208318 0.565322 0.546388 -0.494118 0.211159 0.568937 0.549444 -0.498039 0.214016 0.572547 0.552493 -0.501961 0.216889 0.576150 0.555535 -0.505882 0.219777 0.579748 0.558569 -0.509804 0.222681 0.583341 0.561597 -0.513725 0.225601 0.586928 0.564617 -0.517647 0.228536 0.590510 0.567631 -0.521569 0.231487 0.594086 0.570638 -0.525490 0.234454 0.597657 0.573638 -0.529412 0.237436 0.601222 0.576631 -0.533333 0.240434 0.604782 0.579618 -0.537255 0.243447 0.608337 0.582598 -0.541176 0.246476 0.611887 0.585571 -0.545098 0.249520 0.615431 0.588538 -0.549020 0.252579 0.618971 0.591499 -0.552941 0.255654 0.622505 0.594453 -0.556863 0.258744 0.626035 0.597401 -0.560784 0.261849 0.629559 0.600343 -0.564706 0.264970 0.633079 0.603279 -0.568627 0.268105 0.636594 0.606208 -0.572549 0.271256 0.640103 0.609132 -0.576471 0.274422 0.643608 0.612049 -0.580392 0.277603 0.647109 0.614961 -0.584314 0.280800 0.650604 0.617867 -0.588235 0.284011 0.654095 0.620766 -0.592157 0.287237 0.657581 0.623661 -0.596078 0.290478 0.661063 0.626549 -0.600000 0.293735 0.664540 0.629431 -0.603922 0.297006 0.668012 0.632308 -0.607843 0.300292 0.671480 0.635180 -0.611765 0.303593 0.674944 0.638045 -0.615686 0.306909 0.678403 0.640906 -0.619608 0.310239 0.681857 0.643761 -0.623529 0.313585 0.685308 0.646610 -0.627451 0.316945 0.688754 0.649454 -0.631373 0.320320 0.692195 0.652293 -0.635294 0.323709 0.695633 0.655126 -0.639216 0.327114 0.699066 0.657954 -0.643137 0.330533 0.702495 0.660777 -0.647059 0.333966 0.705919 0.663595 -0.650980 0.337414 0.709340 0.666408 -0.654902 0.340877 0.712756 0.669215 -0.658824 0.344354 0.716169 0.672018 -0.662745 0.347846 0.719577 0.674816 -0.666667 0.351352 0.722981 0.677608 -0.670588 0.354873 0.726381 0.680396 -0.674510 0.358408 0.729778 0.683179 -0.678431 0.361958 0.733170 0.685957 -0.682353 0.365522 0.736559 0.688730 -0.686275 0.369100 0.739943 0.691498 -0.690196 0.372693 0.743324 0.694262 -0.694118 0.376300 0.746701 0.697021 -0.698039 0.379921 0.750074 0.699775 -0.701961 0.383557 0.753443 0.702525 -0.705882 0.387207 0.756808 0.705270 -0.709804 0.390871 0.760170 0.708010 -0.713725 0.394549 0.763528 0.710746 -0.717647 0.398242 0.766882 0.713477 -0.721569 0.401948 0.770233 0.716204 -0.725490 0.405669 0.773580 0.718927 -0.729412 0.409404 0.776923 0.721645 -0.733333 0.413153 0.780263 0.724358 -0.737255 0.416916 0.783599 0.727068 -0.741176 0.420693 0.786932 0.729773 -0.745098 0.424484 0.790261 0.732473 -0.749020 0.428289 0.793587 0.735170 -0.752941 0.432108 0.796909 0.737862 -0.756863 0.435940 0.800228 0.740550 -0.760784 0.439787 0.803543 0.743234 -0.764706 0.443648 0.806855 0.745914 -0.768627 0.447523 0.810164 0.748589 -0.772549 0.451411 0.813469 0.751261 -0.776471 0.455314 0.816770 0.753928 -0.780392 0.459230 0.820069 0.756592 -0.784314 0.463160 0.823364 0.759251 -0.788235 0.467103 0.826656 0.761906 -0.792157 0.471061 0.829944 0.764558 -0.796078 0.475032 0.833230 0.767205 -0.800000 0.479017 0.836512 0.769849 -0.803922 0.483016 0.839790 0.772489 -0.807843 0.487028 0.843066 0.775124 -0.811765 0.491054 0.846339 0.777756 -0.815686 0.495094 0.849608 0.780385 -0.819608 0.499147 0.852874 0.783009 -0.823529 0.503214 0.856137 0.785630 -0.827451 0.507294 0.859397 0.788247 -0.831373 0.511388 0.862654 0.790860 -0.835294 0.515496 0.865908 0.793469 -0.839216 0.519617 0.869158 0.796075 -0.843137 0.523751 0.872406 0.798677 -0.847059 0.527899 0.875651 0.801276 -0.850980 0.532061 0.878892 0.803871 -0.854902 0.536236 0.882131 0.806462 -0.858824 0.540424 0.885367 0.809050 -0.862745 0.544626 0.888599 0.811634 -0.866667 0.548841 0.891829 0.814215 -0.870588 0.553070 0.895056 0.816792 -0.874510 0.557311 0.898280 0.819366 -0.878431 0.561567 0.901501 0.821936 -0.882353 0.565835 0.904719 0.824503 -0.886275 0.570117 0.907935 0.827066 -0.890196 0.574412 0.911147 0.829626 -0.894118 0.578721 0.914357 0.832183 -0.898039 0.583042 0.917564 0.834736 -0.901961 0.587377 0.920768 0.837286 -0.905882 0.591725 0.923969 0.839833 -0.909804 0.596087 0.927168 0.842376 -0.913725 0.600461 0.930363 0.844916 -0.917647 0.604849 0.933556 0.847453 -0.921569 0.609249 0.936747 0.849986 -0.925490 0.613663 0.939934 0.852516 -0.929412 0.618090 0.943119 0.855044 -0.933333 0.622530 0.946301 0.857567 -0.937255 0.626984 0.949481 0.860088 -0.941176 0.631450 0.952658 0.862606 -0.945098 0.635929 0.955832 0.865120 -0.949020 0.640421 0.959003 0.867631 -0.952941 0.644927 0.962172 0.870139 -0.956863 0.649445 0.965339 0.872644 -0.960784 0.653976 0.968502 0.875146 -0.964706 0.658521 0.971664 0.877645 -0.968627 0.663078 0.974822 0.880141 -0.972549 0.667648 0.977978 0.882634 -0.976471 0.672231 0.981132 0.885124 -0.980392 0.676827 0.984283 0.887610 -0.984314 0.681436 0.987431 0.890094 -0.988235 0.686058 0.990577 0.892575 -0.992157 0.690692 0.993721 0.895053 -0.996078 0.695340 0.996862 0.897528 -1.000000 0.700000 1.000000 0.900000 -END_DATA diff --git a/spectro/usbio.c b/spectro/usbio.c index 9f8964a..668544a 100644 --- a/spectro/usbio.c +++ b/spectro/usbio.c @@ -118,7 +118,7 @@ int rwsize, /* Bytes to read or write */ double tout /* Timeout in seconds */ ) { int rv = 0; /* Return value */ - int rwbytes; /* Data bytes read or written */ + int c, rwbytes; /* Data bytes read or written */ long top; /* timeout in msec */ if (p->log->debug >= 8) { @@ -412,7 +412,7 @@ double tout) /* Until data is all written, we time out, or the user aborts */ for (top = ttop; top > 0 && len > 0;) { - int rv; + int c, rv; a1logd(p->log, 8, "icoms_usb_ser_write: attempting to write %d bytes to usb top = %d\n",len,top); rv = icoms_usb_transaction(p, NULL, &wbytes, type, (unsigned char)ep, (unsigned char *)wbuf, len, top); diff --git a/spectro/usbio_nt.c b/spectro/usbio_nt.c index f5c3af8..8daac0d 100644 --- a/spectro/usbio_nt.c +++ b/spectro/usbio_nt.c @@ -567,7 +567,7 @@ char **pnames /* List of process names to try and kill before opening */ /* -------------------------------------------------------------- */ -/* Our universal USB transfer function, used for rd/wr. */ +/* Our universal USB transfer function */ /* It appears that we may return a timeout with valid characters. */ static int icoms_usb_transaction( icoms *p, |