case.scad: alternative lid clips
[heater.git] / case.scad
index e4acfcb..653a79a 100644 (file)
--- a/case.scad
+++ b/case.scad
@@ -1,20 +1,15 @@
-/* TODO
-   - nabeh zaklapavaciho hranolu by mel byt zkoseny
-   - vystup pro kabel leze do vystupu pro snuru pri vetsim wall
-   - diry pro uchyceni jsou mozna prilis male
-*/
-lowres = 1; // fast rendering or fine printing with print-friendly orientation
+lowres = 0; // fast rendering or fine printing with print-friendly orientation
 
 eps = 0.01;
 infty = 300;
 
 
 eps = 0.01;
 infty = 300;
 
-wall = 2.0; // generic wall thickness
+wall = 1.5; // generic wall thickness
 
 // 18650 is ~18mm diameter, ~65mm length, 
 
 // 18650 is ~18mm diameter, ~65mm length, 
-batt_diam = 18 + 0.6;
-batt_len = 65 + 1.5;
+batt_diam = 18 + 0.8;
+batt_len = 65 + 2.0;
 
 
-cable_sep = 2;
+cable_sep = 1.5;
 
 // front flat area
 front_flat_len = batt_len + 4*wall + 2*cable_sep;
 
 // front flat area
 front_flat_len = batt_len + 4*wall + 2*cable_sep;
@@ -24,20 +19,18 @@ pcb_len = 36 + 1;   // length of the board
 pcb_width = 11 + 0.5;  // width of the board
 pcb_thick = 1.2 + 0.3;         // thickness of the board
 pcb_comp_h = 2.2;      // height of the components on board
 pcb_width = 11 + 0.5;  // width of the board
 pcb_thick = 1.2 + 0.3;         // thickness of the board
 pcb_comp_h = 2.2;      // height of the components on board
+pcb_comp_h2 = 4.5;     // height of the components on board - component side
 pcb_groove = 1;
 
 pcb_groove = 1;
 
-body_top_h = 0.35 * batt_diam; // cube-shaped part of the body
+body_top_h = 0.38 * batt_diam; // cube-shaped part of the body
 
 
-outwire_thick = 2.2;
-wire_thick = 2.2;
+wire_thick = 2.5;
 wire_sep = 3.5;
 wire_sep = 3.5;
-cable_out_diam = 5.2;
 
 
-batt_end_h = wire_sep/2 + wire_thick/2 + 1.5;;
+lid_sep = 0.2; // the lid is made this much smaller to separate from the body
 
 
-lid_sep = 0.1; // the lid is made this much smaller to separate from the body
-
-sw_diam = 2.5 + 0.5;
+// sw_diam = 2.5 + 0.5;
+sw_diam = 3.5 + 0.5;
 led_diam = 3 + 0.5;
 sw_xoff =  250 * 25.4/1000; // x offset of microswitches
 pcb_xoff = 90 * 25.4/1000; // offset of the LED from the middle of the PCB
 led_diam = 3 + 0.5;
 sw_xoff =  250 * 25.4/1000; // x offset of microswitches
 pcb_xoff = 90 * 25.4/1000; // offset of the LED from the middle of the PCB
@@ -45,8 +38,26 @@ pcb_xoff = 90 * 25.4/1000; // offset of the LED from the middle of the PCB
 prg_len = 10; // programming connector
 prg_width = 7;
 
 prg_len = 10; // programming connector
 prg_width = 7;
 
