    Then go to the component id state."
   [{:keys [decode-sm ^ByteBuffer input-buffer] :as channel} a-byte]
   (.put input-buffer ^byte a-byte)
-  (swap! decode-sm assoc :state compid-state
-                     :system-id (byte-to-long a-byte))
+  (reset! decode-sm compid-state)
   nil)
 
 (defn seq-id-state

    (while (zero? (.get payload (dec (.position payload))))
      (.position payload (dec (.position payload))))
    (let [trimmed-payload-size (.position payload)]
      (.aset-byte packed (.byteValue (new Long trimmed-payload-size)))

      ; now copy the array from the payload to the packed array.
      (java.lang.System/arraycopy (.array payload) 0 packed 6 (.position payload))

   Ignore every other byte. Go to Payload size state when a start byte is seen;
   don't save the byte regardless. When a start byte is seen, completely reset
   the state."
  [{:keys [decode-sm decode-message-id ^ByteBuffer input-buffer] :as channel} a-byte]
  (when (or (= a-byte MAVLINK1-START-BYTE)
            (= a-byte MAVLINK2-START-BYTE))
    (reset! decode-sm payload-size-state)
    (reset! decode-message-id nil)
    (.clear input-buffer)
    (.put input-buffer ^byte a-byte)
    nil))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
