Consolidated ERC fixes

- Consistent calculation of IsStacked() for pins across ERC checks
 - Correct placement of ERC marker for unresolved field variables
 - Add sheet-specific paths to two ERC check results
This commit is contained in:
James J 2023-03-07 00:37:33 +00:00 committed by Seth Hillbrand
parent 7653a2bf99
commit 39e56485fc
2 changed files with 16 additions and 18 deletions

View File

@ -208,15 +208,11 @@ void ERC_TESTER::TestTextVars( DS_PROXY_VIEW_ITEM* aDrawingSheet )
{
if( unresolved( field.GetShownText() ) )
{
VECTOR2I pos = field.GetPosition() - symbol->GetPosition();
pos = symbol->GetTransform().TransformCoordinate( pos );
pos += symbol->GetPosition();
std::shared_ptr<ERC_ITEM> ercItem =
ERC_ITEM::Create( ERCE_UNRESOLVED_VARIABLE );
ercItem->SetItems( &field );
SCH_MARKER* marker = new SCH_MARKER( ercItem, pos );
SCH_MARKER* marker = new SCH_MARKER( ercItem, field.GetPosition() );
screen->Append( marker );
}
}
@ -683,11 +679,7 @@ int ERC_TESTER::TestPinToPin()
// Multiple pins in the same symbol that share a type,
// name and position are considered
// "stacked" and shouldn't trigger ERC errors
if( refPin.Pin()->GetParent() == testPin.Pin()->GetParent()
&& refPin.Pin()->GetPosition() == testPin.Pin()->GetPosition()
&& refPin.Pin()->GetName() == testPin.Pin()->GetName()
&& refPin.Pin()->GetType() == testPin.Pin()->GetType()
&& refPin.Sheet() == testPin.Sheet() )
if( refPin.Pin()->IsStacked( testPin.Pin() ) && refPin.Sheet() == testPin.Sheet() )
continue;
ELECTRICAL_PINTYPE testType = testPin.Pin()->GetType();
@ -730,6 +722,8 @@ int ERC_TESTER::TestPinToPin()
std::shared_ptr<ERC_ITEM> ercItem = ERC_ITEM::Create( err_code );
ercItem->SetItems( needsDriver.Pin() );
ercItem->SetSheetSpecificPath( needsDriver.Sheet() );
ercItem->SetItemsSheetPaths( needsDriver.Sheet() );
SCH_MARKER* marker =
new SCH_MARKER( ercItem, needsDriver.Pin()->GetTransformedPosition() );
@ -809,7 +803,7 @@ int ERC_TESTER::TestSimilarLabels()
int errors = 0;
std::unordered_map<wxString, SCH_LABEL_BASE*> labelMap;
std::unordered_map<wxString, std::pair<SCH_LABEL_BASE*, SCH_SHEET_PATH>> labelMap;
for( const std::pair<NET_NAME_CODE_CACHE_KEY, std::vector<CONNECTION_SUBGRAPH*>> net : nets )
{
@ -829,12 +823,16 @@ int ERC_TESTER::TestSimilarLabels()
if( !labelMap.count( normalized ) )
{
labelMap[normalized] = label;
labelMap[normalized] = std::make_pair( label, subgraph->GetSheet() );
}
else if( labelMap.at( normalized )->GetShownText() != label->GetShownText() )
else if( labelMap.at( normalized ).first->GetShownText()
!= label->GetShownText() )
{
std::shared_ptr<ERC_ITEM> ercItem = ERC_ITEM::Create( ERCE_SIMILAR_LABELS );
ercItem->SetItems( label, labelMap.at( normalized ) );
ercItem->SetItems( label, labelMap.at( normalized ).first );
ercItem->SetSheetSpecificPath( subgraph->GetSheet() );
ercItem->SetItemsSheetPaths( subgraph->GetSheet(),
labelMap.at( normalized ).second );
SCH_MARKER* marker = new SCH_MARKER( ercItem, label->GetPosition() );
subgraph->GetSheet().LastScreen()->Append( marker );

View File

@ -249,10 +249,10 @@ void SCH_PIN::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITE
bool SCH_PIN::IsStacked( const SCH_PIN* aPin ) const
{
return m_parent == aPin->GetParent()
&& GetTransformedPosition() == aPin->GetTransformedPosition()
&& ( ( GetType() == aPin->GetType() )
|| ( GetType() == ELECTRICAL_PINTYPE::PT_PASSIVE )
|| ( aPin->GetType() == ELECTRICAL_PINTYPE::PT_PASSIVE ) );
&& GetTransformedPosition() == aPin->GetTransformedPosition()
&& GetName() == aPin->GetName()
&& ( ( GetType() == aPin->GetType() ) || ( GetType() == ELECTRICAL_PINTYPE::PT_PASSIVE )
|| ( aPin->GetType() == ELECTRICAL_PINTYPE::PT_PASSIVE ) );
}