Skip to content

Commit

Permalink
Fixed issue with overwriting the .bin location in flash
Browse files Browse the repository at this point in the history
Still not a final solution until the IndexedDB values are synced into the
re-frame db.

Fixes #26
  • Loading branch information
jbondeson committed Nov 2, 2017
1 parent 431d11d commit 0213c88
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/kii/ui/components/flash.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,22 @@

(defn flash-firmware
[]
(r/with-let [dfu-path (r/atom (if ((.-sync command-exists) "dfu-util") "dfu-util" ""))
(r/with-let [loaded? (r/atom false)
dfu-path (r/atom (if ((.-sync command-exists) "dfu-util") "dfu-util" ""))
bin-file (r/atom "")
flashing? (r/atom false)
progress (r/atom "")
status (r/atom :none)]
;; TODO - Read this in on start...
(go
(if-let [cfg-val (<? (config/get :dfu-util-path))]
(reset! dfu-path cfg-val)))
(when (false? @loaded?)
(go
(let [cfg-val (<? (config/get :dfu-util-path))
last-dl (<? (config/get :last-download))]
(when (some? cfg-val) (reset! dfu-path cfg-val))
(when (some? last-dl) (reset! bin-file last-dl))
(reset! loaded? true)
)))

(go
(if-let [last-dl (<? (config/get :last-download))]
(reset! bin-file last-dl)))

(add-watch dfu-path :path-update
(fn [k a prev next]
(when (not= prev next)
Expand Down

0 comments on commit 0213c88

Please sign in to comment.