Fixed bug 664795 (not connected electrical pin type)

This commit is contained in:
jean-pierre charras 2010-10-22 09:52:55 +02:00
commit 62916eb28f
3 changed files with 971 additions and 946 deletions

View File

@ -150,6 +150,7 @@ const wxChar* MsgPinElectricType[] =
wxT( "power_out" ),
wxT( "openCol" ),
wxT( "openEm" ),
wxT( "NotConnected" ),
wxT( "?????" )
};
@ -602,6 +603,10 @@ bool LIB_PIN::Save( FILE* ExportFile )
case PIN_OPENEMITTER:
Etype = 'E';
break;
case PIN_NC:
Etype = 'N';
break;
}
ReturnPinStringNum( StringPinNum );
@ -728,6 +733,10 @@ bool LIB_PIN::Load( char* line, wxString& errorMsg )
m_PinType = PIN_OPENEMITTER;
break;
case 'N':
m_PinType = PIN_NC;
break;
default:
errorMsg.Printf( wxT( "unknown pin type [%c]" ), *pinType & 255 );
return false;
@ -1034,16 +1043,26 @@ void LIB_PIN::DrawPinSymbol( WinEDA_DrawPanel* aPanel,
}
/* Draw the pin end target (active end of the pin)
* Draw but do not print the pin end target 1 pixel width
*/
if( !screen->m_IsPrinting )
#define NCSYMB_PIN_DIM TARGET_PIN_DIAM
if( m_PinType == PIN_NC ) // Draw a N.C. symbol
{
GRLine( &aPanel->m_ClipBox, aDC,
posX-NCSYMB_PIN_DIM, posY-NCSYMB_PIN_DIM,
posX+NCSYMB_PIN_DIM, posY+NCSYMB_PIN_DIM,
width, color);
GRLine( &aPanel->m_ClipBox, aDC,
posX+NCSYMB_PIN_DIM, posY-NCSYMB_PIN_DIM,
posX-NCSYMB_PIN_DIM, posY+NCSYMB_PIN_DIM,
width, color);
}
/* Draw but do not print the pin end target 1 pixel width
*/
else if( !screen->m_IsPrinting )
GRCircle( &aPanel->m_ClipBox,
aDC,
posX,
posY,
aDC, posX, posY,
TARGET_PIN_DIAM,
0,
color );
0, color );
}

File diff suppressed because it is too large Load Diff

View File

