chiark / gitweb /
adafruit-powerboost: battery legend wip
[reprap-play.git] / adafruit-powerboost-1000.scad
1 // -*- C -*-
2
3 psu_sz_nom = [ 11.43*2, 36.20 ];
4
5 //// toplevels-from:
6 include <adafruit-powerboost-common.scad>
7
8 psu_hole_pos = [ 2.05, // from back edge of psu_sz[0]
9                  0.55 * 0.5 * 25.4, // from centreline
10                  ];
11
12 psu_led_low_x = 4;
13
14 psu_led_usbend_y_min = 4.5;
15 psu_led_chrg_min_x = -1.0;
16 psu_led_chrg_max_x = 3.0;
17 psu_led_chrg_both_sz_y = 7.0;
18
19 psu_led_low_sz_x = 4.5;
20 psu_led_low_min_y = -1.5;
21 psu_led_low_max_y = 2.5;
22
23 psu_led_baffle_th = 0.8;
24 psu_led_baffle_ends = 1.5;
25
26 psu_baffle_th = [ 0.8, 3.5 ];
27 psu_innerend_led_depth = 7;
28
29 psu_led_legend_battery_l = 6.0;
30 psu_led_legend_battery_w = 4.0;
31 psu_led_legend_battery_edge = 0.75;
32 psu_led_legend_battery_nub_l = 0.75;
33 psu_led_legend_battery_nub_w = 1.5;
34
35 psu_led_legend_gap = 0.75;
36
37 // ----- calculated -----
38
39 psu_innerend_led_x_midder =  - psu_hole_pos[1] - psu_hole_dia/2;
40
41 module PsuLedBafflePlan(){
42   AtPsuMountCorner(0,0) {
43     translate([ (psu_led_chrg_min_x + psu_led_chrg_max_x)/2,
44                psu_led_usbend_y_min + psu_led_chrg_both_sz_y/2 ])
45       square(center=true,
46              [ psu_led_chrg_max_x - psu_led_chrg_min_x
47                + psu_led_baffle_ends*2,
48                psu_led_baffle_th ]);
49   }
50 }
51
52 module PsuLedWindowsPlanCore(){
53   difference(){
54     union(){
55       // Two LEDs one side of inlet connector
56       // "Full" (near edge) and "Chrg" (inner)
57       AtPsuMountCorner(0,0) {
58         translate([0, psu_led_usbend_y_min ])
59           rectfromto([ psu_led_chrg_min_x, 0 ],
60                      [ psu_led_chrg_max_x,
61                        psu_led_chrg_both_sz_y ]);
62       }
63
64       // One LED, "Low", other side of inlet connector
65       AtPsuMountCorner(1,0) {
66         translate([0, psu_led_usbend_y_min ])
67           rectfromto([ 0,
68                        psu_led_low_min_y ],
69                      [ psu_led_low_sz_x,
70                        psu_led_low_max_y ]);
71       }
72
73       // One LED, PWR, near outlet USB pads
74       AtPsuMountCorner(0,1){
75         rectfromto([0,0],
76                    [psu_sz[0]/2 + psu_innerend_led_x_midder,
77                     psu_innerend_led_depth]);
78       }
79     }
80   }
81 }
82
83 module PsuLedLegendBattery(percent=50){
84   e = psu_led_legend_battery_edge;
85   empty_l = (100-percent)/100 * (psu_led_legend_battery_l - e*2);
86   difference(){
87     union(){
88       square([psu_led_legend_battery_l,
89               psu_led_legend_battery_w], center=true);
90       translate([psu_led_legend_battery_l/2, 0])
91         square([psu_led_legend_battery_nub_l*2,
92                 psu_led_legend_battery_nub_w], center=true);
93     }
94     if (empty_l > 0)
95       translate([-(psu_led_legend_battery_l/2-e),
96                  -(psu_led_legend_battery_w/2-e)])
97         square([empty_l, psu_led_legend_battery_w - e*2]);
98   }
99 }  
100
101 module PsuLedLegendsPlan(){
102   translate(0.5 * [0, psu_sz[1]]
103             + [psu_led_legend_battery_l/2
104                + psu_innerend_led_x_midder
105                + psu_led_legend_gap,
106                -psu_innerend_led_depth/2]
107             )
108     PsuLedLegendBattery(0);
109 //  mirror([1,0])
110 //    text("\u2300\u23fb", font="Noto Regular");
111 }