Skip to content

Commit

Permalink
Merge pull request #56 from happysalada/add_cljfmt
Browse files Browse the repository at this point in the history
add cljfmt and run it
  • Loading branch information
ibnuda authored Oct 10, 2020
2 parents 8874402 + a73b520 commit eabc43e
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 20 deletions.
3 changes: 2 additions & 1 deletion project.clj
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
:plugins [[lein-exec "0.3.7"]
[lein-auto "0.1.3"]
[lein-ring "0.12.5"]
[cider/cider-nrepl "0.24.0"]]
[cider/cider-nrepl "0.24.0"]
[lein-cljfmt "0.7.0"]]
:aliases {"generate-lightcycle" ["exec" "-p" "src/dactyl_keyboard/lightcycle.clj"]
"generate-manuform" ["exec" "-p" "src/dactyl_keyboard/manuform.clj"]}
:ring {:handler dactyl-keyboard.handler/app
Expand Down
9 changes: 4 additions & 5 deletions src/dactyl_keyboard/lightcycle.clj
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,7 @@
hide-pinky (fn [column row]
(not (and use-lastrow?
hide-last-pinky?
(last-pinky-location column row))))
]
(last-pinky-location column row))))]
(apply union
(for [column columns
row rows
Expand Down Expand Up @@ -342,7 +341,7 @@
(translate [0 (- (extended-plate-height %)) 0]))]
;;Connecting main thumb keys.
(union
(case thumb-count
(case thumb-count
:eight (union
(triangle-hulls (thumb-place c 0 0 (thumb-bl 1))
(thumb-place c 1 0 (thumb-br 1))
Expand All @@ -365,7 +364,7 @@
(thumb-place c 0 0 (thumb-bl 1))
(thumb-place c 1 0 (thumb-br 1))))
(triangle-hulls #_(thumb-place c 1 -1/2 (thumb-tl 2))
(thumb-place c 0 -1/2 (thumb-bl 2))
(thumb-place c 0 -1/2 (thumb-bl 2))
(thumb-place c 1 -1/2 (thumb-br 2))
(thumb-place c 0 -1/2 (thumb-tl 2))
(thumb-place c 1 -1/2 (thumb-tr 2))
Expand Down Expand Up @@ -564,7 +563,7 @@
(let [thickness (if thick-wall? 2 1)]
(->> (sphere thickness)
(translate coords)
(with-fn wall-sphere-n) )))
(with-fn wall-sphere-n))))

(defn scale-to-range [start end x]
(+ start (* (- end start) x)))
Expand Down
27 changes: 13 additions & 14 deletions src/dactyl_keyboard/manuform.clj
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@

; this is the function that puts the key switch holes
; based on the row and the column.


(defn key-place
"Puts the keys' shape to its place based on it's column and row."
[c column row shape]
Expand Down Expand Up @@ -136,8 +138,7 @@
hide-pinky (fn [column row]
(not (and (= last-row-count :full)
hide-last-pinky?
(last-pinky-location column row))))
]
(last-pinky-location column row))))]
(apply
union
(for [column (if use-inner-column? (range -1 ncols) (columns ncols))
Expand Down Expand Up @@ -200,8 +201,7 @@
hide-pinky (fn [column row]
(not (and (= last-row-count :full)
hide-last-pinky?
(last-pinky-location column row))))
]
(last-pinky-location column row))))]
(union
(apply
union
Expand Down Expand Up @@ -317,7 +317,7 @@
x-rotation (if (= thumb-count :five) 10 -6)
y-rotation (if (= thumb-count :five) -23 -34)
z-rotation (if (= thumb-count :five) 25 48)
movement (if (= thumb-count :five) [-23 -34 -6] [-29 -40 -13]) ]
movement (if (= thumb-count :five) [-23 -34 -6] [-29 -40 -13])]
(->> shape
(rotate (deg2rad x-rotation) [1 0 0])
(rotate (deg2rad y-rotation) [0 1 0])
Expand Down Expand Up @@ -355,11 +355,11 @@
z-rotation (if (= thumb-count :five) 35 52)
movement (if (= thumb-count :five) [-51 -25 -11.5] [-56.3 -43.3 -23.5])]
(->> shape
(rotate (deg2rad x-rotation) [1 0 0])
(rotate (deg2rad y-rotation) [0 1 0])
(rotate (deg2rad z-rotation) [0 0 1])
(translate (thumborigin c))
(translate movement))))
(rotate (deg2rad x-rotation) [1 0 0])
(rotate (deg2rad y-rotation) [0 1 0])
(rotate (deg2rad z-rotation) [0 0 1])
(translate (thumborigin c))
(translate movement))))

(defn thumb-1x-layout [c shape]
(let [thumb-count (get c :configuration-thumb-count)]
Expand Down Expand Up @@ -449,7 +449,7 @@
(key-place c 2 cornerrow web-post-bl)
(key-place c 2 lastrow web-post-tr)
(key-place c 2 cornerrow web-post-br)
(key-place c 3 cornerrow web-post-bl)) )))
(key-place c 3 cornerrow web-post-bl)))))

(defn thumb-connector-three [c]
(let [row-count (get c :configuration-last-row-count)
Expand Down Expand Up @@ -862,7 +862,7 @@
lastrow (flastrow nrows)
cornerrow (fcornerrow nrows)
row-count (get c :configuration-last-row-count)
thumb-tr-post (if (= (get c :configuration-thumb-count) :five ) web-post-br thumb-post-br)]
thumb-tr-post (if (= (get c :configuration-thumb-count) :five) web-post-br thumb-post-br)]
(union
(wall-brace (partial thumb-tr-place c) 0 -1 thumb-tr-post
(partial (partial key-place c) 3 (case row-count :zero cornerrow lastrow)) 0 -1 web-post-bl)
Expand Down Expand Up @@ -1156,7 +1156,7 @@
5 -1
6 -2
-3)]
( key-position c 1 0 (map - (wall-locate2 0 y-addition) [0 (/ mount-height 2) 0]))))
(key-position c 1 0 (map - (wall-locate2 0 y-addition) [0 (/ mount-height 2) 0]))))

(defn trrs-usb-holder-position [c]
(map + [17 19.3 0] [(first (trrs-usb-holder-ref c)) (second (trrs-usb-holder-ref c)) 2]))
Expand Down Expand Up @@ -1440,7 +1440,6 @@
screw-insert-outers)
(translate [0 0 -10] screw-insert-screw-holes))))))


#_(spit "things/left.scad"
(write-scad (mirror [-1 0 0] model-right)))

Expand Down

0 comments on commit eabc43e

Please sign in to comment.