From 9491825ddff7a294d1f49061bae7044e426aeb2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Fri, 6 Nov 2015 05:38:49 +0100 Subject: Imported Upstream version 1.8.3 --- spectro/IntsLib_Readme.txt | 0 spectro/Jamfile | 0 spectro/License.txt | 0 spectro/License2.txt | 0 spectro/License3.txt | 0 spectro/LzmaDec.c | 0 spectro/LzmaDec.h | 0 spectro/LzmaTypes.h | 0 spectro/Makefile.OSX | 0 spectro/Makefile.SA | 0 spectro/Makefile.UNIX | 0 spectro/Makefile.WNT | 0 spectro/Readme.txt | 0 spectro/SOtele.sp | 0 spectro/afiles | 0 spectro/aglob.c | 1 + spectro/aglob.h | 0 spectro/average.c | 0 spectro/base64.c | 0 spectro/base64.h | 0 spectro/ccwin.c | 0 spectro/ccwin.h | 0 spectro/ccxx.ti1 | 0 spectro/ccxxmake.c | 5 +- spectro/chartread.c | 19 +++++-- spectro/colorhug.c | 1 + spectro/colorhug.h | 0 spectro/conv.c | 9 ++++ spectro/conv.h | 0 spectro/cubecal.h | 0 spectro/dispcal.c | 0 spectro/dispread.c | 0 spectro/dispsup.c | 0 spectro/dispsup.h | 0 spectro/disptechs.c | 0 spectro/disptechs.h | 0 spectro/dispwin.c | 7 ++- spectro/dispwin.h | 0 spectro/dtp20.c | 5 +- spectro/dtp20.h | 0 spectro/dtp22.c | 3 +- spectro/dtp22.h | 0 spectro/dtp41.c | 5 +- spectro/dtp41.h | 0 spectro/dtp51.c | 3 +- spectro/dtp51.h | 0 spectro/dtp92.c | 3 +- spectro/dtp92.h | 0 spectro/ex1.c | 11 ++-- spectro/ex1.h | 0 spectro/fakeread.c | 0 spectro/hcfr.c | 1 + spectro/hcfr.h | 0 spectro/hidio.c | 0 spectro/hidio.h | 0 spectro/huey.c | 5 +- spectro/huey.h | 0 spectro/i1d3.c | 58 +++++++++++++++++++-- spectro/i1d3.h | 1 + spectro/i1disp.c | 3 +- spectro/i1disp.h | 0 spectro/i1pro.c | 3 +- spectro/i1pro.h | 0 spectro/i1pro_imp.c | 123 ++++++++++++++++++++++++++++++++++----------- spectro/i1pro_imp.h | 8 ++- spectro/icoms.c | 0 spectro/icoms.h | 0 spectro/icoms_nt.c | 0 spectro/icoms_ux.c | 0 spectro/ifiles | 0 spectro/illumread.c | 0 spectro/inflate.c | 0 spectro/inst.c | 18 +++++++ spectro/inst.h | 4 ++ spectro/instappsup.c | 2 +- spectro/instappsup.h | 0 spectro/instlib.ksh | 0 spectro/instlib.txt | 0 spectro/insttypeinst.h | 0 spectro/insttypes.c | 0 spectro/insttypes.h | 0 spectro/iusb.h | 0 spectro/kleink10.c | 114 +++++++++++++++++++++++++++++++---------- spectro/kleink10.h | 0 spectro/linear.cal | 2 +- spectro/linear.sp | 0 spectro/madvrwin.c | 0 spectro/madvrwin.h | 0 spectro/mongoose.c | 0 spectro/mongoose.h | 0 spectro/munki.c | 3 +- spectro/munki.h | 0 spectro/munki_imp.c | 0 spectro/munki_imp.h | 0 spectro/oemarch.c | 0 spectro/oemarch.h | 0 spectro/oeminst.c | 0 spectro/pollem.c | 0 spectro/pollem.h | 0 spectro/rspec.c | 4 +- spectro/rspec.h | 6 +-- spectro/smcube.c | 13 +++-- spectro/smcube.h | 0 spectro/spec2cie.c | 2 +- spectro/specbos.c | 1 + spectro/specbos.h | 0 spectro/spotread.c | 0 spectro/spyd2.c | 30 ++++++++--- spectro/spyd2.h | 1 + spectro/ss.c | 3 +- spectro/ss.h | 0 spectro/ss_imp.c | 0 spectro/ss_imp.h | 0 spectro/strange.cal | 2 +- spectro/synthcal.c | 0 spectro/synthread.c | 0 spectro/usbio.c | 4 +- spectro/usbio.h | 0 spectro/usbio_bsd.c | 0 spectro/usbio_lx.c | 0 spectro/usbio_nt.c | 2 +- spectro/usbio_ox.c | 0 spectro/vinflate.c | 0 spectro/webwin.c | 0 spectro/webwin.h | 0 spectro/xdg_bds.c | 0 spectro/xdg_bds.h | 0 127 files changed, 376 insertions(+), 109 deletions(-) mode change 100644 => 100755 spectro/IntsLib_Readme.txt mode change 100644 => 100755 spectro/Jamfile mode change 100644 => 100755 spectro/License.txt mode change 100644 => 100755 spectro/License2.txt mode change 100644 => 100755 spectro/License3.txt mode change 100644 => 100755 spectro/LzmaDec.c mode change 100644 => 100755 spectro/LzmaDec.h mode change 100644 => 100755 spectro/LzmaTypes.h mode change 100644 => 100755 spectro/Makefile.OSX mode change 100644 => 100755 spectro/Makefile.SA mode change 100644 => 100755 spectro/Makefile.UNIX mode change 100644 => 100755 spectro/Makefile.WNT mode change 100644 => 100755 spectro/Readme.txt mode change 100644 => 100755 spectro/SOtele.sp mode change 100644 => 100755 spectro/afiles mode change 100644 => 100755 spectro/aglob.c mode change 100644 => 100755 spectro/aglob.h mode change 100644 => 100755 spectro/average.c mode change 100644 => 100755 spectro/base64.c mode change 100644 => 100755 spectro/base64.h mode change 100644 => 100755 spectro/ccwin.c mode change 100644 => 100755 spectro/ccwin.h mode change 100644 => 100755 spectro/ccxx.ti1 mode change 100644 => 100755 spectro/ccxxmake.c mode change 100644 => 100755 spectro/chartread.c mode change 100644 => 100755 spectro/colorhug.c mode change 100644 => 100755 spectro/colorhug.h mode change 100644 => 100755 spectro/conv.c mode change 100644 => 100755 spectro/conv.h mode change 100644 => 100755 spectro/cubecal.h mode change 100644 => 100755 spectro/dispcal.c mode change 100644 => 100755 spectro/dispread.c mode change 100644 => 100755 spectro/dispsup.c mode change 100644 => 100755 spectro/dispsup.h mode change 100644 => 100755 spectro/disptechs.c mode change 100644 => 100755 spectro/disptechs.h mode change 100644 => 100755 spectro/dispwin.c mode change 100644 => 100755 spectro/dispwin.h mode change 100644 => 100755 spectro/dtp20.c mode change 100644 => 100755 spectro/dtp20.h mode change 100644 => 100755 spectro/dtp22.c mode change 100644 => 100755 spectro/dtp22.h mode change 100644 => 100755 spectro/dtp41.c mode change 100644 => 100755 spectro/dtp41.h mode change 100644 => 100755 spectro/dtp51.c mode change 100644 => 100755 spectro/dtp51.h mode change 100644 => 100755 spectro/dtp92.c mode change 100644 => 100755 spectro/dtp92.h mode change 100644 => 100755 spectro/ex1.c mode change 100644 => 100755 spectro/ex1.h mode change 100644 => 100755 spectro/fakeread.c mode change 100644 => 100755 spectro/hcfr.c mode change 100644 => 100755 spectro/hcfr.h mode change 100644 => 100755 spectro/hidio.c mode change 100644 => 100755 spectro/hidio.h mode change 100644 => 100755 spectro/huey.c mode change 100644 => 100755 spectro/huey.h mode change 100644 => 100755 spectro/i1d3.c mode change 100644 => 100755 spectro/i1d3.h mode change 100644 => 100755 spectro/i1disp.c mode change 100644 => 100755 spectro/i1disp.h mode change 100644 => 100755 spectro/i1pro.c mode change 100644 => 100755 spectro/i1pro.h mode change 100644 => 100755 spectro/i1pro_imp.c mode change 100644 => 100755 spectro/i1pro_imp.h mode change 100644 => 100755 spectro/icoms.c mode change 100644 => 100755 spectro/icoms.h mode change 100644 => 100755 spectro/icoms_nt.c mode change 100644 => 100755 spectro/icoms_ux.c mode change 100644 => 100755 spectro/ifiles mode change 100644 => 100755 spectro/illumread.c mode change 100644 => 100755 spectro/inflate.c mode change 100644 => 100755 spectro/inst.c mode change 100644 => 100755 spectro/inst.h mode change 100644 => 100755 spectro/instappsup.c mode change 100644 => 100755 spectro/instappsup.h mode change 100644 => 100755 spectro/instlib.ksh mode change 100644 => 100755 spectro/instlib.txt mode change 100644 => 100755 spectro/insttypeinst.h mode change 100644 => 100755 spectro/insttypes.c mode change 100644 => 100755 spectro/insttypes.h mode change 100644 => 100755 spectro/iusb.h mode change 100644 => 100755 spectro/kleink10.c mode change 100644 => 100755 spectro/kleink10.h mode change 100644 => 100755 spectro/linear.cal mode change 100644 => 100755 spectro/linear.sp mode change 100644 => 100755 spectro/madvrwin.c mode change 100644 => 100755 spectro/madvrwin.h mode change 100644 => 100755 spectro/mongoose.c mode change 100644 => 100755 spectro/mongoose.h mode change 100644 => 100755 spectro/munki.c mode change 100644 => 100755 spectro/munki.h mode change 100644 => 100755 spectro/munki_imp.c mode change 100644 => 100755 spectro/munki_imp.h mode change 100644 => 100755 spectro/oemarch.c mode change 100644 => 100755 spectro/oemarch.h mode change 100644 => 100755 spectro/oeminst.c mode change 100644 => 100755 spectro/pollem.c mode change 100644 => 100755 spectro/pollem.h mode change 100644 => 100755 spectro/rspec.c mode change 100644 => 100755 spectro/rspec.h mode change 100644 => 100755 spectro/smcube.c mode change 100644 => 100755 spectro/smcube.h mode change 100644 => 100755 spectro/spec2cie.c mode change 100644 => 100755 spectro/specbos.c mode change 100644 => 100755 spectro/specbos.h mode change 100644 => 100755 spectro/spotread.c mode change 100644 => 100755 spectro/spyd2.c mode change 100644 => 100755 spectro/spyd2.h mode change 100644 => 100755 spectro/ss.c mode change 100644 => 100755 spectro/ss.h mode change 100644 => 100755 spectro/ss_imp.c mode change 100644 => 100755 spectro/ss_imp.h mode change 100644 => 100755 spectro/strange.cal mode change 100644 => 100755 spectro/synthcal.c mode change 100644 => 100755 spectro/synthread.c mode change 100644 => 100755 spectro/usbio.c mode change 100644 => 100755 spectro/usbio.h mode change 100644 => 100755 spectro/usbio_bsd.c mode change 100644 => 100755 spectro/usbio_lx.c mode change 100644 => 100755 spectro/usbio_nt.c mode change 100644 => 100755 spectro/usbio_ox.c mode change 100644 => 100755 spectro/vinflate.c mode change 100644 => 100755 spectro/webwin.c mode change 100644 => 100755 spectro/webwin.h mode change 100644 => 100755 spectro/xdg_bds.c mode change 100644 => 100755 spectro/xdg_bds.h (limited to 'spectro') diff --git a/spectro/IntsLib_Readme.txt b/spectro/IntsLib_Readme.txt old mode 100644 new mode 100755 diff --git a/spectro/Jamfile b/spectro/Jamfile old mode 100644 new mode 100755 diff --git a/spectro/License.txt b/spectro/License.txt old mode 100644 new mode 100755 diff --git a/spectro/License2.txt b/spectro/License2.txt old mode 100644 new mode 100755 diff --git a/spectro/License3.txt b/spectro/License3.txt old mode 100644 new mode 100755 diff --git a/spectro/LzmaDec.c b/spectro/LzmaDec.c old mode 100644 new mode 100755 diff --git a/spectro/LzmaDec.h b/spectro/LzmaDec.h old mode 100644 new mode 100755 diff --git a/spectro/LzmaTypes.h b/spectro/LzmaTypes.h old mode 100644 new mode 100755 diff --git a/spectro/Makefile.OSX b/spectro/Makefile.OSX old mode 100644 new mode 100755 diff --git a/spectro/Makefile.SA b/spectro/Makefile.SA old mode 100644 new mode 100755 diff --git a/spectro/Makefile.UNIX b/spectro/Makefile.UNIX old mode 100644 new mode 100755 diff --git a/spectro/Makefile.WNT b/spectro/Makefile.WNT old mode 100644 new mode 100755 diff --git a/spectro/Readme.txt b/spectro/Readme.txt old mode 100644 new mode 100755 diff --git a/spectro/SOtele.sp b/spectro/SOtele.sp old mode 100644 new mode 100755 diff --git a/spectro/afiles b/spectro/afiles old mode 100644 new mode 100755 diff --git a/spectro/aglob.c b/spectro/aglob.c old mode 100644 new mode 100755 index 2ba37d5..dbf9157 --- a/spectro/aglob.c +++ b/spectro/aglob.c @@ -42,6 +42,7 @@ # include #endif +#include #include #include #include diff --git a/spectro/aglob.h b/spectro/aglob.h old mode 100644 new mode 100755 diff --git a/spectro/average.c b/spectro/average.c old mode 100644 new mode 100755 diff --git a/spectro/base64.c b/spectro/base64.c old mode 100644 new mode 100755 diff --git a/spectro/base64.h b/spectro/base64.h old mode 100644 new mode 100755 diff --git a/spectro/ccwin.c b/spectro/ccwin.c old mode 100644 new mode 100755 diff --git a/spectro/ccwin.h b/spectro/ccwin.h old mode 100644 new mode 100755 diff --git a/spectro/ccxx.ti1 b/spectro/ccxx.ti1 old mode 100644 new mode 100755 diff --git a/spectro/ccxxmake.c b/spectro/ccxxmake.c old mode 100644 new mode 100755 index 4202c67..418affc --- a/spectro/ccxxmake.c +++ b/spectro/ccxxmake.c @@ -27,6 +27,9 @@ /* 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. @@ -34,7 +37,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. + or an i1D3 created .ti3 as the reference. (can do this with .ti3 files). 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 old mode 100644 new mode 100755 index 0fc7646..9cf6c22 --- a/spectro/chartread.c +++ b/spectro/chartread.c @@ -198,6 +198,7 @@ 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 */ @@ -1389,7 +1390,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 (disbidi == 0 && (cap2 & inst2_bidi_scan)) + if (rand && disbidi == 0 && (cap2 & inst2_bidi_scan)) dirrg = 2; /* Enable bi-directional strip recognition */ /* DTP51 has a nasty habit of misaligning test squares by +/- 1 */ @@ -1463,7 +1464,7 @@ a1log *log /* verb, debug & error log */ } } } - if (emit_warnings != 0 && boroi != oroi) { /* Looks like the wrong strip */ + if (emit_warnings != 0 && rand && boroi != oroi) { /* Looks like the wrong strip */ char *mm = NULL; mm = paix->aix(paix, boroi); #ifdef DEBUG @@ -2110,6 +2111,7 @@ 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); @@ -2472,10 +2474,13 @@ 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]); - else if ((ti = icg->find_kword(icg, 0, "CHART_ID")) >= 0) + rand = 1; + } 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; @@ -2503,6 +2508,10 @@ 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 = "); @@ -2838,7 +2847,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, hex, ipath, fc, plen, glen, tlen, + saix, ixord, rstart, rand, 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 old mode 100644 new mode 100755 index 1b2a56d..7397314 --- a/spectro/colorhug.c +++ b/spectro/colorhug.c @@ -825,6 +825,7 @@ 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/colorhug.h b/spectro/colorhug.h old mode 100644 new mode 100755 diff --git a/spectro/conv.c b/spectro/conv.c old mode 100644 new mode 100755 index 1a8c78b..94023db --- a/spectro/conv.c +++ b/spectro/conv.c @@ -68,6 +68,7 @@ //#include #include #include +#include #include #include #include @@ -263,12 +264,14 @@ 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); @@ -278,6 +281,7 @@ 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); } } @@ -549,6 +553,8 @@ 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) { @@ -779,6 +785,7 @@ 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); @@ -794,6 +801,7 @@ 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); @@ -803,6 +811,7 @@ 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/conv.h b/spectro/conv.h old mode 100644 new mode 100755 diff --git a/spectro/cubecal.h b/spectro/cubecal.h old mode 100644 new mode 100755 diff --git a/spectro/dispcal.c b/spectro/dispcal.c old mode 100644 new mode 100755 diff --git a/spectro/dispread.c b/spectro/dispread.c old mode 100644 new mode 100755 diff --git a/spectro/dispsup.c b/spectro/dispsup.c old mode 100644 new mode 100755 diff --git a/spectro/dispsup.h b/spectro/dispsup.h old mode 100644 new mode 100755 diff --git a/spectro/disptechs.c b/spectro/disptechs.c old mode 100644 new mode 100755 diff --git a/spectro/disptechs.h b/spectro/disptechs.h old mode 100644 new mode 100755 diff --git a/spectro/dispwin.c b/spectro/dispwin.c old mode 100644 new mode 100755 index 69536f3..fffbaee --- a/spectro/dispwin.c +++ b/spectro/dispwin.c @@ -3624,6 +3624,9 @@ 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 */ @@ -6451,7 +6454,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], 2.0); + dw->r->v[j][i] = pow(dw->or->v[j][i], 1.6); } } printf("Darkening screen\n"); @@ -6464,7 +6467,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.5); + dw->r->v[j][i] = pow(dw->or->v[j][i], 0.625); } } printf("Lightening screen\n"); diff --git a/spectro/dispwin.h b/spectro/dispwin.h old mode 100644 new mode 100755 diff --git a/spectro/dtp20.c b/spectro/dtp20.c old mode 100644 new mode 100755 index a504803..6af2484 --- a/spectro/dtp20.c +++ b/spectro/dtp20.c @@ -217,7 +217,7 @@ double top) { /* Timout in seconds */ } /* Establish communications with a DTP20 */ -/* Return DTP_COMS_FAIL on failure to establish communications */ +/* Return DTP20_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,7 +1402,8 @@ dtp20_del(inst *pp) { dtp20 *p = (dtp20 *)pp; if (p->icom != NULL) p->icom->del(p->icom); - free (p); + p->vdel(pp); + free(p); } /* Set the instrument capabilities */ diff --git a/spectro/dtp20.h b/spectro/dtp20.h old mode 100644 new mode 100755 diff --git a/spectro/dtp22.c b/spectro/dtp22.c old mode 100644 new mode 100755 index d332ffc..2cb3634 --- 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 DTP_COMS_FAIL on failure to establish communications */ +/* Return DTP22_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,6 +930,7 @@ 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/dtp22.h b/spectro/dtp22.h old mode 100644 new mode 100755 diff --git a/spectro/dtp41.c b/spectro/dtp41.c old mode 100644 new mode 100755 index 5c3361c..44ac6c6 --- 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 DTP_COMS_FAIL on failure to establish communications */ +/* Return DTP41_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,7 +1085,8 @@ dtp41_del(inst *pp) { dtp41 *p = (dtp41 *)pp; if (p->icom != NULL) p->icom->del(p->icom); - free (p); + p->vdel(pp); + free(p); } /* Interogate the device to discover its capabilities */ diff --git a/spectro/dtp41.h b/spectro/dtp41.h old mode 100644 new mode 100755 diff --git a/spectro/dtp51.c b/spectro/dtp51.c old mode 100644 new mode 100755 index cfd1265..ab1999d --- 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 DTP_COMS_FAIL on failure to establish communications */ +/* Return DTP51_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,6 +787,7 @@ 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/dtp51.h b/spectro/dtp51.h old mode 100644 new mode 100755 diff --git a/spectro/dtp92.c b/spectro/dtp92.c old mode 100644 new mode 100755 index 1ed9bc1..3b6dacd --- 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 DTP_COMS_FAIL on failure to establish communications */ +/* Return DTP92_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,6 +1023,7 @@ 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/dtp92.h b/spectro/dtp92.h old mode 100644 new mode 100755 diff --git a/spectro/ex1.c b/spectro/ex1.c old mode 100644 new mode 100755 index 93d0a31..b336cbc --- a/spectro/ex1.c +++ b/spectro/ex1.c @@ -147,6 +147,10 @@ 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 */ @@ -1038,6 +1042,7 @@ ex1_del(inst *pp) { if (p->conv != NULL) p->conv->del(p->conv); + p->vdel(pp); free(p); } } @@ -1234,7 +1239,7 @@ extern ex1 *new_ex1(icoms *icom, instType itype) { /* =============================================================================== */ /* Calibration info save/restore */ -int ex1_save_calibration(ex1 *p) { +static int ex1_save_calibration(ex1 *p) { int ev = EX1_OK; int i; char fname[100]; /* Name */ @@ -1280,7 +1285,7 @@ int ex1_save_calibration(ex1 *p) { } /* Restore the all modes calibration from the local system */ -int ex1_restore_calibration(ex1 *p) { +static int ex1_restore_calibration(ex1 *p) { int ev = EX1_OK; int i, j; char fname[100]; /* Name */ @@ -1353,7 +1358,7 @@ int ex1_restore_calibration(ex1 *p) { return ev; } -int ex1_touch_calibration(ex1 *p) { +static int ex1_touch_calibration(ex1 *p) { int ev = EX1_OK; char fname[100]; /* Name */ int rv; diff --git a/spectro/ex1.h b/spectro/ex1.h old mode 100644 new mode 100755 diff --git a/spectro/fakeread.c b/spectro/fakeread.c old mode 100644 new mode 100755 diff --git a/spectro/hcfr.c b/spectro/hcfr.c old mode 100644 new mode 100755 index d0a8261..a6c457e --- a/spectro/hcfr.c +++ b/spectro/hcfr.c @@ -637,6 +637,7 @@ 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/hcfr.h b/spectro/hcfr.h old mode 100644 new mode 100755 diff --git a/spectro/hidio.c b/spectro/hidio.c old mode 100644 new mode 100755 diff --git a/spectro/hidio.h b/spectro/hidio.h old mode 100644 new mode 100755 diff --git a/spectro/huey.c b/spectro/huey.c old mode 100644 new mode 100755 index 79f8089..b09ed2c --- 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 libusb, or an HID driver. */ +/* We allow for communicating via usbio, 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 DTP_COMS_FAIL on failure to establish communications */ +/* Return HUEY_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,6 +1400,7 @@ 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/huey.h b/spectro/huey.h old mode 100644 new mode 100755 diff --git a/spectro/i1d3.c b/spectro/i1d3.c old mode 100644 new mode 100755 index 689f328..df7d3f0 --- a/spectro/i1d3.c +++ b/spectro/i1d3.c @@ -34,6 +34,10 @@ and agreed to support. */ +/* TTBD: + +*/ + #include #include #include @@ -70,6 +74,8 @@ #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); @@ -105,6 +111,12 @@ 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 ?? */ @@ -174,7 +186,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 libusb, or an HID driver. */ +/* We allow for communicating via usbio, or an HID driver. */ static inst_code i1d3_command( i1d3 *p, /* i1d3 object */ @@ -265,6 +277,21 @@ 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]); @@ -756,7 +783,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 values */ + double rgb[3] /* Return the RGB count values */ ) { int intclks; unsigned char todev[64]; @@ -1568,6 +1595,11 @@ 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 */ @@ -1863,6 +1895,11 @@ 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 */ @@ -1907,6 +1944,11 @@ 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; } @@ -1983,7 +2025,7 @@ static inst_code i1d3_decode_intEE( p->serial_no[20] = '\000'; strncpy(p->vers_no, (char *)buf + 0x2C, 10); - p->serial_no[10] = '\000'; + p->vers_no[10] = '\000'; /* Read the black level offset */ for (i = 0; i < 3; i++) { @@ -2395,7 +2437,7 @@ i1d3_set_cal(i1d3 *p) { /* ------------------------------------------------------------------------ */ /* Establish communications with a I1D3 */ -/* Return DTP_COMS_FAIL on failure to establish communications */ +/* Return I1D3_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; @@ -3287,6 +3329,9 @@ 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: @@ -3355,11 +3400,13 @@ 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 @@ -3411,6 +3458,7 @@ 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 old mode 100644 new mode 100755 index 47f3858..bb239df --- a/spectro/i1d3.h +++ b/spectro/i1d3.h @@ -63,6 +63,7 @@ #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 old mode 100644 new mode 100755 index 437e1fa..489c6cd --- 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 DTP_COMS_FAIL on failure to establish communications */ +/* Return I1DISP_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,6 +2240,7 @@ 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/i1disp.h b/spectro/i1disp.h old mode 100644 new mode 100755 diff --git a/spectro/i1pro.c b/spectro/i1pro.c old mode 100644 new mode 100755 index 96335cc..816aee5 --- 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 DTP_COMS_FAIL on failure to establish communications */ +/* Return I1PRO_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,6 +806,7 @@ 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.h b/spectro/i1pro.h old mode 100644 new mode 100755 diff --git a/spectro/i1pro_imp.c b/spectro/i1pro_imp.c old mode 100644 new mode 100755 index 0b6fc69..8577f8c --- a/spectro/i1pro_imp.c +++ b/spectro/i1pro_imp.c @@ -149,6 +149,8 @@ /* 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 */ @@ -398,6 +400,7 @@ 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); @@ -958,6 +961,7 @@ 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); @@ -972,6 +976,7 @@ 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) { @@ -1057,12 +1062,14 @@ 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; @@ -1620,10 +1627,10 @@ i1pro_code i1pro_imp_calibrate( || (s->emiss && !s->adaptive && !s->scan) || (s->trans && !s->adaptive))) { int stm; - int usesdct23 = 0; /* Is a mode that uses dcaltime2 & 3 */ + int usesdct234 = 0; /* Is a mode that uses dcaltime2, 3 & 4 */ if (s->emiss && !s->adaptive && !s->scan) - usesdct23 = 1; + usesdct234 = 1; nummeas = i1pro_comp_nummeas(p, s->dcaltime, s->inttime); @@ -1637,7 +1644,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 (usesdct23) { + if (usesdct234) { 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(); @@ -1658,6 +1665,17 @@ 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; @@ -1686,13 +1704,15 @@ 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, tranfer it too */ - if (usesdct23 && ss->emiss && !ss->adaptive && !ss->scan) { + /* If this is a mode with dark_data2/3/4, tranfer it too */ + if (usesdct234 && ss->emiss && !ss->adaptive && !ss->scan) { ss->dark_int_time2 = s->dark_int_time2; - ss->dark_int_time3 = s->dark_int_time2; + ss->dark_int_time3 = s->dark_int_time3; + ss->dark_int_time4 = s->dark_int_time4; 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]; } } } @@ -2276,6 +2296,9 @@ 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; @@ -2284,30 +2307,43 @@ 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 alternate display integration time %f seconds\n",s->dark_int_time2); + a1logd(p->log,2,"Switching to 2nd display integration time %f seconds\n",s->dark_int_time2); + /* swap in 2nd display integration time */ 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 alternate display integration time */ + /* saturation, switch to the 3rd 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 alternate display integration time %f seconds\n",s->dark_int_time3); + a1logd(p->log,2,"Switching to 3rd 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 2nd alternate */ + /* swap in 3rd time */ 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); @@ -2947,16 +2983,16 @@ i1pro_code i1pro_imp_measure( /* and try again. */ if (s->emiss && !s->scan && !s->adaptive && ev == I1PRO_RD_SENSORSATURATED - && s->dispswap < 2) { + && s->dispswap < 3) { double *tt, tv; if (s->dispswap == 0) { - a1logd(p->log,2,"Switching to alternate display integration time %f seconds\n",s->dark_int_time2); + a1logd(p->log,2,"Switching to 2nd 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 2nd alternate display integration time %f seconds\n",s->dark_int_time3); + a1logd(p->log,2,"Switching to 3rd 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; @@ -2964,6 +3000,15 @@ 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); @@ -4145,6 +4190,8 @@ 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) { @@ -4288,7 +4335,10 @@ 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); + 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 */ for (j = -1; j < m->nraw; j++) read_doubles(&x, fp, &dd, 1); read_ints(&x, fp, &di, 1); @@ -4338,6 +4388,7 @@ 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); @@ -4384,6 +4435,8 @@ 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) { @@ -4419,6 +4472,7 @@ 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) @@ -4451,6 +4505,9 @@ 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; @@ -4480,7 +4537,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\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,"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,"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]); } } @@ -4489,6 +4546,7 @@ 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); @@ -4549,6 +4607,8 @@ 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; @@ -10724,14 +10784,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\n",se); + a1logd(p->log,1,"i1pro_readEEProm: read failed with ICOM err 0x%x (%d msec)\n",se, msec_time()-stime); 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\n",se); + a1logd(p->log,1,"i1pro_readEEProm: read failed with ICOM err 0x%x (%d msec)\n",se, msec_time()-stime); return rv; } @@ -10812,7 +10872,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\n",se); + a1logd(p->log,2,"i1pro_writeEEProm: write failed with ICOM err 0x%x (%d msec)\n",se, msec_time()-stime); return rv; } @@ -10820,7 +10880,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\n",se); + a1logd(p->log,1,"i1pro_writeEEProm: failed with ICOM err 0x%x (%d msec)\n",se, msec_time()-stime); return rv; } @@ -10837,7 +10897,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\n",se); + a1logd(p->log,1,"i1pro_writeEEProm: write failed with ICOM err 0x%x (%d msec)\n",se, msec_time()-stime); return rv; } @@ -10889,7 +10949,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\n",se); + a1logd(p->log,1,"i1pro_getmisc: failed with ICOM err 0x%x (%d msec)\n",se, msec_time()-stime); return rv; } @@ -10937,7 +10997,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\n",se); + a1logd(p->log,1,"i1pro_getmeasparams: failed with ICOM err 0x%x (%d msec)\n",se, msec_time()-stime); return rv; } @@ -11002,7 +11062,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\n",se); + a1logd(p->log,1,"i1pro_setmeasparams: failed with ICOM err 0x%x (%d msec)\n",se, msec_time()-stime); return rv; } @@ -11318,10 +11378,13 @@ 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\n",se); + a1logd(p->log,1,"i1pro_setmcmode: failed with ICOM err 0x%x (%d msec)\n",se, msec_time()-stime); 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; @@ -11358,7 +11421,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\n",se); + a1logd(p->log,1,"i1pro_getmcmode: failed with ICOM err 0x%x (%d msec)\n",se, msec_time()-stime); return rv; } @@ -11403,7 +11466,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\n",se); + a1logd(p->log,1,"i1pro_waitfor_switch: failed with ICOM err 0x%x (%d msec)\n",se, msec_time()-stime); return rv; } diff --git a/spectro/i1pro_imp.h b/spectro/i1pro_imp.h old mode 100644 new mode 100755 index 6bf8de4..5a2cef2 --- a/spectro/i1pro_imp.h +++ b/spectro/i1pro_imp.h @@ -127,6 +127,7 @@ 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 */ @@ -135,6 +136,9 @@ 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; @@ -200,8 +204,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 = Rev D */ - /* 629 = Rev E (i1pro2) */ + /* 101 = Rev A, 202 = Rev A update, 302 = Rev B, */ + /* 502, 505, 631 = Rev D, 629 = Rev E (i1pro2) */ int cpldrev; /* int - CPLD revision number in EEProm */ /* Not used internaly ???? */ diff --git a/spectro/icoms.c b/spectro/icoms.c old mode 100644 new mode 100755 diff --git a/spectro/icoms.h b/spectro/icoms.h old mode 100644 new mode 100755 diff --git a/spectro/icoms_nt.c b/spectro/icoms_nt.c old mode 100644 new mode 100755 diff --git a/spectro/icoms_ux.c b/spectro/icoms_ux.c old mode 100644 new mode 100755 diff --git a/spectro/ifiles b/spectro/ifiles old mode 100644 new mode 100755 diff --git a/spectro/illumread.c b/spectro/illumread.c old mode 100644 new mode 100755 diff --git a/spectro/inflate.c b/spectro/inflate.c old mode 100644 new mode 100755 diff --git a/spectro/inst.c b/spectro/inst.c old mode 100644 new mode 100755 index 949e34f..8976669 --- a/spectro/inst.c +++ b/spectro/inst.c @@ -581,6 +581,18 @@ 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. */ @@ -702,6 +714,8 @@ 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; @@ -785,6 +799,10 @@ 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 old mode 100644 new mode 100755 index d47f7ea..736a879 --- a/spectro/inst.h +++ b/spectro/inst.h @@ -643,6 +643,10 @@ 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 old mode 100644 new mode 100755 index 0762bbe..d2ce7ff --- 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/instappsup.h b/spectro/instappsup.h old mode 100644 new mode 100755 diff --git a/spectro/instlib.ksh b/spectro/instlib.ksh old mode 100644 new mode 100755 diff --git a/spectro/instlib.txt b/spectro/instlib.txt old mode 100644 new mode 100755 diff --git a/spectro/insttypeinst.h b/spectro/insttypeinst.h old mode 100644 new mode 100755 diff --git a/spectro/insttypes.c b/spectro/insttypes.c old mode 100644 new mode 100755 diff --git a/spectro/insttypes.h b/spectro/insttypes.h old mode 100644 new mode 100755 diff --git a/spectro/iusb.h b/spectro/iusb.h old mode 100644 new mode 100755 diff --git a/spectro/kleink10.c b/spectro/kleink10.c old mode 100644 new mode 100755 index 461cb28..9599972 --- 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 3 /* [3] Retry range error readings 3 times */ +#define RETRY_RANGE_ERROR 4 /* [4] Retry range error readings 4 times */ #undef PLOT_REFRESH /* [und] Plot refresh rate measurement info */ #undef PLOT_UPDELAY /* [und] Plot update delay measurement info */ @@ -81,6 +81,7 @@ 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') { @@ -125,28 +126,34 @@ extract_ec(char *s, int *nlength, int bread) { if (*p == '>') break; } - if (p < s) + if (p < s) { +//printf("p %d < s %d ? %d\n", p, s, 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) + if (p-f-1 <= 0) { +//printf("p-f-1 %d <= 0 ? %d\n", p-f-1, p-f-1 <= 0); return K10_BAD_RETVAL; + } strncpy(tt, f+1, p-f-1); tt[p-f-1] = '\000'; @@ -155,7 +162,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 id more than one can occur. */ + /* really prioritize them if more than one can occur. */ for (p = tt; *p != '\000'; p++) { rv = decodeK10err(*p); break; @@ -467,7 +474,15 @@ 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) { + 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) { amutex_unlock(p->lock); return ev; } @@ -510,14 +525,20 @@ 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 = "K10"; + model = "K-10"; break; case k10_k10a: - model = "K10-A"; + model = "K-10A"; break; case k10_kv10a: - model = "KV10-A"; + model = "KV-10A"; break; } a1logv(p->log, 1, " Model: '%s'\n",model); @@ -886,7 +907,7 @@ kleink10 *p) { /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ -static abort_flicker(kleink10 *p, int isnew, double *retbuf) { +static void abort_flicker(kleink10 *p, int isnew, double *retbuf) { char buf[MAX_MES_SIZE]; int bread; @@ -976,7 +997,15 @@ 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) { + 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) { amutex_unlock(p->lock); free(retbuf); a1logd(p->log, 1, "k10_read_flicker: L0 failed\n"); @@ -1182,9 +1211,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, XYZ[3]; + int range[3]; /* Range for RGB sensor values */ + int i, tries, ntav = 1; /* Number of readings to average */ + double v, vv; if (!p->gotcoms) return inst_no_coms; @@ -1230,7 +1259,15 @@ 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) { + 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) { amutex_unlock(p->lock); a1logd(p->log, 1, "k10_read_sample: L0 failed\n"); return rv; @@ -1256,7 +1293,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) @@ -1273,7 +1310,6 @@ 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. */ @@ -1292,13 +1328,26 @@ 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++) { - if ((rv = k10_command(p, "N5\r", buf, MAX_MES_SIZE, &bsize, 15, ec_ec, 2.0)) != inst_ok) + 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 break; + } + if ((rv = decodeN5(p, XYZ, range, buf, bsize)) != inst_ok) break; @@ -1321,10 +1370,6 @@ 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); @@ -2396,6 +2441,7 @@ k10_del(inst *pp) { if (p->icom != NULL) p->icom->del(p->icom); amutex_del(p->lock); + p->vdel(pp); free(p); } } @@ -2741,14 +2787,30 @@ 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) { + 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) { 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) { + 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) { amutex_unlock(p->lock); a1logd(p->log, 1, "k10_get_set_opt: L0 failed\n"); return ev; diff --git a/spectro/kleink10.h b/spectro/kleink10.h old mode 100644 new mode 100755 diff --git a/spectro/linear.cal b/spectro/linear.cal old mode 100644 new mode 100755 index 96cad93..9c88605 --- a/spectro/linear.cal +++ b/spectro/linear.cal @@ -2,7 +2,7 @@ CAL DESCRIPTOR "Argyll Device Calibration Curves" ORIGINATOR "Argyll synthcal" -CREATED "Mon Sep 07 03:37:56 2015" +CREATED "Mon Oct 26 01:10:48 2015" DEVICE_CLASS "DISPLAY" COLOR_REP "RGB" diff --git a/spectro/linear.sp b/spectro/linear.sp old mode 100644 new mode 100755 diff --git a/spectro/madvrwin.c b/spectro/madvrwin.c old mode 100644 new mode 100755 diff --git a/spectro/madvrwin.h b/spectro/madvrwin.h old mode 100644 new mode 100755 diff --git a/spectro/mongoose.c b/spectro/mongoose.c old mode 100644 new mode 100755 diff --git a/spectro/mongoose.h b/spectro/mongoose.h old mode 100644 new mode 100755 diff --git a/spectro/munki.c b/spectro/munki.c old mode 100644 new mode 100755 index 57f5ce8..df54cd9 --- 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 DTP_COMS_FAIL on failure to establish communications */ +/* Return MUNKI_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,6 +937,7 @@ 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/munki.h b/spectro/munki.h old mode 100644 new mode 100755 diff --git a/spectro/munki_imp.c b/spectro/munki_imp.c old mode 100644 new mode 100755 diff --git a/spectro/munki_imp.h b/spectro/munki_imp.h old mode 100644 new mode 100755 diff --git a/spectro/oemarch.c b/spectro/oemarch.c old mode 100644 new mode 100755 diff --git a/spectro/oemarch.h b/spectro/oemarch.h old mode 100644 new mode 100755 diff --git a/spectro/oeminst.c b/spectro/oeminst.c old mode 100644 new mode 100755 diff --git a/spectro/pollem.c b/spectro/pollem.c old mode 100644 new mode 100755 diff --git a/spectro/pollem.h b/spectro/pollem.h old mode 100644 new mode 100755 diff --git a/spectro/rspec.c b/spectro/rspec.c old mode 100644 new mode 100755 index 49d725b..e0e0194 --- a/spectro/rspec.c +++ b/spectro/rspec.c @@ -43,6 +43,7 @@ #include "sa_config.h" #include "numsup.h" #endif /* !SALONEINSTLIB */ +#include "plot.h" #include "xspect.h" #include "insttypes.h" #include "conv.h" @@ -152,9 +153,6 @@ 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 old mode 100644 new mode 100755 index bc5d427..0cbee58 --- a/spectro/rspec.h +++ b/spectro/rspec.h @@ -33,12 +33,12 @@ /* - - - - - - - - - - - - - */ /* Collection of raw samples */ typedef enum { - rspec_sensor, /* Includes shielded/temperaturee values */ + rspec_sensor, /* Includes shielded/temperature 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 contesnt of rspec_inf. */ +/* Completely free contents 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 old mode 100644 new mode 100755 index 1618447..8a788ec --- a/spectro/smcube.c +++ b/spectro/smcube.c @@ -140,6 +140,12 @@ 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. */ @@ -849,6 +855,7 @@ smcube_del(inst *pp) { if (p->icom != NULL) p->icom->del(p->icom); amutex_del(p->lock); + p->vdel(pp); free(p); } } @@ -2009,7 +2016,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 smcube_save_calibration(smcube *p) { +int static smcube_save_calibration(smcube *p) { int ev = SMCUBE_OK; int i; char fname[100]; /* Name */ @@ -2067,7 +2074,7 @@ int smcube_save_calibration(smcube *p) { } /* Restore the all modes calibration from the local system */ -int smcube_restore_calibration(smcube *p) { +int static smcube_restore_calibration(smcube *p) { int ev = SMCUBE_OK; int i, j; char fname[100]; /* Name */ @@ -2169,7 +2176,7 @@ int smcube_restore_calibration(smcube *p) { return ev; } -int smcube_touch_calibration(smcube *p) { +int static smcube_touch_calibration(smcube *p) { int ev = SMCUBE_OK; char fname[100]; /* Name */ int rv; diff --git a/spectro/smcube.h b/spectro/smcube.h old mode 100644 new mode 100755 diff --git a/spectro/spec2cie.c b/spectro/spec2cie.c old mode 100644 new mode 100755 index aa91ebb..322ab05 --- 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 old mode 100644 new mode 100755 index e819c06..491fe97 --- a/spectro/specbos.c +++ b/spectro/specbos.c @@ -1434,6 +1434,7 @@ 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/specbos.h b/spectro/specbos.h old mode 100644 new mode 100755 diff --git a/spectro/spotread.c b/spectro/spotread.c old mode 100644 new mode 100755 diff --git a/spectro/spyd2.c b/spectro/spyd2.c old mode 100644 new mode 100755 index b546f6b..6833e89 --- a/spectro/spyd2.c +++ b/spectro/spyd2.c @@ -642,12 +642,13 @@ spyd2_GetReading_ll( int value; int index; int flag; - int nords, retr; + int 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); @@ -691,7 +692,7 @@ spyd2_GetReading_ll( } /* The Spyder comms seems especially flakey... */ - for (retr = 0, nords = 1; ; retr++, nords++) { + for (retr = 0; ; retr++) { //int start = msec_time(); @@ -888,13 +889,14 @@ 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)nords * (double)intclks); + sensv[k] = ((double)transcnt - 1.0) * (double)CLKRATE / (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); @@ -967,6 +969,8 @@ 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); @@ -978,6 +982,16 @@ 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; } @@ -2843,7 +2857,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 DTP_COMS_FAIL on failure to establish communications */ +/* Return SPYD2_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; @@ -2866,7 +2880,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 libusb0 driver for it. */ + /* gets retries anyway. So we use the libusb-win32 driver for it. */ #if defined(NT) if (p->itype == instSpyder3) { usbflags |= icomuf_resetep_before_read; /* The spyder USB is buggy ? */ @@ -3391,6 +3405,8 @@ 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"; @@ -3445,6 +3461,7 @@ 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; @@ -3461,6 +3478,7 @@ 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 old mode 100644 new mode 100755 index 923234f..0588b9b --- a/spectro/spyd2.h +++ b/spectro/spyd2.h @@ -56,6 +56,7 @@ #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 old mode 100644 new mode 100755 index 90720ca..837e264 --- 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 DTP_COMS_FAIL on failure to establish communications */ +/* Return SS_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,6 +2037,7 @@ ss_del(inst *pp) { if (p->icom != NULL) p->icom->del(p->icom); + p->vdel(pp); free (p); } diff --git a/spectro/ss.h b/spectro/ss.h old mode 100644 new mode 100755 diff --git a/spectro/ss_imp.c b/spectro/ss_imp.c old mode 100644 new mode 100755 diff --git a/spectro/ss_imp.h b/spectro/ss_imp.h old mode 100644 new mode 100755 diff --git a/spectro/strange.cal b/spectro/strange.cal old mode 100644 new mode 100755 index 406fba4..5f2e94d --- a/spectro/strange.cal +++ b/spectro/strange.cal @@ -2,7 +2,7 @@ CAL DESCRIPTOR "Argyll Device Calibration Curves" ORIGINATOR "Argyll synthcal" -CREATED "Mon Sep 07 03:37:56 2015" +CREATED "Mon Oct 26 01:10:48 2015" DEVICE_CLASS "DISPLAY" COLOR_REP "RGB" diff --git a/spectro/synthcal.c b/spectro/synthcal.c old mode 100644 new mode 100755 diff --git a/spectro/synthread.c b/spectro/synthread.c old mode 100644 new mode 100755 diff --git a/spectro/usbio.c b/spectro/usbio.c old mode 100644 new mode 100755 index 668544a..9f8964a --- 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 c, rwbytes; /* Data bytes read or written */ + int 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 c, rv; + int 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.h b/spectro/usbio.h old mode 100644 new mode 100755 diff --git a/spectro/usbio_bsd.c b/spectro/usbio_bsd.c old mode 100644 new mode 100755 diff --git a/spectro/usbio_lx.c b/spectro/usbio_lx.c old mode 100644 new mode 100755 diff --git a/spectro/usbio_nt.c b/spectro/usbio_nt.c old mode 100644 new mode 100755 index 8daac0d..f5c3af8 --- 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 */ +/* Our universal USB transfer function, used for rd/wr. */ /* It appears that we may return a timeout with valid characters. */ static int icoms_usb_transaction( icoms *p, diff --git a/spectro/usbio_ox.c b/spectro/usbio_ox.c old mode 100644 new mode 100755 diff --git a/spectro/vinflate.c b/spectro/vinflate.c old mode 100644 new mode 100755 diff --git a/spectro/webwin.c b/spectro/webwin.c old mode 100644 new mode 100755 diff --git a/spectro/webwin.h b/spectro/webwin.h old mode 100644 new mode 100755 diff --git a/spectro/xdg_bds.c b/spectro/xdg_bds.c old mode 100644 new mode 100755 diff --git a/spectro/xdg_bds.h b/spectro/xdg_bds.h old mode 100644 new mode 100755 -- cgit v1.2.3