Add a warning for hidden power pins.
Fixes https://gitlab.com/kicad/code/kicad/issues/6440
This commit is contained in:
parent
78ba87be8f
commit
b4a9792e23
|
@ -204,7 +204,6 @@ int EE_INSPECTION_TOOL::CheckSymbol( const TOOL_EVENT& aEvent )
|
|||
|
||||
std::vector<wxString> messages;
|
||||
wxString msg;
|
||||
int dup_error = 0;
|
||||
|
||||
for( unsigned ii = 1; ii < pinList.size(); ii++ )
|
||||
{
|
||||
|
@ -223,15 +222,13 @@ int EE_INSPECTION_TOOL::CheckSymbol( const TOOL_EVENT& aEvent )
|
|||
if( next->GetName() != "~" && !next->GetName().IsEmpty() )
|
||||
nextName = " '" + next->GetName() + "'";
|
||||
|
||||
dup_error++;
|
||||
|
||||
if( part->HasConversion() && next->GetConvert() )
|
||||
{
|
||||
if( part->GetUnitCount() <= 1 )
|
||||
{
|
||||
msg.Printf( _( "<b>Duplicate pin %s</b> %s at location <b>(%.3f, %.3f)</b>"
|
||||
" conflicts with pin %s%s at location <b>(%.3f, %.3f)</b>"
|
||||
" of converted" ),
|
||||
" of converted." ),
|
||||
next->GetNumber(),
|
||||
nextName,
|
||||
next->GetPosition().x / 1000.0, -next->GetPosition().y / 1000.0,
|
||||
|
@ -243,7 +240,7 @@ int EE_INSPECTION_TOOL::CheckSymbol( const TOOL_EVENT& aEvent )
|
|||
{
|
||||
msg.Printf( _( "<b>Duplicate pin %s</b> %s at location <b>(%.3f, %.3f)</b>"
|
||||
" conflicts with pin %s%s at location <b>(%.3f, %.3f)</b>"
|
||||
" in units %c and %c of converted" ),
|
||||
" in units %c and %c of converted." ),
|
||||
next->GetNumber(),
|
||||
nextName,
|
||||
next->GetPosition().x / 1000.0, -next->GetPosition().y / 1000.0,
|
||||
|
@ -259,7 +256,7 @@ int EE_INSPECTION_TOOL::CheckSymbol( const TOOL_EVENT& aEvent )
|
|||
if( part->GetUnitCount() <= 1 )
|
||||
{
|
||||
msg.Printf( _( "<b>Duplicate pin %s</b> %s at location <b>(%.3f, %.3f)</b>"
|
||||
" conflicts with pin %s%s at location <b>(%.3f, %.3f)</b>" ),
|
||||
" conflicts with pin %s%s at location <b>(%.3f, %.3f)</b>." ),
|
||||
next->GetNumber(),
|
||||
nextName,
|
||||
next->GetPosition().x / 1000.0, -next->GetPosition().y / 1000.0,
|
||||
|
@ -271,7 +268,7 @@ int EE_INSPECTION_TOOL::CheckSymbol( const TOOL_EVENT& aEvent )
|
|||
{
|
||||
msg.Printf( _( "<b>Duplicate pin %s</b> %s at location <b>(%.3f, %.3f)</b>"
|
||||
" conflicts with pin %s%s at location <b>(%.3f, %.3f)</b>"
|
||||
" in units %c and %c" ),
|
||||
" in units %c and %c." ),
|
||||
next->GetNumber(),
|
||||
nextName,
|
||||
next->GetPosition().x / 1000.0, -next->GetPosition().y / 1000.0,
|
||||
|
@ -283,24 +280,12 @@ int EE_INSPECTION_TOOL::CheckSymbol( const TOOL_EVENT& aEvent )
|
|||
}
|
||||
}
|
||||
|
||||
msg += wxT( ".<br><br>" );
|
||||
msg += wxT( "<br><br>" );
|
||||
messages.push_back( msg );
|
||||
}
|
||||
|
||||
// Test for off grid pins:
|
||||
int offgrid_error = 0;
|
||||
|
||||
for( LIB_PIN* pin : pinList )
|
||||
{
|
||||
if( ( (pin->GetPosition().x % clamped_grid_size) == 0 )
|
||||
&& ( (pin->GetPosition().y % clamped_grid_size) == 0 ) )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// "pin" is off grid here.
|
||||
offgrid_error++;
|
||||
|
||||
wxString pinName = pin->GetName();
|
||||
|
||||
if( pinName.IsEmpty() || pinName == "~" )
|
||||
|
@ -308,12 +293,67 @@ int EE_INSPECTION_TOOL::CheckSymbol( const TOOL_EVENT& aEvent )
|
|||
else
|
||||
pinName = "'" + pinName + "'";
|
||||
|
||||
if( !part->IsPower()
|
||||
&& pin->GetType() == ELECTRICAL_PINTYPE::PT_POWER_IN
|
||||
&& !pin->IsVisible() )
|
||||
{
|
||||
// hidden power pin
|
||||
if( part->HasConversion() && pin->GetConvert() )
|
||||
{
|
||||
if( part->GetUnitCount() <= 1 )
|
||||
{
|
||||
msg.Printf( _( "<b>Hidden power pin %s</b> %s at location <b>(%.3f, %.3f)</b>"
|
||||
" of converted." ),
|
||||
pin->GetNumber(),
|
||||
pinName,
|
||||
pin->GetPosition().x / 1000.0, -pin->GetPosition().y / 1000.0 );
|
||||
}
|
||||
else
|
||||
{
|
||||
msg.Printf( _( "<b>Hidden power pin %s</b> %s at location <b>(%.3f, %.3f)</b>"
|
||||
" in unit %c of converted." ),
|
||||
pin->GetNumber(),
|
||||
pinName,
|
||||
pin->GetPosition().x / 1000.0, -pin->GetPosition().y / 1000.0,
|
||||
'A' + pin->GetUnit() - 1 );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if( part->GetUnitCount() <= 1 )
|
||||
{
|
||||
msg.Printf( _( "<b>Hidden power pin %s</b> %s at location <b>(%.3f, %.3f)</b>." ),
|
||||
pin->GetNumber(),
|
||||
pinName,
|
||||
pin->GetPosition().x / 1000.0, -pin->GetPosition().y / 1000.0 );
|
||||
}
|
||||
else
|
||||
{
|
||||
msg.Printf( _( "<b>Hidden power pin %s</b> %s at location <b>(%.3f, %.3f)</b>"
|
||||
" in unit %c." ),
|
||||
pin->GetNumber(),
|
||||
pinName,
|
||||
pin->GetPosition().x / 1000.0, -pin->GetPosition().y / 1000.0,
|
||||
'A' + pin->GetUnit() - 1 );
|
||||
}
|
||||
}
|
||||
|
||||
msg += wxT( "<br>" );
|
||||
msg += _( "(Hidden power pins will drive their pin names on to any connected nets.)" );
|
||||
msg += wxT( "<br><br>" );
|
||||
messages.push_back( msg );
|
||||
}
|
||||
|
||||
if( ( (pin->GetPosition().x % clamped_grid_size) != 0 )
|
||||
|| ( (pin->GetPosition().y % clamped_grid_size) != 0 ) )
|
||||
{
|
||||
// pin is off grid
|
||||
if( part->HasConversion() && pin->GetConvert() )
|
||||
{
|
||||
if( part->GetUnitCount() <= 1 )
|
||||
{
|
||||
msg.Printf( _( "<b>Off grid pin %s</b> %s at location <b>(%.3f, %.3f)</b>"
|
||||
" of converted" ),
|
||||
" of converted." ),
|
||||
pin->GetNumber(),
|
||||
pinName,
|
||||
pin->GetPosition().x / 1000.0, -pin->GetPosition().y / 1000.0 );
|
||||
|
@ -321,7 +361,7 @@ int EE_INSPECTION_TOOL::CheckSymbol( const TOOL_EVENT& aEvent )
|
|||
else
|
||||
{
|
||||
msg.Printf( _( "<b>Off grid pin %s</b> %s at location <b>(%.3f, %.3f)</b>"
|
||||
" in symbol %c of converted" ),
|
||||
" in unit %c of converted." ),
|
||||
pin->GetNumber(),
|
||||
pinName,
|
||||
pin->GetPosition().x / 1000.0, -pin->GetPosition().y / 1000.0,
|
||||
|
@ -332,7 +372,7 @@ int EE_INSPECTION_TOOL::CheckSymbol( const TOOL_EVENT& aEvent )
|
|||
{
|
||||
if( part->GetUnitCount() <= 1 )
|
||||
{
|
||||
msg.Printf( _( "<b>Off grid pin %s</b>%s at location <b>(%.3f, %.3f)</b>" ),
|
||||
msg.Printf( _( "<b>Off grid pin %s</b> %s at location <b>(%.3f, %.3f)</b>." ),
|
||||
pin->GetNumber(),
|
||||
pinName,
|
||||
pin->GetPosition().x / 1000.0, -pin->GetPosition().y / 1000.0 );
|
||||
|
@ -340,7 +380,7 @@ int EE_INSPECTION_TOOL::CheckSymbol( const TOOL_EVENT& aEvent )
|
|||
else
|
||||
{
|
||||
msg.Printf( _( "<b>Off grid pin %s</b> %s at location <b>(%.3f, %.3f)</b>"
|
||||
" in symbol %c" ),
|
||||
" in unit %c." ),
|
||||
pin->GetNumber(),
|
||||
pinName,
|
||||
pin->GetPosition().x / 1000.0, -pin->GetPosition().y / 1000.0,
|
||||
|
@ -348,12 +388,15 @@ int EE_INSPECTION_TOOL::CheckSymbol( const TOOL_EVENT& aEvent )
|
|||
}
|
||||
}
|
||||
|
||||
msg += wxT( ".<br><br>" );
|
||||
msg += wxT( "<br><br>" );
|
||||
messages.push_back( msg );
|
||||
}
|
||||
}
|
||||
|
||||
if( !dup_error && !offgrid_error )
|
||||
DisplayInfoMessage( m_frame, _( "No off grid or duplicate pins were found." ) );
|
||||
if( messages.empty() )
|
||||
{
|
||||
DisplayInfoMessage( m_frame, _( "No symbol issues found." ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
wxColour bgcolor = wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW );
|
||||
|
|
Loading…
Reference in New Issue