1 #!/usr/bin/expect -f |
1 #!/usr/bin/expect -f |
2 #====================================================================== |
2 #====================================================================== |
3 # E R A S E M E M 2 |
3 # E R A S E M E M 2 |
4 # doc: Mon Mar 8 02:57:35 2004 |
4 # doc: Mon Mar 8 02:57:35 2004 |
5 # dlm: Thu Aug 26 00:28:51 2010 |
5 # dlm: Fri Jul 3 10:16:02 2020 |
6 # (c) 2004 A.M. Thurnherr |
6 # (c) 2004 A.M. Thurnherr |
7 # uE-Info: 18 39 NIL 0 0 72 2 2 8 NIL ofnI |
7 # uE-Info: 61 9 NIL 0 0 72 2 2 8 NIL ofnI |
8 #====================================================================== |
8 #====================================================================== |
9 |
9 |
10 # HISTORY: |
10 # HISTORY: |
11 # Mar 8, 2004: - created |
11 # Mar 8, 2004: - created |
12 # Nov 19, 2008: - added version |
12 # Nov 19, 2008: - added version |
13 # Aug 25, 2010: - DEFAULTS.expect -> CRUISE_SETUP.expect |
13 # Aug 25, 2010: - DEFAULTS.expect -> CRUISE_SETUP.expect |
14 # - libBB.expect -> libRDI.expect |
14 # - libBB.expect -> libRDI.expect |
|
15 # Jul 3, 2020: - expunged master/slave terminology |
15 |
16 |
16 log_user 0; |
17 log_user 0; |
17 |
18 |
18 regsub {dir1} [exec which dir1] {libRDI.expect} path; |
19 regsub {dir1} [exec which dir1] {libRDI.expect} path; |
19 source $path; |
20 source $path; |
26 spawn bbabble -ms $tty0 $tty1; |
27 spawn bbabble -ms $tty0 $tty1; |
27 wait_for_startup; |
28 wait_for_startup; |
28 reset_two_instruments; |
29 reset_two_instruments; |
29 |
30 |
30 set must_erase 0; |
31 set must_erase 0; |
31 select_master 0; |
32 select_DL 0; |
32 if {[memory_empty]} { |
33 if {[memory_empty]} { |
33 select_slave; |
34 select_UL; |
34 if {[memory_empty]} { |
35 if {[memory_empty]} { |
35 send_user "\nMemory is empty --- nothing to erase.\n"; |
36 send_user "\nMemory is empty --- nothing to erase.\n"; |
36 } else { |
37 } else { |
37 send_user "\n"; list_dir; |
38 send_user "\n"; list_dir; |
38 set must_erase 1; |
39 set must_erase 1; |
39 } |
40 } |
40 } else { |
41 } else { |
41 send_user "\n"; list_dir; |
42 send_user "\n"; list_dir; |
42 set must_erase 1; |
43 set must_erase 1; |
43 select_slave; |
44 select_UL; |
44 if {![memory_empty]} { |
45 if {![memory_empty]} { |
45 send_user "\n"; list_dir; |
46 send_user "\n"; list_dir; |
46 set must_erase 1; |
47 set must_erase 1; |
47 } |
48 } |
48 } |
49 } |
49 |
50 |
50 if {$must_erase == 1} { |
51 if {$must_erase == 1} { |
51 if {[affirm "\nERASE FILES? (Y/n) --- timeout erases! " 10 1]} { |
52 if {[affirm "\nERASE FILES? (Y/n) --- timeout erases! " 10 1]} { |
52 send_user "Erasing memory..."; |
53 send_user "Erasing memory..."; |
53 select_master; erase_memory; |
54 select_DL; erase_memory; |
54 select_slave; erase_memory; |
55 select_UL; erase_memory; |
55 send_user "\n"; |
56 send_user "\n"; |
56 } |
57 } |
57 } |
58 } |
58 |
59 |
59 send_user "Putting instruments to sleep..." |
60 send_user "Putting instruments to sleep..." |
60 select_master; put_to_sleep; select_slave; put_to_sleep; |
61 select_DL; put_to_sleep; select_UL; put_to_sleep; |
61 |
62 |
62 send_user "\nDone\n" |
63 send_user "\nDone\n" |