2 * Copyright © 2016 Keith Packard <keithp@keithp.com>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 2 of the License.
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * General Public License for more details.
13 * You should have received a copy of the GNU General Public License along
14 * with this program; if not, write to the Free Software Foundation, Inc.,
15 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
23 real pixtomm(real pix) = pix / dpi * 25.4;
33 real xmm(real xpix) = pixtomm(xpix - origin_x);
35 /* Image was of the bottom, mirror the result */
36 real ymm(real ypix) = pixtomm(1999 - (ypix - origin_y));
38 pos_t pos(real xpix, real ypix) = (pos_t) { .x = xmm(xpix), .y = ymm(ypix) };
40 pos_t ul = pos(543, 213);
41 pos_t ur = pos(2912, 213);
42 pos_t mll = pos(423, 1036);
43 pos_t mlr = pos(543, 1036);
44 pos_t mrl = pos(2912, 1036);
45 pos_t mrr = pos(3980, 1036);
46 pos_t ll = pos(423, 1955);
47 pos_t lr = pos(3980, 1955);
49 pos_t mount_ul = pos(761, 208);
50 pos_t mount_ur = pos(2082, 208);
52 pos_t mount_ll = pos(652, 1999);
53 pos_t mount_lr = pos(3500, 1999);
55 real mounting_hole = pixtomm(142);
57 pos_t pin_l = pos(423 + 257, 1955 - 826);
58 pos_t pin_r = pos(423 + 1788, 1955 - 826);
60 real index_pin = pixtomm(100);
62 void linepos(pos_t a, pos_t b) { line(a.x, a.y, b.x, b.y); }
76 pin_mm_options(a.x, a.y, mounting_hole, 0, "mount", "mount", "hole");
80 pin_mm_options(a.x, a.y, index_pin, 0, "pin", "pin", "hole");
95 real ysplit = ymm(1500);
96 real ygap = pixtomm(1536 - 1442);
98 void contact(pos_t ul, pos_t lr, string name, string num) {
99 pad_mm((ul.x + lr.x) / 2,
106 void top_contact(real x, real width, string name, string num) {
107 contact((pos_t) { .x = x, .y = mll.y },
108 (pos_t) { .x = x + width, .y = ysplit + ygap / 2 },
112 real contact_left = xmm(563 + 2909 - 2667);
113 real contact_right = xmm(2922);
114 real contact_width = pixtomm(3267 - 2901);
116 void bottom_contact(real x, real width, string name, string num) {
117 contact((pos_t) { .x = x, .y = ysplit - ygap / 2 },
118 (pos_t) { .x = x + width, .y = ll.y },
122 element_start("servo");
128 bottom_contact(contact_left, contact_width, "1", "1");
129 bottom_contact(contact_right, contact_width, "2", "2");
131 top_contact(contact_left, contact_width, "3", "3");
132 top_contact(contact_right, contact_width, "4", "4");