libRDI.expect
changeset 12 5e67754f6457
parent 8 45809527a522
--- a/libRDI.expect	Thu Nov 21 14:01:21 2013 +0000
+++ b/libRDI.expect	Fri Jul 03 10:25:08 2020 -0400
@@ -2,9 +2,9 @@
 #======================================================================
 #                    L I B R D I . E X P E C T 
 #                    doc: Mon Mar  8 02:57:35 2004
-#                    dlm: Wed Dec 29 16:00:39 2010
+#                    dlm: Fri Jul  3 10:23:56 2020
 #                    (c) 2004 A.M. Thurnherr
-#                    uE-Info: 255 0 NIL 0 0 72 2 2 8 NIL ofnI
+#                    uE-Info: 48 40 NIL 0 0 72 2 2 8 NIL ofnI
 #======================================================================
 
 # HISTORY:
@@ -43,7 +43,9 @@
 # Dec  1, 2010: - replaced ! by * in upload_file
 # Dec  9, 2010: - increased timeout to 10s in load_factory_defaults
 # Dec 10, 2010: - changed version to 1.5
-# Dec 29, 2010: - implemented work-around to always wake up slave first
+# Dec 29, 2010: - implemented work-around to always wake up uplooker first
+# Jul  3, 2020: - expunged master/slave terminology
+#		- changed version to 1.6
 
 # NOTE: after having written this, I am not much of a fan of TCL and and
 #	expect(1) syntax any more...
@@ -67,10 +69,10 @@
 set TOGGLE	\024;	# ^T
 set DNLOAD	\030;	# ^X
 
-set cid -1;						# current instrument (master or slave)
+set cid -1;						# current instrument (DL or UL)
 
 proc print_version {} {
-	send_user "acquire V1.5\n"
+	send_user "acquire V1.6\n"
 }
 
 proc set_color {{cid -1}} {				# set instrument color
@@ -146,8 +148,8 @@
 	if {$cid == 0} {set cid 1} else {set cid 0}
 }
 
