From 08178104bbbdb94a3724e6925943f9005646d5d0 Mon Sep 17 00:00:00 2001 From: Tomasz Wlostowski Date: Thu, 5 Nov 2015 19:20:08 +1000 Subject: [PATCH] router: take track width changes into account when calculating trace length for tuning --- pcbnew/router/pns_joint.h | 14 ++++++++++++++ pcbnew/router/pns_topology.cpp | 10 +++++++--- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/pcbnew/router/pns_joint.h b/pcbnew/router/pns_joint.h index d1e4a14fc6..eab4a562a1 100644 --- a/pcbnew/router/pns_joint.h +++ b/pcbnew/router/pns_joint.h @@ -102,6 +102,20 @@ public: return ( m_linkedItems.Size() == 3 && vias == 1 && segs == 2 ); } + bool IsTraceWidthChange() const + { + if( m_linkedItems.Size() != 2 ) + return false; + + if( m_linkedItems.Count( SEGMENT ) != 2) + return false; + + PNS_SEGMENT* seg1 = static_cast( m_linkedItems[0] ); + PNS_SEGMENT* seg2 = static_cast( m_linkedItems[1] ); + + return seg1->Width() != seg2->Width(); + } + ///> Links the joint to a given board item (when it's added to the PNS_NODE) void Link( PNS_ITEM* aItem ) { diff --git a/pcbnew/router/pns_topology.cpp b/pcbnew/router/pns_topology.cpp index bb4b83247b..3fb17b0efa 100644 --- a/pcbnew/router/pns_topology.cpp +++ b/pcbnew/router/pns_topology.cpp @@ -183,7 +183,7 @@ bool PNS_TOPOLOGY::followTrivialPath( PNS_LINE* aLine, bool aLeft, PNS_ITEMSET& aVisited.insert( last ); - if( jt->IsNonFanoutVia() ) + if( jt->IsNonFanoutVia() || jt->IsTraceWidthChange() ) { PNS_ITEM* via = NULL; PNS_SEGMENT* next_seg = NULL; @@ -210,12 +210,16 @@ bool PNS_TOPOLOGY::followTrivialPath( PNS_LINE* aLine, bool aLeft, PNS_ITEMSET& if( aLeft ) { - aSet.Prepend( via ); + if( via ) + aSet.Prepend( via ); + aSet.Prepend( l ); } else { - aSet.Add( via ); + if( via ) + aSet.Add( via ); + aSet.Add( l ); }