Fix a couple of holes in the IsTestEnabled() checks.

Fixes https://gitlab.com/kicad/code/kicad/issues/7270
This commit is contained in:
Jeff Young 2021-11-04 16:23:25 +00:00
parent 393c84e67a
commit 83e5208213
3 changed files with 75 additions and 57 deletions

View File

@ -2209,11 +2209,13 @@ int CONNECTION_GRAPH::RunERC()
error_count++;
}
// The following checks are always performed since they don't currently
// have an option exposed to the user
if( settings.IsTestEnabled( ERCE_NOCONNECT_CONNECTED )
|| settings.IsTestEnabled( ERCE_NOCONNECT_NOT_CONNECTED )
|| settings.IsTestEnabled( ERCE_PIN_NOT_CONNECTED ) )
{
if( !ercCheckNoConnects( subgraph ) )
error_count++;
}
if( settings.IsTestEnabled( ERCE_LABEL_NOT_CONNECTED )
|| settings.IsTestEnabled( ERCE_GLOBLABEL ) )
@ -2224,8 +2226,11 @@ int CONNECTION_GRAPH::RunERC()
}
// Hierarchical sheet checking is done at the schematic level
if( settings.IsTestEnabled( ERCE_HIERACHICAL_LABEL ) )
if( settings.IsTestEnabled( ERCE_HIERACHICAL_LABEL )
|| settings.IsTestEnabled( ERCE_PIN_NOT_CONNECTED ) )
{
error_count += ercCheckHierSheets();
}
return error_count;
}
@ -2545,7 +2550,7 @@ bool CONNECTION_GRAPH::ercCheckNoConnects( const CONNECTION_SUBGRAPH* aSubgraph
// Any subgraph that contains both a pin and a no-connect should not
// contain any other driving items.
for( auto item : aSubgraph->m_items )
for( SCH_ITEM* item : aSubgraph->m_items )
{
switch( item->Type() )
{
@ -2589,7 +2594,7 @@ bool CONNECTION_GRAPH::ercCheckNoConnects( const CONNECTION_SUBGRAPH* aSubgraph
ok = false;
}
if( !has_other_items && settings.IsTestEnabled(ERCE_NOCONNECT_NOT_CONNECTED ) )
if( !has_other_items && settings.IsTestEnabled( ERCE_NOCONNECT_NOT_CONNECTED ) )
{
std::shared_ptr<ERC_ITEM> ercItem = ERC_ITEM::Create( ERCE_NOCONNECT_NOT_CONNECTED );
ercItem->SetItems( aSubgraph->m_no_connect );
@ -2880,6 +2885,7 @@ int CONNECTION_GRAPH::ercCheckHierSheets()
for( SCH_SHEET_PIN* pin : parentSheet->GetPins() )
{
if( settings.IsTestEnabled( ERCE_HIERACHICAL_LABEL ) )
pins[pin->GetText()] = pin;
if( pin->IsDangling() && settings.IsTestEnabled( ERCE_PIN_NOT_CONNECTED ) )
@ -2894,6 +2900,8 @@ int CONNECTION_GRAPH::ercCheckHierSheets()
}
}
if( settings.IsTestEnabled( ERCE_HIERACHICAL_LABEL ) )
{
std::set<wxString> matchedPins;
for( SCH_ITEM* subItem : parentSheet->GetScreen()->Items() )
@ -2947,6 +2955,7 @@ int CONNECTION_GRAPH::ercCheckHierSheets()
}
}
}
}
return errors;
}

View File

@ -381,8 +381,12 @@ void DIALOG_ERC::testErc()
tester.TestMultUnitPinConflicts();
// Test pins on each net against the pin connection table
if( settings.IsTestEnabled( ERCE_PIN_TO_PIN_ERROR ) )
if( settings.IsTestEnabled( ERCE_PIN_TO_PIN_ERROR )
|| settings.IsTestEnabled( ERCE_POWERPIN_NOT_DRIVEN )
|| settings.IsTestEnabled( ERCE_PIN_NOT_DRIVEN ) )
{
tester.TestPinToPin();
}
// Test similar labels (i;e. labels which are identical when
// using case insensitive comparisons)

View File

@ -521,7 +521,7 @@ int ERC_TESTER::TestPinToPin()
PIN_ERROR erc = settings.GetPinMapValue( refType, testType );
if( erc != PIN_ERROR::OK )
if( erc != PIN_ERROR::OK && settings.IsTestEnabled( ERCE_PIN_TO_PIN_WARNING ) )
{
std::shared_ptr<ERC_ITEM> ercItem =
ERC_ITEM::Create( erc == PIN_ERROR::WARNING ? ERCE_PIN_TO_PIN_WARNING :
@ -534,8 +534,8 @@ int ERC_TESTER::TestPinToPin()
ElectricalPinTypeGetText( refType ),
ElectricalPinTypeGetText( testType ) ) );
SCH_MARKER* marker =
new SCH_MARKER( ercItem, refPin->GetTransformedPosition() );
SCH_MARKER* marker = new SCH_MARKER( ercItem,
refPin->GetTransformedPosition() );
pinToScreenMap[refPin]->Append( marker );
errors++;
}
@ -545,15 +545,20 @@ int ERC_TESTER::TestPinToPin()
if( needsDriver && !hasDriver )
{
int err_code = ispowerNet ? ERCE_POWERPIN_NOT_DRIVEN : ERCE_PIN_NOT_DRIVEN;
if( settings.IsTestEnabled( err_code ) )
{
std::shared_ptr<ERC_ITEM> ercItem = ERC_ITEM::Create( err_code );
ercItem->SetItems( needsDriver );
SCH_MARKER* marker = new SCH_MARKER( ercItem, needsDriver->GetTransformedPosition() );
SCH_MARKER* marker = new SCH_MARKER( ercItem,
needsDriver->GetTransformedPosition() );
pinToScreenMap[needsDriver]->Append( marker );
errors++;
}
}
}
return errors;
}