seveibar/am3352-dev-board-4layer-dogbone
Defines PCB footprints and pin mappings for a TI AM3352ZCZ100 processor, JST GH connectors, and assembly-part lookup helpers for capacitors, resistors, and headers.
- Version
- 0.1.5
- License
- unset
- Stars
- 0
scripts/via_travel.py
"""Measure used barrel travel without guessing unspecified inner-layer depths."""
def via_travel(path, layers, thickness):
# A graph may represent a plated barrel as a star. Collapse intermediate
# graph nodes at one XY site to the layers on which the route enters/leaves.
collapsed=[]
i=0
while i<len(path):
j=i+1
while j<len(path) and path[j][:2]==path[i][:2]:j+=1
collapsed.append(path[i])
if path[j-1][2]!=path[i][2]:collapsed.append(path[j-1])
i=j
coefficients={layer:0 for layer in layers}
sequence=[collapsed[0][2]] if collapsed else []
for a,b in zip(collapsed,collapsed[1:]):
if a[2]==b[2]:continue
shallow,deep=sorted((a[2],b[2]),key=layers.index)
coefficients[deep]+=1
coefficients[shallow]-=1
sequence.append(b[2])
known=all(coefficients[l]==0 for l in layers[1:-1])
return {'layerSequence':sequence,'depthCoefficients':coefficients,
'verticalLengthMm':round(coefficients[layers[-1]]*thickness,6) if known else None}