Properly send cross-probe for nested buses

Fixes https://gitlab.com/kicad/code/kicad/-/issues/4541
This commit is contained in:
Jon Evans 2020-05-25 17:03:49 -04:00
parent 91b9e928dc
commit df16ea25a8
3 changed files with 20 additions and 4 deletions

View File

@ -384,9 +384,11 @@ void SCH_EDIT_FRAME::SetCrossProbeConnection( const SCH_CONNECTION* aConnection
if( aConnection->Members().empty() ) if( aConnection->Members().empty() )
return; return;
wxString nets = aConnection->Members()[0]->Name(); auto all_members = aConnection->AllMembers();
if( aConnection->Members().size() == 1 ) wxString nets = all_members[0]->Name();
if( all_members.size() == 1 )
{ {
SendCrossProbeNetName( nets ); SendCrossProbeNetName( nets );
return; return;
@ -396,8 +398,8 @@ void SCH_EDIT_FRAME::SetCrossProbeConnection( const SCH_CONNECTION* aConnection
// included as part of the netlist sent from eeschema to pcbnew (and thus pcbnew can // included as part of the netlist sent from eeschema to pcbnew (and thus pcbnew can
// natively keep track of bus membership) // natively keep track of bus membership)
for( size_t i = 1; i < aConnection->Members().size(); i++ ) for( size_t i = 1; i < all_members.size(); i++ )
nets << "," << aConnection->Members()[i]->Name(); nets << "," << all_members[i]->Name();
std::string packet = StrPrintf( "$NETS: \"%s\"", TO_UTF8( nets ) ); std::string packet = StrPrintf( "$NETS: \"%s\"", TO_UTF8( nets ) );

View File

@ -643,6 +643,18 @@ bool SCH_CONNECTION::ParseBusGroup( wxString aGroup, wxString* aName,
} }
const std::vector< std::shared_ptr< SCH_CONNECTION > > SCH_CONNECTION::AllMembers() const
{
std::vector< std::shared_ptr< SCH_CONNECTION > > ret( m_members );
for( const auto& member : m_members )
if( member->IsBus() )
ret.insert( ret.end(), member->Members().begin(), member->Members().end() );
return ret;
}
wxString SCH_CONNECTION::PrintBusForUI( const wxString& aGroup ) wxString SCH_CONNECTION::PrintBusForUI( const wxString& aGroup )
{ {
size_t groupLen = aGroup.length(); size_t groupLen = aGroup.length();

View File

@ -258,6 +258,8 @@ public:
return m_members; return m_members;
} }
const std::vector< std::shared_ptr< SCH_CONNECTION > > AllMembers() const;
static wxString PrintBusForUI( const wxString& aString ); static wxString PrintBusForUI( const wxString& aString );
/** /**