فهرست منبع

Reorganize SCAD files into single-responsibility components with shared params

- params.scad: all constants and derived values in one place, eliminating
  hardcoded EPD alignment copies from cpu_case and WALL/CORNER_R duplication
- cpu_case.scad: base only; preview-only battery and EE04 board
- epd_case.scad: epd case only; preview-only display mockup
- lid.scad: lid only; uses epd_case module; preview-only display mockup
- plunger.scad: plunger only
- combined.scad: full assembly view replacing old cpu_case assembly role
- EPD_IS_LID design-time flag in params (was SHOW_EPD_CASE preview flag in lid)
- render.sh updated; bottom.scad retired
ZiB 4 ماه پیش
والد
کامیت
6d2a6b4ebe
7فایلهای تغییر یافته به همراه440 افزوده شده و 450 حذف شده
  1. 34 0
      combined.scad
  2. 105 343
      cpu_case.scad
  3. 42 88
      epd_case.scad
  4. 101 8
      lid.scad
  5. 134 0
      params.scad
  6. 19 7
      plunger.scad
  7. 5 4
      render.sh

+ 34 - 0
combined.scad

@@ -0,0 +1,34 @@
+// ============================================================
+//  Full Assembly — EE04 case + lid + epd_case + plungers
+//  Replaces the old assembly view that lived in cpu_case.scad
+// ============================================================
+include <params.scad>
+use <cpu_case.scad>
+use <lid.scad>
+use <plunger.scad>
+
+/* [Preview] */
+SHOW_BASE     = true;
+SHOW_LID      = true;
+SHOW_BOARD    = true;
+SHOW_PLUNGERS = true;
+SHOW_BATTERY  = true;
+SHOW_DISP     = true;
+EXPLODE       = 70;   // mm to pull lid out in Y- for inspection (try 40)
+
+if (SHOW_BASE)  base();
+
+if ($preview && SHOW_BATTERY) battery();
+
+if (SHOW_LID)
+  translate([0,
+             WALL - EXPLODE,
+             BASE_H - FLANGE_H])
+    lid();
+
+if ($preview && SHOW_BOARD) stl_board();
+
+if (SHOW_PLUNGERS)
+  for (bcx = BTN_CX)
+    translate([PCB_OX + bcx, OUT_W - WALL, PCB_Z + BTN_CZ])
+      plunger();

+ 105 - 343
cpu_case.scad

@@ -1,381 +1,143 @@
 // ============================================================
-//  XIAO ePaper Display Board EE04 — 3D-Printed Case
+//  XIAO ePaper Display Board EE04 — 3D-Printed Case (base only)
 //  OpenSCAD parametric model
 // ============================================================
+include <params.scad>
 use <ee04.scad>
-use <epd_case.scad>
 
 /* [Preview] */
