Pcbnew: regression fix when using the new netlist format:
* when a footprint has many pads having the same pad name, only the first pad was connected to the net
This commit is contained in:
parent
909c2a6051
commit
c047d7f484
|
@ -363,15 +363,18 @@ public:
|
|||
void RemoveExtraFootprints( );
|
||||
|
||||
/**
|
||||
* Function SetPadNetName
|
||||
* Update a pad netname
|
||||
* Function SetPadsNetName
|
||||
* Update pads netnames for a given module.
|
||||
* Because a pad name can be found more than once in this module,
|
||||
* all pads matching the pad name are updated
|
||||
* @param aModule = module reference
|
||||
* @param aPadname = pad name (pad num)
|
||||
* @param aNetname = new net name of the pad
|
||||
* @return a pointer to the pad or NULL if the pad is not found
|
||||
* @param aPadList = a std::vector<D_PAD*>& buffer where the updated pads can be stored
|
||||
* @return the pad count
|
||||
*/
|
||||
D_PAD* SetPadNetName( const wxString & aModule, const wxString & aPadname,
|
||||
const wxString & aNetname );
|
||||
int SetPadsNetName( const wxString & aModule, const wxString & aPadname,
|
||||
const wxString & aNetname, std::vector<D_PAD*> & aPadList );
|
||||
|
||||
private:
|
||||
|
||||
|
|
|
@ -278,27 +278,43 @@ void NETLIST_READER::TestFootprintsMatchingAndExchange()
|
|||
}
|
||||
|
||||
/**
|
||||
* Function SetPadNetName
|
||||
* Update a pad netname
|
||||
* Function SetPadsNetName
|
||||
* Update pads netnames for a given module.
|
||||
* Because a pad name can be found more than once in this module,
|
||||
* all pads matching the pad name are updated
|
||||
* @param aModule = module reference
|
||||
* @param aPadname = pad name (pad num)
|
||||
* @param aNetname = new net name of the pad
|
||||
* @return a pointer to the pad or NULL if the pad is not found
|
||||
* @param aPadList = a std::vector<D_PAD*>& buffer where the updated pads can be stored
|
||||
* @return the pad count
|
||||
*/
|
||||
D_PAD* NETLIST_READER::SetPadNetName( const wxString & aModule, const wxString & aPadname,
|
||||
const wxString & aNetname )
|
||||
int NETLIST_READER::SetPadsNetName( const wxString & aModule, const wxString & aPadname,
|
||||
const wxString & aNetname, std::vector<D_PAD*> & aPadList )
|
||||
{
|
||||
if( m_pcbframe == NULL )
|
||||
return NULL;
|
||||
return 0;
|
||||
|
||||
int padcount = 0;
|
||||
MODULE* module = m_pcbframe->GetBoard()->FindModuleByReference( aModule );
|
||||
if( module )
|
||||
{
|
||||
D_PAD * pad = module->FindPadByName( aPadname );
|
||||
if( pad )
|
||||
{
|
||||
padcount++;
|
||||
aPadList.push_back( pad );
|
||||
pad->SetNetname( aNetname );
|
||||
return pad;
|
||||
// Search for other pads having the same pad name/num
|
||||
for( D_PAD* curr_pad = pad->Next(); curr_pad; curr_pad = curr_pad->Next() )
|
||||
{
|
||||
if( pad->PadNameEqual( curr_pad ) )
|
||||
{
|
||||
padcount++;
|
||||
aPadList.push_back( curr_pad );
|
||||
curr_pad->SetNetname( aNetname );
|
||||
}
|
||||
}
|
||||
return padcount;
|
||||
}
|
||||
if( m_messageWindow )
|
||||
{
|
||||
|
@ -309,7 +325,7 @@ D_PAD* NETLIST_READER::SetPadNetName( const wxString & aModule, const wxString &
|
|||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -245,8 +245,9 @@ void NETLIST_READER_KICAD_PARSER::ParseNet( BOARD * aBrd )
|
|||
wxString name;
|
||||
wxString cmpref;
|
||||
wxString pin;
|
||||
D_PAD * pad = NULL;
|
||||
int nodecount = 0;
|
||||
std::vector<D_PAD*> padList;
|
||||
|
||||
// The token net was read, so the next data is (code <number>)
|
||||
while( (token = NextTok()) != T_RIGHT )
|
||||
{
|
||||
|
@ -292,7 +293,7 @@ void NETLIST_READER_KICAD_PARSER::ParseNet( BOARD * aBrd )
|
|||
break;
|
||||
}
|
||||
}
|
||||
pad = netlist_reader->SetPadNetName( cmpref, pin, name );
|
||||
netlist_reader->SetPadsNetName( cmpref, pin, name, padList );
|
||||
nodecount++;
|
||||
break;
|
||||
|
||||
|
@ -303,8 +304,11 @@ void NETLIST_READER_KICAD_PARSER::ParseNet( BOARD * aBrd )
|
|||
}
|
||||
|
||||
// When there is only one item in net, clear pad netname
|
||||
if( nodecount < 2 && pad )
|
||||
pad->SetNetname( wxEmptyString );
|
||||
// Remember one can have more than one pad in list, because a footprint
|
||||
// can have many pads with the same pad name
|
||||
if( nodecount < 2 )
|
||||
for( unsigned ii = 0; ii < padList.size(); ii++ )
|
||||
padList[ii]->SetNetname( wxEmptyString );
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue