Apply 0ef63aca47 to diff pairs.

Fixes https://gitlab.com/kicad/code/kicad/issues/6314
This commit is contained in:
Jeff Young 2020-12-12 02:52:33 +00:00
parent a8269b6380
commit c0a9742b3a
2 changed files with 33 additions and 10 deletions

View File

@ -260,13 +260,14 @@ class DP_GATEWAYS
/**
* DIFF_PAIR
*
* Basic class for a differential pair. Stores two PNS_LINEs (for positive and negative nets, respectively),
* the gap and coupling constraints.
* Basic class for a differential pair. Stores two PNS_LINEs (for positive and negative nets,
* respectively), the gap and coupling constraints.
**/
class DIFF_PAIR : public LINK_HOLDER {
class DIFF_PAIR : public LINK_HOLDER
{
public:
struct COUPLED_SEGMENTS {
struct COUPLED_SEGMENTS
{
COUPLED_SEGMENTS ( const SEG& aCoupledP, const SEG& aParentP, int aIndexP,
const SEG& aCoupledN, const SEG& aParentN, int aIndexN ) :
coupledP( aCoupledP ),
@ -287,7 +288,9 @@ public:
typedef std::vector<COUPLED_SEGMENTS> COUPLED_SEGMENTS_VEC;
DIFF_PAIR() : LINK_HOLDER( ITEM::DIFF_PAIR_T ), m_hasVias( false )
DIFF_PAIR() :
LINK_HOLDER( ITEM::DIFF_PAIR_T ),
m_hasVias( false )
{
// Initialize some members, to avoid uninitialized variables.
m_net_p = 0;
@ -315,7 +318,7 @@ public:
m_chamferLimit = 0;
}
DIFF_PAIR( const SHAPE_LINE_CHAIN &aP, const SHAPE_LINE_CHAIN& aN, int aGap = 0 ):
DIFF_PAIR( const SHAPE_LINE_CHAIN &aP, const SHAPE_LINE_CHAIN& aN, int aGap = 0 ) :
LINK_HOLDER( ITEM::DIFF_PAIR_T ),
m_n( aN ),
m_p( aP ),
@ -333,7 +336,7 @@ public:
m_chamferLimit = 0;
}
DIFF_PAIR( const LINE &aLineP, const LINE &aLineN, int aGap = 0 ):
DIFF_PAIR( const LINE &aLineP, const LINE &aLineN, int aGap = 0 ) :
LINK_HOLDER( ITEM::DIFF_PAIR_T ),
m_line_p( aLineP ),
m_line_n( aLineN ),
@ -398,6 +401,8 @@ public:
void SetWidth( int aWidth )
{
m_width = aWidth;
m_n.SetWidth( aWidth );
m_p.SetWidth( aWidth );
}
int Width() const { return m_width; }
@ -430,6 +435,18 @@ public:
return m_hasVias;
}
void SetViaDiameter( int aDiameter )
{
m_via_p.SetDiameter( aDiameter );
m_via_n.SetDiameter( aDiameter );
}
void SetViaDrill( int aDrill )
{
m_via_p.SetDrill( aDrill );
m_via_n.SetDrill( aDrill );
}
int NetP() const
{
return m_net_p;

View File

@ -738,8 +738,14 @@ void DIFF_PAIR_PLACER::UpdateSizes( const SIZES_SETTINGS& aSizes )
if( !m_idle )
{
initPlacement();
Move( m_currentEnd, NULL );
m_currentTrace.SetWidth( m_sizes.DiffPairWidth() );
m_currentTrace.SetGap( m_sizes.DiffPairGap() );
if( m_currentTrace.EndsWithVias() )
{
m_currentTrace.SetViaDiameter( m_sizes.ViaDiameter() );
m_currentTrace.SetViaDrill( m_sizes.ViaDrill() );
}
}
}