-rear_clip_hole_dist = 10; // distance between the holes in the rear clip
-rear_clip_aspect = 0.35; // w/h aspect ratio of the ellipse of the rear clip
+outcable_h = 4.5;
+outcable_w = 2.5;
+
+// mounting cylinder + holes
+mounthole_w = 5;
+mounthole_h = 3;
+mountcyl_w = mounthole_w + 4*wall;
+mountcyl_h = 2*wall;
+mountcone_h = mounthole_h + 2*wall;
+
+clip_pretension = 0.5;
+
+plus_width = 4.5; // width of the + sign
+
+batt_contact_w = 12;
+batt_contact_h = 14;
+batt_contact_h_lid = batt_contact_h-2;
+clip_cyl_r = 0.7;
+batt_end_h = body_top_h - 4*clip_cyl_r;;
+
 
 module case_body() {
        hull() {
 
 module case_body() {
        hull() {
@@ -61,26 +72,53 @@ module case_body() {
                        translate([-infty/2, -infty/2, eps]) cube(infty);
                };
                translate([-front_flat_len/2,
                        translate([-infty/2, -infty/2, eps]) cube(infty);
                };
                translate([-front_flat_len/2,
-                       batt_diam/2 - pcb_width,
-                       -batt_diam/2-2*pcb_comp_h-pcb_thick-wall])
-                       cube([front_flat_len, pcb_width+wall, eps]);
+                       batt_diam/2 - pcb_width-0.5*wall,
+                       -batt_diam/2-pcb_comp_h-pcb_comp_h2-pcb_thick-wall])
+                       cube([front_flat_len, pcb_width+1.5*wall, eps]);
+       };
+       // mounting cylinders
+       for (x = [-1, 1]) translate([x*(batt_len/2-mounthole_w/2),
+               batt_diam/2+wall, 0]) {
+                       translate([0, 0, -batt_diam/2-wall-pcb_comp_h-pcb_comp_h2-pcb_thick])
+                               mount_cyl(); // front
+                       translate([0, 0, body_top_h]) // rear
+                               scale([1, 1, -1])
+                               mount_cyl();
        };
        };
-       for (x = [-1, 1]) scale([x, 1, 1]) hull() {
-               for (x0 = [0-wall, 10+wall])
-                       translate([batt_len/2-wall-wire_thick-x0, batt_diam/2, 0])
-                               rotate([-90, 0, 0]) scale([rear_clip_aspect, 1, 1])
-                               cylinder(r=batt_diam/2 + 2*wall + wire_thick, h=wall);
-               };
 };
 
 };
 
