Skip to content

Commit

Permalink
Merge pull request #64 from happysalada/add_thumb_cluster_offsets
Browse files Browse the repository at this point in the history
add thumb cluster offsets
  • Loading branch information
ibnuda authored Oct 31, 2020
2 parents 22b9e83 + e872e3b commit 79b47ed
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 8 deletions.
35 changes: 35 additions & 0 deletions resources/manuform.html
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,41 @@ <h3>Form of the Case</h3>
<option value="false">No</option>
<option value="true">Yes</option>
</select>
<label for="form.thumb-offsets"
>Thumb cluster offsets</label
>
<div class="row" id="form.thumb-offsets">
<div class="column column-33">
<label for="form.thumb-offset-x">X (toward the pinky)</label>
<input
type="number"
name="form.thumb-offset-x"
id="form.thumb-offset-x"
value="6"
step="0.1"
/>
</div>
<div class="column column-33">
<label for="form.thumb-offset-y">Y (toward the index)</label>
<input
type="number"
name="form.thumb-offset-y"
id="form.thumb-offset-y"
value="-3"
step="0.1"
/>
</div>
<div class="column column-33">
<label for="form.thumb-offset-z">Z (altitude)</label>
<input
type="number"
name="form.thumb-offset-z"
id="form.thumb-offset-z"
value="7"
step="0.1"
/>
</div>
</div>
<label for="form.stagger">Stagger?</label>
<select id="form.stagger" name="form.stagger">
<option value="true">Yes</option>
Expand Down
3 changes: 3 additions & 0 deletions src/dactyl_keyboard/generator.clj
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@
:trrs (get confs :configuration-use-trrs?)
:micro-usb (get confs :configuration-use-promicro-usb-hole?)}
:form {:hotswap (get confs :configuration-use-hotswap?)
:thumb-offset-x (get confs :configuration-thumb-offset-x)
:thumb-offset-y (get confs :configuration-thumb-offset-y)
:thumb-offset-z (get confs :configuration-thumb-offset-z)
:stagger (get confs :configuration-stagger?)
:stagger-index-y (second stagger-index)
:stagger-index-z (last stagger-index)
Expand Down
12 changes: 12 additions & 0 deletions src/dactyl_keyboard/handler.clj
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@
param-wide-pinky (parse-bool (get p "form.wide-pinky"))
param-wire-post (parse-bool (get p "form.wire-post"))
param-screw-inserts (parse-bool (get p "form.screw-inserts"))
param-thumb-offset-x (parse-float (get p "form.thumb-offset-x"))
param-thumb-offset-y (parse-float (get p "form.thumb-offset-y"))
param-thumb-offset-z (parse-float (get p "form.thumb-offset-z"))
param-index-y (parse-float (get p "form.stagger-index-y"))
param-index-z (parse-float (get p "form.stagger-index-z"))
param-middle-y (parse-float (get p "form.stagger-middle-y"))
Expand Down Expand Up @@ -130,6 +133,9 @@
:configuration-use-promicro-usb-hole? param-use-promicro-usb-hole

:configuration-use-hotswap? param-hotswap
:configuration-thumb-offset-x param-thumb-offset-x
:configuration-thumb-offset-y param-thumb-offset-y
:configuration-thumb-offset-z param-thumb-offset-z
:configuration-stagger? param-stagger
:configuration-stagger-index stagger-index
:configuration-stagger-middle stagger-middle
Expand Down Expand Up @@ -253,6 +259,9 @@
curve (get body :curve)
connector (get body :connector)
form (get body :form)
thumb-x (get form :thumb-offset-x 6)
thumb-y (get form :thumb-offset-y -3)
thumb-z (get form :thumb-offset-z 7)
index-y (get form :stagger-index-y 0)
index-z (get form :stagger-index-z 0)
middle-y (get form :stagger-middle-y 2.8)
Expand Down Expand Up @@ -285,6 +294,9 @@
:configuration-use-trrs? (get connector :trrs false)
:configuration-use-promicro-usb-hole? (get connector :micro-usb false)

:configuration-thumb-offset-x thumb-x
:configuration-thumb-offset-y thumb-y
:configuration-thumb-offset-z thumb-z
:configuration-use-hotswap? (get form :hotswap false)
:configuration-stagger? (get form :stagger true)
:configuration-stagger-index stagger-index
Expand Down
22 changes: 14 additions & 8 deletions src/dactyl_keyboard/manuform.clj
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,6 @@
[dactyl-keyboard.common :refer :all]))

(def column-style :standard)
; it dictates the location of the thumb cluster.
; the first member of the vector is x axis, second one y axis,
; while the last one is y axis.
; the higher x axis value is, the closer it to the pinky.
; the higher y axis value is, the closer it to the alphas.
; the higher z axis value is, the higher it is.
(def thumb-offsets [6 -3 7])

; controls overall height; original=9 with centercol=3; use 16 for centercol=2
;(def keyboard-z-offset 4)
Expand Down Expand Up @@ -277,14 +270,27 @@
;; Thumbs ;;
;;;;;;;;;;;;

; it dictates the location of the thumb cluster.
; the first member of the vector is x axis, second one y axis,
; while the last one is y axis.
; the higher x axis value is, the closer it to the pinky.
; the higher y axis value is, the closer it to the alphas.
; the higher z axis value is, the higher it is.
(defn thumb-offsets [c]
(let [x-offset (get c :configuration-thumb-offset-x)
y-offset (get c :configuration-thumb-offset-y)
z-offset (get c :configuration-thumb-offset-z)]
[x-offset y-offset z-offset ]))


; this is where the original position of the thumb switches defined.
; each and every thumb keys is derived from this value.
; the value itself is defined from the 'm' key's position in qwerty layout
; and then added by some values, including thumb-offsets above.
(defn thumborigin [c]
(let [cornerrow (fcornerrow (get c :configuration-nrows))]
(map + (key-position c 1 cornerrow [(/ mount-width 2) (- (/ mount-height 2)) 0])
thumb-offsets)))
(thumb-offsets c))))

(defn thumb-tr-place [c shape]
(let [thumb-count (get c :configuration-thumb-count)
Expand Down

0 comments on commit 79b47ed

Please sign in to comment.