From eea949ce0a0ec625d675e89546959f60f0962aae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20W=C5=82ostowski?= Date: Thu, 18 Oct 2018 13:48:19 +0200 Subject: [PATCH] router: don't cross DP lines when length tuning, fix swap pair polarity bug Fixes: lp:1798500 * https://bugs.launchpad.net/kicad/+bug/1798500 Fixes: lp:1798221 * https://bugs.launchpad.net/kicad/+bug/1798221 --- pcbnew/router/pns_diff_pair_placer.cpp | 2 +- pcbnew/router/pns_dp_meander_placer.cpp | 4 ++-- pcbnew/router/pns_dp_meander_placer.h | 3 ++- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/pcbnew/router/pns_diff_pair_placer.cpp b/pcbnew/router/pns_diff_pair_placer.cpp index cddc9b093c..8a33d333fb 100644 --- a/pcbnew/router/pns_diff_pair_placer.cpp +++ b/pcbnew/router/pns_diff_pair_placer.cpp @@ -503,7 +503,7 @@ bool DIFF_PAIR_PLACER::findDpPrimitivePair( const VECTOR2I& aP, ITEM* aItem, found = true; bestDist = dist; - if( refNet == netP ) + if( refNet != netP ) { aPair = DP_PRIMITIVE_PAIR ( item, primRef ); aPair.SetAnchors( *anchor, *refAnchor ); diff --git a/pcbnew/router/pns_dp_meander_placer.cpp b/pcbnew/router/pns_dp_meander_placer.cpp index 8d5797b339..d4102ce84d 100644 --- a/pcbnew/router/pns_dp_meander_placer.cpp +++ b/pcbnew/router/pns_dp_meander_placer.cpp @@ -150,7 +150,7 @@ const SEG DP_MEANDER_PLACER::baselineSegment( const DIFF_PAIR::COUPLED_SEGMENTS& } -static bool pairOrientation( const DIFF_PAIR::COUPLED_SEGMENTS& aPair ) +bool DP_MEANDER_PLACER::pairOrientation( const DIFF_PAIR::COUPLED_SEGMENTS& aPair ) { VECTOR2I midp = ( aPair.coupledP.A + aPair.coupledN.A ) / 2; @@ -197,7 +197,7 @@ bool DP_MEANDER_PLACER::Move( const VECTOR2I& aP, ITEM* aEndItem ) int offset = ( tuned.Gap() + tuned.Width() ) / 2; - if( !pairOrientation( coupledSegments[0] ) ) + if( pairOrientation( coupledSegments[0] ) ) offset *= -1; m_result.SetBaselineOffset( offset ); diff --git a/pcbnew/router/pns_dp_meander_placer.h b/pcbnew/router/pns_dp_meander_placer.h index 22b36dc63f..7fa9532c98 100644 --- a/pcbnew/router/pns_dp_meander_placer.h +++ b/pcbnew/router/pns_dp_meander_placer.h @@ -115,7 +115,8 @@ private: // void addCorner ( const VECTOR2I& aP ); const SEG baselineSegment( const DIFF_PAIR::COUPLED_SEGMENTS& aCoupledSegs ); - + bool pairOrientation( const DIFF_PAIR::COUPLED_SEGMENTS& aPair ); + void setWorld( NODE* aWorld ); void release();