Fix Bug #1462876 (Eeschema ERC NoConnect not reliable.)

This commit is contained in:
jean-pierre charras 2015-06-09 12:40:34 +02:00
parent 1617957ef4
commit d583b1ff98
3 changed files with 40 additions and 9 deletions

View File

@ -473,7 +473,6 @@ void DIALOG_ERC::TestErc( wxArrayString* aMessagesList )
unsigned lastNet;
unsigned nextNet = lastNet = 0;
int NetNbItems = 0;
int MinConn = NOC;
for( unsigned net = 0; net < objectsConnectedList->size(); net++ )
@ -483,7 +482,6 @@ void DIALOG_ERC::TestErc( wxArrayString* aMessagesList )
{
// New net found:
MinConn = NOC;
NetNbItems = 0;
nextNet = net;
}
@ -517,7 +515,7 @@ void DIALOG_ERC::TestErc( wxArrayString* aMessagesList )
// ERC problems when a noconnect symbol is connected to more than one pin.
MinConn = NET_NC;
if( NetNbItems != 0 )
if( CountPinsInNet( objectsConnectedList.get(), nextNet ) > 1 )
Diagnose( objectsConnectedList->GetItem( net ), NULL, MinConn, UNC );
break;
@ -525,7 +523,7 @@ void DIALOG_ERC::TestErc( wxArrayString* aMessagesList )
case NET_PIN:
// Look for ERC problems between pins:
TestOthersItems( objectsConnectedList.get(), net, nextNet, &NetNbItems, &MinConn );
TestOthersItems( objectsConnectedList.get(), net, nextNet, &MinConn );
break;
}

View File

@ -356,7 +356,7 @@ void Diagnose( NETLIST_OBJECT* aNetItemRef, NETLIST_OBJECT* aNetItemTst,
void TestOthersItems( NETLIST_OBJECT_LIST* aList,
unsigned aNetItemRef, unsigned aNetStart,
int* aNetNbItems, int* aMinConnexion )
int* aMinConnexion )
{
unsigned netItemTst = aNetStart;
int jj;
@ -467,8 +467,6 @@ void TestOthersItems( NETLIST_OBJECT_LIST* aList,
if( netItemTst <= aNetItemRef )
break;
*aNetNbItems += 1;
if( erc == OK )
{
erc = DiagErc[ref_elect_type][jj];
@ -491,6 +489,26 @@ void TestOthersItems( NETLIST_OBJECT_LIST* aList,
}
int CountPinsInNet( NETLIST_OBJECT_LIST* aList, unsigned aNetStart )
{
int count = 0;
int curr_net = aList->GetItemNet( aNetStart );
/* Test pins connected to NetItemRef */
for( unsigned item = aNetStart; item < aList->size(); item++ )
{
// We examine only a given net. We stop the search if the net changes
if( curr_net != aList->GetItemNet( item ) ) // End of net
break;
if( aList->GetItemType( item ) == NET_PIN )
count++;
}
return count;
}
bool WriteDiagnosticERC( const wxString& aFullFileName )
{
SCH_ITEM* item;

View File

@ -84,11 +84,26 @@ extern void Diagnose( NETLIST_OBJECT* NetItemRef, NETLIST_OBJECT* NetItemTst,
/**
* Perform ERC testing for electrical conflicts between \a NetItemRef and other items
* on the same net.
* (mainly pin) on the same net.
* @param aList = a reference to the list of connected objects
* @param aNetItemRef = index in list of the current object
* @param aNetStart = index in list of net objects of the first item
* @param aMinConnexion = a pointer to a variable to store the minimal connection
* found( NOD, DRV, NPI, NET_NC)
*/
extern void TestOthersItems( NETLIST_OBJECT_LIST* aList,
unsigned aNetItemRef, unsigned aNetStart,
int* aNetNbItems, int* aMinConnexion );
int* aMinConnexion );
/**
* Counts number of pins connected on the same net.
* Used to find all pins conected to a no connect symbol
* @return the pin count of the net starting at aNetStart
* @param aNetStart = index in list of net objects of the first item
* @param aList = a reference to the list of connected objects
*/
int CountPinsInNet( NETLIST_OBJECT_LIST* aList, unsigned aNetStart );
/**
* Function TestLabel