Improvements to ERC and bus parsing.
1) Add some nullptr safety to ERC. 2) Allow unconnected flagging on bus/wire entries. 3) Allow commas in bus group definitions. Fixes https://gitlab.com/kicad/code/kicad/issues/7155
This commit is contained in:
parent
f1221a9ca3
commit
f3a6d2655e
|
@ -459,16 +459,17 @@ bool NET_SETTINGS::ParseBusGroup( wxString aGroup, wxString* aName,
|
|||
}
|
||||
else
|
||||
{
|
||||
if( aMemberList )
|
||||
if( aMemberList && !tmp.IsEmpty() )
|
||||
aMemberList->push_back( EscapeString( tmp, CTX_NETNAME ) );
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if( aGroup[i] == ' ' )
|
||||
// Commas aren't strictly legal, but we can be pretty sure what the author had in mind.
|
||||
if( aGroup[i] == ' ' || aGroup[i] == ',' )
|
||||
{
|
||||
if( aMemberList )
|
||||
if( aMemberList && !tmp.IsEmpty() )
|
||||
aMemberList->push_back( EscapeString( tmp, CTX_NETNAME ) );
|
||||
|
||||
tmp.Clear();
|
||||
|
|
|
@ -2375,6 +2375,12 @@ bool CONNECTION_GRAPH::ercCheckBusToBusEntryConflicts( const CONNECTION_SUBGRAPH
|
|||
SCH_ITEM* bus_wire = nullptr;
|
||||
wxString bus_name;
|
||||
|
||||
if( !aSubgraph->m_driver_connection )
|
||||
{
|
||||
// Incomplete bus entry. Let the unconnected tests handle it.
|
||||
return true;
|
||||
}
|
||||
|
||||
for( auto item : aSubgraph->m_items )
|
||||
{
|
||||
switch( item->Type() )
|
||||
|
@ -2632,7 +2638,7 @@ bool CONNECTION_GRAPH::ercCheckFloatingWires( const CONNECTION_SUBGRAPH* aSubgra
|
|||
if( aSubgraph->m_driver )
|
||||
return true;
|
||||
|
||||
std::vector<SCH_LINE*> wires;
|
||||
std::vector<SCH_ITEM*> wires;
|
||||
|
||||
// We've gotten this far, so we know we have no valid driver. All we need to do is check
|
||||
// for a wire that we can place the error on.
|
||||
|
@ -2640,7 +2646,9 @@ bool CONNECTION_GRAPH::ercCheckFloatingWires( const CONNECTION_SUBGRAPH* aSubgra
|
|||
for( SCH_ITEM* item : aSubgraph->m_items )
|
||||
{
|
||||
if( item->Type() == SCH_LINE_T && item->GetLayer() == LAYER_WIRE )
|
||||
wires.emplace_back( static_cast<SCH_LINE*>( item ) );
|
||||
wires.emplace_back( item );
|
||||
else if( item->Type() == SCH_BUS_WIRE_ENTRY_T )
|
||||
wires.emplace_back( item );
|
||||
}
|
||||
|
||||
if( !wires.empty() )
|
||||
|
@ -2674,6 +2682,9 @@ bool CONNECTION_GRAPH::ercCheckLabels( const CONNECTION_SUBGRAPH* aSubgraph )
|
|||
if( aSubgraph->m_no_connect )
|
||||
return true;
|
||||
|
||||
if( !aSubgraph->m_driver_connection )
|
||||
return true;
|
||||
|
||||
// Buses are excluded from this test: many users create buses with only a single instance
|
||||
// and it's not really a problem as long as the nets in the bus pass ERC
|
||||
if( aSubgraph->m_driver_connection->IsBus() )
|
||||
|
|
Loading…
Reference in New Issue