Add a PT_NIC pin electrical type and a netlist token for SCH_NO_CONNECT.

ADDED a new pin electrical type "free" for internally unconnected pins.

CHANGED the "unconnected" pin electrical type is now represented by
"no_connect" in files and netlists.  (The legacy syntax is also accepted
in files.)
This commit is contained in:
Jeff Young 2021-01-22 13:04:43 +00:00
parent 10c6e0bc46
commit 0ba0160da9
17 changed files with 248 additions and 89 deletions

View File

@ -97,6 +97,7 @@ set( BMAPS_SMALL
pintype_poweroutput
pintype_opencoll
pintype_openemit
pintype_nic
pintype_noconnect
small_down
small_edit

View File

@ -0,0 +1,34 @@
/* Do not modify this file, it was automatically generated by the
* PNG2cpp CMake script, using a *.png file as input.
*/
#include <bitmaps_png/bitmaps_list.h>
static const unsigned char png[] = {
0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52,
0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, 0x08, 0x06, 0x00, 0x00, 0x00, 0x1f, 0xf3, 0xff,
0x61, 0x00, 0x00, 0x00, 0x04, 0x73, 0x42, 0x49, 0x54, 0x08, 0x08, 0x08, 0x08, 0x7c, 0x08, 0x64,
0x88, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, 0x73, 0x00, 0x00, 0x09, 0xd8, 0x00, 0x00, 0x09,
0xd8, 0x01, 0xc7, 0xa0, 0xb9, 0xad, 0x00, 0x00, 0x00, 0x19, 0x74, 0x45, 0x58, 0x74, 0x53, 0x6f,
0x66, 0x74, 0x77, 0x61, 0x72, 0x65, 0x00, 0x77, 0x77, 0x77, 0x2e, 0x69, 0x6e, 0x6b, 0x73, 0x63,
0x61, 0x70, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x9b, 0xee, 0x3c, 0x1a, 0x00, 0x00, 0x00, 0x13, 0x74,
0x45, 0x58, 0x74, 0x54, 0x69, 0x74, 0x6c, 0x65, 0x00, 0x70, 0x69, 0x6e, 0x74, 0x79, 0x70, 0x65,
0x5f, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x86, 0x31, 0x28, 0xad, 0x00, 0x00, 0x00, 0x52, 0x74, 0x45,
0x58, 0x74, 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68, 0x74, 0x00, 0x43, 0x43, 0x20, 0x41,
0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x2d, 0x53, 0x68, 0x61, 0x72, 0x65,
0x41, 0x6c, 0x69, 0x6b, 0x65, 0x20, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x63, 0x72, 0x65,
0x61, 0x74, 0x69, 0x76, 0x65, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x73, 0x2e, 0x6f, 0x72, 0x67,
0x2f, 0x6c, 0x69, 0x63, 0x65, 0x6e, 0x73, 0x65, 0x73, 0x2f, 0x62, 0x79, 0x2d, 0x73, 0x61, 0x2f,
0x34, 0x2e, 0x30, 0x2f, 0xc3, 0x54, 0x62, 0x05, 0x00, 0x00, 0x00, 0x50, 0x49, 0x44, 0x41, 0x54,
0x38, 0x8d, 0x63, 0x64, 0x20, 0x13, 0x04, 0x05, 0x05, 0x59, 0x30, 0x31, 0x31, 0xcd, 0x61, 0x22,
0xd7, 0x00, 0x26, 0x26, 0x26, 0x59, 0x06, 0x06, 0x06, 0x6d, 0xb2, 0x0d, 0x80, 0x1b, 0x34, 0x6a,
0x00, 0x03, 0x4b, 0x70, 0x70, 0xf0, 0x04, 0x46, 0x46, 0x46, 0x29, 0x3c, 0x6a, 0x56, 0xaf, 0x59,
0xb3, 0x66, 0x35, 0xed, 0x5c, 0xb0, 0x76, 0xed, 0xda, 0x02, 0x4a, 0x0c, 0x18, 0xf8, 0x40, 0x1c,
0xc9, 0x06, 0xfc, 0xfb, 0xf7, 0xef, 0x31, 0x03, 0x03, 0xc3, 0x55, 0x00, 0xb2, 0xc0, 0x0e, 0x6b,
0x5c, 0x4d, 0xd8, 0x35, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82,
};
const BITMAP_OPAQUE pintype_nic_xpm[1] = {{ png, sizeof( png ), "pintype_nic_xpm" }};
//EOF

View File

@ -381,6 +381,7 @@ EXTERN_BITMAP( pintype_poweroutput_xpm )
EXTERN_BITMAP( pintype_opencoll_xpm )
EXTERN_BITMAP( pintype_openemit_xpm )
EXTERN_BITMAP( pintype_noconnect_xpm )
EXTERN_BITMAP( pintype_nic_xpm )
EXTERN_BITMAP( pin_xpm )
EXTERN_BITMAP( plot_xpm )
EXTERN_BITMAP( polar_coord_xpm )

View File

@ -0,0 +1,97 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
id="Слой_1"
data-name="Слой 1"
viewBox="0 0 24 24"
version="1.1"
sodipodi:docname="pintype_nic.svg"
inkscape:version="0.92.2 5c3e80d, 2017-08-06">
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1609"
inkscape:window-height="1286"
id="namedview30"
showgrid="true"
inkscape:zoom="27.961538"
inkscape:cx="14.920868"
inkscape:cy="9.749987"
inkscape:window-x="0"
inkscape:window-y="37"
inkscape:window-maximized="0"
inkscape:document-rotation="0"
inkscape:current-layer="Слой_1">
<inkscape:grid
type="xygrid"
id="grid_kicad"
spacingx="0.5"
spacingy="0.5"
color="#9999ff"
opacity="0.13"
empspacing="2" />
</sodipodi:namedview>
<metadata
id="metadata43">
<rdf:RDF>
<cc:Work
rdf:about="">
<cc:license
rdf:resource="http://creativecommons.org/licenses/by-sa/4.0/" />
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title>pintype_input</dc:title>
</cc:Work>
<cc:License
rdf:about="http://creativecommons.org/licenses/by-sa/4.0/">
<cc:permits
rdf:resource="http://creativecommons.org/ns#Reproduction" />
<cc:permits
rdf:resource="http://creativecommons.org/ns#Distribution" />
<cc:requires
rdf:resource="http://creativecommons.org/ns#Notice" />
<cc:requires
rdf:resource="http://creativecommons.org/ns#Attribution" />
<cc:permits
rdf:resource="http://creativecommons.org/ns#DerivativeWorks" />
<cc:requires
rdf:resource="http://creativecommons.org/ns#ShareAlike" />
</cc:License>
</rdf:RDF>
</metadata>
<defs
id="defs26367">
<style
id="style26365">.cls-1{fill:none;stroke:#545454;stroke-linecap:round;stroke-linejoin:round;stroke-width:2px;}</style>
</defs>
<title
id="title26369">pintype_input</title>
<line
class="cls-1"
x1="0.98160005"
y1="12"
x2="12"
y2="12"
id="line26373"
style="fill:none;stroke:#545454;stroke-width:2px;stroke-linecap:round;stroke-linejoin:round" />
<line
class="cls-1"
x1="23.0058"
y1="1.0660999"
x2="23.0058"
y2="22.933901"
id="line26375" />
</svg>

After

Width:  |  Height:  |  Size: 3.0 KiB

View File

@ -1487,14 +1487,13 @@ void CONNECTION_GRAPH::buildConnectionGraph()
{
CONNECTION_SUBGRAPH* subgraph = m_driver_subgraphs[subgraphId];
// Make sure weakly-driven single-pin nets get the no_connect_ prefix
// Make sure weakly-driven single-pin nets get the unconnected_ prefix
if( !subgraph->m_strong_driver && subgraph->m_drivers.size() == 1 &&
subgraph->m_driver->Type() == SCH_PIN_T )
{
SCH_PIN* pin = static_cast<SCH_PIN*>( subgraph->m_driver );
wxString name = pin->GetDefaultNetName( subgraph->m_sheet, true );
pin->ClearDefaultNetName( &subgraph->m_sheet );
subgraph->m_driver_connection->ConfigureFromLabel( name );
}
@ -2598,6 +2597,7 @@ bool CONNECTION_GRAPH::ercCheckNoConnects( const CONNECTION_SUBGRAPH* aSubgraph
// Only one pin, and it's not a no-connect pin
if( pin && !has_other_connections
&& pin->GetType() != ELECTRICAL_PINTYPE::PT_NC
&& pin->GetType() != ELECTRICAL_PINTYPE::PT_NIC
&& settings.IsTestEnabled( ERCE_PIN_NOT_CONNECTED ) )
{
std::shared_ptr<ERC_ITEM> ercItem = ERC_ITEM::Create( ERCE_PIN_NOT_CONNECTED );

View File

@ -38,20 +38,21 @@ const int ercSettingsSchemaVersion = 0;
* Default Look up table which gives the ERC error level for a pair of connected pins
*/
PIN_ERROR ERC_SETTINGS::m_defaultPinMap[ELECTRICAL_PINTYPES_TOTAL][ELECTRICAL_PINTYPES_TOTAL] =
{
/* I, O, Bi, 3S, Pas, UnS, PwrI, PwrO, OC, OE, NC */
/* 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, 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 }
};
{
/* I, O, Bi, 3S, Pas, NIC, UnS, PwrI, PwrO, OC, OE, NC */
/* I */ { OK, OK, OK, OK, OK, OK, WAR, OK, OK, OK, OK, ERR },
/* O */ { OK, ERR, OK, WAR, OK, OK, WAR, OK, ERR, ERR, ERR, ERR },
/* Bi */ { OK, OK, OK, OK, OK, OK, WAR, OK, WAR, OK, WAR, ERR },
/* 3S */ { OK, WAR, OK, OK, OK, OK, WAR, WAR, ERR, WAR, WAR, ERR },
/*Pas */ { OK, OK, OK, OK, OK, OK, WAR, OK, OK, OK, OK, ERR },
/*NIC */ { OK, OK, OK, OK, OK, OK, OK, OK, OK, OK, OK, ERR },
/*UnS */ { WAR, WAR, WAR, WAR, WAR, OK, WAR, WAR, WAR, WAR, WAR, ERR },
/*PwrI*/ { OK, OK, OK, WAR, OK, OK, WAR, OK, OK, OK, OK, ERR },
/*PwrO*/ { OK, ERR, WAR, ERR, OK, OK, WAR, OK, ERR, ERR, ERR, ERR },
/* OC */ { OK, ERR, OK, WAR, OK, OK, WAR, OK, ERR, OK, OK, ERR },
/* OE */ { OK, ERR, WAR, WAR, OK, OK, WAR, OK, ERR, OK, OK, ERR },
/* NC */ { ERR, ERR, ERR, ERR, ERR, ERR, ERR, ERR, ERR, ERR, ERR, ERR }
};
/**
@ -65,20 +66,21 @@ PIN_ERROR ERC_SETTINGS::m_defaultPinMap[ELECTRICAL_PINTYPES_TOTAL][ELECTRICAL_PI
* NOD have no valid source signal.
*/
int ERC_SETTINGS::m_PinMinDrive[ELECTRICAL_PINTYPES_TOTAL][ELECTRICAL_PINTYPES_TOTAL] =
{
/* In Out, Bi, 3S, Pas, UnS, PwrI,PwrO,OC, OE, NC */
/* 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 }
};
{
/* I, O, Bi, 3S, Pas, NIC, UnS, PwrI, PwrO, OC, OE, NC */
/* I */ { NOD, DRV, DRV, DRV, DRV, NOD, DRV, NOD, DRV, DRV, DRV, NPI },
/* O */ { DRV, DRV, DRV, DRV, DRV, NOD, DRV, DRV, DRV, DRV, DRV, NPI },
/* Bi */ { DRV, DRV, DRV, DRV, DRV, NOD, DRV, NOD, DRV, DRV, DRV, NPI },
/* 3S */ { DRV, DRV, DRV, DRV, DRV, NOD, DRV, NOD, DRV, DRV, DRV, NPI },
/*Pas */ { DRV, DRV, DRV, DRV, DRV, NOD, DRV, NOD, DRV, DRV, DRV, NPI },
/*NIC */ { NOD, NOD, NOD, NOD, NOD, NOD, NOD, NOD, NOD, NOD, NOD, NPI },
/*UnS */ { DRV, DRV, DRV, DRV, DRV, NOD, DRV, NOD, DRV, DRV, DRV, NPI },
/*PwrI*/ { NOD, DRV, NOD, NOD, NOD, NOD, NOD, NOD, DRV, NOD, NOD, NPI },
/*PwrO*/ { DRV, DRV, DRV, DRV, DRV, NOD, DRV, DRV, DRV, DRV, DRV, NPI },
/* OC */ { DRV, DRV, DRV, DRV, DRV, NOD, DRV, NOD, DRV, DRV, DRV, NPI },
/* OE */ { DRV, DRV, DRV, DRV, DRV, NOD, DRV, NOD, DRV, DRV, DRV, NPI },
/* NC */ { NPI, NPI, NPI, NPI, NPI, NPI, NPI, NPI, NPI, NPI, NPI, NPI }
};
ERC_SETTINGS::ERC_SETTINGS( JSON_SETTINGS* aParent, const std::string& aPath ) :

View File

@ -53,12 +53,13 @@ const wxString LIB_PIN::GetCanonicalElectricalTypeName( ELECTRICAL_PINTYPE aType
wxT( "bidirectional" ),
wxT( "tri_state" ),
wxT( "passive" ),
wxT( "free" ),
wxT( "unspecified" ),
wxT( "power_in" ),
wxT( "power_out" ),
wxT( "open_collector" ),
wxT( "open_emitter" ),
wxT( "unconnected" )
wxT( "no_connect" )
};
return msgPinElectricType[static_cast<int>( aType )];

View File

@ -557,9 +557,6 @@ XNODE* NETLIST_EXPORTER_XML::makeLibParts()
}
#define NC_PREFIX "no_connect_"
XNODE* NETLIST_EXPORTER_XML::makeListOfNets( unsigned aCtl )
{
XNODE* xnets = node( "nets" ); // auto_ptr if exceptions ever get used.
@ -576,8 +573,29 @@ XNODE* NETLIST_EXPORTER_XML::makeListOfNets( unsigned aCtl )
</net>
*/
typedef std::pair<SCH_PIN*, SCH_SHEET_PATH> MEMBER_RECORD;
typedef std::pair<wxString, std::vector<MEMBER_RECORD>> NET_RECORD;
struct NET_NODE
{
NET_NODE( SCH_PIN* aPin, const SCH_SHEET_PATH& aSheet, bool aNoConnect ) :
m_Pin( aPin ),
m_Sheet( aSheet ),
m_NoConnect( aNoConnect )
{}
SCH_PIN* m_Pin;
SCH_SHEET_PATH m_Sheet;
bool m_NoConnect;
};
struct NET_RECORD
{
NET_RECORD( const wxString& aName ) :
m_Name( aName )
{};
wxString m_Name;
std::vector<NET_NODE> m_Nodes;
};
std::vector<NET_RECORD*> nets;
for( const auto& it : m_schematic->ConnectionGraph()->GetNetMap() )
@ -589,11 +607,12 @@ XNODE* NETLIST_EXPORTER_XML::makeListOfNets( unsigned aCtl )
if( subgraphs.empty() )
continue;
nets.push_back( new NET_RECORD( net_name, std::vector<MEMBER_RECORD>() ) );
nets.emplace_back( new NET_RECORD( net_name ) );
net_record = nets.back();
for( CONNECTION_SUBGRAPH* subgraph : subgraphs )
{
bool nc = subgraph->m_no_connect && subgraph->m_no_connect->Type() == SCH_NO_CONNECT_T;
const SCH_SHEET_PATH& sheet = subgraph->m_sheet;
for( SCH_ITEM* item : subgraph->m_items )
@ -610,7 +629,7 @@ XNODE* NETLIST_EXPORTER_XML::makeListOfNets( unsigned aCtl )
continue;
}
net_record->second.emplace_back( pin, sheet );
net_record->m_Nodes.emplace_back( pin, sheet, nc );
}
}
}
@ -620,7 +639,7 @@ XNODE* NETLIST_EXPORTER_XML::makeListOfNets( unsigned aCtl )
std::sort( nets.begin(), nets.end(),
[]( const NET_RECORD* a, const NET_RECORD*b )
{
return StrNumCmp( a->first, b->first ) < 0;
return StrNumCmp( a->m_Name, b->m_Name ) < 0;
} );
for( int i = 0; i < (int) nets.size(); ++i )
@ -630,17 +649,14 @@ XNODE* NETLIST_EXPORTER_XML::makeListOfNets( unsigned aCtl )
XNODE* xnode;
// Netlist ordering: Net name, then ref des, then pin name
std::sort( net_record->second.begin(), net_record->second.end(),
[]( const std::pair<SCH_PIN*, SCH_SHEET_PATH>& a,
const std::pair<SCH_PIN*, SCH_SHEET_PATH>& b )
std::sort( net_record->m_Nodes.begin(), net_record->m_Nodes.end(),
[]( const NET_NODE& a, const NET_NODE& b )
{
SCH_PIN* pinA = a.first;
SCH_PIN* pinB = b.first;
wxString refA = pinA->GetParentSymbol()->GetRef( &a.second );
wxString refB = pinB->GetParentSymbol()->GetRef( &b.second );
wxString refA = a.m_Pin->GetParentSymbol()->GetRef( &a.m_Sheet );
wxString refB = b.m_Pin->GetParentSymbol()->GetRef( &b.m_Sheet );
if( refA == refB )
return pinA->GetNumber() < pinB->GetNumber();
return a.m_Pin->GetNumber() < b.m_Pin->GetNumber();
return refA < refB;
} );
@ -648,27 +664,21 @@ XNODE* NETLIST_EXPORTER_XML::makeListOfNets( unsigned aCtl )
// Some duplicates can exist, for example on multi-unit parts with duplicated
// pins across units. If the user connects the pins on each unit, they will
// appear on separate subgraphs. Remove those here:
net_record->second.erase(
std::unique( net_record->second.begin(), net_record->second.end(),
[]( const std::pair<SCH_PIN*, SCH_SHEET_PATH>& a,
const std::pair<SCH_PIN*, SCH_SHEET_PATH>& b )
{
SCH_PIN* pinA = a.first;
SCH_PIN* pinB = b.first;
wxString refA = pinA->GetParentSymbol()->GetRef( &a.second );
wxString refB = pinB->GetParentSymbol()->GetRef( &b.second );
net_record->m_Nodes.erase(
std::unique( net_record->m_Nodes.begin(), net_record->m_Nodes.end(),
[]( const NET_NODE& a, const NET_NODE& b )
{
wxString refA = a.m_Pin->GetParentSymbol()->GetRef( &a.m_Sheet );
wxString refB = b.m_Pin->GetParentSymbol()->GetRef( &b.m_Sheet );
return refA == refB && pinA->GetNumber() == pinB->GetNumber();
} ),
net_record->second.end() );
return refA == refB && a.m_Pin->GetNumber() == b.m_Pin->GetNumber();
} ),
net_record->m_Nodes.end() );
for( const std::pair<SCH_PIN*, SCH_SHEET_PATH>& pair : net_record->second )
for( const NET_NODE& netNode : net_record->m_Nodes )
{
SCH_PIN* pin = pair.first;
SCH_SHEET_PATH sheet = pair.second;
wxString refText = pin->GetParentSymbol()->GetRef( &sheet );
wxString pinText = pin->GetNumber();
wxString refText = netNode.m_Pin->GetParentSymbol()->GetRef( &netNode.m_Sheet );
wxString pinText = netNode.m_Pin->GetNumber();
// Skip power symbols and virtual components
if( refText[0] == wxChar( '#' ) )
@ -680,7 +690,7 @@ XNODE* NETLIST_EXPORTER_XML::makeListOfNets( unsigned aCtl )
xnets->AddChild( xnet = node( "net" ) );
xnet->AddAttribute( "code", netCodeTxt );
xnet->AddAttribute( "name", net_record->first );
xnet->AddAttribute( "name", net_record->m_Name );
added = true;
}
@ -689,15 +699,17 @@ XNODE* NETLIST_EXPORTER_XML::makeListOfNets( unsigned aCtl )
xnode->AddAttribute( "ref", refText );
xnode->AddAttribute( "pin", pinText );
wxString pinName;
wxString pinName = netNode.m_Pin->GetName();
wxString pinType = netNode.m_Pin->GetCanonicalElectricalTypeName();
if( pin->GetName() != "~" ) // ~ is a char used to code empty strings in libs.
pinName = pin->GetName();
if( !pinName.IsEmpty() )
// ~ is a char used to code empty strings in libs.
if( pinName != "~" && !pinName.IsEmpty() )
xnode->AddAttribute( "pinfunction", pinName );
xnode->AddAttribute( "pintype", pin->GetCanonicalElectricalTypeName() );
if( netNode.m_NoConnect )
pinType += "+no_connect";
xnode->AddAttribute( "pintype", pinType );
}
}

View File

@ -1,7 +1,7 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2004-2020 KiCad Developers, see change_log.txt for contributors.
* Copyright (C) 2004-2021 KiCad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -23,7 +23,6 @@
#include <pin_type.h>
#include <lib_pin.h>
#include <base_units.h>
#include <core/arraydim.h>
@ -45,9 +44,6 @@ struct pinTypeStruct
const BITMAP_OPAQUE* bitmap;
};
/*
* Conversion map between PLOT_DASH_TYPE values and style names displayed
*/
// clang-format off
const std::map<ELECTRICAL_PINTYPE, struct pinTypeStruct> pinTypes = {
{ ELECTRICAL_PINTYPE::PT_INPUT, { _( "Input" ), pintype_input_xpm } },
@ -55,12 +51,13 @@ const std::map<ELECTRICAL_PINTYPE, struct pinTypeStruct> pinTypes = {
{ ELECTRICAL_PINTYPE::PT_BIDI, { _( "Bidirectional" ), pintype_bidi_xpm } },
{ ELECTRICAL_PINTYPE::PT_TRISTATE, { _( "Tri-state" ), pintype_3states_xpm } },
{ ELECTRICAL_PINTYPE::PT_PASSIVE, { _( "Passive" ), pintype_passive_xpm } },
{ ELECTRICAL_PINTYPE::PT_NIC, { _( "Free" ), pintype_nic_xpm } },
{ ELECTRICAL_PINTYPE::PT_UNSPECIFIED, { _( "Unspecified" ), pintype_notspecif_xpm } },
{ ELECTRICAL_PINTYPE::PT_POWER_IN, { _( "Power input" ), pintype_powerinput_xpm } },
{ ELECTRICAL_PINTYPE::PT_POWER_OUT, { _( "Power output" ), pintype_poweroutput_xpm } },
{ ELECTRICAL_PINTYPE::PT_OPENCOLLECTOR,{ _( "Open collector" ), pintype_opencoll_xpm } },
{ ELECTRICAL_PINTYPE::PT_OPENEMITTER, { _( "Open emitter" ), pintype_openemit_xpm } },
{ ELECTRICAL_PINTYPE::PT_NC, { _( "Not connected" ), pintype_noconnect_xpm } },
{ ELECTRICAL_PINTYPE::PT_NC, { _( "Unconnected" ), pintype_noconnect_xpm } },
};
// clang-format on
@ -71,9 +68,7 @@ struct pinShapeStruct
const BITMAP_OPAQUE* bitmap;
};
/*
* Conversion map between PLOT_DASH_TYPE values and style names displayed
*/
// clang-format off
const std::map<GRAPHIC_PINSHAPE, struct pinShapeStruct> pinShapes = {
{ GRAPHIC_PINSHAPE::LINE, { _( "Line" ), pinshape_normal_xpm } },

View File

@ -38,6 +38,7 @@ enum class ELECTRICAL_PINTYPE
PT_BIDI, ///< input or output (like port for a microprocessor)
PT_TRISTATE, ///< tris state bus pin
PT_PASSIVE, ///< pin for passive components: must be connected, and can be connected to any pin
PT_NIC, ///< not internally connected (may be connected to anything)
PT_UNSPECIFIED, ///< unknown electrical properties: creates always a warning when connected
PT_POWER_IN, ///< power input (GND, VCC for ICs). Must be connected to a power output.
PT_POWER_OUT, ///< output of a regulator: intended to be connected to power input pins

View File

@ -249,7 +249,7 @@ wxString SCH_PIN::GetDefaultNetName( const SCH_SHEET_PATH& aPath, bool aForceNoC
wxString name = "Net-(";
if( aForceNoConnect || GetType() == ELECTRICAL_PINTYPE::PT_NC )
name = ( "no_connect_(" );
name = ( "unconnected-(" );
name << GetParentSymbol()->GetRef( &aPath );

View File

@ -1098,12 +1098,14 @@ LIB_PIN* SCH_SEXPR_PARSER::parsePin()
case T_power_out: return ELECTRICAL_PINTYPE::PT_POWER_OUT;
case T_open_collector: return ELECTRICAL_PINTYPE::PT_OPENCOLLECTOR;
case T_open_emitter: return ELECTRICAL_PINTYPE::PT_OPENEMITTER;
case T_unconnected: return ELECTRICAL_PINTYPE::PT_NC;
case T_unconnected:
case T_no_connect: return ELECTRICAL_PINTYPE::PT_NC;
case T_free: return ELECTRICAL_PINTYPE::PT_NIC;
default:
Expecting( "input, output, bidirectional, tri_state, passive, "
"unspecified, power_in, power_out, open_collector, "
"open_emitter, or unconnected" );
"open_emitter, free or noconnect" );
return ELECTRICAL_PINTYPE::PT_UNSPECIFIED;
}
};

