Bring Pin Not Driven ERC to the new system
Also reword the error title to be a bit more clear Fixes https://gitlab.com/kicad/code/kicad/-/issues/5681
This commit is contained in:
parent
2153a7655b
commit
af28634df1
|
@ -100,6 +100,20 @@ const wxString CommentERC_V[] =
|
|||
};
|
||||
|
||||
|
||||
// List of pin types that are considered drivers
|
||||
const std::set<ELECTRICAL_PINTYPE> DrivingPinTypes =
|
||||
{
|
||||
ELECTRICAL_PINTYPE::PT_OUTPUT,
|
||||
ELECTRICAL_PINTYPE::PT_POWER_OUT
|
||||
};
|
||||
|
||||
// List of pin types that require a driver elsewhere on the net
|
||||
const std::set<ELECTRICAL_PINTYPE> DrivenPinTypes =
|
||||
{
|
||||
ELECTRICAL_PINTYPE::PT_INPUT,
|
||||
ELECTRICAL_PINTYPE::PT_POWER_IN
|
||||
};
|
||||
|
||||
int ERC_TESTER::TestDuplicateSheetNames( bool aCreateMarker )
|
||||
{
|
||||
SCH_SCREEN* screen;
|
||||
|
@ -438,10 +452,18 @@ int ERC_TESTER::TestPinToPin()
|
|||
|
||||
std::set<std::pair<SCH_PIN*, SCH_PIN*>> tested;
|
||||
|
||||
SCH_PIN* needsDriver = nullptr;
|
||||
bool hasDriver = false;
|
||||
|
||||
for( SCH_PIN* refPin : pins )
|
||||
{
|
||||
ELECTRICAL_PINTYPE refType = refPin->GetType();
|
||||
|
||||
if( !needsDriver && DrivenPinTypes.count( refType ) )
|
||||
needsDriver = refPin;
|
||||
|
||||
hasDriver |= DrivingPinTypes.count( refType );
|
||||
|
||||
for( SCH_PIN* testPin : pins )
|
||||
{
|
||||
if( testPin == refPin )
|
||||
|
@ -458,6 +480,8 @@ int ERC_TESTER::TestPinToPin()
|
|||
|
||||
ELECTRICAL_PINTYPE testType = testPin->GetType();
|
||||
|
||||
hasDriver |= DrivingPinTypes.count( testType );
|
||||
|
||||
PIN_ERROR erc = settings.GetPinMapValue( refType, testType );
|
||||
|
||||
if( erc != PIN_ERROR::OK )
|
||||
|
@ -479,6 +503,16 @@ int ERC_TESTER::TestPinToPin()
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( needsDriver && !hasDriver )
|
||||
{
|
||||
std::shared_ptr<ERC_ITEM> ercItem = ERC_ITEM::Create( ERCE_PIN_NOT_DRIVEN );
|
||||
ercItem->SetItems( needsDriver );
|
||||
|
||||
SCH_MARKER* marker = new SCH_MARKER( ercItem, needsDriver->GetTransformedPosition() );
|
||||
pinToScreenMap[needsDriver]->Append( marker );
|
||||
errors++;
|
||||
}
|
||||
}
|
||||
|
||||
return errors;
|
||||
|
|
|
@ -47,7 +47,7 @@ ERC_ITEM ERC_ITEM::pinNotConnected( ERCE_PIN_NOT_CONNECTED,
|
|||
wxT( "pin_not_connected" ) );
|
||||
|
||||
ERC_ITEM ERC_ITEM::pinNotDriven( ERCE_PIN_NOT_DRIVEN,
|
||||
_( "Pin connected to other pins, but not driven by any pin" ),
|
||||
_( "Input pin not driven by any Output pins" ),
|
||||
wxT( "pin_not_driven" ) );
|
||||
|
||||
ERC_ITEM ERC_ITEM::pinTableWarning( ERCE_PIN_TO_PIN_WARNING,
|
||||
|
|
Loading…
Reference in New Issue