// ============================================
// SaltyLab — Jetson Orin Nano Super Shelf
// 120×100×15mm PETG
// Mounts Jetson Orin Nano Super to 2020 extrusion
// ============================================
include <dimensions.scad>

shelf_w = 120;
shelf_d = 100;
shelf_h = 15;
base_h = 3;
standoff_h = 8;  // Clearance for Jetson underside components

module jetson_shelf() {
    difference() {
        union() {
            // Base plate
            translate([-shelf_w/2, -shelf_d/2, 0])
                cube([shelf_w, shelf_d, base_h]);
            
            // Jetson standoffs (M2.5, 86mm × 58mm pattern)
            for (x = [-jetson_hole_x/2, jetson_hole_x/2]) {
                for (y = [-jetson_hole_y/2, jetson_hole_y/2]) {
                    translate([x, y, 0])
                        cylinder(d=6, h=base_h + standoff_h, $fn=25);
                }
            }
            
            // 2020 extrusion clamp (back edge)
            translate([-15, shelf_d/2 - wall, 0])
                cube([30, wall + 10, base_h + 12]);
            
            // Side rails for Jetson alignment
            for (x = [-jetson_w/2 - wall, jetson_w/2]) {
                translate([x, -jetson_d/2, base_h + standoff_h])
                    cube([wall, jetson_d, 4]);
            }
        }
        
        // Jetson M2.5 holes (through standoffs)
        for (x = [-jetson_hole_x/2, jetson_hole_x/2]) {
            for (y = [-jetson_hole_y/2, jetson_hole_y/2]) {
                translate([x, y, -1])
                    cylinder(d=jetson_hole_dia, h=base_h + standoff_h + 2, $fn=25);
            }
        }
        
        // Extrusion bolt hole (M5, through back clamp)
        translate([0, shelf_d/2 + 3, base_h + 6])
            rotate([90, 0, 0])
                cylinder(d=m5_clear, h=wall + 15, $fn=30);
        
        // Extrusion channel slot
        translate([-extrusion_w/2 - tol, shelf_d/2 - wall - 1, -1])
            cube([extrusion_w + tol*2, wall + 2, base_h + 2]);
        
        // Ventilation / cable routing
        for (x = [-25, 0, 25]) {
            translate([x, 0, -1])
                cylinder(d=15, h=base_h + 2, $fn=25);
        }
        
        // USB/Ethernet/GPIO access cutouts (front edge)
        translate([-jetson_w/2, -shelf_d/2 - 1, base_h])
            cube([jetson_w, wall + 2, shelf_h]);
    }
}

jetson_shelf();