+module mount_cyl() {
+       assign(h = mounthole_h+wall)
+       hull () {
+               translate([0, -mountcyl_w/2+mounthole_h + wall])
+                       cylinder(r = mountcyl_w/2, h = mountcyl_h);
+               assign(l = 2*sqrt(h*(mountcyl_w-h)))
+               translate([-l/2, 0, mountcyl_h + mountcone_h])
+                       cube([l, eps, eps]);
+       };
+};
+       
 module case() {
        difference() {
                case_body();
                // upper cube-shaped part
                // rotate([20, 0, 0])
                translate([-batt_len/2, -batt_diam/2, 0])
 module case() {
        difference() {
                case_body();
                // upper cube-shaped part
                // rotate([20, 0, 0])
                translate([-batt_len/2, -batt_diam/2, 0])
-                       cube([batt_len, batt_diam, batt_diam]);
-
+                       cube([batt_len, batt_diam, batt_end_h+eps]);
+               // upper longer cube-shaped part
+               difference() {
+                       translate([-batt_len/2-cable_sep-wall, -batt_diam/2, batt_end_h])
+                               cube([batt_len+2*cable_sep+2*wall, batt_diam, batt_diam]);
+                       // clips
+                       for (x = [-1,1]) scale([1, x, 1])
+                               translate([batt_len/6, batt_diam/2, batt_end_h + 3*clip_cyl_r])
+                               rotate([0, -90, 0])
+                               cylinder(r = clip_cyl_r, h = batt_len/3, $fn=4);
+               }
+               // grabbing holes
+               for (x=[-1,1]) scale([x,1,1])
+               translate([batt_len/2 + 2*wall + cable_sep+10-wall, 0, 0])
+                       cylinder(r1 = 7, r2 = 10, h = body_top_h + eps);
                // battery cylinder for the lower part
                translate([-batt_len/2, 0, 0])
                        rotate([0, 90, 0])
                // battery cylinder for the lower part
                translate([-batt_len/2, 0, 0])
                        rotate([0, 90, 0])
@@ -92,29 +130,40 @@ module case() {
                        -batt_diam/2-pcb_thick - pcb_comp_h])
                        cube([pcb_len, pcb_width,
                                batt_diam/2 + pcb_thick + pcb_comp_h + eps]);
                        -batt_diam/2-pcb_thick - pcb_comp_h])
                        cube([pcb_len, pcb_width,
                                batt_diam/2 + pcb_thick + pcb_comp_h + eps]);
-               // hole above the PCB
-               translate([-pcb_len/2-pcb_xoff-wall-2*outwire_thick,
+               // hole above the PCB for the outgoing cable
+               translate([-pcb_len/2-pcb_xoff-2*wall-outcable_w,
                        batt_diam/2-pcb_width,
                        -batt_diam/2-pcb_comp_h])
                        cube([pcb_len, pcb_width,
                                batt_diam/2 + pcb_comp_h + eps]);
                        batt_diam/2-pcb_width,
                        -batt_diam/2-pcb_comp_h])
                        cube([pcb_len, pcb_width,
                                batt_diam/2 + pcb_comp_h + eps]);
-               // hole under the PCB
+               // cable outlet
+               translate([-pcb_xoff-pcb_len/2-wall-outcable_w,
+                       -pcb_width+batt_diam/2,
+                       -batt_diam/2-outcable_h])
+                       cube([outcable_w, infty, outcable_h]);
+               // hole under the PCB (groove)
                translate([-pcb_len/2+pcb_groove-pcb_xoff,
                        batt_diam/2-pcb_width + pcb_groove,
                translate([-pcb_len/2+pcb_groove-pcb_xoff,
                        batt_diam/2-pcb_width + pcb_groove,
-                       -batt_diam/2-pcb_thick - 2*pcb_comp_h])
+                       -batt_diam/2-pcb_thick - pcb_comp_h - pcb_comp_h2])
                        cube([pcb_len-2*pcb_groove, pcb_width-2*pcb_groove,
                        cube([pcb_len-2*pcb_groove, pcb_width-2*pcb_groove,
-                               batt_diam/2 + pcb_thick + pcb_comp_h + eps]);
+                               batt_diam/2 + pcb_thick + pcb_comp_h2 + eps]);
+               // hole under the PCB (pcb-width)
+               translate([-pcb_len/2+2*pcb_groove-pcb_xoff,
+                       batt_diam/2-pcb_width,
+                       -batt_diam/2-pcb_thick - pcb_comp_h - pcb_comp_h2])
+                       cube([pcb_len-4*pcb_groove, pcb_width,
+                               batt_diam/2 + pcb_thick + pcb_comp_h2 + eps]);
                // hole for prog connector
                translate([pcb_len/2-pcb_xoff-pcb_groove-eps,
                        batt_diam/2-pcb_width/2-prg_width/2,
                // hole for prog connector
                translate([pcb_len/2-pcb_xoff-pcb_groove-eps,
                        batt_diam/2-pcb_width/2-prg_width/2,
-                       -batt_diam/2-pcb_thick - 2*pcb_comp_h])
+                       -batt_diam/2-pcb_thick - pcb_comp_h - pcb_comp_h2])
                        difference() {
                                cube([prg_len+pcb_groove+eps, prg_width,
                                        batt_diam/2 + pcb_thick + pcb_comp_h + eps]);
                        difference() {
                                cube([prg_len+pcb_groove+eps, prg_width,
                                        batt_diam/2 + pcb_thick + pcb_comp_h + eps]);
-                               translate([prg_len/2+pcb_groove, -eps, pcb_comp_h])
+                               translate([prg_len/2+pcb_groove, -eps, pcb_comp_h2])
                                        cube([prg_len/2+eps, prg_width+2*eps, pcb_thick]);
                        };
                                        cube([prg_len/2+eps, prg_width+2*eps, pcb_thick]);
                        };
-                // LED hole
+                // LED and button holes
                translate([0, batt_diam/2-pcb_width/2, -infty/2]) {
                        cylinder(r=led_diam/2, h=infty, $fn=6);
                        translate([sw_xoff, 0, 0])
                translate([0, batt_diam/2-pcb_width/2, -infty/2]) {
                        cylinder(r=led_diam/2, h=infty, $fn=6);
                        translate([sw_xoff, 0, 0])
@@ -122,138 +171,82 @@ module case() {
                        translate([-sw_xoff, 0, 0])
                                cylinder(r=sw_diam/2, h=infty, $fn=6);
                };
                        translate([-sw_xoff, 0, 0])
                                cylinder(r=sw_diam/2, h=infty, $fn=6);
                };
-               // cable outlet
-               translate([-pcb_xoff-pcb_len/2-outwire_thick-wall, -6, 0])
-                       rotate([40, 0, 0])
-                       scale([2, 1, -1])
-                       cylinder(r=outwire_thick/2, h = infty, $fn=12);
-               // space under the wire holes for battery contacts
-               translate([-batt_len/2-2*wall-cable_sep-eps, 0, 0])
-                       difference() {
-                               rotate([0, 90, 0])
-                                       cylinder(r = batt_diam/2-wall, h = batt_len + 4*wall + 2*cable_sep + 2*eps);
-                               translate([-infty/2, -infty/2, -batt_end_h])
-                                       cube(infty);
-                       };
-               // space above the wire holes for battery contacts
-               translate([-batt_len/2-2*wall-cable_sep-eps, -batt_diam/2, batt_end_h])
-                       cube([batt_len + 4*wall + 2*cable_sep + 2*eps, 
-                               batt_diam,
-                               batt_end_h]);
-               // wire holes for battery contacts
-               for (x = [-1, 1])
-               for (y = [-1, 1])
-                       translate([-batt_len/2-wall-eps, x*wire_sep/2, y*wire_sep/2])
-                       rotate([0, 90, 0])
-                               cylinder(r = wire_thick/2, h = batt_len + 2*wall + 2*eps, $fn=6);
                // wire hole from PCB to battery contacts
                // wire hole from PCB to battery contacts
-               // translate([-batt_len/2-wall-eps, 0, -batt_diam/2-pcb_comp_h + wire_thick/2])
-               rotate([40, 0, 0])
-               translate([-batt_len/2-wall-eps, 0, -batt_diam/2 - wall/2 - wire_thick/2])
-                       rotate([0, 90, 0])
-                               cylinder(r = wire_thick/2, h = batt_len + 2*wall + 2*eps, $fn=6);
-               // hole behind the battery contacts
-               for(x=[1, -1])
-               scale([x, 1, 1]) translate([batt_len/2+wall, 0, 0]) hull() {
-                       translate([0, -batt_diam/2, 0])
-                               cube([wall + cable_sep + eps, batt_diam, infty]);
-                       rotate([0, 90, 0])
-                               cylinder(r = batt_diam/2, h = wall+cable_sep+eps);
-                       translate([0, batt_diam/2 - pcb_width,
-                               -batt_diam/2-pcb_comp_h-pcb_thick])
-                               cube([wall + cable_sep + eps, pcb_width, eps]);
-                       translate([cable_sep, batt_diam/2 - pcb_width + wall,
-                               -batt_diam/2-pcb_comp_h-pcb_thick-wall])
-                               cube([wall + eps, pcb_width-2*wall, eps]);
-               };
-               // cable lead to battery contacts
-               for (x=[1, -1]) scale([x, 1, 1])
-                       rotate([-140, 0, 0])
-                       translate([batt_len/2+wire_thick/2, 0, batt_diam/2-2.7])
-                               cylinder(r=wire_thick/2, h = 5.4);
-               
+               rotate([-48, 0, 0])
+               translate([-batt_len/2-wall-cable_sep, 0, -wire_thick/2-wall/2])
+                       cube([batt_len + 2*wall + 2* cable_sep, batt_diam/2 + wire_thick + wall, wire_thick]);
                // mounting holes
                for(x=[-1,1]) scale([x, 1, 1])
                // mounting holes
                for(x=[-1,1]) scale([x, 1, 1])
-               translate([batt_len/2-wall-wire_thick, batt_diam/2+2*wall, -batt_diam/2-pcb_thick-2*pcb_comp_h-wall])
-                       vert_torus();
-                       
-               for (x = [-1, 1]) scale([x, 1, 1]) for (x0 = [0, 10])
-                       translate([batt_len/2-wall-wire_thick-x0, 0, batt_diam/2+wire_thick/2+wall])
-                       rotate([-90, 0, 0])
-                       scale([2,1,1]) cylinder (r=wire_thick/2, h=infty, $fn=16);
+               translate([batt_len/2-mounthole_w/2, batt_diam/2+wall+mounthole_h/2, -infty/2])
+                       scale([1, mounthole_h/mounthole_w, 1])
+                       cylinder(r = mounthole_w/2, h = infty);
+               // holes in front of battery contacts
+               for(x=[-1,1]) scale([x, 1, 1])
+               translate([batt_len/2-eps, wall/2-batt_contact_w/2,
+                       wall/2-batt_contact_h/2])
+                       cube([wall+2*eps, batt_contact_w-wall, infty]);
+               // holes for battery contacts
+               for(x=[-1,1]) scale([x, 1, 1])
+               translate([batt_len/2+wall-eps, -batt_contact_w/2,
+                       -batt_contact_h/2])
+                       cube([cable_sep+2*eps, batt_contact_w, infty]);
+               // internal plus sign - vertical line
+               translate([-batt_len/2 + 0.5*wall+plus_width/2, -plus_width/2, -batt_diam/2-wall])
+                       cube([wall, plus_width, infty]);
+               // internal plus and minus signs - horizontal line
+               for(x=[-1,1]) scale([x, 1, 1])
+               translate([batt_len/2 - wall - plus_width, -wall/2, -batt_diam/2-wall])
+                       cube([plus_width, wall, infty]);
+               // button + label
+               scale([-1, 1, 1])
+               translate([sw_xoff + sw_diam/2 + wall/2 + plus_width/2, batt_diam/2-pcb_width/2-plus_width/2, -batt_diam/2-pcb_thick-pcb_comp_h-pcb_comp_h2-wall-eps])
+                       cube([wall, plus_width, wall/2]);
+               // button +/- label - horizontal line
+               for (x=[-1, 1]) scale([x, 1, 1])
+               translate([sw_xoff + sw_diam/2 + wall, batt_diam/2-pcb_width/2-wall/2, -batt_diam/2-pcb_thick-pcb_comp_h-pcb_comp_h2-wall-eps])
+                       cube([plus_width, wall, wall/2]);
        };
        };