-SHOW_BOARD    = true;
-SHOW_LID      = true;
-SHOW_BASE     = true;
-SHOW_PLUNGERS = true;
-SHOW_BATTERY  = true;
-SHOW_EPD_CASE = true;
-EXPLODE       = 70;      // mm to pull lid out in Y- for inspection (try 40)
-
-/* [Board Dimensions — from EE04 STL] */
-PCB_L = 80.00;   // board length  (case_x axis)
-PCB_W = 41.22;   // board width   (case_y axis)
-PCB_T =  1.93;   // PCB thickness
-
-// Component heights measured from PCB bottom face:
-COMP_MAX_Z  = 7.29;   // tallest component (XIAO module)
-COMP_SIDE_Z = 3.82;   // tallest component on +Y wall (buttons, USB-C)
-
-/* [Sliding Lid] */
-LID_T       =  1.5;   // lid ceiling thickness
-FLANGE_H    =  3.0;   // Z height of retention flanges (base + lid); drives lid placement and Y- wall step
-FLANGE_W    =  FLANGE_H * tan(30);   // flange width — 30° from vertical (60° from horizontal), printable without support
-SLIDE_CLEAR =  0.40;  // clearance between flange/rib and groove/channel on all mating faces (0.4 mm suits typical FDM tolerances)
-
-// ---- Y- edge: FPC connector — notch in lid Y+ stop rib ----
-// FPC_NOTCH_W and FPC_SLOT_W match the Z- face opening of epd_case:
-//   _fpc_xw = 12.5 + 5.0 = 17.5 mm (cable + 2.5 mm clearance per side)
-//   slot Y-extent at z=0: sqrt(_fpc_ro² − (FPC_BEND_R−WALL)²) ≈ 4.1 mm
-//   with epd_case defaults: bend_r=4, wall=2, fpc_t=0.3, tol=0.3 → _fpc_ro=4.6
-FPC_NOTCH_W =  17.5;   // = _fpc_xw in epd_case (cable 12.5 + 2×2.5 mm clearance)
-FPC_U_T     = LID_T;   // U-rib arm and bar thickness
-FPC_SLOT_W  =   4.1;   // ≈ sqrt(_fpc_ro²−(FPC_BEND_R−WALL)²) at epd_case z=0
-
-// epd_case reference values for alignment (must match epd_case.scad)
-_EPD_CASE_W      = 130.0;   // case_w in epd_case (DISP_W+2×TOL+2×WALL = 125.4+0.6+4)
-_EPD_CASE_D      = 108.14;  // case_d in epd_case (max(cav_d+WALL+BEZEL_Y, _bend_my+WALL))
-_EPD_FPC_SLOT_CX =  65.98;  // _fpc_x1 + _fpc_xw/2 in epd_case (slot X centre)
-_EPD_FPC_SLOT_Y  = 102.0;   // BEZEL_Y + DISP_D in epd_case (slot Y- edge)
-
-/* [Cutout Positions — from STL geometry, PCB-origin-relative] */
-
-// ---- +Y wall: Sliding power switch ----
-// TODO: measure actual switch body dimensions from STL (as done for USB-C) before next print
-PWR_CX      =  10.3;   // PCB-relative case_x centre
-PWR_W       =   5.0;   // slot width
-PWR_H       =   2.5;   // slot height
-PWR_CZ      =   3.8;   // height above PCB bottom
-PWR_COVER_T =   0.6;   // exterior skin over switch pocket (switch not user-accessible)
-
-// ---- +Y wall: USB-C port ----
-USBC_CX         =  65.65;
-USBC_W          =   9.0;   // port body width from STL
-USBC_H          =   3.22;  // port body height from STL
-USBC_CZ         =   4.31;
-USBC_CBL_CLEAR  =   1.5;   // added per side for cable plug + routing clearance
-
-// ---- +Y wall: 3× user buttons + 1× reset ----
-BTN_CX      = [48.4, 39.075, 29.725, 20.425];   // PCB-relative case_x centres
-BTN_D       =   2.3;   // HOLE_D from hat.scad: PLUNGER_D(2.0) + 2×SLIP_CLEAR(0.15)
-BTN_CZ      =   3.85;
-
-/* [Plunger] */
-PLUNGER_D  =  2.0;   // body and head diameter — matches button actuator
-FLANGE_D   =  2.9;   // retention flange OD
-FLANGE_T   =  1.2;   // flange thickness (axial)
-PLUNGER_HEAD_H =  1.5;   // exterior head protrusion past wall face
-
-/* [Case Parameters] */
-WALL          =  2.0;   // wall thickness
-FLOOR         =  2.0;   // base floor thickness (thicker for thread engagement)
-CORNER_R      =  2.5;   // XY corner fillet radius
-SCREW_D       =  3.2;   // M3 tap drill diameter
-BOSS_D        =  6.0;   // PCB standoff boss outer diameter
-BOSS_H        =  2.0;   // standoff boss height; PCB bottom sits flush on boss top
-
-/* [Locating Studs] */
-STUD_CLEAR  =  0.10;   // radial clearance per side — close (non-interference) fit in SLA resin
-STUD_H      =  PCB_T + 1.0;   // stud cylinder height above boss top: through PCB + 1 mm proud
-STUD_R      =  (SCREW_D - 2*STUD_CLEAR) / 2;   // stud pin radius (= cylinder + dome radius)
-
-/* [PCB Standoff Positions — relative to PCB origin] */
-PCB_BOSS_X1   =  2.5;
-PCB_BOSS_X2   =  PCB_L - 2.5;
-PCB_BOSS_Y1   =  2.5;
-PCB_BOSS_Y2   =  PCB_W - 2.5;
-
-/* [Interior Clearances — PCB edge to interior wall face] */
-CLR_XN   =   2.0;   // X- side
-CLR_XP   =  44.0;   // X+ side — sized so OUT_L == _EPD_CASE_W (130 − 2×WALL − CLR_XN − PCB_L)
-CLR_YN   =  15.0;   // Y- side (FPC routing; lid inserts from here)
-CLR_YP   =   1.77;  // Y+ side: calibrated contact(1.565) + rest clearance(0.20)
-CLR_LID  =   3.5;   // from tallest component top to lid underside
-BATT_W   =  34.5;   // 603449 LiPo width  (X)
-BATT_D   =  51.0;   // 603449 LiPo depth  (Y)
-BATT_T   =   6.3;   // 603449 LiPo thickness (Z)
-CLR_BATX =   1.5;   // battery X clearance from X+ wall
-CLR_BATY =   1.5;   // battery Y clearance from Y+ wall
-
-/* [Computed] */
-PCB_Z    = FLOOR + BOSS_H;
-
-// Base inner height: floor to lid underside ≈ BASE_H (flange rests on groove floor)
-BASE_INNER_H = BOSS_H + COMP_MAX_Z + CLR_LID;
-BASE_H       = FLOOR + BASE_INNER_H;
-
-PCB_OX   = WALL + CLR_XN;
-PCB_OY   = WALL + CLR_YN;
-
-CAV_L    = CLR_XN + PCB_L + CLR_XP;
-CAV_W    = CLR_YN + PCB_W + CLR_YP;
-OUT_L    = CAV_L + 2*WALL;
-OUT_W    = CAV_W + 2*WALL;
-
-LID_H     = FLANGE_H + LID_T;
-LID_Y_LEN = CAV_W;   // flange length; lid Y+ end stops against Y+ interior wall
-
-// FPC notch X centre — keeps lid notch aligned with epd_case slot when centred on lid
-FPC_CX = OUT_L/2 - _EPD_CASE_W/2 + _EPD_FPC_SLOT_CX - PCB_OX;
-
-// U-rib depth — derived so ceiling slot Y aligns with epd_case FPC slot Y
-// (3 = hardcoded rib Y thickness in lid module)
-FPC_U_DEPTH = FPC_U_T - WALL - 3 + (_EPD_CASE_D - _EPD_FPC_SLOT_Y);
+SHOW_BOARD   = true;
+SHOW_BATTERY = true;
 
 // ============================================================
 //  HELPERS
 // ============================================================
