Push nets to free pads when they're used.

Fixes https://gitlab.com/kicad/code/kicad/issues/13516

Fixes https://gitlab.com/kicad/code/kicad/issues/13517
This commit is contained in:
Jeff Young 2023-01-14 22:04:15 +00:00
parent 1d223d1439
commit 3cc960a872
2 changed files with 21 additions and 15 deletions

View File

@ -553,19 +553,14 @@ void CN_CONNECTIVITY_ALGO::LocalBuild( const std::vector<BOARD_ITEM*>& aItems )
void CN_CONNECTIVITY_ALGO::propagateConnections( BOARD_COMMIT* aCommit, PROPAGATE_MODE aMode )
{
bool skipConflicts = ( aMode == PROPAGATE_MODE::SKIP_CONFLICTS );
bool resolveConflicts = ( aMode != PROPAGATE_MODE::SKIP_CONFLICTS );
wxLogTrace( wxT( "CN" ), wxT( "propagateConnections: propagate skip conflicts? %d" ),
skipConflicts );
wxLogTrace( wxT( "CN" ), wxT( "propagateConnections: resolve conflicts? %d" ),
resolveConflicts );
for( const std::shared_ptr<CN_CLUSTER>& cluster : m_connClusters )
{
if( skipConflicts && cluster->IsConflicting() )
{
wxLogTrace( wxT( "CN" ), wxT( "Conflicting nets in cluster %p; skipping update" ),
cluster.get() );
}
else if( cluster->IsOrphaned() )
if( cluster->IsOrphaned() )
{
wxLogTrace( wxT( "CN" ), wxT( "Skipping orphaned cluster %p [net: %s]" ),
cluster.get(),
@ -575,10 +570,18 @@ void CN_CONNECTIVITY_ALGO::propagateConnections( BOARD_COMMIT* aCommit, PROPAGAT
{
if( cluster->IsConflicting() )
{
wxLogTrace( wxT( "CN" ), wxT( "Conflicting nets in cluster %p; chose %d (%s)" ),
cluster.get(),
cluster->OriginNet(),
cluster->OriginNetName() );
if( resolveConflicts )
{
wxLogTrace( wxT( "CN" ), wxT( "Conflicting nets in cluster %p; chose %d (%s)" ),
cluster.get(),
cluster->OriginNet(),
cluster->OriginNetName() );
}
else
{
wxLogTrace( wxT( "CN" ), wxT( "Conflicting nets in cluster %p; skipping update" ),
cluster.get() );
}
}
// normal cluster: just propagate from the pads
@ -586,7 +589,10 @@ void CN_CONNECTIVITY_ALGO::propagateConnections( BOARD_COMMIT* aCommit, PROPAGAT
for( CN_ITEM* item : *cluster )
{
if( item->CanChangeNet() )
bool isFreePad = item->Parent()->Type() == PCB_PAD_T
&& static_cast<PAD*>( item->Parent() )->IsFreePad();
if( ( resolveConflicts && item->CanChangeNet() ) || isFreePad )
{
if( item->Valid() && item->Parent()->GetNetCode() != cluster->OriginNet() )
{

View File

@ -416,7 +416,7 @@ void CN_CLUSTER::Add( CN_ITEM* item )
if( m_originNet <= 0 )
m_originNet = netCode;
if( item->Parent()->Type() == PCB_PAD_T )
if( item->Parent()->Type() == PCB_PAD_T && !static_cast<PAD*>( item->Parent() )->IsFreePad() )
{
if( m_netRanks.count( netCode ) )
{