Generate NC-pin errors when connected to other items.
Also removes the NC row in the pin map as it hasn't been used since 6.0 (see #1826). Fixes https://gitlab.com/kicad/code/kicad/-/issues/15558
This commit is contained in:
parent
0cde8cff1d
commit
9999ac5662
|
@ -42,9 +42,12 @@
|
|||
#define ID_MATRIX_0 1800
|
||||
|
||||
|
||||
// NC is not included in the pin map as it generates errors separately
|
||||
#define PINMAP_TYPE_COUNT ( ELECTRICAL_PINTYPES_TOTAL - 1 )
|
||||
|
||||
|
||||
BEGIN_EVENT_TABLE( PANEL_SETUP_PINMAP, PANEL_SETUP_PINMAP_BASE )
|
||||
EVT_COMMAND_RANGE( ID_MATRIX_0,
|
||||
ID_MATRIX_0 + ( ELECTRICAL_PINTYPES_TOTAL * ELECTRICAL_PINTYPES_TOTAL ) - 1,
|
||||
EVT_COMMAND_RANGE( ID_MATRIX_0, ID_MATRIX_0 + ( PINMAP_TYPE_COUNT * PINMAP_TYPE_COUNT ) - 1,
|
||||
wxEVT_COMMAND_BUTTON_CLICKED, PANEL_SETUP_PINMAP::changeErrorLevel )
|
||||
END_EVENT_TABLE()
|
||||
|
||||
|
@ -66,7 +69,7 @@ PANEL_SETUP_PINMAP::~PANEL_SETUP_PINMAP()
|
|||
#ifndef __WXMAC__
|
||||
if( m_initialized )
|
||||
{
|
||||
for( int ii = 0; ii < ELECTRICAL_PINTYPES_TOTAL; ii++ )
|
||||
for( int ii = 0; ii < PINMAP_TYPE_COUNT; ii++ )
|
||||
{
|
||||
for( int jj = 0; jj <= ii; jj++ )
|
||||
{
|
||||
|
@ -129,7 +132,7 @@ void PANEL_SETUP_PINMAP::reBuildMatrixPanel()
|
|||
std::vector<wxStaticText*> labels;
|
||||
|
||||
// Print row labels
|
||||
for( int ii = 0; ii < ELECTRICAL_PINTYPES_TOTAL; ii++ )
|
||||
for( int ii = 0; ii < PINMAP_TYPE_COUNT; ii++ )
|
||||
{
|
||||
int y = pos.y + ( ii * ( bitmapSize.y + text_padding.y ) );
|
||||
text = new wxStaticText( m_matrixPanel, - 1, CommentERC_H[ii],
|
||||
|
@ -141,7 +144,7 @@ void PANEL_SETUP_PINMAP::reBuildMatrixPanel()
|
|||
}
|
||||
|
||||
// Right-align
|
||||
for( int ii = 0; ii < ELECTRICAL_PINTYPES_TOTAL; ii++ )
|
||||
for( int ii = 0; ii < PINMAP_TYPE_COUNT; ii++ )
|
||||
{
|
||||
wxPoint labelPos = labels[ ii ]->GetPosition();
|
||||
labelPos.x = pos.x - labels[ ii ]->GetRect().GetWidth();
|
||||
|
@ -156,7 +159,7 @@ void PANEL_SETUP_PINMAP::reBuildMatrixPanel()
|
|||
pos = m_buttonList[0][0]->GetPosition();
|
||||
}
|
||||
|
||||
for( int ii = 0; ii < ELECTRICAL_PINTYPES_TOTAL; ii++ )
|
||||
for( int ii = 0; ii < PINMAP_TYPE_COUNT; ii++ )
|
||||
{
|
||||
int y = pos.y + (ii * ( bitmapSize.y + text_padding.y ) );
|
||||
|
||||
|
@ -178,7 +181,7 @@ void PANEL_SETUP_PINMAP::reBuildMatrixPanel()
|
|||
new wxStaticText( m_matrixPanel, wxID_ANY, "|", calloutPos );
|
||||
}
|
||||
|
||||
int id = ID_MATRIX_0 + ii + ( jj * ELECTRICAL_PINTYPES_TOTAL );
|
||||
int id = ID_MATRIX_0 + ii + ( jj * PINMAP_TYPE_COUNT );
|
||||
BITMAPS bitmap_butt = BITMAPS::erc_green;
|
||||
|
||||
#ifdef __WXMAC__
|
||||
|
@ -250,8 +253,8 @@ void PANEL_SETUP_PINMAP::changeErrorLevel( wxCommandEvent& event )
|
|||
{
|
||||
int id = event.GetId();
|
||||
int ii = id - ID_MATRIX_0;
|
||||
ELECTRICAL_PINTYPE x = static_cast<ELECTRICAL_PINTYPE>( ii / ELECTRICAL_PINTYPES_TOTAL );
|
||||
ELECTRICAL_PINTYPE y = static_cast<ELECTRICAL_PINTYPE>( ii % ELECTRICAL_PINTYPES_TOTAL );
|
||||
ELECTRICAL_PINTYPE x = static_cast<ELECTRICAL_PINTYPE>( ii / PINMAP_TYPE_COUNT );
|
||||
ELECTRICAL_PINTYPE y = static_cast<ELECTRICAL_PINTYPE>( ii % PINMAP_TYPE_COUNT );
|
||||
wxWindow* butt = static_cast<wxWindow*>( event.GetEventObject() );
|
||||
|
||||
int level = static_cast<int>( m_schematic->ErcSettings().GetPinMapValue( y, x ) );
|
||||
|
@ -266,7 +269,7 @@ void PANEL_SETUP_PINMAP::changeErrorLevel( wxCommandEvent& event )
|
|||
|
||||
void PANEL_SETUP_PINMAP::ImportSettingsFrom( PIN_ERROR aPinMap[][ELECTRICAL_PINTYPES_TOTAL] )
|
||||
{
|
||||
for( int ii = 0; ii < ELECTRICAL_PINTYPES_TOTAL; ii++ )
|
||||
for( int ii = 0; ii < PINMAP_TYPE_COUNT; ii++ )
|
||||
{
|
||||
for( int jj = 0; jj <= ii; jj++ )
|
||||
setDRCMatrixButtonState( m_buttonList[ii][jj], aPinMap[ii][jj] );
|
||||
|
|
|
@ -18,12 +18,12 @@ PANEL_SETUP_PINMAP_BASE::PANEL_SETUP_PINMAP_BASE( wxWindow* parent, wxWindowID i
|
|||
m_panelMatrixSizer = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_matrixPanel = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
|
||||
m_matrixPanel->SetMinSize( wxSize( 500,444 ) );
|
||||
m_matrixPanel->SetMinSize( wxSize( 500,424 ) );
|
||||
|
||||
m_panelMatrixSizer->Add( m_matrixPanel, 1, wxEXPAND | wxALL, 5 );
|
||||
|
||||
|
||||
bSizer2->Add( m_panelMatrixSizer, 1, wxEXPAND, 10 );
|
||||
bSizer2->Add( m_panelMatrixSizer, 1, wxEXPAND|wxTOP, 5 );
|
||||
|
||||
|
||||
this->SetSizer( bSizer2 );
|
||||
|
|
|
@ -58,8 +58,8 @@
|
|||
<property name="orient">wxHORIZONTAL</property>
|
||||
<property name="permission">none</property>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">10</property>
|
||||
<property name="flag">wxEXPAND</property>
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND|wxTOP</property>
|
||||
<property name="proportion">1</property>
|
||||
<object class="wxBoxSizer" expanded="1">
|
||||
<property name="minimum_size"></property>
|
||||
|
@ -103,7 +103,7 @@
|
|||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size">500,444</property>
|
||||
<property name="minimum_size">500,424</property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_matrixPanel</property>
|
||||
<property name="pane_border">1</property>
|
||||
|
|
|
@ -552,7 +552,14 @@ int ERC_TESTER::TestNoConnectPins()
|
|||
|
||||
for( const SCH_SHEET_PATH& sheet : m_schematic->GetSheets() )
|
||||
{
|
||||
std::map<VECTOR2I, std::vector<SCH_PIN*>> pinMap;
|
||||
std::map<VECTOR2I, std::vector<SCH_ITEM*>> pinMap;
|
||||
|
||||
auto addOther =
|
||||
[&]( const VECTOR2I& pt, SCH_ITEM* aOther )
|
||||
{
|
||||
if( pinMap.count( pt ) )
|
||||
pinMap[pt].emplace_back( aOther );
|
||||
};
|
||||
|
||||
for( SCH_ITEM* item : sheet.LastScreen()->Items().OfType( SCH_SYMBOL_T ) )
|
||||
{
|
||||
|
@ -565,7 +572,26 @@ int ERC_TESTER::TestNoConnectPins()
|
|||
}
|
||||
}
|
||||
|
||||
for( const std::pair<const VECTOR2I, std::vector<SCH_PIN*>>& pair : pinMap )
|
||||
for( SCH_ITEM* item : sheet.LastScreen()->Items() )
|
||||
{
|
||||
if( item->Type() == SCH_SYMBOL_T )
|
||||
{
|
||||
SCH_SYMBOL* symbol = static_cast<SCH_SYMBOL*>( item );
|
||||
|
||||
for( SCH_PIN* pin : symbol->GetPins( &sheet ) )
|
||||
{
|
||||
if( pin->GetLibPin()->GetType() != ELECTRICAL_PINTYPE::PT_NC )
|
||||
addOther( pin->GetPosition(), pin );
|
||||
}
|
||||
}
|
||||
else if( item->IsConnectable() )
|
||||
{
|
||||
for( const VECTOR2I& pt : item->GetConnectionPoints() )
|
||||
addOther( pt, item );
|
||||
}
|
||||
}
|
||||
|
||||
for( const std::pair<const VECTOR2I, std::vector<SCH_ITEM*>>& pair : pinMap )
|
||||
{
|
||||
if( pair.second.size() > 1 )
|
||||
{
|
||||
|
@ -576,7 +602,7 @@ int ERC_TESTER::TestNoConnectPins()
|
|||
ercItem->SetItems( pair.second[0], pair.second[1],
|
||||
pair.second.size() > 2 ? pair.second[2] : nullptr,
|
||||
pair.second.size() > 3 ? pair.second[3] : nullptr );
|
||||
ercItem->SetErrorMessage( _( "Pins with 'no connection' type are connected" ) );
|
||||
ercItem->SetErrorMessage( _( "Pin with 'no connection' type is connected" ) );
|
||||
|
||||
SCH_MARKER* marker = new SCH_MARKER( ercItem, pair.first );
|
||||
sheet.LastScreen()->Append( marker );
|
||||
|
|
Loading…
Reference in New Issue