proc dilprepLayout args {
  set bad [list]
  foreach {chan min max} {
    /tmon/sorb 260 3290
    /tmon/onek 2000 2400
    /tmon/stillt 2000 2400
    /tmon/mix 2000 2400
    /tmon/samplehtr 2600 2800
    /ts 270 320
  } {
    set val [silent 0 hval $chan]
    if {$val < $min || $val > $max } {
      lappend bad [lindex [split $chan /] end]
    } 
  }
  if {[enum_txt /dilprep/dil] eq "undef"} {
    Style hotwarning
    Label "detecting stick, please wait"
  } elseif {[enum_txt /dilprep] eq "warmup"} {
    Style hotwarning
    Label "warming up [enum_txt /dilprep/dil], please wait before opening"
  } elseif {[result _tmon status] eq "no response"} {
    Style hotwarning
    Label "LakeShore switched off"
  } elseif {[result _tmon status] ne ""} {
    Style hotwarning
    Label "LakeShore not properly connected"
  } elseif {$val == 0} {
    Style hotwarning
    Label "stick disconnected"
  } elseif {[llength $bad] > 0} {
    Style hotwarning
    Label "bad channels: $bad"
  } else {
    Label "All channels OK on [enum_txt /dilprep/dil]"
  }
}