@ -120,36 +120,40 @@ bool DiagErcTableInit; // go to TRUE after DiagErc init
/* Default Look up table which gives the diag for a pair of connected pins
* Same as DiagErc, but cannot be modified
* Used to init or reset DiagErc
* note also, to avoid inconsistancy:
* DefaultDiagErc[i][j] = DefaultDiagErc[j][i]
*/
int DefaultDiagErc[PIN_NMAX][PIN_NMAX] =
{
/* I, O, Bi, 3S, Pas, UnS, PwrI, PwrO, OC, OE, NC */
/* I */ { OK, OK, OK, OK, OK, WAR, OK, OK, OK, OK, WAR },
/* O */ { OK, ERR, OK, WAR, OK, WAR, OK, ERR, ERR, ERR, WAR },
/* Bi*/ { OK, OK, OK, OK, OK, WAR, OK, WAR, OK, WAR, WAR },
/* 3S*/ { OK, WAR, OK, OK, OK, WAR, WAR, ERR, WAR, WAR, WAR },
/*Pas*/ { OK, OK, OK, OK, OK, WAR, OK, OK, OK, OK, WAR },
/*UnS */ { WAR, WAR, WAR, WAR, WAR, WAR, WAR, WAR, WAR, WAR, WAR },
/* I */ { OK, OK, OK, OK, OK, WAR, OK, OK, OK, OK, ERR },
/* O */ { OK, ERR, OK, WAR, OK, WAR, OK, ERR, ERR, ERR, ERR },
/* Bi*/ { OK, OK, OK, OK, OK, WAR, OK, WAR, OK, WAR, ERR },
/* 3S*/ { OK, WAR, OK, OK, OK, WAR, WAR, ERR, WAR, WAR, ERR },
/*Pas*/ { OK, OK, OK, OK, OK, WAR, OK, OK, OK, OK, ERR },
/*UnS */ { WAR, WAR, WAR, WAR, WAR, WAR, WAR, WAR, WAR, WAR, ERR },
/*PwrI*/ { OK, OK, OK, WAR, OK, WAR, OK, OK, OK, OK, ERR },
/*PwrO*/ { OK, ERR, WAR, ERR, OK, WAR, OK, ERR, ERR, ERR, WAR },
/* OC */ { OK, ERR, OK, WAR, OK, WAR, OK, ERR, OK, OK, WAR },
/* OE */ { OK, ERR, WAR, WAR, OK, WAR, OK, ERR, OK, OK, WAR },
/* NC */ { WAR, WAR, WAR, WAR, WAR, WAR, WAR, WAR, WAR, WAR, WAR }
/*PwrO*/ { OK, ERR, WAR, ERR, OK, WAR, OK, ERR, ERR, ERR, ERR },
/* OC */ { OK, ERR, OK, WAR, OK, WAR, OK, ERR, OK, OK, ERR },
/* OE */ { OK, ERR, WAR, WAR, OK, WAR, OK, ERR, OK, OK, ERR },
/* NC */ { ERR, ERR, ERR, ERR, ERR, ERR, ERR, ERR, ERR, ERR, ERR }
};
/* Minimal connection table */
#define NPI 4 /* Net with Pin isolated, but this pin has type Not Connected, and must be left N.C. */
#define DRV 3 /* Net driven by a signal (a pin output for instance) */
#define NET_NC 2 /* Net "connected" to a "NoConnect symbol" */
#define NOD 1 /* Net not driven ( Such as 2 or more connected inputs )*/
#define NOC 0 /* Pin isolated, no connection */
#define NOC 0 /* initial state of a net: no connection */
/* Look up table which gives the minimal drive for a pair of connected pins on
* a net
* Initial state of a net is NOC (No Connection)
* Can be updated to NET_NC, or NOD (Not Driven) or DRV (DRIven)
* Initial state of a net is NOC (Net with No Connection)
* Can be updated to NPI (Pin Isolated), NET_NC (Net with a no connect symbol),
* NOD (Not Driven) or DRV (DRIven)
*
* Can be updated to NET_NC only if the previous state is NOC
* Can be updated to NET_NC with no error only if there is only one pin in net
*
* Nets are OK when their final state is NET_NC or DRV
* Nets with the state NOD have no source signal
@ -157,17 +161,17 @@ int DefaultDiagErc[PIN_NMAX][PIN_NMAX] =
static int MinimalReq[PIN_NMAX][PIN_NMAX] =
{
/* In Out, Bi, 3S, Pas, UnS, PwrI,PwrO,OC, OE, NC */
/* In*/ { NOD, DRV, DRV, DRV, DRV, DRV, NOD, DRV, DRV, DRV, NOC },
/*Out*/ { DRV, DRV, DRV, DRV, DRV, DRV, DRV, DRV, DRV, DRV, NOC },
/* Bi*/ { DRV, DRV, DRV, DRV, DRV, DRV, NOD, DRV, DRV, DRV, NOC },
/* 3S*/ { DRV, DRV, DRV, DRV, DRV, DRV, NOD, DRV, DRV, DRV, NOC },
/*Pas*/ { DRV, DRV, DRV, DRV, DRV, DRV, NOD, DRV, DRV, DRV, NOC },
/*UnS*/ { DRV, DRV, DRV, DRV, DRV, DRV, NOD, DRV, DRV, DRV, NOC },
/*PwrI*/ { NOD, DRV, NOD, NOD, NOD, NOD, NOD, DRV, NOD, NOD, NOC },
/*PwrO*/ { DRV, DRV, DRV, DRV, DRV, DRV, DRV, DRV, DRV, DRV, NOC },
/* OC*/ { DRV, DRV, DRV, DRV, DRV, DRV, NOD, DRV, DRV, DRV, NOC },
/* OE*/ { DRV, DRV, DRV, DRV, DRV, DRV, NOD, DRV, DRV, DRV, NOC },
/* NC*/ { NOC, NOC, NOC, NOC, NOC, NOC, NOC, NOC, NOC, NOC, NOC }
/* In*/ { NOD, DRV, DRV, DRV, DRV, DRV, NOD, DRV, DRV, DRV, NPI },
/*Out*/ { DRV, DRV, DRV, DRV, DRV, DRV, DRV, DRV, DRV, DRV, NPI },
/* Bi*/ { DRV, DRV, DRV, DRV, DRV, DRV, NOD, DRV, DRV, DRV, NPI },
/* 3S*/ { DRV, DRV, DRV, DRV, DRV, DRV, NOD, DRV, DRV, DRV, NPI },
/*Pas*/ { DRV, DRV, DRV, DRV, DRV, DRV, NOD, DRV, DRV, DRV, NPI },
/*UnS*/ { DRV, DRV, DRV, DRV, DRV, DRV, NOD, DRV, DRV, DRV, NPI },
/*PwrI*/ { NOD, DRV, NOD, NOD, NOD, NOD, NOD, DRV, NOD, NOD, NPI },
/*PwrO*/ { DRV, DRV, DRV, DRV, DRV, DRV, DRV, DRV, DRV, DRV, NPI },
/* OC*/ { DRV, DRV, DRV, DRV, DRV, DRV, NOD, DRV, DRV, DRV, NPI },
/* OE*/ { DRV, DRV, DRV, DRV, DRV, DRV, NOD, DRV, DRV, DRV, NPI },
/* NC*/ { NPI, NPI, NPI, NPI, NPI, NPI, NPI, NPI, NPI, NPI, NPI }
};
@ -303,7 +307,7 @@ void DIALOG_ERC::TestErc( wxArrayString* aMessagesList )
{
if( g_NetObjectslist[OldItem]->GetNet() !=
g_NetObjectslist[NetItemRef]->GetNet() )
{
{ // New ne found:
MinConn = NOC;
NetNbItems = 0;
StartNet = NetItemRef;
@ -550,6 +554,8 @@ static void TestOthersItems( WinEDA_DrawPanel* panel,
NetItemTst = netstart;
local_minconn = NOC;
if( ref_elect_type == PIN_NC )
local_minconn = NPI;
/* Test pins connected to NetItemRef */
for( ; ; NetItemTst++ )