Catch connection errors when stacked pins have NC flags
Don't flag the error as having a connected net with an NC flag. Stacked pins are not connected in that sense, so are allowed an NC flag
This commit is contained in:
parent
f2e3329617
commit
16479277cc
|
@ -2739,12 +2739,8 @@ bool CONNECTION_GRAPH::ercCheckNoConnects( const CONNECTION_SUBGRAPH* aSubgraph
|
||||||
|
|
||||||
if( aSubgraph->m_no_connect != nullptr )
|
if( aSubgraph->m_no_connect != nullptr )
|
||||||
{
|
{
|
||||||
bool has_invalid_items = false;
|
|
||||||
bool has_other_items = false;
|
|
||||||
SCH_PIN* pin = nullptr;
|
SCH_PIN* pin = nullptr;
|
||||||
std::vector<SCH_ITEM*> invalid_items;
|
std::set<SCH_ITEM*> unique_items;
|
||||||
VECTOR2I noConnectPos = aSubgraph->m_no_connect->GetPosition();
|
|
||||||
double minDist = 0;
|
|
||||||
|
|
||||||
// Any subgraph that contains both a pin and a no-connect should not
|
// Any subgraph that contains both a pin and a no-connect should not
|
||||||
// contain any other driving items.
|
// contain any other driving items.
|
||||||
|
@ -2755,18 +2751,21 @@ bool CONNECTION_GRAPH::ercCheckNoConnects( const CONNECTION_SUBGRAPH* aSubgraph
|
||||||
{
|
{
|
||||||
case SCH_PIN_T:
|
case SCH_PIN_T:
|
||||||
{
|
{
|
||||||
SCH_PIN* candidate = static_cast<SCH_PIN*>( item );
|
pin = static_cast<SCH_PIN*>( item );
|
||||||
double dist = VECTOR2I( candidate->GetTransformedPosition() - noConnectPos )
|
|
||||||
.SquaredEuclideanNorm();
|
|
||||||
|
|
||||||
if( !pin || dist < minDist )
|
// Insert the pin's parent so that we don't flag stacked pins
|
||||||
|
if( auto [existing, success] = unique_items.insert(
|
||||||
|
static_cast<SCH_ITEM*>( pin->GetParent() ) ); !success )
|
||||||
{
|
{
|
||||||
pin = candidate;
|
SCH_PIN* ex_pin = static_cast<SCH_PIN*>( *existing );
|
||||||
minDist = dist;
|
|
||||||
|
// Stacked pins don't count as connected
|
||||||
|
// but if they are not stacked, but still in the same symbol
|
||||||
|
// flag this for an error
|
||||||
|
if( !pin->IsStacked( ex_pin ) )
|
||||||
|
unique_items.insert( ex_pin );
|
||||||
}
|
}
|
||||||
|
|
||||||
has_invalid_items |= has_other_items;
|
|
||||||
has_other_items = true;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2776,13 +2775,11 @@ bool CONNECTION_GRAPH::ercCheckNoConnects( const CONNECTION_SUBGRAPH* aSubgraph
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
has_invalid_items = true;
|
unique_items.insert( item );
|
||||||
has_other_items = true;
|
|
||||||
invalid_items.push_back( item );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( pin && has_invalid_items && settings.IsTestEnabled( ERCE_NOCONNECT_CONNECTED ) )
|
if( unique_items.size() > 1 && pin && settings.IsTestEnabled( ERCE_NOCONNECT_CONNECTED ) )
|
||||||
{
|
{
|
||||||
std::shared_ptr<ERC_ITEM> ercItem = ERC_ITEM::Create( ERCE_NOCONNECT_CONNECTED );
|
std::shared_ptr<ERC_ITEM> ercItem = ERC_ITEM::Create( ERCE_NOCONNECT_CONNECTED );
|
||||||
ercItem->SetItems( pin );
|
ercItem->SetItems( pin );
|
||||||
|
@ -2793,7 +2790,7 @@ bool CONNECTION_GRAPH::ercCheckNoConnects( const CONNECTION_SUBGRAPH* aSubgraph
|
||||||
ok = false;
|
ok = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !has_other_items && settings.IsTestEnabled( ERCE_NOCONNECT_NOT_CONNECTED ) )
|
if( unique_items.empty() && settings.IsTestEnabled( ERCE_NOCONNECT_NOT_CONNECTED ) )
|
||||||
{
|
{
|
||||||
std::shared_ptr<ERC_ITEM> ercItem = ERC_ITEM::Create( ERCE_NOCONNECT_NOT_CONNECTED );
|
std::shared_ptr<ERC_ITEM> ercItem = ERC_ITEM::Create( ERCE_NOCONNECT_NOT_CONNECTED );
|
||||||
ercItem->SetItems( aSubgraph->m_no_connect );
|
ercItem->SetItems( aSubgraph->m_no_connect );
|
||||||
|
|
|
@ -246,6 +246,14 @@ 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();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void SCH_PIN::ClearDefaultNetName( const SCH_SHEET_PATH* aPath )
|
void SCH_PIN::ClearDefaultNetName( const SCH_SHEET_PATH* aPath )
|
||||||
{
|
{
|
||||||
std::lock_guard<std::recursive_mutex> lock( m_netmap_mutex );
|
std::lock_guard<std::recursive_mutex> lock( m_netmap_mutex );
|
||||||
|
|
|
@ -110,6 +110,12 @@ public:
|
||||||
|
|
||||||
void SetIsDangling( bool isDangling ) { m_isDangling = isDangling; }
|
void SetIsDangling( bool isDangling ) { m_isDangling = isDangling; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param aPin Comparison Pin
|
||||||
|
* @return True if aPin is stacked with this pin
|
||||||
|
*/
|
||||||
|
bool IsStacked( const SCH_PIN* aPin ) const;
|
||||||
|
|
||||||
bool IsPointClickableAnchor( const VECTOR2I& aPos ) const override
|
bool IsPointClickableAnchor( const VECTOR2I& aPos ) const override
|
||||||
{
|
{
|
||||||
return m_isDangling && GetPosition() == aPos;
|
return m_isDangling && GetPosition() == aPos;
|
||||||
|
|
Loading…
Reference in New Issue