Added explanation for ERC on schematics not fully annotated

Related to #86
This commit is contained in:
Salvador E. Tropea 2021-09-21 13:14:06 -03:00
parent 0fc1c11c50
commit b7b39d4bfe
2 changed files with 12 additions and 1 deletions

View File

@ -831,6 +831,7 @@ class SchematicComponent(object):
self.bottom = False self.bottom = False
self.footprint_rot = 0.0 self.footprint_rot = 0.0
self.qty = 1 self.qty = 1
self.annotation_error = False
# KiCad 5 PCB flags (mutually exclusive) # KiCad 5 PCB flags (mutually exclusive)
self.smd = False self.smd = False
self.virtual = False self.virtual = False
@ -1060,6 +1061,7 @@ class SchematicComponent(object):
comp.is_power = comp.ref.startswith('#PWR') or comp.ref.startswith('#FLG') comp.is_power = comp.ref.startswith('#PWR') or comp.ref.startswith('#FLG')
if comp.ref[-1] == '?': if comp.ref[-1] == '?':
logger.warning(W_NOANNO + 'Component {} is not annotated'.format(comp)) logger.warning(W_NOANNO + 'Component {} is not annotated'.format(comp))
comp.annotation_error = True
# Separate the reference in its components # Separate the reference in its components
m = SchematicComponent.ref_re.match(comp.ref) m = SchematicComponent.ref_re.match(comp.ref)
if not m: if not m:
@ -1327,6 +1329,7 @@ class SchematicSheet(object):
super().__init__() super().__init__()
self.sheet = None self.sheet = None
self.id = '' self.id = ''
self.annotation_error = False
def load_sheet(self, project, parent, sheet_path, sheet_path_h, libs, fields, fields_lc): def load_sheet(self, project, parent, sheet_path, sheet_path_h, libs, fields, fields_lc):
assert self.name assert self.name
@ -1404,6 +1407,7 @@ class Schematic(object):
super().__init__() super().__init__()
self.dcms = {} self.dcms = {}
self.lib_comps = {} self.lib_comps = {}
self.annotation_error = False
def _get_title_block(self, f): def _get_title_block(self, f):
line = f.get_line() line = f.get_line()
@ -1491,6 +1495,8 @@ class Schematic(object):
while not line.startswith('$EndSCHEMATC'): while not line.startswith('$EndSCHEMATC'):
if line.startswith('$Comp'): if line.startswith('$Comp'):
obj = SchematicComponent.load(f, project, sheet_path, sheet_path_h, libs, fields, fields_lc) obj = SchematicComponent.load(f, project, sheet_path, sheet_path_h, libs, fields, fields_lc)
if obj.annotation_error:
self.annotation_error = True
self.components.append(obj) self.components.append(obj)
elif line.startswith('NoConn'): elif line.startswith('NoConn'):
obj = SchematicConnection.parse(False, line[7:], f) obj = SchematicConnection.parse(False, line[7:], f)
@ -1517,7 +1523,10 @@ class Schematic(object):
# Load sub-sheets # Load sub-sheets
self.sub_sheets = [] self.sub_sheets = []
for sch in self.sheets: for sch in self.sheets:
self.sub_sheets.append(sch.load_sheet(project, fname, sheet_path, sheet_path_h, libs, fields, fields_lc)) sheet = sch.load_sheet(project, fname, sheet_path, sheet_path_h, libs, fields, fields_lc)
if sheet.annotation_error:
self.annotation_error = True
self.sub_sheets.append(sheet)
def get_files(self): def get_files(self):
""" A list of the names for all the sheets, including this one. """ A list of the names for all the sheets, including this one.

View File

@ -63,4 +63,6 @@ class Run_ERC(BasePreFlight): # noqa: F821
logger.error('ERC errors: %d', -ret) logger.error('ERC errors: %d', -ret)
else: else:
logger.error('ERC returned %d', ret) logger.error('ERC returned %d', ret)
if GS.sch.annotation_error:
logger.error('Make sure your schematic is fully annotated')
exit(ERC_ERROR) exit(ERC_ERROR)