{
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "$id": "https://paramlet.com/tools/mcu-enclosure/schema.json",
 "title": "ESP32 & sensor enclosure — parameters",
 "description": "Generate a 3D-printable two-chamber enclosure for ESP32, ESP32-S3, or D1 Mini boards with a thermally separated vented sensor bay, PIR window, and USB slot. All lengths are millimetres. Unknown keys are rejected; out-of-range values are rejected by the URL and API and clamped when a project file is opened.",
 "x-tool": "mcu-enclosure",
 "x-toolVersion": "1.3.0",
 "x-specVersion": "1.0",
 "x-apiVersion": "1",
 "x-groups": [
  {
   "id": "board",
   "title": "MCU board (measure to confirm)"
  },
  {
   "id": "sensor",
   "title": "Sensor chamber & openings"
  },
  {
   "id": "look",
   "title": "Lid texture & colour"
  }
 ],
 "x-presets": {
  "note": "Choosing a preset resets every key marked x-resetOnPreset to its default and then applies the preset values.",
  "items": [
   {
    "id": "measure-your-own",
    "title": "Measure your own board",
    "description": "Default generic MCU + sensor enclosure: measure your board and sensor before printing.",
    "values": {
     "pcbLength": 52,
     "pcbWidth": 28,
     "pcbHeight": 14,
     "sensorChamber": true,
     "pirWindow": false,
     "color": "#e85d22",
     "lidColor": "#f4f1ea"
    }
   },
   {
    "id": "fits-esp32-devkit-30pin",
    "title": "Fits ELEGOO ESP32 DevKit (30-pin)",
    "description": "Clone board sizes vary (~52×28 mm) — measure your board to confirm. Not affiliated with or endorsed by ELEGOO.",
    "values": {
     "pcbLength": 52,
     "pcbWidth": 28,
     "pcbHeight": 13,
     "sensorChamber": true,
     "pirWindow": false,
     "color": "#2563eb",
     "lidColor": "#dbe7f3"
    }
   },
   {
    "id": "fits-esp32-s3-devkitc-1",
    "title": "Fits ESP32-S3-DevKitC-1",
    "description": "Clone board sizes vary (~63×26 mm) — measure your board to confirm. Not affiliated with or endorsed by Espressif.",
    "values": {
     "pcbLength": 63,
     "pcbWidth": 26,
     "pcbHeight": 14,
     "sensorChamber": true,
     "pirWindow": false,
     "color": "#15803d",
     "lidColor": "#e9efe3"
    }
   },
   {
    "id": "fits-d1-mini",
    "title": "Fits D1 Mini ESP8266 (USB-C)",
    "description": "Clone D1 Mini (~35×26 mm) — measure your board to confirm. Includes PIR dome option. Not affiliated with or endorsed by D1 Mini makers.",
    "values": {
     "pcbLength": 35,
     "pcbWidth": 26,
     "pcbHeight": 12,
     "sensorChamber": true,
     "pirWindow": true,
     "color": "#d97706",
     "lidColor": "#1f2a37"
    }
   }
  ]
 },
 "x-coreParams": {
  "exportFormat": {
   "type": "string",
   "title": "File format",
   "description": "3mf = 3MF (mm); stl = STL files in a zip (mm)",
   "x-group": "download",
   "x-role": "core.exportFormat",
   "x-unit": "none",
   "x-agentSafe": true,
   "enum": [
    "3mf",
    "stl"
   ],
   "default": "3mf"
  },
  "exportTol": {
   "type": "number",
   "title": "Mesh precision",
   "description": "Simplification tolerance in mm (0 = original mesh).",
   "x-group": "download",
   "x-role": "core.exportTolerance",
   "x-unit": "mm",
   "x-agentSafe": true,
   "enum": [
    0,
    0.01,
    0.02
   ],
   "default": 0.02
  },
  "units": {
   "type": "string",
   "title": "Units shown",
   "description": "Display only: mm or inches (1 in = 25.4 mm). Stored values, the API and exports are always mm.",
   "x-group": "view",
   "x-role": "core.displayUnits",
   "x-unit": "none",
   "x-agentSafe": true,
   "enum": [
    "mm",
    "in"
   ],
   "x-enumTitles": {
    "mm": "Millimetres",
    "in": "Inches"
   },
   "default": "mm"
  },
  "massUnits": {
   "type": "string",
   "title": "Weight shown in",
   "description": "Display only: grams or ounces (1 oz = 28.3495 g). Stored values, the API and exports are always grams.",
   "x-group": "view",
   "x-role": "core.displayMassUnits",
   "x-unit": "none",
   "x-agentSafe": true,
   "enum": [
    "g",
    "oz"
   ],
   "x-enumTitles": {
    "g": "Grams",
    "oz": "Ounces"
   },
   "default": "g"
  }
 },
 "type": "object",
 "properties": {
  "pcbLength": {
   "type": "number",
   "minimum": 25,
   "maximum": 110,
   "x-step": 0.5,
   "title": "Board length (measure)",
   "description": "Length of the board. Its chamber is made 2.4 mm longer, and the USB opening is cut in the wall at the short end.",
   "x-group": "board",
   "x-unit": "mm",
   "x-agentSafe": true,
   "x-label-lv": "Plates garums (izmēri)",
   "default": 52
  },
  "pcbWidth": {
   "type": "number",
   "minimum": 18,
   "maximum": 65,
   "x-step": 0.5,
   "title": "Board width (measure)",
   "description": "Width of the board. The chamber is made 2.4 mm wider.",
   "x-group": "board",
   "x-unit": "mm",
   "x-agentSafe": true,
   "x-label-lv": "Plates platums (izmēri)",
   "default": 28
  },
  "pcbHeight": {
   "type": "number",
   "minimum": 8,
   "maximum": 35,
   "multipleOf": 1,
   "title": "Internal height",
   "description": "Height of the board with everything on it. The box gives it 3 mm more, and the lip of the lid takes back 2 mm along the walls.",
   "x-group": "board",
   "x-unit": "mm",
   "x-agentSafe": true,
   "x-label-lv": "Iekšējais augstums",
   "default": 14
  },
  "sensorChamber": {
   "type": "integer",
   "enum": [
    0,
    1
   ],
   "title": "Separate vented sensor bay",
   "description": "A second room behind a wall with a notch for the wires, with slots in the end wall and in the lid. It keeps the heat of the board away from the sensor.",
   "x-group": "sensor",
   "x-agentSafe": true,
   "x-label-lv": "Atdalīts ventilēts sensoru nodalījums",
   "default": 1
  },
  "sensorBayLen": {
   "type": "number",
   "minimum": 15,
   "maximum": 45,
   "multipleOf": 1,
   "title": "Sensor bay length",
   "description": "Length of the sensor room.",
   "x-group": "sensor",
   "x-unit": "mm",
   "x-visibleIf": {
    "sensorChamber": true
   },
   "x-agentSafe": true,
   "x-label-lv": "Sensoru nodalījuma garums",
   "default": 24
  },
  "pirWindow": {
   "type": "integer",
   "enum": [
    0,
    1
   ],
   "title": "PIR sensor dome window in lid",
   "description": "A round hole in the lid for the white dome of a PIR motion sensor, over the board.",
   "x-group": "sensor",
   "x-agentSafe": true,
   "x-label-lv": "PIR sensora kupola logs vākā",
   "default": 0
  },
  "pirDia": {
   "type": "number",
   "minimum": 12,
   "maximum": 30,
   "x-step": 0.5,
   "title": "PIR dome Ø",
   "description": "Diameter of the dome. The hole is made this wide, and never wider than the box allows.",
   "x-group": "sensor",
   "x-unit": "mm",
   "x-visibleIf": {
    "pirWindow": true
   },
   "x-agentSafe": true,
   "x-label-lv": "PIR kupola Ø",
   "default": 23
  },
  "glandDia": {
   "type": "number",
   "minimum": 0,
   "maximum": 16,
   "x-step": 0.5,
   "title": "Cable gland hole Ø (0 = none)",
   "description": "A hole for a cable gland in the long side wall, next to the board. 0 leaves the wall closed.",
   "x-group": "sensor",
   "x-unit": "mm",
   "x-agentSafe": true,
   "x-label-lv": "Kabeļa ievada Ø (0 = nav)",
   "default": 8
  },
  "material": {
   "type": "string",
   "enum": [
    "petg",
    "pla"
   ],
   "x-enumTitles": {
    "petg": "PETG",
    "pla": "PLA"
   },
   "title": "Filament",
   "description": "PLA in a room. PETG outdoors or on a sunny window sill, where a dark box gets hotter than 55 °C.",
   "x-group": "sensor",
   "x-role": "core.printMaterial",
   "x-agentSafe": true,
   "x-label-lv": "Filaments",
   "default": "petg"
  },
  "wallCount": {
   "type": "integer",
   "minimum": 2,
   "maximum": 6,
   "multipleOf": 1,
   "title": "Perimeter walls",
   "description": "Perimeter lines. Three are enough. The wall between the rooms is 2 mm and comes out solid.",
   "x-group": "sensor",
   "x-unit": "count",
   "x-role": "print.wallCount",
   "x-agentSafe": true,
   "x-label-lv": "Sienu skaits",
   "default": 3
  },
  "infill": {
   "type": "integer",
   "minimum": 5,
   "maximum": 100,
   "multipleOf": 5,
   "title": "Infill",
   "description": "15 to 20 % is enough for a box that stands on a shelf.",
   "x-group": "sensor",
   "x-unit": "pct",
   "x-role": "print.infill",
   "x-agentSafe": true,
   "x-label-lv": "Aizpildījums",
   "default": 20
  },
  "lidTexture": {
   "type": "string",
   "enum": [
    "none",
    "hex",
    "diamond",
    "waves",
    "dots",
    "basketweave",
    "wood",
    "hammered",
    "folk"
   ],
   "x-enumTitles": {
    "none": "Smooth (plain)",
    "hex": "Honeycomb",
    "diamond": "Diamond lattice",
    "waves": "Flowing waves",
    "dots": "Polka dots",
    "basketweave": "Basketweave",
    "wood": "Woodgrain",
    "hammered": "Hammered / slate",
    "folk": "Latvian folk motif"
   },
   "title": "Lid surface texture",
   "description": "Optional carved relief on the exterior of the lid (printed face-down on the bed); vents and PIR opening stay flat.",
   "x-group": "look",
   "x-agentSafe": true,
   "x-label-lv": "Vāka virsmas tekstūra",
   "default": "none",
   "x-resetOnPreset": true
  },
  "textureDepth": {
   "type": "number",
   "minimum": 0.3,
   "maximum": 0.6,
   "x-step": 0.1,
   "title": "Texture depth",
   "description": "Engraved depth into the lid face (0.4 mm is two 0.2 mm layers and bridges cleanly on the build plate).",
   "x-group": "look",
   "x-unit": "mm",
   "x-visibleIf": {
    "lidTexture": {
     "ne": "none"
    }
   },
   "x-agentSafe": true,
   "x-label-lv": "Tekstūras dziļums",
   "default": 0.4,
   "x-resetOnPreset": true
  },
  "textureScale": {
   "type": "number",
   "minimum": 4,
   "maximum": 18,
   "multipleOf": 1,
   "title": "Texture scale",
   "description": "Size of one repeating pattern cell in millimetres.",
   "x-group": "look",
   "x-unit": "mm",
   "x-visibleIf": {
    "lidTexture": {
     "ne": "none"
    }
   },
   "x-agentSafe": true,
   "x-label-lv": "Tekstūras mērogs",
   "default": 8,
   "x-resetOnPreset": true
  },
  "color": {
   "type": "string",
   "pattern": "^#[0-9a-fA-F]{6}$",
   "title": "Colour",
   "description": "Colour of the box. The lid follows it unless it gets a colour of its own. White disappears on a white wall; black hides scuffs.",
   "x-group": "look",
   "x-role": "core.previewColor",
   "x-agentSafe": true,
   "x-label-lv": "Krāsa",
   "default": "#c5c9cc"
  },
  "lidColor": {
   "type": "string",
   "pattern": "^#[0-9a-fA-F]{6}$",
   "title": "Lid colour",
   "description": "The lid follows the main colour until you pick another one here: then a two-colour box from two filaments, with no nozzle change.",
   "x-group": "look",
   "x-agentSafe": true,
   "x-label-lv": "Vāka krāsa",
   "default": "#c5c9cc"
  }
 },
 "additionalProperties": false,
 "recommended_materials": [
  {
   "id": "petg-filament-1kg",
   "title": "PETG Filament 1.75 mm (1 kg) — heat-resistant & durable",
   "why": "Stronger and more heat-resistant than PLA for molds, jigs and outdoor parts.",
   "url": "https://paramlet.com/go/petg-filament-1kg?src=agent",
   "relation": "material",
   "disclosure": "Affiliate link (Amazon Associates, tag paramlet-21)"
  },
  {
   "id": "pla-matte-filament",
   "title": "Matte PLA Filament 1.75 mm (1 kg) — smooth surface finish",
   "why": "Clean matte finish for decorative vases, ornaments and candle holders.",
   "url": "https://paramlet.com/go/pla-matte-filament?src=agent",
   "relation": "material",
   "disclosure": "Affiliate link (Amazon Associates, tag paramlet-21)"
  }
 ]
}