       new-options
       (parse-options ba next-offset new-options))))
 
-(defn parse-navdata [navdata-bytes]
-  (let [header       (get-int navdata-bytes 0)
-        state        (get-int navdata-bytes 4)
-        seqnum       (get-int navdata-bytes 8)
-        vision-flag  (= (get-int navdata-bytes 12) 1)
-        pstate       (parse-nav-state state)
-        options      (parse-options navdata-bytes 16 {})]
-    (merge
-      {:header header
-       :seq-num seqnum
-       :vision-flag vision-flag}
-      pstate
-      options)))
+
+(defn parse-navdata [navdata]
+  (when @navdata-logging? (log navdata))
+  (merge
+    {:header   (get-int navdata 0)
+     :seq-num  (get-int navdata 8)
+     :vision   (= (get-int navdata 12) 1)}
+    (parse-nav-state (get-int navdata 4))
+    (parse-options navdata 16 {})))
 
 (defonce ^DatagramSocket nav-socket (doto (DatagramSocket. 5554) (.setSoTimeout 1000)))
 (def trigger (DatagramPacket. (byte-array (map ubyte [0x01 0x00 0x00 0x00])) 4 drone-ip 5554))

      (doto nav-socket
        (.send trigger)
        (.receive packet))
      (parse-navdata (.getData packet)))
    (catch java.net.SocketTimeoutException e
      nil)))


(defn send-hover []
  (send-at "AT*PCMD" [0 0.0 0.0 0.0 0.0]))

;;
;; Dump:
