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;
|
std::vector<wxString> messages;
|
||||||
wxString msg;
|
wxString msg;
|
||||||
int dup_error = 0;
|
|
||||||
|
|
||||||
for( unsigned ii = 1; ii < pinList.size(); ii++ )
|
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() )
|
if( next->GetName() != "~" && !next->GetName().IsEmpty() )
|
||||||
nextName = " '" + next->GetName() + "'";
|
nextName = " '" + next->GetName() + "'";
|
||||||
|
|
||||||
dup_error++;
|
|
||||||
|
|
||||||
if( part->HasConversion() && next->GetConvert() )
|
if( part->HasConversion() && next->GetConvert() )
|
||||||
{
|
{
|
||||||
if( part->GetUnitCount() <= 1 )
|
if( part->GetUnitCount() <= 1 )
|
||||||
{
|
{
|
||||||
msg.Printf( _( "<b>Duplicate pin %s</b>%s at location <b>(%.3f, %.3f)</b>"
|
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>"
|
||||||
" of converted" ),
|
" of converted." ),
|
||||||
next->GetNumber(),
|
next->GetNumber(),
|
||||||
nextName,
|
nextName,
|
||||||
next->GetPosition().x / 1000.0, -next->GetPosition().y / 1000.0,
|
next->GetPosition().x / 1000.0, -next->GetPosition().y / 1000.0,
|
||||||
|
@ -241,9 +238,9 @@ int EE_INSPECTION_TOOL::CheckSymbol( const TOOL_EVENT& aEvent )
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
msg.Printf( _( "<b>Duplicate pin %s</b>%s at location <b>(%.3f, %.3f)</b>"
|
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>"
|
||||||
" in units %c and %c of converted" ),
|
" in units %c and %c of converted." ),
|
||||||
next->GetNumber(),
|
next->GetNumber(),
|
||||||
nextName,
|
nextName,
|
||||||
next->GetPosition().x / 1000.0, -next->GetPosition().y / 1000.0,
|
next->GetPosition().x / 1000.0, -next->GetPosition().y / 1000.0,
|
||||||
|
@ -258,8 +255,8 @@ int EE_INSPECTION_TOOL::CheckSymbol( const TOOL_EVENT& aEvent )
|
||||||
{
|
{
|
||||||
if( part->GetUnitCount() <= 1 )
|
if( part->GetUnitCount() <= 1 )
|
||||||
{
|
{
|
||||||
msg.Printf( _( "<b>Duplicate pin %s</b>%s at location <b>(%.3f, %.3f)</b>"
|
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(),
|
next->GetNumber(),
|
||||||
nextName,
|
nextName,
|
||||||
next->GetPosition().x / 1000.0, -next->GetPosition().y / 1000.0,
|
next->GetPosition().x / 1000.0, -next->GetPosition().y / 1000.0,
|
||||||
|
@ -269,9 +266,9 @@ int EE_INSPECTION_TOOL::CheckSymbol( const TOOL_EVENT& aEvent )
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
msg.Printf( _( "<b>Duplicate pin %s</b>%s at location <b>(%.3f, %.3f)</b>"
|
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>"
|
||||||
" in units %c and %c" ),
|
" in units %c and %c." ),
|
||||||
next->GetNumber(),
|
next->GetNumber(),
|
||||||
nextName,
|
nextName,
|
||||||
next->GetPosition().x / 1000.0, -next->GetPosition().y / 1000.0,
|
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 );
|
messages.push_back( msg );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test for off grid pins:
|
|
||||||
int offgrid_error = 0;
|
|
||||||
|
|
||||||
for( LIB_PIN* pin : pinList )
|
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();
|
wxString pinName = pin->GetName();
|
||||||
|
|
||||||
if( pinName.IsEmpty() || pinName == "~" )
|
if( pinName.IsEmpty() || pinName == "~" )
|
||||||
|
@ -308,52 +293,110 @@ int EE_INSPECTION_TOOL::CheckSymbol( const TOOL_EVENT& aEvent )
|
||||||
else
|
else
|
||||||
pinName = "'" + pinName + "'";
|
pinName = "'" + pinName + "'";
|
||||||
|
|
||||||
if( part->HasConversion() && pin->GetConvert() )
|
if( !part->IsPower()
|
||||||
|
&& pin->GetType() == ELECTRICAL_PINTYPE::PT_POWER_IN
|
||||||
|
&& !pin->IsVisible() )
|
||||||
{
|
{
|
||||||
if( part->GetUnitCount() <= 1 )
|
// hidden power pin
|
||||||
|
if( part->HasConversion() && pin->GetConvert() )
|
||||||
{
|
{
|
||||||
msg.Printf( _( "<b>Off grid pin %s</b>%s at location <b>(%.3f, %.3f)</b>"
|
if( part->GetUnitCount() <= 1 )
|
||||||
" of converted" ),
|
{
|
||||||
pin->GetNumber(),
|
msg.Printf( _( "<b>Hidden power pin %s</b> %s at location <b>(%.3f, %.3f)</b>"
|
||||||
pinName,
|
" of converted." ),
|
||||||
pin->GetPosition().x / 1000.0, -pin->GetPosition().y / 1000.0 );
|
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
|
else
|
||||||
{
|
{
|
||||||
msg.Printf( _( "<b>Off grid pin %s</b>%s at location <b>(%.3f, %.3f)</b>"
|
if( part->GetUnitCount() <= 1 )
|
||||||
" in symbol %c of converted" ),
|
{
|
||||||
pin->GetNumber(),
|
msg.Printf( _( "<b>Hidden power pin %s</b> %s at location <b>(%.3f, %.3f)</b>." ),
|
||||||
pinName,
|
pin->GetNumber(),
|
||||||
pin->GetPosition().x / 1000.0, -pin->GetPosition().y / 1000.0,
|
pinName,
|
||||||
'A' + pin->GetUnit() - 1 );
|
pin->GetPosition().x / 1000.0, -pin->GetPosition().y / 1000.0 );
|
||||||
}
|
}
|
||||||
}
|
else
|
||||||
else
|
{
|
||||||
{
|
msg.Printf( _( "<b>Hidden power pin %s</b> %s at location <b>(%.3f, %.3f)</b>"
|
||||||
if( part->GetUnitCount() <= 1 )
|
" in unit %c." ),
|
||||||
{
|
pin->GetNumber(),
|
||||||
msg.Printf( _( "<b>Off grid pin %s</b>%s at location <b>(%.3f, %.3f)</b>" ),
|
pinName,
|
||||||
pin->GetNumber(),
|
pin->GetPosition().x / 1000.0, -pin->GetPosition().y / 1000.0,
|
||||||
pinName,
|
'A' + pin->GetUnit() - 1 );
|
||||||
pin->GetPosition().x / 1000.0, -pin->GetPosition().y / 1000.0 );
|
}
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
msg.Printf( _( "<b>Off grid pin %s</b>%s at location <b>(%.3f, %.3f)</b>"
|
|
||||||
" in symbol %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 );
|
||||||
}
|
}
|
||||||
|
|
||||||
msg += wxT( ".<br><br>" );
|
if( ( (pin->GetPosition().x % clamped_grid_size) != 0 )
|
||||||
messages.push_back( msg );
|
|| ( (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." ),
|
||||||
|
pin->GetNumber(),
|
||||||
|
pinName,
|
||||||
|
pin->GetPosition().x / 1000.0, -pin->GetPosition().y / 1000.0 );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
msg.Printf( _( "<b>Off grid 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>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 );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
msg.Printf( _( "<b>Off grid 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><br>" );
|
||||||
|
messages.push_back( msg );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !dup_error && !offgrid_error )
|
if( messages.empty() )
|
||||||
DisplayInfoMessage( m_frame, _( "No off grid or duplicate pins were found." ) );
|
{
|
||||||
|
DisplayInfoMessage( m_frame, _( "No symbol issues found." ) );
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
wxColour bgcolor = wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW );
|
wxColour bgcolor = wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW );
|
||||||
|
|
Loading…
Reference in New Issue