A slightly better ERC check for hierarchical labels

Fixes: lp:1839822
* https://bugs.launchpad.net/kicad/+bug/1839822
This commit is contained in:
Jon Evans 2019-11-29 21:10:16 -05:00
parent 972d765aea
commit 8b87dc7e0f
2 changed files with 18 additions and 1 deletions

View File

@ -1481,6 +1481,8 @@ void CONNECTION_GRAPH::propagateToNeighbors( CONNECTION_SUBGRAPH* aSubgraph )
wxLogTrace( "CONN", "%lu: found child %lu (%s)", aParent->m_code,
candidate->m_code, candidate->m_driver_connection->Name() );
candidate->m_hier_parent = aParent;
search_list.push_back( candidate );
break;
}
@ -2269,6 +2271,18 @@ bool CONNECTION_GRAPH::ercCheckLabels( const CONNECTION_SUBGRAPH* aSubgraph,
&& m_net_name_to_subgraphs_map.at( name ).size() > 1 )
has_other_connections = true;
}
else if (text->Type() == SCH_HIER_LABEL_T)
{
// For a hier label, check if the parent pin is connected
if (aSubgraph->m_hier_parent &&
(aSubgraph->m_hier_parent->m_strong_driver ||
aSubgraph->m_hier_parent->m_drivers.size() > 1))
{
// For now, a simple check: if there is more than one driver, the parent is probably
// connected elsewhere (because at least one driver will be the hier pin itself)
has_other_connections = true;
}
}
else
{
auto pair = std::make_pair( aSubgraph->m_sheet, name );

View File

@ -72,7 +72,7 @@ public:
m_dirty( false ), m_absorbed( false ), m_absorbed_by( nullptr ), m_code( -1 ),
m_multiple_drivers( false ), m_strong_driver( false ), m_local_driver( false ),
m_no_connect( nullptr ), m_bus_entry( nullptr ), m_driver( nullptr ), m_frame( aFrame ),
m_driver_connection( nullptr )
m_driver_connection( nullptr ), m_hier_parent( nullptr )
{}
/**
* Determines which potential driver should drive the subgraph.
@ -188,6 +188,9 @@ public:
// Cache for lookup of any hierarchical ports on this subgraph (for referring up)
std::vector<SCH_HIERLABEL*> m_hier_ports;
// If not null, this indicates the subgraph on a higher level sheet that is linked to this one
CONNECTION_SUBGRAPH* m_hier_parent;
};