shibosoftwaredev/f1c100s-linux-nema17-stepper-controller
A four-layer NEMA 17 motor-controller PCB combining an Allwinner F1C100S Linux computer, USB‑PD/buck power system, W5500 Ethernet, STM32 real-time motion control, DRV8825 stepper driver, protection/temperature/current telemetry, USB interfaces, and local LED/buzzer diagnostics.
- Version
- 0.4.56
- License
- unset
- Stars
- 0
assembly-stencil.ts
import type { PcbSmtPad, PcbSolderPaste } from "circuit-json"
type RoundedPaste = Extract<PcbSolderPaste, { shape: "pill" | "rotated_pill" }>
/** The pinned core creates rounded lands without their paste. Generate the
* missing apertures from final board-coordinate pads, not JSX coordinates.
* Keep the same 0.7 linear reduction used by core for other signal lands.
* This supplies artwork; it does not approve stencil thickness or reflow.
*/
export function roundedPadPaste(pad: PcbSmtPad): RoundedPaste | undefined {
if (pad.is_covered_with_solder_mask ||
(pad.shape !== "pill" && pad.shape !== "rotated_pill")) return
return {
type: "pcb_solder_paste",
pcb_solder_paste_id: `assembly_paste_${pad.pcb_smtpad_id}`,
pcb_smtpad_id: pad.pcb_smtpad_id,
pcb_component_id: pad.pcb_component_id,
pcb_group_id: pad.pcb_group_id,
subcircuit_id: pad.subcircuit_id,
layer: pad.layer,
shape: pad.shape,
x: pad.x,
y: pad.y,
width: pad.width * .7,
height: pad.height * .7,
radius: pad.radius * .7,
...(pad.shape === "rotated_pill" ? { ccw_rotation: pad.ccw_rotation } : {}),
} as RoundedPaste
}
export function applyMissingRoundedPaste(db: any) {
const present = new Set(db.pcb_solder_paste.list().map((p: PcbSolderPaste) => p.pcb_smtpad_id))
for (const pad of db.pcb_smtpad.list()) {
const pcb = db.pcb_component.get(pad.pcb_component_id)
const source = pcb && db.source_component.get(pcb.source_component_id)
if (!pcb || pcb.do_not_place || source?.ftype === "simple_test_point" ||
present.has(pad.pcb_smtpad_id)) continue
const paste = roundedPadPaste(pad)
if (paste) {
db.pcb_solder_paste.insert(paste)
present.add(pad.pcb_smtpad_id)
}
}
}