chiark / gitweb /
fairphone5-case: midpoint button measuring (prep)
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Mon, 30 Jun 2025 15:38:35 +0000 (16:38 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Mon, 30 Jun 2025 15:41:50 +0000 (16:41 +0100)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
fairphone5-case.scad

index 3c4a89acf1bfce6472fc58f88b0356e6cfe72bd2..ac05b5eab212fc5954fa7df02bcf9c2593684f53 100644 (file)
@@ -781,13 +781,13 @@ module CaseAperture(pos, dia, $fn, topbottom=0) {
 
 module SideButton(y, y_ref_sign, l, suppress_over_keeper=0){
   // y_ref_sign:
-  //   +1  measured from top    of actual phone to top    of button
-  //   -1  measured from bottom of actual phone to bottom of button
-  //    0  y is centre of button in coordinate system
+  //   +1   measured from top    of actual phone to top    of button
+  //   -1   measured from bottom of actual phone to bottom of button
+  //    0   y is centre of button in coordinate system
   $button_l= l;
   $button_suppress_over_keeper= suppress_over_keeper;
-  eff_y = y_ref_sign > 0 ?         -bumper [1] -y -l/2 :
-         y_ref_sign < 0 ? (-phone -bumper)[1] +y +l/2 :
+  eff_y = y_ref_sign >= 1    ?         -bumper [1] -y -l/2 :
+         y_ref_sign <= -1   ? (-phone -bumper)[1] +y +l/2 :
          y;
   //echo(eff_y);
   translate([0, eff_y, 0])