     (let [xy (.getXYStagePosition gui)]
       [(.x xy) (.y xy)])))
 
+(defn enable-continuous-focus [on?]
+  (let [autofocus (core getAutoFocusDevice)]
+    (device-best-effort autofocus
+                        (core enableContinuousFocus on?))))
+
 (defn set-shutter-open [open?]
   (let [shutter (core getShutterDevice)]
     (device-best-effort shutter

  (when (and (@state :init-continuous-focus)
             (not (core isContinuousFocusDrive stage))
             (core isContinuousFocusEnabled))
    (core enableContinuousFocus false))
  (device-best-effort stage (core setPosition stage pos)))

(defn set-stage-position

        (set-shutter-open state))
      (when (and (@state :init-continuous-focus)
                 (not (core isContinuousFocusEnabled)))
        (core enable-continuous-focus true))
      (return-config)
      (. gui enableRoiButtons true))
    (catch Throwable t (ReportingUtils/showError t "Acquisition cleanup failed."))))
