AnasSarkiz/NEMA14_CH32X035G8U6
A NEMA stepper motor is shown with proposed M3 screws/spacers, four wired motor leads and splices, and a JST SHR-04V-S connector.
- Version
- 1.12.2
- License
- ISC
- Stars
- 0
scripts/classify-source.ts
/** Supplier imports use chip JSX; classify passive connectors/crystal accurately for ERC. */
export function classifySource(json:any[]) {
for(const c of json.filter(e=>e.type==='source_component')) {
if(c.name.startsWith('J_')) c.ftype='simple_connector'
if(c.name==='D_STATUS') c.ftype='simple_led'
if(c.name.startsWith('Q_STATUS_')) Object.assign(c,{ftype:'simple_transistor',transistor_type:'npn'})
if(c.name==='Q_BUZZER') Object.assign(c,{ftype:'simple_mosfet',channel_type:'n',mosfet_mode:'enhancement'})
if(c.name==='BZ1') c.ftype='simple_pinout' // Generic numbered pinout; buzzer function is identified by its MPN and schematic.
if(c.name==='D_TVS') c.ftype='simple_diode'
if(c.name==='Y_MCU') Object.assign(c,{ftype:'simple_crystal',frequency:12_000_000,load_capacitance:10})
}
const bootIds=new Set(json.filter(e=>e.type==='pcb_component' && json.some(c=>c.type==='source_component' && c.source_component_id===e.source_component_id && ['R_USB_BOOT','J_BOOT'].includes(c.name))).map(e=>e.pcb_component_id))
for(const e of json) if(e.type==='pcb_silkscreen_text' && bootIds.has(e.pcb_component_id)) e.pcb_silkscreen_text_id='usb_boot_'+e.pcb_silkscreen_text_id
return json
}