Fix list of apertures which should be raised before moving guides.
Optimise aperture selection.
This commit is contained in:
@ -125,11 +125,11 @@ proc nguide { {num "REPORTNUM"} {sel_ap_name "NONE"} {aprest_name "NONE"}} {
|
||||
if {$num != "REPORTNUM"} {
|
||||
if {$num >= 0 && $num < 8} {
|
||||
if { $sel_ap_name == "NONE" || $aprest_name == "NONE" } {
|
||||
error "EMSG(invalidarg): You must provide two aperture arguments"
|
||||
error "$EMSG(invalidarg): You must provide two aperture arguments"
|
||||
} elseif { [lsearch -nocase $ap_names $sel_ap_name] == -1 } {
|
||||
error "EMSG(invalidarg): $sel_ap_name should be one of $ap_names"
|
||||
error "$EMSG(invalidarg): $sel_ap_name should be one of $ap_names"
|
||||
} elseif { [lsearch -nocase $ap_names $aprest_name] == -1 } {
|
||||
error "EMSG(invalidarg): $aprest_name should be one of $ap_names"
|
||||
error "$EMSG(invalidarg): $aprest_name should be one of $ap_names"
|
||||
}
|
||||
}
|
||||
if {$num >= 0 && $num <= 8} {
|
||||
@ -140,7 +140,7 @@ proc nguide { {num "REPORTNUM"} {sel_ap_name "NONE"} {aprest_name "NONE"}} {
|
||||
set table_guideunit [SplitReply [pc$last posit2unit $guideposit]]
|
||||
if {[expr {abs($currpos - $table_guideunit)}] > $tol} {
|
||||
lappend pcdrvlist c$last $guideposit
|
||||
lappend apdrvlist ap$n 1
|
||||
lappend apdrvlist ap$last 1
|
||||
}
|
||||
incr last -1
|
||||
}
|
||||
@ -192,21 +192,25 @@ proc nguide { {num "REPORTNUM"} {sel_ap_name "NONE"} {aprest_name "NONE"}} {
|
||||
if {$ng != $num} {
|
||||
error "$EMSG(drivefailed)"
|
||||
} elseif {$num >= 0 && $num < 8} {
|
||||
set aprest_list {}
|
||||
for {set n [expr $last - 1]} {$n > 0} {incr n -1} {
|
||||
lappend aprest_list ap$n $aprest_name
|
||||
}
|
||||
pdrive ap$last $sel_ap_name {*}$aprest_list
|
||||
set ap_target_list {}
|
||||
set sel_ap_pos [SplitReply [ ap$last ]]
|
||||
set req_sel_ap_pos [ SplitReply [ ap$last posit2unit $sel_ap_name ] ]
|
||||
set prec [ SplitReply [ap$last precision] ]
|
||||
if { [expr abs($req_sel_ap_pos - $sel_ap_pos)] > $prec } {
|
||||
error "$EMSG(apfailed): ap$last"
|
||||
set sel_ap_prec [ SplitReply [ap$last precision] ]
|
||||
if { [expr abs($req_sel_ap_pos - $sel_ap_pos)] > $sel_ap_prec } {
|
||||
lappend ap_target_list ap$last $sel_ap_name
|
||||
}
|
||||
foreach {ap_mot ap_name} $aprest_list {
|
||||
set sel_pos [SplitReply [ $ap_mot ]]
|
||||
set req_pos [ SplitReply [ $ap_mot posit2unit $ap_name ] ]
|
||||
set prec [ SplitReply [$ap_mot precision] ]
|
||||
for {set n [expr $last - 1]} {$n > 0} {incr n -1} {
|
||||
set sel_pos [SplitReply [ ap$n ]]
|
||||
set req_pos [ SplitReply [ ap$n posit2unit $aprest_name ] ]
|
||||
set prec [ SplitReply [ap$n precision] ]
|
||||
if { [expr abs($req_pos - $sel_pos)] > $prec } {
|
||||
lappend ap_target_list ap$n $aprest_name
|
||||
}
|
||||
}
|
||||
if {[llength $ap_target_list] > 0} {
|
||||
pdrive {*}$ap_target_list
|
||||
}
|
||||
foreach {ap_mot ap_name} $ap_target_list {
|
||||
if { [expr abs($req_pos - $sel_pos)] > $prec } {
|
||||
error "$EMSG(apfailed): $ap_mot"
|
||||
}
|
||||
|
Reference in New Issue
Block a user