-proc select_master {{toggle_first 1}} {			# select master & check S/N
-	global cid master_sn slave_sn;
+proc select_DL {{toggle_first 1}} {			# select DL & check S/N
+	global cid DL_sn UL_sn;
 
 	if {$toggle_first} toggle_instrument;
 	gobble_prompts;
@@ -155,15 +157,15 @@
 	send "PS0\r";
 	expect {
 		timeout {error "Can't determine serial number"}
-		-timeout 8 -re "Instrument S/N:  $master_sn.*>|Xducer Ser #:  $master_sn.*>|PS0...>" {}
-		-timeout 8 -re "Instrument S/N:  $slave_sn.*>" {
+		-timeout 8 -re "Instrument S/N:  $DL_sn.*>|Xducer Ser #:  $DL_sn.*>|PS0...>" {}
+		-timeout 8 -re "Instrument S/N:  $UL_sn.*>" {
 			toggle_instrument;
 			send "PS0\r";
 			expect {
 				timeout {error "Can't determine serial number"}
-				-timeout 8 -re "Instrument S/N:  $master_sn.*>|Xducer Ser #:  $master_sn.*>|PS0...>" {}
-				-timeout 8 -re "Instrument S/N:  $slave_sn.*>" {
-					error "Can't switch to master"
+				-timeout 8 -re "Instrument S/N:  $DL_sn.*>|Xducer Ser #:  $DL_sn.*>|PS0...>" {}
+				-timeout 8 -re "Instrument S/N:  $UL_sn.*>" {
+					error "Can't switch to DL"
 				}
 			}
 		}
@@ -171,24 +173,24 @@
 	set cid 0;
 }
 
-proc select_slave {{toggle_first 1}} {			# select slave & check S/N
-	global cid master_sn slave_sn;
+proc select_UL {{toggle_first 1}} {			# select UL & check S/N
+	global cid DL_sn UL_sn;
 
 	if {$toggle_first} toggle_instrument;
 	gobble_prompts;
 	send "\r"; wait_for_prompt;			# save current value
 	send "PS0\r";
 	expect {
-		timeout {error "Can't determine master/slave"}
-		-timeout 8 -re "Instrument S/N:  $slave_sn.*>" {}
-		-timeout 8 -re "Instrument S/N:  $master_sn.*>|Xducer Ser #:  $master_sn.*>|PS0...>" {
+		timeout {error "Can't determine DL/UL"}
+		-timeout 8 -re "Instrument S/N:  $UL_sn.*>" {}
+		-timeout 8 -re "Instrument S/N:  $DL_sn.*>|Xducer Ser #:  $DL_sn.*>|PS0...>" {
 			toggle_instrument;
 			send "PS0\r";
 			expect {
-				timeout {error "Can't determine master/slave"}
-				-timeout 8 -re "Instrument S/N:  $slave_sn.*>" {}
-				-timeout 8 -re "Instrument S/N:  $master_sn.*>|Xducer Ser #:  $master_sn.*>|PS0...>" {
-					error "Can't switch to slave"
+				timeout {error "Can't determine DL/UL"}
+				-timeout 8 -re "Instrument S/N:  $UL_sn.*>" {}
+				-timeout 8 -re "Instrument S/N:  $DL_sn.*>|Xducer Ser #:  $DL_sn.*>|PS0...>" {
+					error "Can't switch to UL"
 				}
 			}
 		}
@@ -222,23 +224,23 @@
 }
 
 # In 2010 on the DIMES UK2 cruise, it was found that the instruments did
-# not communicate correctly, unless the slave was woken up first. On previous
+# not communicate correctly, unless the UL was woken up first. On previous
 # cruises it had also been found that the order in which the instruments are
 # woken up can matter, although it had not been recorded which of the instruments
 # has to be woken first. An early workaround consisted in having a commented-out
 # toggle_instrument statement at the beginning of reset_two_instruments. In case
 # the communication did not work, that statement could simply be uncommented.
-# Another workaround would be to switch the serial ports the master/slave
+# Another workaround would be to switch the serial ports the DL/UL
 # ADCPs were connected to. Neither workaround is satisfacory, of course. Therefore
 # I decided to modify the routine reset_two_instruments to wake up an instrument,
-# determine whether it is the slave and, if not, send it back to sleep, toggle,
+# determine whether it is the UL and, if not, send it back to sleep, toggle,
 # and wake up the other one. I am hoping that this is solves the problems once
 # and for all. If not, the code between the ### WORKAROUND markers should be
 # removed because it slows down comms with the ADCPs even more. In case of
 # wakeup/comms problems, the serial lines should then be switched.
 
 proc reset_two_instruments {} {			# reset regardless of state
-	global cid master_sn slave_sn;
+	global cid DL_sn UL_sn;
 	set ok 0;
 
 	while {$ok < 2} {
@@ -256,28 +258,28 @@
 	send "PS0\r";
 	expect {
 		timeout {error "Can't determine serial number"}
-		-timeout 8 -re "Instrument S/N:  $master_sn.*>|Xducer Ser #:  $master_sn.*>|PS0...>" {
+		-timeout 8 -re "Instrument S/N:  $DL_sn.*>|Xducer Ser #:  $DL_sn.*>|PS0...>" {
 			put_to_sleep;
 			toggle_instrument;
 			put_to_sleep;
 			reset_two_instruments;
 			toggle_instrument;
 		}
-		-timeout 8 -re "Instrument S/N:  $slave_sn.*>" {
+		-timeout 8 -re "Instrument S/N:  $UL_sn.*>" {
 			toggle_instrument;
                 }
 		send "PS0\r";
 		expect {
 			timeout {error "Can't determine serial number"}
-			-timeout 8 -re "Instrument S/N:  $master_sn.*>|Xducer Ser #:  $master_sn.*>|PS0...>" {}
-			-timeout 8 -re "Instrument S/N:  $slave_sn.*>" {
-				error "Can't switch to master"
+			-timeout 8 -re "Instrument S/N:  $DL_sn.*>|Xducer Ser #:  $DL_sn.*>|PS0...>" {}
+			-timeout 8 -re "Instrument S/N:  $UL_sn.*>" {
+				error "Can't switch to DL"
 			}
 		}
        }
 	set cid 0;
 ### WORKAROUND ELSE
-#	select_master;
+#	select_DL;
 ### WORKAROUND END
 }
 
@@ -344,12 +346,12 @@
 	}
 	expect -timeout 5 ">";
 
-	global cid master_download_filename slave_download_filename;
-	global master_deployment_name_fmt slave_deployment_name_fmt;
+	global cid DL_download_filename UL_download_filename;
+	global DL_deployment_name_fmt UL_deployment_name_fmt;
 	if {$cid == 0} {
-		rename_master_download_file [format $master_deployment_name_fmt $stn]000.000;
+		rename_DL_download_file [format $DL_deployment_name_fmt $stn]000.000;
 	} else {
-		rename_slave_download_file [format $slave_deployment_name_fmt $stn]000.000;
+		rename_UL_download_file [format $UL_deployment_name_fmt $stn]000.000;
         }
 }
 
@@ -545,7 +547,7 @@
 }
 
 proc get_deployment_name {} {				# get deployment name
-	global stn_format master_deployment_name_fmt;
+	global stn_format DL_deployment_name_fmt;
 	gobble_prompts;
 	send "\r"; wait_for_prompt;
 	send "RN?\r"; sleep 1;
@@ -556,7 +558,7 @@
 				error "Can't find .last_stn";
 			}
 			set stn [exec cat .last_stn];
-			set dn [format $master_deployment_name_fmt $stn];
+			set dn [format $DL_deployment_name_fmt $stn];
 			wait_for_prompt;
 			return $dn;			
 		}