View File

@ -111,6 +111,9 @@ static const char* getPinElectricalTypeToken( ELECTRICAL_PINTYPE aType )
case ELECTRICAL_PINTYPE::PT_PASSIVE:
return SCHEMATIC_LEXER::TokenName( T_passive );
case ELECTRICAL_PINTYPE::PT_NIC:
return SCHEMATIC_LEXER::TokenName( T_free );
case ELECTRICAL_PINTYPE::PT_UNSPECIFIED:
return SCHEMATIC_LEXER::TokenName( T_unspecified );
@ -127,7 +130,7 @@ static const char* getPinElectricalTypeToken( ELECTRICAL_PINTYPE aType )
return SCHEMATIC_LEXER::TokenName( T_open_emitter );
case ELECTRICAL_PINTYPE::PT_NC:
return SCHEMATIC_LEXER::TokenName( T_unconnected );
return SCHEMATIC_LEXER::TokenName( T_no_connect );
default:
wxFAIL_MSG( "Missing symbol library pin connection type" );

View File

@ -35,6 +35,7 @@ extends
fill
font
footprint
free
global_label
hide
hierarchical_label

View File

@ -995,9 +995,9 @@ bool DIALOG_NET_INSPECTOR::netFilterMatches( NETINFO_ITEM* aNet ) const
if( aNet->GetNetCode() <= 0 )
return false;
// Show no-connect nets only if specifically asked for by filter
// Show unconnected nets only if specifically asked for by filter
if( m_netFilter.empty() )
return !aNet->GetNetname().StartsWith( "no_connect_" );
return !aNet->GetNetname().StartsWith( "unconnected-(" );
wxString net_str = UnescapeString( aNet->GetNetname() ).Upper();

