Prevent unannotated components from driving connectivity
Fixes: lp:1829301 * https://bugs.launchpad.net/kicad/+bug/1829301
This commit is contained in:
parent
cc290715a2
commit
9d56102210
|
@ -724,6 +724,29 @@ void SCH_COMPONENT::SetRef( const SCH_SHEET_PATH* sheet, const wxString& ref )
|
|||
}
|
||||
|
||||
|
||||
bool SCH_COMPONENT::IsAnnotated( const SCH_SHEET_PATH* aSheet )
|
||||
{
|
||||
wxString path = GetPath( aSheet );
|
||||
wxString h_path;
|
||||
wxStringTokenizer tokenizer;
|
||||
wxString separators( wxT( " " ) );
|
||||
|
||||
for( unsigned ii = 0; ii < m_PathsAndReferences.GetCount(); ii++ )
|
||||
{
|
||||
tokenizer.SetString( m_PathsAndReferences[ii], separators );
|
||||
h_path = tokenizer.GetNextToken();
|
||||
|
||||
if( h_path.Cmp( path ) == 0 )
|
||||
{
|
||||
wxString ref = tokenizer.GetNextToken();
|
||||
return ref.Last() != '?';
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
void SCH_COMPONENT::SetTimeStamp( timestamp_t aNewTimeStamp )
|
||||
{
|
||||
wxString string_timestamp, string_oldtimestamp;
|
||||
|
|
|
@ -506,6 +506,13 @@ public:
|
|||
*/
|
||||
void SetRef( const SCH_SHEET_PATH* aSheet, const wxString& aReference );
|
||||
|
||||
/**
|
||||
* Checks if the component has a valid annotation (reference) for the given sheet path
|
||||
* @param aSheet is the sheet path to test
|
||||
* @return true if the component exists on that sheet and has a valid reference
|
||||
*/
|
||||
bool IsAnnotated( const SCH_SHEET_PATH* aSheet );
|
||||
|
||||
/**
|
||||
* Add a full hierarchical reference to this symbol.
|
||||
*
|
||||
|
|
|
@ -23,6 +23,8 @@
|
|||
|
||||
#include <advanced_config.h>
|
||||
#include <connection_graph.h>
|
||||
#include <sch_component.h>
|
||||
#include <sch_pin.h>
|
||||
#include <sch_screen.h>
|
||||
|
||||
#include <sch_connection.h>
|
||||
|
@ -234,12 +236,19 @@ bool SCH_CONNECTION::IsDriver() const
|
|||
case SCH_LABEL_T:
|
||||
case SCH_GLOBAL_LABEL_T:
|
||||
case SCH_HIER_LABEL_T:
|
||||
case SCH_PIN_T:
|
||||
case SCH_SHEET_PIN_T:
|
||||
case SCH_SHEET_T:
|
||||
case LIB_PIN_T:
|
||||
return true;
|
||||
|
||||
case SCH_PIN_T:
|
||||
{
|
||||
auto pin = static_cast<SCH_PIN*>( Parent() );
|
||||
|
||||
// Only annotated components should drive nets
|
||||
return pin->GetParentComponent()->IsAnnotated( &m_sheet );
|
||||
}
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -89,13 +89,19 @@ wxString SCH_PIN::GetDefaultNetName( const SCH_SHEET_PATH aPath )
|
|||
|
||||
name << GetParentComponent()->GetRef( &aPath );
|
||||
|
||||
// TODO(JE) do we need adoptTimestamp?
|
||||
if( /* adoptTimestamp && */ name.Last() == '?' )
|
||||
bool annotated = true;
|
||||
|
||||
// Add timestamp for uninitialized components
|
||||
if( name.Last() == '?' )
|
||||
{
|
||||
name << GetParentComponent()->GetTimeStamp();
|
||||
annotated = false;
|
||||
}
|
||||
|
||||
name << "-Pad" << m_libPin->GetNumber() << ")";
|
||||
|
||||
m_net_name_map[ aPath ] = name;
|
||||
if( annotated )
|
||||
m_net_name_map[ aPath ] = name;
|
||||
|
||||
return name;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue