Skip to content

Commit

Permalink
Merge pull request ibnuda#82 from happysalada/refaktor
Browse files Browse the repository at this point in the history
add web-thickness configuration for manuform
  • Loading branch information
ibnuda authored Jul 19, 2021
2 parents 5e0d697 + 640f638 commit 60a9bde
Show file tree
Hide file tree
Showing 5 changed files with 501 additions and 452 deletions.
10 changes: 10 additions & 0 deletions resources/manuform.html
Original file line number Diff line number Diff line change
Expand Up @@ -622,6 +622,16 @@ <h3>Form of the Case</h3>
<option value="{{ho}}">{{ho}}mm</option>
{% endfor %}
</select>
<label for="form.web-thickness">Web thickness (top part of the keyboard around the keyholes)</label>
<input
type="number"
name="form.web-thickness"
id="form.web-thickness"
value="7"
step="0.1"
min="1"
max="10"
/>
<label for="form.wire-post">Wire Posts?</label>
<select id="form.wire-post" name="form.wire-post">
<option value="false">No</option>
Expand Down
12 changes: 12 additions & 0 deletions src/dactyl_keyboard/common.clj
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@
tenting-angle (get c :configuration-tenting-angle)
switch-type (get c :configuration-switch-type)
keyboard-z-offset (get c :configuration-z-offset)
web-thickness (get c :configuration-web-thickness)
rotate-x-angle (get c :configuration-rotate-x-angle)
column-angle (* beta (- centercol column))
placed-shape (->> shape
Expand Down Expand Up @@ -408,16 +409,27 @@

(def web-thickness 7)
(def post-size 0.1)
;; TODO remove the constants once lightcycle has been converted
(def web-post
(->> (cube post-size post-size web-thickness)
(translate [0 0 (+ (/ web-thickness -2)
plate-thickness)])))
(defn web-post [web-thickness]
(->> (cube post-size post-size web-thickness)
(translate [0 0 (+ (/ web-thickness -2)
plate-thickness)])))

(def post-adj (/ post-size 2))

;; TODO remove the constants once lightcycle has been converted
(def web-post-tr (translate [(- (/ mount-width 2) post-adj) (- (/ mount-height 2) post-adj) 0] web-post))
(def web-post-tl (translate [(+ (/ mount-width -2) post-adj) (- (/ mount-height 2) post-adj) 0] web-post))
(def web-post-bl (translate [(+ (/ mount-width -2) post-adj) (+ (/ mount-height -2) post-adj) 0] web-post))
(def web-post-br (translate [(- (/ mount-width 2) post-adj) (+ (/ mount-height -2) post-adj) 0] web-post))
(defn web-post-tr [web-thickness] (translate [(- (/ mount-width 2) post-adj) (- (/ mount-height 2) post-adj) 0] (web-post web-thickness)))
(defn web-post-tl [web-thickness] (translate [(+ (/ mount-width -2) post-adj) (- (/ mount-height 2) post-adj) 0] (web-post web-thickness)))
(defn web-post-bl [web-thickness] (translate [(+ (/ mount-width -2) post-adj) (+ (/ mount-height -2) post-adj) 0] (web-post web-thickness)))
(defn web-post-br [web-thickness] (translate [(- (/ mount-width 2) post-adj) (+ (/ mount-height -2) post-adj) 0] (web-post web-thickness)))

; length of the first downward-sloping part of the wall (negative)
(def wall-z-offset -15)
Expand Down
2 changes: 2 additions & 0 deletions src/dactyl_keyboard/generator.clj
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
:stagger-pinky-z (last stagger-pinky)
:wide-pinky (get confs :configuration-use-wide-pinky?)
:height-offset (get confs :configuration-z-offset)
:web-thickness (get confs :configuration-web-thickness)
:wire-post (get confs :configuration-use-wire-post?)
:screw-inserts (get confs :configuration-use-screw-inserts?)}
:misc {:keycaps (get confs :configuration-show-caps?)
Expand All @@ -90,6 +91,7 @@
:thumb-offset-z (get confs :configuration-thumb-offset-z)
:wide-pinky (get confs :configuration-use-wide-pinky?)
:z-offset (get confs :configuration-z-offset)
:web-thickness (get confs :configuration-web-thickness)
:manuform-offset (get confs :configuration-manuform-offset?)
:border (get confs :configuration-use-border?)
:thick-wall (get confs :configuration-thick-wall?)}
Expand Down
6 changes: 6 additions & 0 deletions src/dactyl_keyboard/handler.clj
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@
param-hotswap (parse-bool (get p "form.hotswap"))
param-stagger (parse-bool (get p "form.stagger"))
param-keyboard-z-offset (parse-int (get p "form.height-offset"))
param-web-thickness (parse-float (get p "form.web-thickness"))
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"))
Expand Down Expand Up @@ -189,6 +190,7 @@
:configuration-stagger-ring stagger-ring
:configuration-stagger-pinky stagger-pinky
:configuration-z-offset param-keyboard-z-offset
:configuration-web-thickness param-web-thickness
:configuration-show-caps? param-show-keycaps
:configuration-use-wide-pinky? param-wide-pinky
:configuration-use-wire-post? param-wire-post
Expand Down Expand Up @@ -247,6 +249,7 @@
param-thumb-offset-z (parse-int (get p "form.thumb-offset-z"))
param-use-wide-pinky (parse-bool (get p "form.wide-pinky"))
param-z-offset (parse-int (get p "form.z-offset"))
param-web-thickness (parse-float (get p "form.web-thickness"))
param-manuform-offset (parse-bool (get p "form.manuform-offset"))
param-use-border (parse-bool (get p "form.border"))
param-thick-wall (parse-bool (get p "form.thick-wall"))
Expand Down Expand Up @@ -284,6 +287,7 @@
:configuration-thumb-offset-y (if generate-json? param-thumb-offset-y (- 0 param-thumb-offset-y))
:configuration-thumb-offset-z param-thumb-offset-z
:configuration-z-offset param-z-offset
:configuration-web-thickness param-web-thickness
:configuration-manuform-offset? param-manuform-offset
:configuration-use-border? param-use-border
:configuration-thick-wall? param-thick-wall
Expand Down Expand Up @@ -365,6 +369,7 @@
:configuration-thumb-middle-left-tenting-x (/ pi (get form :thumb-middle-left-tenting-x 10))
:configuration-thumb-middle-left-tenting-y (/ pi (get form :thumb-middle-left-tenting-y -4))
:configuration-thumb-middle-left-tenting-z (/ pi (get form :thumb-middle-left-tenting-z 10))

:configuration-thumb-middle-left-offset-x (get form :thumb-middle-left-offset-x -35)
:configuration-thumb-middle-left-offset-y (get form :thumb-middle-left-offset-y -16)
:configuration-thumb-middle-left-offset-z (get form :thumb-middle-left-offset-z 2)
Expand Down Expand Up @@ -418,6 +423,7 @@
:configuration-thumb-offset-z (get form :thumb-offset-z 27)
:configuration-use-wide-pinky? (get form :wide-pinky false)
:configuration-z-offset (get form :z-offset 10)
:configuration-web-thickness (get form :web-thickness 7)
:configuration-manuform-offset? (get form :manuform-offset false)
:configuration-use-border? (get form :use-border true)
:configuration-thick-wall? (get form :thick-wall false)
Expand Down
Loading

0 comments on commit 60a9bde

Please sign in to comment.