From 2127712115b46abc0fccb001bb7ec49f32db8210 Mon Sep 17 00:00:00 2001 From: James J <13408010-JamesJCode@users.noreply.gitlab.com> Date: Tue, 7 Mar 2023 00:37:33 +0000 Subject: [PATCH] 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 (cherry picked from commit 39e56485fc8d32dd76225b97faf1147330aa2374) --- eeschema/erc.cpp | 26 ++++++++++++-------------- eeschema/sch_pin.cpp | 8 ++++---- 2 files changed, 16 insertions(+), 18 deletions(-) diff --git a/eeschema/erc.cpp b/eeschema/erc.cpp index e136448bb8..7344561e4f 100644 --- a/eeschema/erc.cpp +++ b/eeschema/erc.cpp @@ -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 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 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() ); @@ -808,7 +802,7 @@ int ERC_TESTER::TestSimilarLabels() int errors = 0; - std::unordered_map labelMap; + std::unordered_map> labelMap; for( const std::pair> net : nets ) { @@ -828,12 +822,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 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->m_sheet.LastScreen()->Append( marker ); diff --git a/eeschema/sch_pin.cpp b/eeschema/sch_pin.cpp index 3decd1bf39..e04340cf8c 100644 --- a/eeschema/sch_pin.cpp +++ b/eeschema/sch_pin.cpp @@ -248,10 +248,10 @@ void SCH_PIN::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vectorGetParent() - && 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 ) ); }