   (fn [navdata]
     (reset! (:navdata drone) navdata)
     (reset! (:connected? drone) true)
+    (let [disable-emergency? (:disable-emergency? drone)
+          state (:state navdata)]
+      (if (and state (= (:emergency-landing state) :on) @disable-emergency?)
+        (swap! (:ref drone) assoc :emergency true)
+        (do
+          (swap! (:ref drone) assoc :emergency false)
+          (reset! disable-emergency? false))))
     (raise-event drone :navdata navdata)))
 
 

  drone)


(defn- assoc-exclusive
  "Sets k1 to v and removes k2 from a map."
  [map k1 k2 v]

                :command-queue (ref '())
                :ref (atom {})
                :pcmd (atom {})
                :disable-emergency? (atom false)
                :seq-num (ref 1)
                :connected? (atom false)
                :event-handler event-handler