View File

@ -791,6 +791,12 @@ void PCB_PAINTER::draw( const VIA* aVia, int aLayer )
}
bool isImplicitNet( const wxString& aNetName )
{
return aNetName.StartsWith( wxT( "Net-(" ) ) || aNetName.StartsWith( wxT( "unconnected-(" ) );
}
void PCB_PAINTER::draw( const PAD* aPad, int aLayer )
{
// Draw description layer
@ -860,9 +866,12 @@ void PCB_PAINTER::draw( const PAD* aPad, int aLayer )
if( displayNetname )
{
wxString netname = UnescapeString( aPad->GetShortNetname() );
wxString pinType = aPad->GetPinType();
if( netname.StartsWith( "no_connect_" ) )
if( pinType == wxT( "no_connect" ) || pinType.EndsWith( wxT( "+no_connect" ) ) )
netname = "x";
else if( pinType == wxT( "free" ) && isImplicitNet( netname ) )
netname = "*";
// calculate the size of net name text:
double tsize = 1.5 * padsize.x / netname.Length();

View File

@ -247,7 +247,7 @@ void NET_GRID_TABLE::Rebuild()
{
int netCode = pair.second->GetNetCode();
if( netCode > 0 && !pair.first.StartsWith( "no_connect_" ) )
if( netCode > 0 && !pair.first.StartsWith( "unconnected-(" ) )
{
COLOR4D color = netColors.count( netCode ) ? netColors.at( netCode ) :
COLOR4D::UNSPECIFIED;