Skip to content

Commit

Permalink
Merge pull request #9 from razerbann/refaktor
Browse files Browse the repository at this point in the history
Dactyl Lightcycle: Add a 5th screw insert + Fix screw holes not showing when selecting external holder option
  • Loading branch information
ibnuda authored Apr 17, 2020
2 parents 5c34b7c + 3eb29b5 commit f064a3a
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 9 deletions.
1 change: 0 additions & 1 deletion project.clj
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
[lein-ring "0.12.5"]]
:ring {:handler dactyl-keyboard.handler/app
:port 3030
:auto-refresh? true
:auto-reload? true}
:profiles {:dev {:dependencies [[javax.servlet/servlet-api "2.5"]
[ring/ring-mock "0.3.2"]]}})
31 changes: 23 additions & 8 deletions src/dactyl_keyboard/lightcycle.clj
Original file line number Diff line number Diff line change
Expand Up @@ -838,12 +838,27 @@
(translate [(first position) (second position) (/ height 2)]))))

(defn screw-placement [c bottom-radius top-radius height]
(let [lastrow (if (get c :configuration-use-lastrow?) 4.0 3.6)
lastcol (* (get c :configuration-ncols) 0.82)]
(union (screw-insert c -1.5 5 bottom-radius top-radius height)
(screw-insert c -0.5 1 bottom-radius top-radius height)
(screw-insert c 2 lastrow bottom-radius top-radius height)
(screw-insert c lastcol 1.6 bottom-radius top-radius height))))
(let [lastrow (if (get c :configuration-use-lastrow?) 4 3.55)
toprow (if (get c :configuration-use-numrow?) -0.12 0.8)
ncols (get c :configuration-ncols)
ncold-coefficient (case ncols
4 0.77
5 0.8
6 0.82)
lastcol (* ncols ncold-coefficient)
middlecol (case ncols
4 2
5 1.7
6 2)
middlerow (case ncols
4 1.5
5 3
6 3)]
(union (screw-insert c -1.5 4.9 bottom-radius top-radius height)
(screw-insert c 2 toprow bottom-radius top-radius height)
(screw-insert c -0.75 2 bottom-radius top-radius height)
(screw-insert c middlerow lastrow bottom-radius top-radius height)
(screw-insert c lastcol middlecol bottom-radius top-radius height))))

(defn new-case [c]
(let [use-external-holder? (get c :configuration-use-external-holder?)]
Expand Down Expand Up @@ -883,9 +898,9 @@
(rj9-holder frj9-start c))
(union (key-holes c)
(connectors c)
(if use-screw-inserts? (screw-insert-outers screw-placement c) ())
(thumb c)
(difference (new-case c)
(difference (union (new-case c)
(if use-screw-inserts? (screw-insert-outers screw-placement c) ()))
(if use-screw-inserts? (screw-insert-holes screw-placement c) ())
(external-holder-space c)
(translate [0 0 -60] (cube 350 350 120)))))))
Expand Down

0 comments on commit f064a3a

Please sign in to comment.