// ============================================
// SaltyLab — ESP32-C3 Mount
// 30×25×10mm PETG
// Tiny mount for LED controller MCU
// ============================================
include <dimensions.scad>

mount_w = 30;
mount_d = 25;
mount_h = 10;
base_h = 2;

module esp32c3_mount() {
    difference() {
        union() {
            // Base
            translate([-mount_w/2, -mount_d/2, 0])
                cube([mount_w, mount_d, base_h]);
            
            // Retaining walls (3 sides, front open for USB)
            translate([-mount_w/2, -mount_d/2, 0])
                cube([wall, mount_d, mount_h]);
            translate([mount_w/2 - wall, -mount_d/2, 0])
                cube([wall, mount_d, mount_h]);
            translate([-mount_w/2, mount_d/2 - wall, 0])
                cube([mount_w, wall, mount_h]);
            
            // Clip tabs (front corners)
            for (x = [-mount_w/2, mount_w/2 - wall]) {
                translate([x, -mount_d/2, mount_h - 2])
                    cube([wall, 4, 2]);
            }
            
            // Zip-tie slot wings
            for (x = [-mount_w/2 - 4, mount_w/2 + 1]) {
                translate([x, -5, 0])
                    cube([3, 10, base_h]);
            }
        }
        
        // Board pocket (recessed)
        translate([-esp_w/2 - tol, -esp_d/2 - tol, base_h])
            cube([esp_w + tol*2, esp_d + tol*2, mount_h]);
        
        // Zip-tie slots
        for (x = [-mount_w/2 - 4, mount_w/2 + 1]) {
            translate([x, -2, -1])
                cube([3, 4, base_h + 2]);
        }
        
        // USB port clearance (front)
        translate([-5, -mount_d/2 - 1, base_h])
            cube([10, wall + 2, 5]);
    }
}

esp32c3_mount();