-module rounded_box(l, w, h, r) {
-    hull()
-        for (dx = [r, l-r], dy = [r, w-r])
-            translate([dx, dy, 0]) cylinder(r=r, h=h, $fn=32);
-}
 
 // Standoff boss: screw variant has through-hole; stud variant has locating pin instead.
 // Diagonal (X1,Y1)+(X2,Y2) → studs; (X1,Y2)+(X2,Y1) → screws.
 module pcb_boss(px, py, stud=false) {
-    translate([PCB_OX + px, PCB_OY + py, FLOOR]) {
-        difference() {
-            cylinder(d=BOSS_D, h=BOSS_H + 0.01, $fn=24);
-            if (!stud)
-                translate([0, 0, -0.1])
-                    cylinder(d=SCREW_D * 0.7, h=BOSS_H + 0.2, $fn=18);
-        }
-        if (stud)
-            translate([0, 0, BOSS_H]) {
-                cylinder(r=STUD_R, h=STUD_H, $fn=24);
-                translate([0, 0, STUD_H])
-                    sphere(r=STUD_R, $fn=24);
-            }
-    }
-}
-
-// Button plunger — origin at hole centre on the interior wall face.
-// At rest: flange flush with interior face, head proud of exterior face.
-module plunger() {
-    color("orange") union() {
-        translate([0, -FLANGE_T, 0])
-            rotate([-90, 0, 0])
-                cylinder(d = PLUNGER_D, h = FLANGE_T + WALL + PLUNGER_HEAD_H, $fn = 32);
-        translate([0, -FLANGE_T, 0])
-            rotate([-90, 0, 0])
-                cylinder(d = FLANGE_D, h = FLANGE_T, $fn = 32);
-        translate([0, WALL, 0])
-            rotate([-90, 0, 0])
-                cylinder(d = PLUNGER_D, h = PLUNGER_HEAD_H, $fn = 32);
+  translate([PCB_OX + px, PCB_OY + py, FLOOR]) {
+    difference() {
+      cylinder(d=BOSS_D, h=BOSS_H + 0.01, $fn=24);
+      if (!stud)
+        translate([0, 0, -0.1])
+          cylinder(d=SCREW_D * 0.7, h=BOSS_H + 0.2, $fn=18);
     }
+    if (stud)
+      translate([0, 0, BOSS_H]) {
+        cylinder(r=STUD_R, h=STUD_H, $fn=24);
+        translate([0, 0, STUD_H])
+          sphere(r=STUD_R, $fn=24);
+      }
+  }
 }
 
 // ============================================================
 //  BASE
 // ============================================================
 module base() {
-    color("#004B49") {
-        difference() {
-            rounded_box(OUT_L, OUT_W, BASE_H, CORNER_R);
-
-            // Interior cavity (open top)
-            translate([WALL, WALL, FLOOR])
-                cube([CAV_L, CAV_W, BASE_H]);
-
-            // ---- Boss screw holes through 50 % of floor (screw diagonal only) ----
-            for (pos = [[PCB_BOSS_X1, PCB_BOSS_Y2], [PCB_BOSS_X2, PCB_BOSS_Y1]])
-                translate([PCB_OX + pos[0], PCB_OY + pos[1], FLOOR * 0.5 - 0.1])
-                    cylinder(d=SCREW_D * 0.7, h=FLOOR * 0.5 + 0.2, $fn=18);
-
-            // ---- +Y wall cutouts ----
-
-            // Sliding power switch pocket — closed exterior face, interior clearance only
-            translate([PCB_OX + PWR_CX - PWR_W/2,
-                       OUT_W - WALL - 0.1,
-                       PCB_Z + PWR_CZ - PWR_H/2])
-                cube([PWR_W, WALL - PWR_COVER_T + 0.1, PWR_H]);
-
-            // USB-C slot
-            translate([PCB_OX + USBC_CX - (USBC_W + 2*USBC_CBL_CLEAR)/2,
-                       OUT_W - WALL - 0.1,
-                       PCB_Z + USBC_CZ - (USBC_H + 2*USBC_CBL_CLEAR)/2])
-                cube([USBC_W + 2*USBC_CBL_CLEAR, WALL + 0.2, USBC_H + 2*USBC_CBL_CLEAR]);
-
-            // 4× button holes (3 user + 1 reset)
-            for (bcx = BTN_CX)
-                translate([PCB_OX + bcx,
-                           OUT_W + 0.1,
-                           PCB_Z + BTN_CZ])
-                    rotate([90, 0, 0])
-                        cylinder(d=BTN_D, h=WALL + 0.3, $fn=32);
-
-            // ---- Y- wall step for lid flange clearance ----
-            // Remove the full Y- wall above z=BASE_H-FLANGE_H-SLIDE_CLEAR so the lid
-            // flanges can enter freely from Y-.
-            translate([-0.1, -0.1, BASE_H - FLANGE_H - SLIDE_CLEAR])
-                cube([OUT_L + 0.2, WALL + 0.2, FLANGE_H + SLIDE_CLEAR + 0.1]);
-        }
-
-        // Standoff bosses (added outside diff so cavity doesn't subtract them)
-        pcb_boss(PCB_BOSS_X1, PCB_BOSS_Y1, stud=true);   // stud diagonal
-        pcb_boss(PCB_BOSS_X2, PCB_BOSS_Y2, stud=true);   // stud diagonal
-        pcb_boss(PCB_BOSS_X1, PCB_BOSS_Y2, stud=false);  // screw diagonal
-        pcb_boss(PCB_BOSS_X2, PCB_BOSS_Y1, stud=false);  // screw diagonal
+  color("#004B49") {
+    difference() {
+      rounded_box(OUT_L, OUT_W, BASE_H, CORNER_R);
+
+      // Interior cavity (open top)
+      translate([WALL, WALL, FLOOR])
+        cube([CAV_L, CAV_W, BASE_H]);
+
+      // ---- Boss screw holes through 50 % of floor (screw diagonal only) ----
+      for (pos = [[PCB_BOSS_X1, PCB_BOSS_Y2], [PCB_BOSS_X2, PCB_BOSS_Y1]])
+        translate([PCB_OX + pos[0], PCB_OY + pos[1], FLOOR * 0.5 - 0.1])
+          cylinder(d=SCREW_D * 0.7, h=FLOOR * 0.5 + 0.2, $fn=18);
+
+      // ---- +Y wall cutouts ----
+
+      // Sliding power switch pocket — closed exterior face, interior clearance only
+      translate([PCB_OX + PWR_CX - PWR_W/2,
+                 OUT_W - WALL - 0.1,
+                 PCB_Z + PWR_CZ - PWR_H/2])
+        cube([PWR_W, WALL - PWR_COVER_T + 0.1, PWR_H]);
+
+      // USB-C slot
+      translate([PCB_OX + USBC_CX - (USBC_W + 2*USBC_CBL_CLEAR)/2,
+                 OUT_W - WALL - 0.1,
+                 PCB_Z + USBC_CZ - (USBC_H + 2*USBC_CBL_CLEAR)/2])
+        cube([USBC_W + 2*USBC_CBL_CLEAR, WALL + 0.2, USBC_H + 2*USBC_CBL_CLEAR]);
+
+      // 4× button holes (3 user + 1 reset)
+      for (bcx = BTN_CX)
+        translate([PCB_OX + bcx,
+                   OUT_W + 0.1,
+                   PCB_Z + BTN_CZ])
+          rotate([90, 0, 0])
+            cylinder(d=BTN_D, h=WALL + 0.3, $fn=32);
+
+      // ---- Y- wall step for lid flange clearance ----
+      // Remove the full Y- wall above z=BASE_H-FLANGE_H-SLIDE_CLEAR so the lid
+      // flanges can enter freely from Y-.
+      translate([-0.1, -0.1, BASE_H - FLANGE_H - SLIDE_CLEAR])
+        cube([OUT_L + 0.2, WALL + 0.2, FLANGE_H + SLIDE_CLEAR + 0.1]);
     }
 
-    // Lid-retention flanges — right triangles, wide face flush with case top (z=BASE_H),
-    // tip pointing down to (WALL, BASE_H-FLANGE_H). Hypotenuse faces down-into-cavity;
-    // lid flanges slide underneath it for Z retention.
-    color("#2C3863") {
-        hull() {
-            translate([WALL, WALL, BASE_H - 0.01])
-                cube([FLANGE_W, CAV_W, 0.01]);
-            translate([WALL, WALL, BASE_H - FLANGE_H])
-                cube([0.01, CAV_W, 0.01]);
-        }
-        hull() {
-            translate([OUT_L - WALL - FLANGE_W, WALL, BASE_H - 0.01])
-                cube([FLANGE_W, CAV_W, 0.01]);
-            translate([OUT_L - WALL - 0.01, WALL, BASE_H - FLANGE_H])
-                cube([0.01, CAV_W, 0.01]);
-        }
-        // Y+ locking flanges — same angled profile as side flanges, in YZ plane;
-        // split around FPC notch for cable clearance
-        for (seg = [
-            [WALL,                             PCB_OX + FPC_CX - FPC_NOTCH_W/2 - WALL],
-            [PCB_OX + FPC_CX + FPC_NOTCH_W/2, OUT_L - WALL - (PCB_OX + FPC_CX + FPC_NOTCH_W/2)]
-        ])
-            hull() {
-                translate([seg[0], OUT_W - WALL - FLANGE_W, BASE_H - 0.01])
-                    cube([seg[1], FLANGE_W, 0.01]);
-                translate([seg[0], OUT_W - WALL - 0.01, BASE_H - FLANGE_H])
-                    cube([seg[1], 0.01, 0.01]);
-            }
+    // Standoff bosses (added outside diff so cavity doesn't subtract them)
+    pcb_boss(PCB_BOSS_X1, PCB_BOSS_Y1, stud=true);   // stud diagonal
+    pcb_boss(PCB_BOSS_X2, PCB_BOSS_Y2, stud=true);   // stud diagonal
+    pcb_boss(PCB_BOSS_X1, PCB_BOSS_Y2, stud=false);  // screw diagonal
+    pcb_boss(PCB_BOSS_X2, PCB_BOSS_Y1, stud=false);  // screw diagonal
+  }
+
+  // Lid-retention flanges — right triangles, wide face flush with case top (z=BASE_H),
+  // tip pointing down to (WALL, BASE_H-FLANGE_H). Hypotenuse faces down-into-cavity;
+  // lid flanges slide underneath it for Z retention.
+  color("#2C3863") {
+    hull() {
+      translate([WALL, WALL, BASE_H - 0.01])
+        cube([FLANGE_W, CAV_W, 0.01]);
+      translate([WALL, WALL, BASE_H - FLANGE_H])
+        cube([0.01, CAV_W, 0.01]);
     }
-}
-
-// ============================================================
-//  LID  (slide-on; enters from Y- face, closes toward Y+)
-//  Print upside-down (ceiling on build plate).
-//  z=0 = bottom of flanges; z=FLANGE_H = ceiling underside.
-//  Flanges sit inside cavity and ride on base retention flange hypotenuses.
-// ============================================================
-module lid() {
-    // Flanges: right triangles in XZ; hypotenuse at reciprocal angle to base retention flanges.
-    // Wide vertical face at x=WALL+FLANGE_W (inner), tip at bottom-wall-face — same
-    // (-FLANGE_W, -FLANGE_H) hypotenuse slope as base flanges so they mate when lid slides in.
-    color("#2C3863") {
-        // Left (X-) flange — stops at Y+ locking flange inner face
-        hull() {
-            translate([WALL + FLANGE_W - SLIDE_CLEAR - 0.01, 0, 0])
-                cube([0.01, LID_Y_LEN - FLANGE_W + SLIDE_CLEAR, FLANGE_H - SLIDE_CLEAR]);
-            translate([WALL + SLIDE_CLEAR, 0, -0.005])
-                cube([0.01, LID_Y_LEN - FLANGE_W + SLIDE_CLEAR, 0.01]);
-        }
-        // Right (X+) flange — stops at Y+ locking flange inner face
-        hull() {
-            translate([OUT_L - WALL - FLANGE_W + SLIDE_CLEAR, 0, 0])
-                cube([0.01, LID_Y_LEN - FLANGE_W + SLIDE_CLEAR, FLANGE_H - SLIDE_CLEAR]);
-            translate([OUT_L - WALL - SLIDE_CLEAR - 0.01, 0, -0.005])
-                cube([0.01, LID_Y_LEN - FLANGE_W + SLIDE_CLEAR, 0.01]);
-        }
-
-        // Interior ribs — 2 mm wide
-        translate([WALL + FLANGE_W - SLIDE_CLEAR, 0, 0])
-            cube([2.0, LID_Y_LEN - FLANGE_W + SLIDE_CLEAR, FLANGE_H]);
-        translate([OUT_L - WALL - FLANGE_W + SLIDE_CLEAR - 2.0, 0, 0])
-            cube([2.0, LID_Y_LEN - FLANGE_W + SLIDE_CLEAR, FLANGE_H]);
-
-        // Y+ locking flanges — angled wedge matching side-flange profile; split around FPC notch
-        for (seg = [
-            [FLANGE_W - SLIDE_CLEAR + 2.0,
-             2+PCB_OX + FPC_CX - FPC_NOTCH_W/2 - (WALL + FLANGE_W - SLIDE_CLEAR + 2.0)],
-            [PCB_OX + FPC_CX + FPC_NOTCH_W/2,
-             OUT_L - FLANGE_W + SLIDE_CLEAR - 2.0 - (PCB_OX + FPC_CX + FPC_NOTCH_W/2)]
-        ]) {
-            hull() {
-                translate([seg[0], LID_Y_LEN - FLANGE_W + SLIDE_CLEAR - 0.01, 0])
-                    cube([seg[1], 0.01, FLANGE_H - SLIDE_CLEAR]);
-                translate([seg[0], LID_Y_LEN - SLIDE_CLEAR - 0.01, -0.005])
-                    cube([seg[1], 0.01, 0.01]);
-            }
-            // Backing rib — 2 mm deep on cavity face of flange, matches side-rib style
-            translate([seg[0], LID_Y_LEN - FLANGE_W + SLIDE_CLEAR - 2.0, 0])
-                cube([seg[1], 2.0, FLANGE_H]);
-        }
-    }
-
-    color("#004B49")
-    difference() {
-        union() {
-            // Ceiling plate — matches base footprint (OUT_L × OUT_W) with CORNER_R rounding
-            if (!SHOW_EPD_CASE)
-                translate([0, -WALL, FLANGE_H])
-                    rounded_box(OUT_L, OUT_W, LID_T, CORNER_R);
-            else
-                translate([
-                            OUT_L/2 - _EPD_CASE_W/2,
-                            OUT_W - _EPD_CASE_D - WALL,
-                            LID_T
-            ])
-                epd_case();
-
-            // Y- lip — same rounded_box profile clipped to the Y- wall zone so the
-            // lip corners match the base exterior corners
-            intersection() {
-                translate([0, -WALL, -SLIDE_CLEAR])
-                    rounded_box(OUT_L, OUT_W, FLANGE_H + SLIDE_CLEAR, CORNER_R);
-                translate([-0.1, -WALL - 0.1, -SLIDE_CLEAR - 0.1])
-                    cube([OUT_L + 0.2, WALL + 0.2, FLANGE_H + SLIDE_CLEAR + 0.2]);
-            }
-        }
-
-        // FPC cable slot — from Y+ face of U-rib bottom bar, FPC_SLOT_W toward Y+
-        translate([PCB_OX + FPC_CX - FPC_NOTCH_W/2,
-                   LID_Y_LEN - 3 - FPC_U_DEPTH + FPC_U_T,
-                   FLANGE_H - 0.1])
-            cube([FPC_NOTCH_W, FPC_SLOT_W, LID_T + 0.2]);
+    hull() {
+      translate([OUT_L - WALL - FLANGE_W, WALL, BASE_H - 0.01])
+        cube([FLANGE_W, CAV_W, 0.01]);
+      translate([OUT_L - WALL - 0.01, WALL, BASE_H - FLANGE_H])
+        cube([0.01, CAV_W, 0.01]);
     }
+    // Y+ locking flanges — same angled profile as side flanges, in YZ plane;
+    // split around FPC notch for cable clearance
+    for (seg = [
+      [WALL,                             PCB_OX + FPC_CX - FPC_NOTCH_W/2 - WALL],
+      [PCB_OX + FPC_CX + FPC_NOTCH_W/2, OUT_L - WALL - (PCB_OX + FPC_CX + FPC_NOTCH_W/2)]
+    ])
+      hull() {
+        translate([seg[0], OUT_W - WALL - FLANGE_W, BASE_H - 0.01])
+          cube([seg[1], FLANGE_W, 0.01]);
+        translate([seg[0], OUT_W - WALL - 0.01, BASE_H - FLANGE_H])
+          cube([seg[1], 0.01, 0.01]);
+      }
+  }
 }
 
 // ============================================================
-//  BOARD PLACEMENT
-//  EE04() XY-normalises the STL (board left/front at origin).
-//  +1.925 corrects for STL native Z (PCB bottom at Z=−1.925) so
-//  the PCB bottom face lands exactly at PCB_Z.
+//  PREVIEW-ONLY COMPONENTS
 // ============================================================
 module stl_board() {
-    translate([PCB_OX, PCB_OY, PCB_Z])
-        EE04();
+  translate([PCB_OX, PCB_OY, PCB_Z])
+    EE04();
 }
 
 module battery() {
-    if ($preview)
-        color("darkgray", 0.85)
-            translate([CAV_L - BATT_W - CLR_BATX,
-                       CAV_W - BATT_D - CLR_BATY,
-                       FLOOR + 0.01])
-                cube([BATT_W, BATT_D, BATT_T]);
+  color("darkgray", 0.85)
+    translate([CAV_L - BATT_W - CLR_BATX,
+               CAV_W - BATT_D - CLR_BATY,
+               FLOOR + 0.01])
+      cube([BATT_W, BATT_D, BATT_T]);
 }
 
 // ============================================================
-//  ASSEMBLY
+//  RENDER
 // ============================================================
-if (SHOW_BASE)  base();
-
-if (SHOW_BATTERY) battery();
+base();
 
-if (SHOW_LID)
-    translate([0,
-               WALL - EXPLODE,
-               BASE_H - FLANGE_H])
-        lid();
-
-if (SHOW_BOARD && $preview) stl_board();
-
-if (SHOW_PLUNGERS)
-    for (bcx = BTN_CX)
-        translate([PCB_OX + bcx, OUT_W - WALL, PCB_Z + BTN_CZ])
-            plunger();
+if ($preview) {
+  if (SHOW_BOARD)   stl_board();
+  if (SHOW_BATTERY) battery();
+}

+ 42 - 88
epd_case.scad

@@ -1,100 +1,54 @@
-// GDEY0583T81 — Waveshare 5.83" ePaper Display Case
-use <GDEY0583T81.scad>
+// Waveshare GDEY0583T81 5.83" ePaper Display Case
 // Display slides in from Y-; no Y- side wall
 // FPC cable exits toward Y+ then bends 90° toward Z- through backplate slot
+include <params.scad>
+use <GDEY0583T81.scad>
 
-// --- Display Dimensions ---
-DISP_W = 125.4;   // overall width  (X)
-DISP_D = 99.5;    // overall depth  (Y)
-DISP_T = 1.2;     // thickness      (Z)
-
-// --- Active (Visible) Area ---
-ACT_W  = 118.78;  // active area width (X)
-ACT_D  = 88.22;   // active area depth (Y)
-
-// --- Case Parameters ---
-WALL     = 2.0;   // wall and backplate thickness
-LIP      = 1.5;   // front bezel lip thickness (Z, sits on top of display)
-TOL      = 0.3;   // per-side clearance for display fit (0.3 mm suits FDM sliding tolerances)
-CHAM       = 1.0;   // chamfer Z height at window opening
-CHAM_ANGLE = 60;    // chamfer face angle from vertical (deg); 45 = equal bevel, lower = less overhang
-CORNER_R = 2.5;   // XY corner fillet radius (matches EE04 case)
-BEZEL_Y    = 2.5;   // extra Y- bezel beyond the display's natural 3.30 mm border
-EXPLODE    = 0;    // mm to pull display mockup toward Y- in preview
-SHOW_DISP  = true; // show GDEY0583T81 mockup in preview
-FPC_BEND_R = 4.0;  // FPC cable bend radius toward Z- (starting at display Y+ edge)
-CLIP_Z     = 0;     // preview-only: mm to remove from Z+ (0 = full model; LIP reveals cavity; LIP+DISP_T reveals floor)
-
-// --- Derived Dimensions ---
-cav_w    = DISP_W + TOL * 2;
-cav_d    = DISP_D + TOL;       // tolerance on Y+ side only; Y- is open
-case_w   = cav_w + WALL * 2;
-case_h   = WALL + DISP_T + LIP;
-
-// FPC slot geometry — cable dims from 583.scad (12.5 mm wide, 0.3 mm thick;
-//   right edge 55.47 mm from display right edge)
-_fpc_x1  = WALL + TOL + DISP_W - 55.47 - 12.50 - 2.5;  // slot left edge (2.5 mm wider each side)
-_fpc_xw  = 12.50 + 5.0;                                  // slot width (5 mm wider than cable)
-_fpc_ro  = FPC_BEND_R + 0.30 + TOL;               // outer clearance radius (bend_r + fpc_t + tol)
-// max Y reached by arc at Z=0 (backplate bottom); drives minimum case_d
-_bend_my = BEZEL_Y + DISP_D + sqrt(_fpc_ro*_fpc_ro - (FPC_BEND_R - WALL)*(FPC_BEND_R - WALL));
-case_d   = max(cav_d + WALL + BEZEL_Y, _bend_my + WALL);
-
-_cham_xy = CHAM * tan(CHAM_ANGLE);  // horizontal expansion derived from angle
-
-// Active window position in case coordinates
-// X: symmetric (3.31 mm border each side)
-// Y: offset per drawing — 3.30 mm from Y- entry edge, 7.98 mm from Y+ (FPC) edge
-win_x  = WALL + TOL + (DISP_W - ACT_W) / 2;
-win_y  = 3.30 + BEZEL_Y;
-
-module rounded_box(l, w, h, r) {
-    hull()
-        for (dx = [r, l-r], dy = [r, w-r])
-            translate([dx, dy, 0]) cylinder(r=r, h=h, $fn=32);
-}
+/* [Preview] */
+SHOW_DISP = true;
+EPD_EXPLODE = 0;   // mm to pull display mockup toward Y- for inspection
+CLIP_Z    = 0;     // mm to remove from Z+ (0 = full model; LIP reveals cavity; LIP+DISP_T reveals floor)
 
 module epd_case() {
-    difference() {
-        // Solid case body — open at Y=0 (no Y- wall) by construction
-        rounded_box(case_w, case_d, case_h, CORNER_R);
-
-        // Display cavity: slides in from Y=0; BEZEL_Y extends depth so display seats at Y=BEZEL_Y
-        translate([WALL, -0.01, WALL])
-            cube([cav_w, BEZEL_Y + cav_d + 0.01, DISP_T + TOL]);
-
-        // Active area window: straight portion + chamfered top edges
-        // Extends 0.01 mm into the display cavity to avoid a coplanar face with the mockup
-        translate([win_x, win_y, WALL + DISP_T - 0.01])
-            cube([ACT_W, ACT_D, LIP - CHAM + 0.02]);
-        hull() {
-            translate([win_x, win_y, case_h - CHAM])
-                cube([ACT_W, ACT_D, 0.01]);
-            translate([win_x - _cham_xy, win_y - _cham_xy, case_h])
-                cube([ACT_W + 2*_cham_xy, ACT_D + 2*_cham_xy, 0.01]);
-        }
-
-        // FPC cable slot — quarter-cylinder swept volume of cable arc from horizontal to vertical.
-        // Arc center at (Y=DISP_D, Z=WALL−FPC_BEND_R); first-quadrant slice (Y≥DISP_D, Z≥arc_center_z).
-        // Creates opening through backplate floor and clears Y+ wall material for bend.
-        translate([_fpc_x1, BEZEL_Y + DISP_D, WALL - FPC_BEND_R])
-            intersection() {
-                rotate([0, 90, 0])
-                    cylinder(r=_fpc_ro, h=_fpc_xw, $fn=32);
-                cube([_fpc_xw, _fpc_ro + 1, _fpc_ro + 1]);
-            }
+  difference() {
+    // Solid case body — open at Y=0 (no Y- wall) by construction
+    rounded_box(epd_case_w, epd_case_d, epd_case_h, CORNER_R);
+
+    // Display cavity: slides in from Y=0; BEZEL_Y extends depth so display seats at Y=BEZEL_Y
+    translate([WALL, -0.01, WALL])
+      cube([epd_cav_w, BEZEL_Y + epd_cav_d + 0.01, DISP_T + TOL]);
+
+    // Active area window: straight portion + chamfered top edges
+    // Extends 0.01 mm into the display cavity to avoid a coplanar face with the mockup
+    translate([epd_win_x, epd_win_y, WALL + DISP_T - 0.01])
+      cube([ACT_W, ACT_D, LIP - CHAM + 0.02]);
+    hull() {
+      translate([epd_win_x, epd_win_y, epd_case_h - CHAM])
+        cube([ACT_W, ACT_D, 0.01]);
+      translate([epd_win_x - _cham_xy, epd_win_y - _cham_xy, epd_case_h])
+        cube([ACT_W + 2*_cham_xy, ACT_D + 2*_cham_xy, 0.01]);
     }
 
+    // FPC cable slot — quarter-cylinder swept volume of cable arc from horizontal to vertical.
+    // Arc center at (Y=DISP_D, Z=WALL−FPC_BEND_R); first-quadrant slice (Y≥DISP_D, Z≥arc_center_z).
+    // Creates opening through backplate floor and clears Y+ wall material for bend.
+    translate([_fpc_x1, BEZEL_Y + DISP_D, WALL - FPC_BEND_R])
+      intersection() {
+        rotate([0, 90, 0])
+          cylinder(r=_fpc_ro, h=_fpc_xw, $fn=32);
+        cube([_fpc_xw, _fpc_ro + 1, _fpc_ro + 1]);
+      }
+  }
 }
 
 color("#004B49")
-    intersection() {
-        epd_case();
-        cube([case_w + 1, case_d + 1,
-              ($preview && CLIP_Z > 0) ? max(0.01, case_h - CLIP_Z) : case_h + 1]);
-    }
+  intersection() {
+    epd_case();
+    cube([epd_case_w + 1, epd_case_d + 1,
+          ($preview && CLIP_Z > 0) ? max(0.01, epd_case_h - CLIP_Z) : epd_case_h + 1]);
+  }
 
-// Display mockup — seated at case origin; EXPLODE pulls it toward Y-
+// Display mockup — seated at case origin; EPD_EXPLODE pulls it toward Y-
 if ($preview && SHOW_DISP)
-    translate([WALL + TOL, BEZEL_Y - EXPLODE, WALL])
-        GDEY0583T81(fpc_bend_start=0, fpc_bend_r=FPC_BEND_R, fpc_post_clip=2);
+  translate([WALL + TOL, BEZEL_Y - EPD_EXPLODE, WALL])
+    GDEY0583T81(fpc_bend_start=0, fpc_bend_r=FPC_BEND_R, fpc_post_clip=2);

+ 101 - 8
lid.scad

@@ -1,11 +1,104 @@
-include <cpu_case.scad>
+// Sliding lid for EE04 case — integrates epd_case as ceiling
+// z=0 = bottom of flanges; z=FLANGE_H = ceiling underside / epd_case backplate bottom
+include <params.scad>
+use <epd_case.scad>
+use <GDEY0583T81.scad>
 
-SHOW_BASE     = false;
-SHOW_BOARD    = false;
-SHOW_BATTERY  = false;
-SHOW_PLUNGERS = false;
-SHOW_LID      = false;
-SHOW_EPD_CASE = true;
-EXPLODE       = 0;
+/* [Preview] */
+SHOW_DISP = true;
 
+// ============================================================
+//  LID  (slide-on; enters from Y- face, closes toward Y+)
+//  Flanges sit inside cavity and ride on base retention flange hypotenuses.
+// ============================================================
+module lid() {
+  // Flanges: right triangles in XZ; hypotenuse at reciprocal angle to base retention flanges.
+  // Wide vertical face at x=WALL+FLANGE_W (inner), tip at bottom-wall-face — same
+  // (-FLANGE_W, -FLANGE_H) hypotenuse slope as base flanges so they mate when lid slides in.
+  color("#2C3863") {
+    // Left (X-) flange — stops at Y+ locking flange inner face
+    hull() {
+      translate([WALL + FLANGE_W - SLIDE_CLEAR - 0.01, 0, 0])
+        cube([0.01, LID_Y_LEN - FLANGE_W + SLIDE_CLEAR, FLANGE_H - SLIDE_CLEAR]);
+      translate([WALL + SLIDE_CLEAR, 0, -0.005])
+        cube([0.01, LID_Y_LEN - FLANGE_W + SLIDE_CLEAR, 0.01]);
+    }
+    // Right (X+) flange — stops at Y+ locking flange inner face
+    hull() {
+      translate([OUT_L - WALL - FLANGE_W + SLIDE_CLEAR, 0, 0])
+        cube([0.01, LID_Y_LEN - FLANGE_W + SLIDE_CLEAR, FLANGE_H - SLIDE_CLEAR]);
+      translate([OUT_L - WALL - SLIDE_CLEAR - 0.01, 0, -0.005])
+        cube([0.01, LID_Y_LEN - FLANGE_W + SLIDE_CLEAR, 0.01]);
+    }
+
+    // Interior ribs — 2 mm wide
+    translate([WALL + FLANGE_W - SLIDE_CLEAR, 0, 0])
+      cube([2.0, LID_Y_LEN - FLANGE_W + SLIDE_CLEAR, FLANGE_H]);
+    translate([OUT_L - WALL - FLANGE_W + SLIDE_CLEAR - 2.0, 0, 0])
+      cube([2.0, LID_Y_LEN - FLANGE_W + SLIDE_CLEAR, FLANGE_H]);
+
+    // Y+ locking flanges — angled wedge matching side-flange profile; split around FPC notch
+    for (seg = [
+      [FLANGE_W - SLIDE_CLEAR + 2.0,
+       2+PCB_OX + FPC_CX - FPC_NOTCH_W/2 - (WALL + FLANGE_W - SLIDE_CLEAR + 2.0)],
+      [PCB_OX + FPC_CX + FPC_NOTCH_W/2,
+       OUT_L - FLANGE_W + SLIDE_CLEAR - 2.0 - (PCB_OX + FPC_CX + FPC_NOTCH_W/2)]
+    ]) {
+      hull() {
+        translate([seg[0], LID_Y_LEN - FLANGE_W + SLIDE_CLEAR - 0.01, 0])
+          cube([seg[1], 0.01, FLANGE_H - SLIDE_CLEAR]);
+        translate([seg[0], LID_Y_LEN - SLIDE_CLEAR - 0.01, -0.005])
+          cube([seg[1], 0.01, 0.01]);
+      }
+      // Backing rib — 2 mm deep on cavity face of flange, matches side-rib style
+      translate([seg[0], LID_Y_LEN - FLANGE_W + SLIDE_CLEAR - 2.0, 0])
+        cube([seg[1], 2.0, FLANGE_H]);
+    }
+  }
+
+  color("#004B49")
+  difference() {
+    union() {
+      if (!EPD_IS_LID)
+        // Flat ceiling plate — test fit without epd_case geometry
+        translate([0, -WALL, FLANGE_H])
+          rounded_box(OUT_L, OUT_W, LID_T, CORNER_R);
+      else
+        translate([
+          OUT_L/2 - epd_case_w/2,
+          OUT_W - epd_case_d - WALL,
+          LID_T
+        ])
+          epd_case();
+
+      // Y- lip — same rounded_box profile clipped to the Y- wall zone so the
+      // lip corners match the base exterior corners
+      intersection() {
+        translate([0, -WALL, -SLIDE_CLEAR])
+          rounded_box(OUT_L, OUT_W, FLANGE_H + SLIDE_CLEAR, CORNER_R);
+        translate([-0.1, -WALL - 0.1, -SLIDE_CLEAR - 0.1])
+          cube([OUT_L + 0.2, WALL + 0.2, FLANGE_H + SLIDE_CLEAR + 0.2]);
+      }
+    }
+
+    // FPC cable slot — from Y+ face of U-rib bottom bar, FPC_SLOT_W toward Y+
+    translate([PCB_OX + FPC_CX - FPC_NOTCH_W/2,
+               LID_Y_LEN - 3 - FPC_U_DEPTH + FPC_U_T,
+               FLANGE_H - 0.1])
+      cube([FPC_NOTCH_W, FPC_SLOT_W, LID_T + 0.2]);
+  }
+
+  // Display mockup — seated inside epd_case, preview only
+  if ($preview && EPD_IS_LID && SHOW_DISP)
+    translate([
+      OUT_L/2 - epd_case_w/2 + WALL + TOL,
+      OUT_W - epd_case_d - WALL + BEZEL_Y,
+      LID_T + WALL
+    ])
+      GDEY0583T81(fpc_bend_start=0, fpc_bend_r=FPC_BEND_R, fpc_post_clip=2);
+}
+
+// ============================================================
+//  RENDER
+// ============================================================
 lid();

+ 134 - 0
params.scad

@@ -0,0 +1,134 @@
+// ============================================================
+//  Shared Parameters
+//  include <params.scad> in all component files
+// ============================================================
+
+/* [Design Style] */
+EPD_IS_LID = true;   // true: epd_case forms the lid ceiling; false: flat ceiling plate
+
+/* [Shared Case] */
+WALL     = 2.0;
+CORNER_R = 2.5;
+
+/* [Display Dimensions — GDEY0583T81] */
+DISP_W = 125.4;
+DISP_D = 99.5;
+DISP_T = 1.2;
+ACT_W  = 118.78;
+ACT_D  = 88.22;
+
+/* [EPD Case Parameters] */
+LIP        = 1.5;
+TOL        = 0.3;
+CHAM       = 1.0;
+CHAM_ANGLE = 60;
+BEZEL_Y    = 2.5;
+FPC_BEND_R = 4.0;
+
+/* [EPD Case Derived] */
+epd_cav_w  = DISP_W + TOL * 2;
+epd_cav_d  = DISP_D + TOL;
+epd_case_w = epd_cav_w + WALL * 2;
+epd_case_h = WALL + DISP_T + LIP;
+_fpc_x1    = WALL + TOL + DISP_W - 55.47 - 12.50 - 2.5;
+_fpc_xw    = 12.50 + 5.0;
+_fpc_ro    = FPC_BEND_R + 0.30 + TOL;
+_bend_my   = BEZEL_Y + DISP_D + sqrt(_fpc_ro*_fpc_ro - (FPC_BEND_R - WALL)*(FPC_BEND_R - WALL));
+epd_case_d = max(epd_cav_d + WALL + BEZEL_Y, _bend_my + WALL);
+_cham_xy   = CHAM * tan(CHAM_ANGLE);
+epd_win_x  = WALL + TOL + (DISP_W - ACT_W) / 2;
+epd_win_y  = 3.30 + BEZEL_Y;
+
+/* [Board Dimensions — EE04] */
+PCB_L       = 80.00;
+PCB_W       = 41.22;
+PCB_T       = 1.93;
+COMP_MAX_Z  = 7.29;
+COMP_SIDE_Z = 3.82;
+
+/* [Sliding Lid] */
+LID_T       = 1.5;
+FLANGE_H    = 3.0;
+FLANGE_W    = FLANGE_H * tan(30);
+SLIDE_CLEAR = 0.40;
+
+/* [FPC Notch — must match EPD case slot geometry] */
+FPC_NOTCH_W = _fpc_xw;    // slot X width: cable 12.5 + 2×2.5 mm clearance
+FPC_U_T     = LID_T;
+FPC_SLOT_W  = 4.1;        // ≈ sqrt(_fpc_ro²−(FPC_BEND_R−WALL)²) at epd_case z=0
+
+/* [+Y Wall Cutouts] */
+PWR_CX      = 10.3;
+PWR_W       = 5.0;
+PWR_H       = 2.5;
+PWR_CZ      = 3.8;
+PWR_COVER_T = 0.6;
+
+USBC_CX        = 65.65;
+USBC_W         = 9.0;
+USBC_H         = 3.22;
+USBC_CZ        = 4.31;
+USBC_CBL_CLEAR = 1.5;
+
+BTN_CX = [48.4, 39.075, 29.725, 20.425];
+BTN_D  = 2.3;
+BTN_CZ = 3.85;
+
+/* [Plunger] */
+PLUNGER_D      = 2.0;
+FLANGE_D       = 2.9;
+FLANGE_T       = 1.2;
+PLUNGER_HEAD_H = 1.5;
+
+/* [CPU Case] */
+FLOOR   = 2.0;
+SCREW_D = 3.2;
+BOSS_D  = 6.0;
+BOSS_H  = 2.0;
+
+/* [Locating Studs] */
+STUD_CLEAR = 0.10;
+STUD_H     = PCB_T + 1.0;
+STUD_R     = (SCREW_D - 2*STUD_CLEAR) / 2;
+
+/* [PCB Standoff Positions — relative to PCB origin] */
+PCB_BOSS_X1 = 2.5;
+PCB_BOSS_X2 = PCB_L - 2.5;
+PCB_BOSS_Y1 = 2.5;
+PCB_BOSS_Y2 = PCB_W - 2.5;
+
+/* [Interior Clearances] */
+CLR_XN   = 2.0;
+CLR_XP   = 44.0;
+CLR_YN   = 15.0;
+CLR_YP   = 1.77;
+CLR_LID  = 3.5;
+BATT_W   = 34.5;
+BATT_D   = 51.0;
+BATT_T   = 6.3;
+CLR_BATX = 1.5;
+CLR_BATY = 1.5;
+
+/* [CPU Case Derived] */
+PCB_Z        = FLOOR + BOSS_H;
+BASE_INNER_H = BOSS_H + COMP_MAX_Z + CLR_LID;
+BASE_H       = FLOOR + BASE_INNER_H;
+PCB_OX       = WALL + CLR_XN;
+PCB_OY       = WALL + CLR_YN;
+CAV_L        = CLR_XN + PCB_L + CLR_XP;
+CAV_W        = CLR_YN + PCB_W + CLR_YP;
+OUT_L        = CAV_L + 2*WALL;
+OUT_W        = CAV_W + 2*WALL;
+LID_H        = FLANGE_H + LID_T;
+LID_Y_LEN    = CAV_W;
+
+// FPC alignment — derived from EPD case geometry (replaces hardcoded values in old cpu_case)
+FPC_CX      = OUT_L/2 - epd_case_w/2 + (_fpc_x1 + _fpc_xw/2) - PCB_OX;
+FPC_U_DEPTH = FPC_U_T - WALL - 3 + (epd_case_d - (BEZEL_Y + DISP_D));
+
+/* [Shared Helper] */
+module rounded_box(l, w, h, r) {
+    hull()
+        for (dx = [r, l-r], dy = [r, w-r])
+            translate([dx, dy, 0]) cylinder(r=r, h=h, $fn=32);
+}

+ 19 - 7
plunger.scad

@@ -1,12 +1,24 @@
-include <cpu_case.scad>
+// Button plunger for EE04 case +Y wall
+// At rest: flange flush with interior face, head proud of exterior face
+include <params.scad>
 
-SHOW_BASE     = false;
-SHOW_BOARD    = false;
-SHOW_LID      = false;
-SHOW_PLUNGERS = false;
+module plunger() {
+  color("orange") union() {
+    translate([0, -FLANGE_T, 0])
+      rotate([-90, 0, 0])
+        cylinder(d = PLUNGER_D, h = FLANGE_T + WALL + PLUNGER_HEAD_H, $fn = 32);
+    translate([0, -FLANGE_T, 0])
+      rotate([-90, 0, 0])
+        cylinder(d = FLANGE_D, h = FLANGE_T, $fn = 32);
+    translate([0, WALL, 0])
+      rotate([-90, 0, 0])
+        cylinder(d = PLUNGER_D, h = PLUNGER_HEAD_H, $fn = 32);
+  }
+}
 
-// Single plunger, long axis vertical — flange on build plate.
-// rotate([90,0,0]) maps Y→Z; translate lifts flange face to z=0.
+// ============================================================
+//  RENDER — long axis vertical, flange face on build plate
+// ============================================================
 translate([0, 0, FLANGE_T])
   rotate([90, 0, 0])
     plunger();

+ 5 - 4
render.sh

@@ -10,8 +10,9 @@ render() {
   "$OPENSCAD" -o "$out" "$src" 2>&1 | grep -v '^$'
 }
 
-echo "Rendering cpu_case pieces..."
-render bottom.scad  bottom.stl
-render lid.scad     lid.stl
-render plunger.scad plunger.stl
+echo "Rendering printable parts..."
+render cpu_case.scad  cpu_case.stl
+render epd_case.scad  epd_case.stl
+render lid.scad       lid.stl
+render plunger.scad   plunger.stl
 echo "Done."