molecule
AM/FM Receiver Molecule
Public Made by Adomby adom
USB-powered AM/FM receiver on an Adom Molecule: discrete BJT and op-amp superhet (10.7 MHz and 455 kHz IFs), STM32G0B1 tuning, self-calibration and USB audio over one USB-C cable. 96 x 96 mm pin grid, 4 layers, KiCad 10.
main
"""Run KiCad DRC (with schematic parity) and summarise the JSON report."""
import json, os, subprocess, sys
from collections import Counter
HERE = os.path.dirname(os.path.abspath(__file__))
PROJ = os.path.abspath(os.path.join(HERE, '..'))
def main(verbose=True):
out = os.path.join(PROJ, 'build', 'drc.json')
subprocess.run(['kicad-cli', 'pcb', 'drc', '--severity-all', '--schematic-parity', '--format', 'json',
'-o', out, os.path.join(PROJ, 'amfm_receiver.kicad_pcb')], capture_output=True)
d = json.load(open(out))
v, u, p = d.get('violations', []), d.get('unconnected_items', []), d.get('schematic_parity', [])
print('DRC: %d violations, %d unconnected, %d schematic-parity issues' % (len(v), len(u), len(p)))
for (t, s), n in Counter((x['type'], x['severity']) for x in v).most_common():
print(' %-28s %-8s %d' % (t, s, n))
if verbose:
for x in v:
if x['severity'] == 'error' or x['type'] in ('clearance', 'shorting_items', 'tracks_crossing',
'hole_clearance', 'copper_edge_clearance'):
print(' E', x['type'], '|', ' / '.join(i['description'][:60] for i in x['items']))
for x in u[:40]:
print(' U', ' / '.join(i['description'][:60] for i in x['items']))
for x in p[:20]:
print(' P', x['type'], x['description'][:90], [i['description'][:50] for i in x['items']])
return len([x for x in v if x['severity'] == 'error']), len(u), len(p)
if __name__ == '__main__':
main('-q' not in sys.argv)