ADDED pad:pin checks for DRC "Test footprints against schematic".
This commit is contained in:
parent
15c4a7b066
commit
007580c4b8
|
@ -154,6 +154,7 @@ BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS( JSON_SETTINGS* aParent, const std:
|
|||
m_DRCSeverities[ DRCE_MISSING_FOOTPRINT ] = RPT_SEVERITY_WARNING;
|
||||
m_DRCSeverities[ DRCE_DUPLICATE_FOOTPRINT ] = RPT_SEVERITY_WARNING;
|
||||
m_DRCSeverities[ DRCE_EXTRA_FOOTPRINT ] = RPT_SEVERITY_WARNING;
|
||||
m_DRCSeverities[ DRCE_NET_CONFLICT ] = RPT_SEVERITY_WARNING;
|
||||
|
||||
m_MaxError = ARC_HIGH_DEF;
|
||||
m_ZoneUseNoOutlineInFill = true; // Use new algo by default to fill zones
|
||||
|
|
|
@ -1100,29 +1100,13 @@ NETINFO_ITEM* BOARD::FindNet( const wxString& aNetname ) const
|
|||
|
||||
MODULE* BOARD::FindModuleByReference( const wxString& aReference ) const
|
||||
{
|
||||
MODULE* found = nullptr;
|
||||
|
||||
// search only for MODULES
|
||||
static const KICAD_T scanTypes[] = { PCB_MODULE_T, EOT };
|
||||
|
||||
INSPECTOR_FUNC inspector = [&]( EDA_ITEM* item, void* testData )
|
||||
for( MODULE* module : m_modules )
|
||||
{
|
||||
MODULE* module = (MODULE*) item;
|
||||
|
||||
if( aReference == module->GetReference() )
|
||||
{
|
||||
found = module;
|
||||
return SEARCH_RESULT::QUIT;
|
||||
return module;
|
||||
}
|
||||
|
||||
return SEARCH_RESULT::CONTINUE;
|
||||
};
|
||||
|
||||
// visit this BOARD with the above inspector
|
||||
BOARD* nonconstMe = (BOARD*) this;
|
||||
nonconstMe->Visit( inspector, NULL, scanTypes );
|
||||
|
||||
return found;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -70,6 +70,7 @@ enum PCB_DRC_CODE {
|
|||
DRCE_MISSING_FOOTPRINT, ///< footprint not found for netlist item
|
||||
DRCE_DUPLICATE_FOOTPRINT, ///< more than one footprints found for netlist item
|
||||
DRCE_EXTRA_FOOTPRINT, ///< netlist item not found for footprint
|
||||
DRCE_NET_CONFLICT, ///< pad net doesn't match netlist
|
||||
|
||||
DRCE_UNRESOLVED_VARIABLE,
|
||||
|
||||
|
|
|
@ -159,6 +159,10 @@ DRC_ITEM DRC_ITEM::extraFootprint( DRCE_EXTRA_FOOTPRINT,
|
|||
_( "Extra footprint" ),
|
||||
wxT( "extra_footprint" ) );
|
||||
|
||||
DRC_ITEM DRC_ITEM::netConflict( DRCE_NET_CONFLICT,
|
||||
_( "Pad net doesn't match schematic" ),
|
||||
wxT( "net_conflict" ) );
|
||||
|
||||
DRC_ITEM DRC_ITEM::unresolvedVariable( DRCE_UNRESOLVED_VARIABLE,
|
||||
_( "Unresolved text variable" ),
|
||||
wxT( "unresolved_variable" ) );
|
||||
|
@ -232,6 +236,7 @@ std::shared_ptr<DRC_ITEM> DRC_ITEM::Create( int aErrorCode )
|
|||
case DRCE_INVALID_OUTLINE: return std::make_shared<DRC_ITEM>( invalidOutline );
|
||||
case DRCE_MISSING_FOOTPRINT: return std::make_shared<DRC_ITEM>( missingFootprint );
|
||||
case DRCE_DUPLICATE_FOOTPRINT: return std::make_shared<DRC_ITEM>( duplicateFootprints );
|
||||
case DRCE_NET_CONFLICT: return std::make_shared<DRC_ITEM>( netConflict );
|
||||
case DRCE_EXTRA_FOOTPRINT: return std::make_shared<DRC_ITEM>( extraFootprint );
|
||||
case DRCE_UNRESOLVED_VARIABLE: return std::make_shared<DRC_ITEM>( unresolvedVariable );
|
||||
|
||||
|
|
|
@ -98,6 +98,7 @@ private:
|
|||
static DRC_ITEM duplicateFootprints;
|
||||
static DRC_ITEM missingFootprint;
|
||||
static DRC_ITEM extraFootprint;
|
||||
static DRC_ITEM netConflict;
|
||||
static DRC_ITEM unresolvedVariable;
|
||||
};
|
||||
|
||||
|
|
|
@ -52,15 +52,15 @@ void TestFootprints( NETLIST& aNetlist, BOARD* aBoard, std::vector<std::shared_p
|
|||
}
|
||||
}
|
||||
|
||||
if( !aBoard->GetDesignSettings().Ignore( DRCE_MISSING_FOOTPRINT ) )
|
||||
{
|
||||
// Search for component footprints in the netlist but not on the board.
|
||||
for( unsigned ii = 0; ii < aNetlist.GetCount(); ii++ )
|
||||
{
|
||||
COMPONENT* component = aNetlist.GetComponent( ii );
|
||||
MODULE* module = aBoard->FindModuleByReference( component->GetReference() );
|
||||
|
||||
if( module == NULL )
|
||||
if( module == nullptr )
|
||||
{
|
||||
if( !aBoard->GetDesignSettings().Ignore( DRCE_MISSING_FOOTPRINT ) && module == NULL )
|
||||
{
|
||||
msg.Printf( _( "Missing footprint %s (%s)" ),
|
||||
component->GetReference(),
|
||||
|
@ -71,6 +71,64 @@ void TestFootprints( NETLIST& aNetlist, BOARD* aBoard, std::vector<std::shared_p
|
|||
aDRCList.push_back( item );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if( !aBoard->GetDesignSettings().Ignore( DRCE_NET_CONFLICT ) )
|
||||
{
|
||||
for( D_PAD* pad : module->Pads() )
|
||||
{
|
||||
const COMPONENT_NET& sch_net = component->GetNet( pad->GetName() );
|
||||
const wxString& pcb_netname = pad->GetNetname();
|
||||
|
||||
if( !pcb_netname.IsEmpty() && sch_net.GetPinName().IsEmpty() )
|
||||
{
|
||||
msg.Printf( _( "No corresponding pin found in schematic." ) );
|
||||
|
||||
std::shared_ptr<DRC_ITEM> item = DRC_ITEM::Create( DRCE_NET_CONFLICT );
|
||||
item->SetErrorMessage( msg );
|
||||
item->SetItems( pad );
|
||||
aDRCList.push_back( item );
|
||||
}
|
||||
else if( pcb_netname.IsEmpty() && !sch_net.GetNetName().IsEmpty() )
|
||||
{
|
||||
msg.Printf( _( "Pad missing net given by schematic (%s)." ),
|
||||
sch_net.GetNetName() );
|
||||
|
||||
std::shared_ptr<DRC_ITEM> item = DRC_ITEM::Create( DRCE_NET_CONFLICT );
|
||||
item->SetErrorMessage( msg );
|
||||
item->SetItems( pad );
|
||||
aDRCList.push_back( item );
|
||||
}
|
||||
else if( pcb_netname != sch_net.GetNetName() )
|
||||
{
|
||||
msg.Printf( _( "Pad net (%s) doesn't match net given by schematic (%s)." ),
|
||||
pcb_netname,
|
||||
sch_net.GetNetName() );
|
||||
|
||||
std::shared_ptr<DRC_ITEM> item = DRC_ITEM::Create( DRCE_NET_CONFLICT );
|
||||
item->SetErrorMessage( msg );
|
||||
item->SetItems( pad );
|
||||
aDRCList.push_back( item );
|
||||
}
|
||||
}
|
||||
|
||||
for( unsigned jj = 0; jj < component->GetNetCount(); ++jj )
|
||||
{
|
||||
const COMPONENT_NET& sch_net = component->GetNet( jj );
|
||||
|
||||
if( !module->FindPadByName( sch_net.GetPinName() ) )
|
||||
{
|
||||
msg.Printf( _( "No pad found for pin %s in schematic." ),
|
||||
sch_net.GetPinName() );
|
||||
|
||||
std::shared_ptr<DRC_ITEM> item = DRC_ITEM::Create( DRCE_NET_CONFLICT );
|
||||
item->SetErrorMessage( msg );
|
||||
item->SetItems( module );
|
||||
aDRCList.push_back( item );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( !aBoard->GetDesignSettings().Ignore( DRCE_EXTRA_FOOTPRINT ) )
|
||||
|
|
|
@ -169,7 +169,8 @@ MODULE* BOARD_NETLIST_UPDATER::addNewComponent( COMPONENT* aComponent )
|
|||
|
||||
// Set the pads ratsnest settings to the global settings
|
||||
bool set_ratsnest = m_frame->GetDisplayOptions().m_ShowGlobalRatsnest;
|
||||
for ( auto pad : footprint->Pads() )
|
||||
|
||||
for ( D_PAD* pad : footprint->Pads() )
|
||||
pad->SetLocalRatsnestVisible( set_ratsnest );
|
||||
|
||||
m_newFootprintsCount++;
|
||||
|
|
Loading…
Reference in New Issue