-       // clip barrier
-       for (x = [-1, 1]) scale([x, 1, 1])
-               translate([batt_len/2+wall-eps, batt_diam/2-pcb_width+wall/2+lid_sep,
-                       -batt_diam/2-pcb_thick-pcb_comp_h + wall + lid_sep])
-                       cube([cable_sep+eps, pcb_width-2*wall-2*lid_sep, wall]);
 };
 
 module lid_body() {
 };
 
 module lid_body() {
-       translate([-batt_len/2 - wall - lid_sep, -batt_diam/2+lid_sep, -batt_diam/2 -wall])
-               cube([batt_len + 2*wall + 2*lid_sep, batt_diam-2*lid_sep, batt_diam/2 - batt_end_h + wall - lid_sep]);
-       translate([-batt_len/2 - 2*wall - cable_sep, -batt_diam/2 - wall,
-               -batt_diam/2-wall])
-               cube([batt_len + 4*wall + 2*cable_sep, batt_diam + 2*wall,
-                       wall + batt_diam/2 - body_top_h - lid_sep]);
-       // clip behind the battery contacts
-       for(x=[1, -1])
-               scale([x, 1, 1]) translate([batt_len/2+wall+lid_sep, 0, 0]) hull() {
-                       translate([0, -batt_diam/2+lid_sep, -batt_diam/2])
-                               cube([wall+cable_sep-lid_sep, batt_diam-2*lid_sep, eps]);
-                       rotate([0, 90, 0])
-                               cylinder(r = batt_diam/2-lid_sep, h = wall+cable_sep-lid_sep);
-                       translate([0, batt_diam/2 - pcb_width+lid_sep,
-                               batt_diam/2+pcb_comp_h+pcb_thick-lid_sep])
-                               cube([wall+cable_sep-lid_sep, pcb_width-2*lid_sep, eps]);
-                       translate([cable_sep+wall/2, batt_diam/2 - pcb_width + 1.5*wall +lid_sep,
-                               batt_diam/2+pcb_comp_h+pcb_thick+wall/2-lid_sep])
-                               cube([wall/2-lid_sep, pcb_width-2*wall-2*lid_sep, eps]);
-                       // rear cone
-                       translate([cable_sep+wall-lid_sep, 0, -batt_diam/2-wall]) difference() {
-                               scale([0.5, 1, 1])
-                               cylinder(r = batt_diam/2 - lid_sep,  h = eps);
-                               translate([-infty, -infty/2, -infty/2]) cube(infty);
-                       };
-               };
-};
+       // outer part
+       hull() {
+               // smaller outermost part
+               translate([-batt_len/2 - wall - cable_sep, -batt_diam/2, -batt_diam/2 - wall])
+                       cube([batt_len + 2*wall + 2*cable_sep, batt_diam, eps]);
+               // this part goes above the main body
+               translate([-batt_len/2 - 2*wall - cable_sep, -batt_diam/2-wall, -body_top_h - lid_sep])
+                       cube([batt_len + 4*wall + 2*cable_sep, batt_diam+2*wall, eps]);
+       };
+       // the part which goes inside the main body
+       translate([-batt_len/2 - wall - cable_sep + lid_sep, -batt_diam/2+lid_sep, -batt_diam/2 -wall])
+               cube([batt_len + 2*wall + 2*cable_sep - 2*lid_sep, batt_diam-2*lid_sep, batt_diam/2 - batt_end_h + wall - lid_sep]);
+       // clips
+       for (x = [-1, 1]) scale([1, x, 1])
+               translate([batt_len/6, batt_diam/2-lid_sep, - batt_end_h - clip_cyl_r - lid_sep])
+               rotate([0, -90, 0])
+               cylinder(r = clip_cyl_r, h = batt_len/3, $fn=4);
+       // translate([batt_len/2 + wall + cable_sep - lid_sep, batt_diam/2 - lid_sep, -batt_end_h-lid_sep-clip_cyl_r])
+}
 
 module lid() {
        difference() {
                lid_body();
 
 module lid() {
        difference() {
                lid_body();
-               translate([-batt_len/2+eps, 0, 0]) rotate([0, 90, 0])
-                       cylinder(r=batt_diam/2, h=batt_len-2*eps);
-               hull() {
-                       difference() {
-                               translate([-batt_len/2-cable_sep-wall, 0, 0]) rotate([0, 90, 0])
-                                       cylinder(r=batt_diam/2-wall-lid_sep, h=batt_len+2*wall+2*cable_sep);
-                               translate([-infty/2, -batt_diam/2, -infty-wire_sep/2-wire_thick/2])
-                                       cube([infty, batt_diam, infty]);
-                       };
-                       translate([-batt_len/2-cable_sep-wall, batt_diam/2-pcb_width+0.5*wall+0.5*lid_sep, batt_diam/2 + pcb_comp_h+pcb_thick-wall-lid_sep])
-                       cube([batt_len + 2*wall + 2* cable_sep, pcb_width-1.5*wall-1.5*lid_sep, eps]);
-               };
-               // holes for the mounting clips on the body
-               for (x = [-1, 1]) scale([x, 1, 1]) hull() {
-               for (x0 = [0-wall, 10+wall])
-                       translate([batt_len/2-wall-wire_thick-x0, batt_diam/2-lid_sep+eps, 0])
-                               rotate([-90, 0, 0]) scale([rear_clip_aspect, 1, 1])
-                               cylinder(r=batt_diam/2 + 2*wall + wire_thick+lid_sep/rear_clip_aspect, h=wall+lid_sep+eps);
-               };
+               translate([-batt_len/2-lid_sep, 0, 0]) rotate([0, 90, 0])
+                       cylinder(r=batt_diam/2 + lid_sep, h=batt_len+2*lid_sep);
+               // holes for battery contacts
+               for(x=[-1,1]) scale([x, 1, 1])
+               translate([batt_len/2+wall-eps, -batt_contact_w/2,
+                       -batt_contact_h_lid/2])
+                       cube([cable_sep+2*eps, batt_contact_w, infty]);
        };
 };
 
        };
 };
 
-module vert_torus() {
-       rotate([0, 90, 0])
-       scale([1, 1, 2])
-       rotate_extrude() translate([5, 0, 0]) circle(r=wire_thick/2, $fn=16);
-};
-
 if (lowres) {
        translate([0, 15, 0]) case();
        translate([0, -15, 0]) rotate([180, 0, 0]) lid();
 } else {
 if (lowres) {
        translate([0, 15, 0]) case();
        translate([0, -15, 0]) rotate([180, 0, 0]) lid();
 } else {
-       translate([0, 15, batt_diam/2+pcb_thick+2*pcb_comp_h+wall])
+       translate([0, 15, batt_diam/2+pcb_thick+pcb_comp_h+pcb_comp_h2+wall])
                case($fn=128);
        translate([0, -15, batt_diam/2+wall])
                lid($fn=128);
                case($fn=128);
        translate([0, -15, batt_diam/2+wall])
                lid($fn=128);