Fix a couple of holes in the IsTestEnabled() checks.
Fixes https://gitlab.com/kicad/code/kicad/issues/7270
This commit is contained in:
parent
393c84e67a
commit
83e5208213
|
@ -2209,11 +2209,13 @@ int CONNECTION_GRAPH::RunERC()
|
||||||
error_count++;
|
error_count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// The following checks are always performed since they don't currently
|
if( settings.IsTestEnabled( ERCE_NOCONNECT_CONNECTED )
|
||||||
// have an option exposed to the user
|
|| settings.IsTestEnabled( ERCE_NOCONNECT_NOT_CONNECTED )
|
||||||
|
|| settings.IsTestEnabled( ERCE_PIN_NOT_CONNECTED ) )
|
||||||
if( !ercCheckNoConnects( subgraph ) )
|
{
|
||||||
error_count++;
|
if( !ercCheckNoConnects( subgraph ) )
|
||||||
|
error_count++;
|
||||||
|
}
|
||||||
|
|
||||||
if( settings.IsTestEnabled( ERCE_LABEL_NOT_CONNECTED )
|
if( settings.IsTestEnabled( ERCE_LABEL_NOT_CONNECTED )
|
||||||
|| settings.IsTestEnabled( ERCE_GLOBLABEL ) )
|
|| settings.IsTestEnabled( ERCE_GLOBLABEL ) )
|
||||||
|
@ -2224,8 +2226,11 @@ int CONNECTION_GRAPH::RunERC()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Hierarchical sheet checking is done at the schematic level
|
// 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();
|
error_count += ercCheckHierSheets();
|
||||||
|
}
|
||||||
|
|
||||||
return error_count;
|
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
|
// Any subgraph that contains both a pin and a no-connect should not
|
||||||
// contain any other driving items.
|
// contain any other driving items.
|
||||||
|
|
||||||
for( auto item : aSubgraph->m_items )
|
for( SCH_ITEM* item : aSubgraph->m_items )
|
||||||
{
|
{
|
||||||
switch( item->Type() )
|
switch( item->Type() )
|
||||||
{
|
{
|
||||||
|
@ -2589,7 +2594,7 @@ bool CONNECTION_GRAPH::ercCheckNoConnects( const CONNECTION_SUBGRAPH* aSubgraph
|
||||||
ok = false;
|
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 );
|
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 );
|
||||||
|
@ -2880,7 +2885,8 @@ int CONNECTION_GRAPH::ercCheckHierSheets()
|
||||||
|
|
||||||
for( SCH_SHEET_PIN* pin : parentSheet->GetPins() )
|
for( SCH_SHEET_PIN* pin : parentSheet->GetPins() )
|
||||||
{
|
{
|
||||||
pins[pin->GetText()] = pin;
|
if( settings.IsTestEnabled( ERCE_HIERACHICAL_LABEL ) )
|
||||||
|
pins[pin->GetText()] = pin;
|
||||||
|
|
||||||
if( pin->IsDangling() && settings.IsTestEnabled( ERCE_PIN_NOT_CONNECTED ) )
|
if( pin->IsDangling() && settings.IsTestEnabled( ERCE_PIN_NOT_CONNECTED ) )
|
||||||
{
|
{
|
||||||
|
@ -2894,56 +2900,59 @@ int CONNECTION_GRAPH::ercCheckHierSheets()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::set<wxString> matchedPins;
|
if( settings.IsTestEnabled( ERCE_HIERACHICAL_LABEL ) )
|
||||||
|
|
||||||
for( SCH_ITEM* subItem : parentSheet->GetScreen()->Items() )
|
|
||||||
{
|
{
|
||||||
if( subItem->Type() == SCH_HIER_LABEL_T )
|
std::set<wxString> matchedPins;
|
||||||
|
|
||||||
|
for( SCH_ITEM* subItem : parentSheet->GetScreen()->Items() )
|
||||||
{
|
{
|
||||||
SCH_HIERLABEL* label = static_cast<SCH_HIERLABEL*>( subItem );
|
if( subItem->Type() == SCH_HIER_LABEL_T )
|
||||||
|
{
|
||||||
|
SCH_HIERLABEL* label = static_cast<SCH_HIERLABEL*>( subItem );
|
||||||
|
|
||||||
if( !pins.count( label->GetText() ) )
|
if( !pins.count( label->GetText() ) )
|
||||||
labels[label->GetText()] = label;
|
labels[label->GetText()] = label;
|
||||||
else
|
else
|
||||||
matchedPins.insert( label->GetText() );
|
matchedPins.insert( label->GetText() );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
for( const wxString& matched : matchedPins )
|
for( const wxString& matched : matchedPins )
|
||||||
pins.erase( matched );
|
pins.erase( matched );
|
||||||
|
|
||||||
for( const std::pair<const wxString, SCH_SHEET_PIN*>& unmatched : pins )
|
for( const std::pair<const wxString, SCH_SHEET_PIN*>& unmatched : pins )
|
||||||
{
|
{
|
||||||
wxString msg = wxString::Format( _( "Sheet pin %s has no matching hierarchical "
|
wxString msg = wxString::Format( _( "Sheet pin %s has no matching hierarchical "
|
||||||
"label inside the sheet" ),
|
"label inside the sheet" ),
|
||||||
UnescapeString( unmatched.first ) );
|
UnescapeString( unmatched.first ) );
|
||||||
|
|
||||||
std::shared_ptr<ERC_ITEM> ercItem = ERC_ITEM::Create( ERCE_HIERACHICAL_LABEL );
|
std::shared_ptr<ERC_ITEM> ercItem = ERC_ITEM::Create( ERCE_HIERACHICAL_LABEL );
|
||||||
ercItem->SetItems( unmatched.second );
|
ercItem->SetItems( unmatched.second );
|
||||||
ercItem->SetErrorMessage( msg );
|
ercItem->SetErrorMessage( msg );
|
||||||
ercItem->SetIsSheetSpecific();
|
ercItem->SetIsSheetSpecific();
|
||||||
|
|
||||||
SCH_MARKER* marker = new SCH_MARKER( ercItem, unmatched.second->GetPosition() );
|
SCH_MARKER* marker = new SCH_MARKER( ercItem, unmatched.second->GetPosition() );
|
||||||
sheet.LastScreen()->Append( marker );
|
sheet.LastScreen()->Append( marker );
|
||||||
|
|
||||||
errors++;
|
errors++;
|
||||||
}
|
}
|
||||||
|
|
||||||
for( const std::pair<const wxString, SCH_HIERLABEL*>& unmatched : labels )
|
for( const std::pair<const wxString, SCH_HIERLABEL*>& unmatched : labels )
|
||||||
{
|
{
|
||||||
wxString msg = wxString::Format( _( "Hierarchical label %s has no matching "
|
wxString msg = wxString::Format( _( "Hierarchical label %s has no matching "
|
||||||
"sheet pin in the parent sheet" ),
|
"sheet pin in the parent sheet" ),
|
||||||
UnescapeString( unmatched.first ) );
|
UnescapeString( unmatched.first ) );
|
||||||
|
|
||||||
std::shared_ptr<ERC_ITEM> ercItem = ERC_ITEM::Create( ERCE_HIERACHICAL_LABEL );
|
std::shared_ptr<ERC_ITEM> ercItem = ERC_ITEM::Create( ERCE_HIERACHICAL_LABEL );
|
||||||
ercItem->SetItems( unmatched.second );
|
ercItem->SetItems( unmatched.second );
|
||||||
ercItem->SetErrorMessage( msg );
|
ercItem->SetErrorMessage( msg );
|
||||||
ercItem->SetIsSheetSpecific();
|
ercItem->SetIsSheetSpecific();
|
||||||
|
|
||||||
SCH_MARKER* marker = new SCH_MARKER( ercItem, unmatched.second->GetPosition() );
|
SCH_MARKER* marker = new SCH_MARKER( ercItem, unmatched.second->GetPosition() );
|
||||||
parentSheet->GetScreen()->Append( marker );
|
parentSheet->GetScreen()->Append( marker );
|
||||||
|
|
||||||
errors++;
|
errors++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -381,8 +381,12 @@ void DIALOG_ERC::testErc()
|
||||||
tester.TestMultUnitPinConflicts();
|
tester.TestMultUnitPinConflicts();
|
||||||
|
|
||||||
// Test pins on each net against the pin connection table
|
// 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();
|
tester.TestPinToPin();
|
||||||
|
}
|
||||||
|
|
||||||
// Test similar labels (i;e. labels which are identical when
|
// Test similar labels (i;e. labels which are identical when
|
||||||
// using case insensitive comparisons)
|
// using case insensitive comparisons)
|
||||||
|
|
|
@ -521,7 +521,7 @@ int ERC_TESTER::TestPinToPin()
|
||||||
|
|
||||||
PIN_ERROR erc = settings.GetPinMapValue( refType, testType );
|
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 =
|
std::shared_ptr<ERC_ITEM> ercItem =
|
||||||
ERC_ITEM::Create( erc == PIN_ERROR::WARNING ? ERCE_PIN_TO_PIN_WARNING :
|
ERC_ITEM::Create( erc == PIN_ERROR::WARNING ? ERCE_PIN_TO_PIN_WARNING :
|
||||||
|
@ -531,11 +531,11 @@ int ERC_TESTER::TestPinToPin()
|
||||||
|
|
||||||
ercItem->SetErrorMessage(
|
ercItem->SetErrorMessage(
|
||||||
wxString::Format( _( "Pins of type %s and %s are connected" ),
|
wxString::Format( _( "Pins of type %s and %s are connected" ),
|
||||||
ElectricalPinTypeGetText( refType ),
|
ElectricalPinTypeGetText( refType ),
|
||||||
ElectricalPinTypeGetText( testType ) ) );
|
ElectricalPinTypeGetText( testType ) ) );
|
||||||
|
|
||||||
SCH_MARKER* marker =
|
SCH_MARKER* marker = new SCH_MARKER( ercItem,
|
||||||
new SCH_MARKER( ercItem, refPin->GetTransformedPosition() );
|
refPin->GetTransformedPosition() );
|
||||||
pinToScreenMap[refPin]->Append( marker );
|
pinToScreenMap[refPin]->Append( marker );
|
||||||
errors++;
|
errors++;
|
||||||
}
|
}
|
||||||
|
@ -545,13 +545,18 @@ int ERC_TESTER::TestPinToPin()
|
||||||
if( needsDriver && !hasDriver )
|
if( needsDriver && !hasDriver )
|
||||||
{
|
{
|
||||||
int err_code = ispowerNet ? ERCE_POWERPIN_NOT_DRIVEN : ERCE_PIN_NOT_DRIVEN;
|
int err_code = ispowerNet ? ERCE_POWERPIN_NOT_DRIVEN : ERCE_PIN_NOT_DRIVEN;
|
||||||
std::shared_ptr<ERC_ITEM> ercItem = ERC_ITEM::Create( err_code );
|
|
||||||
|
|
||||||
ercItem->SetItems( needsDriver );
|
if( settings.IsTestEnabled( err_code ) )
|
||||||
|
{
|
||||||
|
std::shared_ptr<ERC_ITEM> ercItem = ERC_ITEM::Create( err_code );
|
||||||
|
|
||||||
SCH_MARKER* marker = new SCH_MARKER( ercItem, needsDriver->GetTransformedPosition() );
|
ercItem->SetItems( needsDriver );
|
||||||
pinToScreenMap[needsDriver]->Append( marker );
|
|
||||||
errors++;
|
SCH_MARKER* marker = new SCH_MARKER( ercItem,
|
||||||
|
needsDriver->GetTransformedPosition() );
|
||||||
|
pinToScreenMap[needsDriver]->Append( marker );
|
||||||
|
errors++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue