From de1153781f911f10b2cfa9221e787890323644d2 Mon Sep 17 00:00:00 2001
From: Erik Strand <erik.strand@cba.mit.edu>
Date: Fri, 10 May 2019 01:52:17 -0400
Subject: [PATCH] Make board width a derived parameter

Since we always want it to be as small as possible.
---
 node_board/main.cpp | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/node_board/main.cpp b/node_board/main.cpp
index 15018e2..6a5fd54 100644
--- a/node_board/main.cpp
+++ b/node_board/main.cpp
@@ -95,18 +95,23 @@ int main() {
     double pad_y_max;
 
     // board params
-    double const width = 6.6;
+    // width is deduced later
     double const height = 14;
     double const ppmm = 50; // equivalent to 1270 ppi
     double const min_cut_thickness = 0.38;
     double const min_trace_thickness = 0.35;
-    Board board(width, height, ppmm, min_cut_thickness);
 
     // SOIC dims
     double const pad_width = 0.6;
     double const pad_height = 2.4;
     double const soic_height = 7;
     double const soic_pitch = 1.27;
+    double const soic_width = 3 * soic_pitch + pad_width;
+
+    // deduce width and make the board
+    double const width = soic_width + 3 * min_cut_thickness + 3 * min_trace_thickness;
+    std::cout << "Board width: " << width << "mm\n";
+    Board board(width, height, ppmm, min_cut_thickness);
 
     // SOIC pads
     double const soic_x_min = min_trace_thickness + min_cut_thickness;
-- 
GitLab