Skip to content

Commit

Permalink
Merge pull request #68 from c10l/refaktor-kailh
Browse files Browse the repository at this point in the history
Add experimental support for Kailh switches
  • Loading branch information
ibnuda authored Dec 12, 2020
2 parents 7c75976 + daabd19 commit b3b4a4b
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 16 deletions.
1 change: 1 addition & 0 deletions resources/manuform.html
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ <h3>Keys</h3>
<option value="mx">MX</option>
<option value="alps">Alps</option>
<option value="choc">Choc (Experimental)</option>
<option value="kailh">Kailh (Experimental)</option>
</select>
<label for="keys.inner-column">Inner Index Finger's Column?</label>
<select id="keys.inner-column" name="keys.inner-column">
Expand Down
39 changes: 23 additions & 16 deletions src/dactyl_keyboard/common.clj
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,9 @@
use-alps? (case switch-type
:alps true
false) #_(get c :configuration-use-alps?)
use-choc? (case switch-type :choc true false)
use-choc? (case switch-type
:choc true
false)
use-hotswap? (get c :configuration-use-hotswap?)
plate-projection? (get c :configuration-plate-projection? false)
fill-in (translate [0 0 (/ plate-thickness 2)] (cube alps-width alps-height plate-thickness))
Expand All @@ -252,18 +254,18 @@
(/ plate-thickness 2)])))
left-wall (case switch-type
:alps (union (->> (cube 2 (+ keyswitch-height 3) plate-thickness)
(translate [(+ (/ 2 2) (/ 15.6 2))
0
(/ plate-thickness 2)]))
(->> (cube 1.5 (+ keyswitch-height 3) 1.0)
(translate [(+ (/ 1.5 2) (/ alps-notch-width 2))
0
(- plate-thickness
(/ alps-notch-height 2))])))
(translate [(+ (/ 2 2) (/ 15.6 2))
0
(/ plate-thickness 2)]))
(->> (cube 1.5 (+ keyswitch-height 3) 1.0)
(translate [(+ (/ 1.5 2) (/ alps-notch-width 2))
0
(- plate-thickness
(/ alps-notch-height 2))])))
:choc (->> (cube holder-thickness (+ keyswitch-height 3.3) (* plate-thickness 0.65))
(translate [(+ (/ holder-thickness 2) (/ keyswitch-width 2))
0
(* plate-thickness 0.7)]))
(translate [(+ (/ holder-thickness 2) (/ keyswitch-width 2))
0
(* plate-thickness 0.7)]))
(->> (cube holder-thickness (+ keyswitch-height 3.3) plate-thickness)
(translate [(+ (/ holder-thickness 2) (/ keyswitch-width 2))
0
Expand All @@ -276,9 +278,15 @@
0
(/ plate-thickness 2)]))))
; the hole's wall.
plate-half (union top-wall
left-wall
(if create-side-nub? (with-fn 100 side-nub) ()))
kailh-cutout (->> (cube (/ keyswitch-width 3) 1.6 (+ plate-thickness 1.8))
(translate [0
(+ (/ 1.5 2) (+ (/ keyswitch-height 2)))
(/ plate-thickness)]))
plate-half (case switch-type
:kailh (union (difference top-wall kailh-cutout) left-wall)
(union top-wall
left-wall
(if create-side-nub? (with-fn 100 side-nub))))
; the bottom of the hole.
swap-holder-z-offset (if use-choc? 1.5 -1.5)
swap-holder (->> (cube (+ keyswitch-width 3) (/ (+ keyswitch-height 3) 2) 3)
Expand Down Expand Up @@ -496,4 +504,3 @@
(key-position c column row (map + (wall-locate2 1 0) [(/ mount-width 2) 0 0])))))]
(->> (screw-insert-shape bottom-radius top-radius height)
(translate [(first position) (second position) (/ height 2)]))))

2 changes: 2 additions & 0 deletions src/dactyl_keyboard/handler.clj
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
"mx" :mx
"alps" :alps
"choc" :choc
"kailh" :kailh
:box)
param-inner-column (case (get p "keys.inner-column")
"innie" :innie
Expand Down Expand Up @@ -194,6 +195,7 @@
"mx" :mx
"alps" :alps
"choc" :choc
"kailh" :kailh
:box)
param-hide-last-pinky (parse-bool (get p "keys.hide-last-pinky"))
param-alpha (parse-int (get p "curve.alpha"))
Expand Down

0 comments on commit b3b4a4b

Please sign in to comment.