main
John Lauer
Add measured-power and arm-timeout protection; make fan feedback validity explicit in control panel
97b70ea
"""Saved-file reference correction after native resistor rotations; not live IPC."""
from pathlib import Path
import pcbnew as k,shutil,json
p=Path(__file__).resolve().parent
source=p/'placement-candidate.kicad_pcb';target=p/'adom-custom-electronic-load.kicad_pcb'
backup=p/'before-usb-orientation-adoption.kicad_pcb'
if backup.exists():raise RuntimeError('Checkpoint exists; inspect before rerunning')
shutil.copy2(target,backup)
b=k.LoadBoard(str(source));found=[]
for fp in b.GetFootprints():
if fp.GetReference() in ('R31','R32'):
assert abs(fp.GetOrientationDegrees()-180)<.001
x,y=(149.7,43.405) if fp.GetReference()=='R31' else (152.655,46.5)
fp.Reference().SetPosition(k.VECTOR2I(k.FromMM(x),k.FromMM(y)))
fp.Reference().SetTextAngle(k.EDA_ANGLE(0,k.DEGREES_T));found.append(fp.GetReference())
assert len(found)==2
k.SaveBoard(str(target),b)
print(json.dumps({'saved':str(target),'changed_fields':found,'footprints':len(list(b.GetFootprints())),'tracks':len(list(b.GetTracks())),'mechanism':'native pcbnew saved-file correction; must reload editor'}))