From c07de84c05ba7637a660a3fe045c1a0c2581843b Mon Sep 17 00:00:00 2001 From: Jon Evans Date: Sun, 7 Apr 2019 21:33:47 -0400 Subject: [PATCH] Suppress false ERC warnings for invisible power pins --- eeschema/connection_graph.cpp | 37 +++++++++++++++++++++++------------ 1 file changed, 25 insertions(+), 12 deletions(-) diff --git a/eeschema/connection_graph.cpp b/eeschema/connection_graph.cpp index a214d53c47..e15956876f 100644 --- a/eeschema/connection_graph.cpp +++ b/eeschema/connection_graph.cpp @@ -376,6 +376,11 @@ void CONNECTION_GRAPH::updateItemConnectivity( SCH_SHEET_PATH aSheet, pin->GetDefaultNetName( aSheet ); pin->ConnectedItems().clear(); + // Invisible power pins need to be post-processed later + + if( pin->IsPowerConnection() && !pin->IsVisible() ) + m_invisible_power_pins.push_back( pin ); + connection_map[ pos ].push_back( pin ); m_items.insert( pin ); } @@ -568,18 +573,6 @@ void CONNECTION_GRAPH::buildConnectionGraph() connection->SetSubgraphCode( subgraph->m_code ); - if( item->Type() == SCH_PIN_T ) - { - auto pin = static_cast( item ); - - // Invisible power pins need to be post-processed later - - if( pin->IsPowerConnection() && !pin->IsVisible() ) - { - m_invisible_power_pins.push_back( pin ); - } - } - std::list members( item->ConnectedItems().begin(), item->ConnectedItems().end() ); @@ -1879,6 +1872,26 @@ bool CONNECTION_GRAPH::ercCheckNoConnects( CONNECTION_SUBGRAPH* aSubgraph, } } + // Check if invisible power pins connect to anything else + // Note this won't catch if a component has multiple invisible power + // pins but these don't connect to any other net; maybe that should be + // added as a further optional ERC check. + + if( pin && !has_other_connections && + pin->IsPowerConnection() && !pin->IsVisible() ) + { + wxString name = pin->Connection( sheet )->Name(); + + if( int code = m_net_name_to_code_map.count( name ) ) + { + if( m_net_code_to_subgraphs_map.count( code ) ) + { + if( m_net_code_to_subgraphs_map.at( code ).size() > 1 ) + has_other_connections = true; + } + } + } + if( pin && !has_other_connections && pin->GetType() != PIN_NC ) { SCH_COMPONENT* comp = pin->GetParentComponent();