From 651a39d9dca38e6be29d55c9a5881f866e6fb2a3 Mon Sep 17 00:00:00 2001
From: XANTRONIX Development
Date: Wed, 15 Nov 2023 13:13:45 -0500
Subject: Move more values into keyboard.scad

---
 case/keyboard.scad | 28 +++++++++++++++-------------
 case/top.scad      | 18 ++++++++----------
 2 files changed, 23 insertions(+), 23 deletions(-)

(limited to 'case')

diff --git a/case/keyboard.scad b/case/keyboard.scad
index cc50b57..06ff2d2 100644
--- a/case/keyboard.scad
+++ b/case/keyboard.scad
@@ -1,6 +1,18 @@
-keyboard_pcb_width  = 257.175;
-keyboard_pcb_length =  95.250;
-keyboard_pcb_height =   1.600;
+keyboard_switch_width      = 19.0500;
+keyboard_switch_length     = 19.0500;
+keyboard_switch_leg_length =  3.30;
+keyboard_switch_height     = 11.10;
+keyboard_switch_sizes      = [
+    [0.5,  1.0,  1.0,  1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0],
+    [1.0,  1.0,  1.0,  1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.5],
+    [1.25, 1.0,  1.0,  1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.25],
+    [1.75, 1.0,  1.0,  1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.75],
+    [1.0,  1.25, 1.25, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]
+];
+
+keyboard_pcb_width  = 13.5 * keyboard_switch_width;
+keyboard_pcb_length =  5.0 * keyboard_switch_length;
+keyboard_pcb_height =  1.600;
 
 keyboard_pcb_screw_holes = [
     [  4.7625, 85.7250],
@@ -14,13 +26,3 @@ keyboard_pcb_screw_holes = [
     [123.8250,  9.5250],
     [238.1250,  9.5250]
 ];
-
-keyboard_switch_leg_length =  3.30;
-keyboard_switch_height     = 11.10;
-keyboard_switch_sizes      = [
-    [0.5,  1.0,  1.0,  1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0],
-    [1.0,  1.0,  1.0,  1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.5],
-    [1.25, 1.0,  1.0,  1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.25],
-    [1.75, 1.0,  1.0,  1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.75],
-    [1.0,  1.25, 1.25, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]
-];
diff --git a/case/top.scad b/case/top.scad
index 4b66326..7299fac 100644
--- a/case/top.scad
+++ b/case/top.scad
@@ -28,10 +28,8 @@ module top_case(key_switch_sizes, pcb_screw_holes) {
     wall_width  =  2.5000;
     wall_height = 17.2500;
 
-    key_switch_width  = 19.0500;
-    key_switch_length = 19.0500;
-    keyboard_width    = key_switch_width  * 13.5;
-    keyboard_length   = key_switch_length *  5.0;
+    keyboard_width    = keyboard_switch_width  * 13.5;
+    keyboard_length   = keyboard_switch_length *  5.0;
     keyboard_x_offset = 12.2500;
     keyboard_y_offset = 12.2500;
 
@@ -117,12 +115,12 @@ module top_case(key_switch_sizes, pcb_screw_holes) {
         function addrange(v, x, y) = add(slice(v, x, y));
 
         module key_switch_plate(key_switch_size) {
-            plate_width  = key_switch_width * key_switch_size;
-            plate_length = key_switch_length;
+            plate_width  = keyboard_switch_width * key_switch_size;
+            plate_length = keyboard_switch_length;
 
             if (key_switch_size <= 0.5) {
-                cube([key_switch_width  * key_switch_size,
-                      key_switch_length,
+                cube([keyboard_switch_width  * key_switch_size,
+                      keyboard_switch_length,
                       wall_width], false);
             } else {
                 hole_width  = key_switch_footprint[0];
@@ -163,13 +161,13 @@ module top_case(key_switch_sizes, pcb_screw_holes) {
             rows = len(key_switch_sizes);
 
             for (i = [0: rows-1]) {
-                y = key_switch_length * (rows - 1 - i);
+                y = keyboard_switch_length * (rows - 1 - i);
 
                 key_switch_row = key_switch_sizes[i];
                 cols           = len(key_switch_row);
 
                 for (j = [0: cols-1]) {
-                    x = key_switch_width * ((j == 0)?
+                    x = keyboard_switch_width * ((j == 0)?
                         0:
                         addrange(key_switch_row, 0, j-1));
 
-- 
cgit v1.2.3