1 #!/usr/bin/expect -f |
1 #!/usr/bin/expect -f |
2 #====================================================================== |
2 #====================================================================== |
3 # L A D C P 2 |
3 # L A D C P 2 |
4 # doc: Wed Mar 10 22:23:52 2004 |
4 # doc: Wed Mar 10 22:23:52 2004 |
5 # dlm: Fri Dec 10 14:28:20 2010 |
5 # dlm: Fri Jul 3 10:16:46 2020 |
6 # (c) 2004 A.M. Thurnherr |
6 # (c) 2004 A.M. Thurnherr |
7 # uE-Info: 70 34 NIL 0 0 72 2 2 8 NIL ofnI |
7 # uE-Info: 137 66 NIL 0 0 72 2 2 8 NIL ofnI |
8 #====================================================================== |
8 #====================================================================== |
9 |
9 |
10 # HISTORY: |
10 # HISTORY: |
11 # Mar 10, 2004: - created |
11 # Mar 10, 2004: - created |
12 # Mar 12, 2004: - released |
12 # Mar 12, 2004: - released |
20 # Nov 19, 2008: - adapted to new firmware behavior (load_factory_defaults) |
20 # Nov 19, 2008: - adapted to new firmware behavior (load_factory_defaults) |
21 # Nov 19, 2008: - added version |
21 # Nov 19, 2008: - added version |
22 # Aug 25, 2010: - DEFAULTS.expect -> CRUISE_SETUP.expect |
22 # Aug 25, 2010: - DEFAULTS.expect -> CRUISE_SETUP.expect |
23 # - libBB.expect -> libRDI.expect |
23 # - libBB.expect -> libRDI.expect |
24 # Dec 10, 2010: - allow restarting a cast with same number |
24 # Dec 10, 2010: - allow restarting a cast with same number |
|
25 # Jul 3, 2020: - expunged master/slave terminology |
25 |
26 |
26 #---------------------------------------------------------------------- |
27 #---------------------------------------------------------------------- |
27 # Setup |
28 # Setup |
28 #---------------------------------------------------------------------- |
29 #---------------------------------------------------------------------- |
29 |
30 |
88 wait_for_startup; |
89 wait_for_startup; |
89 reset_two_instruments; |
90 reset_two_instruments; |
90 if {![memory_empty]} { |
91 if {![memory_empty]} { |
91 if {![affirm "\nWARNING: Memory is not empty; continue anyway? (y/N) " 10]} { |
92 if {![affirm "\nWARNING: Memory is not empty; continue anyway? (y/N) " 10]} { |
92 send_user "Putting instruments to sleep..."; |
93 send_user "Putting instruments to sleep..."; |
93 select_master 0; put_to_sleep; |
94 select_DL 0; put_to_sleep; |
94 select_slave; put_to_sleep; |
95 select_UL; put_to_sleep; |
95 send_user "\nDone\n"; |
96 send_user "\nDone\n"; |
96 exit; |
97 exit; |
97 } |
98 } |
98 } else { |
99 } else { |
99 send_user "\n"; |
100 send_user "\n"; |
100 } |
101 } |
101 |
102 |
102 exec mkdir $cast_dir; |
103 exec mkdir $cast_dir; |
103 exec cp $master_cmd_file $cast_dir; |
104 exec cp $DL_cmd_file $cast_dir; |
104 exec cp $slave_cmd_file $cast_dir; |
105 exec cp $UL_cmd_file $cast_dir; |
105 exec echo $stn > .last_stn; |
106 exec echo $stn > .last_stn; |
106 cd $cast_dir; |
107 cd $cast_dir; |
107 |
108 |
108 if {![file isfile $master_cmd_file]} { |
109 if {![file isfile $DL_cmd_file]} { |
109 error "Failed to copy $master_cmd_file to [pwd]"; |
110 error "Failed to copy $DL_cmd_file to [pwd]"; |
110 } |
111 } |
111 if {![file isfile $slave_cmd_file]} { |
112 if {![file isfile $UL_cmd_file]} { |
112 error "Failed to copy $slave_cmd_file to [pwd]"; |
113 error "Failed to copy $UL_cmd_file to [pwd]"; |
113 } |
114 } |
114 |
115 |
115 regsub {.*/} $argv0 {} basename; |
116 regsub {.*/} $argv0 {} basename; |
116 start_logging [format %s_%s.log $basename $stnstr]; |
117 start_logging [format %s_%s.log $basename $stnstr]; |
117 |
118 |
118 send_user "Resetting instruments to factory defaults..."; |
119 send_user "Resetting instruments to factory defaults..."; |
119 select_master 0; load_factory_defaults; |
120 select_DL 0; load_factory_defaults; |
120 select_slave; load_factory_defaults; |
121 select_UL; load_factory_defaults; |
121 |
122 |
122 send_user "\nSetting instrument clocks..."; |
123 send_user "\nSetting instrument clocks..."; |
123 set_computer_time; |
124 set_computer_time; |
124 select_master 0; set_instrument_clock; |
125 select_DL 0; set_instrument_clock; |
125 select_slave; set_instrument_clock; |
126 select_UL; set_instrument_clock; |
126 |
127 |
127 send_user "\nSetting deployment names..."; |
128 send_user "\nSetting deployment names..."; |
128 select_master; set_deployment_name [format $master_deployment_name_fmt $stn]; |
129 select_DL; set_deployment_name [format $DL_deployment_name_fmt $stn]; |
129 select_slave; set_deployment_name [format $slave_deployment_name_fmt $stn]; |
130 select_UL; set_deployment_name [format $UL_deployment_name_fmt $stn]; |
130 |
131 |
131 send_user "\nUploading command files"; |
132 send_user "\nUploading command files"; |
132 select_slave 0; |
133 select_UL 0; |
133 upload_file $slave_cmd_file [format %s_log $slave_cmd_file] "[format $slave_deployment_name_fmt $stn].hwconfig"; |
134 upload_file $UL_cmd_file [format %s_log $UL_cmd_file] "[format $UL_deployment_name_fmt $stn].hwconfig"; |
134 resume_logging [format %s_%s.log $basename $stnstr]; |
135 resume_logging [format %s_%s.log $basename $stnstr]; |
135 select_master; |
136 select_DL; |
136 upload_file $master_cmd_file [format %s_log $master_cmd_file] "[format $master_deployment_name_fmt $stn].hwconfig"; |
137 upload_file $DL_cmd_file [format %s_log $DL_cmd_file] "[format $DL_deployment_name_fmt $stn].hwconfig"; |
137 |
138 |
138 send_user "\nDone\n"; |
139 send_user "\nDone\n"; |
139 |
140 |