Skip to content

Commit

Permalink
Rearrange code to accommodate custom layouts.
Browse files Browse the repository at this point in the history
  • Loading branch information
jarrett committed Jun 5, 2019
1 parent b546c81 commit c6089f1
Show file tree
Hide file tree
Showing 3 changed files with 207 additions and 148 deletions.
3 changes: 2 additions & 1 deletion project.clj
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
:dependencies [[org.clojure/clojure "1.8.0"]
[quil "3.0.0"]
[udp-wrapper "0.1.1"]
[cheshire "5.8.1"]]
[cheshire "5.8.1"]
[medley "1.2.0"]]
:plugins [[lein-exec "0.3.7"]]
:profiles {:dev {:dependencies [[midje "1.6.3"]]}})
10 changes: 5 additions & 5 deletions src/arduino_comms/communication.clj
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,12 @@
(assoc-in acc [:custom-values header] value))
acc)) message-packet (:msgs message-packet)))

(defn push-test-msg [msg]
(swap! current-accumulated-message #(let [[k v] (parse-var-set msg)]
(assoc-in % [:custom-values k] v))))

(defn push-message [msg]
(let [current @current-accumulated-message
processed (pre-process-messages msg)
log-view (concat @print-log (:msgs msg))
acc-msg (assoc processed :msgs log-view
acc-msg (assoc processed :time-posted (System/currentTimeMillis)
:msgs log-view
:custom-values (merge
(:custom-values current)
(:custom-values processed)))]
Expand All @@ -47,6 +44,9 @@
(swap! cached-messages #(conj % processed))
(reset! print-log log-view)))

(defn push-test-msg [msg]
(push-message {:msgs [msg]}))

(defonce receive-loop
(u/receive-loop
socket
Expand Down
Loading

0 comments on commit c6089f1

Please sign in to comment.