From 268d57094119cb8f15de097b51f143d997799807 Mon Sep 17 00:00:00 2001 From: Jon Evans Date: Wed, 14 Apr 2021 22:43:54 -0400 Subject: [PATCH] PNS: keep last valid diff pair trace as current state This allows fixing/committing what is on screen even if the current cursor position doesn't have a valid solution (the old behavior would result in the current trace disappearing) --- pcbnew/router/pns_diff_pair_placer.cpp | 6 +++++- pcbnew/router/pns_diff_pair_placer.h | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/pcbnew/router/pns_diff_pair_placer.cpp b/pcbnew/router/pns_diff_pair_placer.cpp index 9b75abc14e..f5e74b36c7 100644 --- a/pcbnew/router/pns_diff_pair_placer.cpp +++ b/pcbnew/router/pns_diff_pair_placer.cpp @@ -55,6 +55,7 @@ DIFF_PAIR_PLACER::DIFF_PAIR_PLACER( ROUTER* aRouter ) : m_snapOnTarget = false; m_currentEndItem = NULL; m_currentMode = RM_MarkObstacles; + m_currentTraceOk = false; m_idle = true; } @@ -556,6 +557,8 @@ bool DIFF_PAIR_PLACER::Start( const VECTOR2I& aP, ITEM* aStartItem ) m_currentEnd = p; m_placingVia = false; m_chainedPlacement = false; + m_currentTraceOk = false; + m_currentTrace = DIFF_PAIR(); initPlacement(); @@ -655,6 +658,7 @@ bool DIFF_PAIR_PLACER::routeHead( const VECTOR2I& aP ) if( result ) { + m_currentTraceOk = true; m_currentTrace.SetNets( m_netP, m_netN ); m_currentTrace.SetWidth( m_sizes.DiffPairWidth() ); m_currentTrace.SetGap( m_sizes.DiffPairGap() ); @@ -668,7 +672,7 @@ bool DIFF_PAIR_PLACER::routeHead( const VECTOR2I& aP ) return true; } - return false; + return m_currentTraceOk; } diff --git a/pcbnew/router/pns_diff_pair_placer.h b/pcbnew/router/pns_diff_pair_placer.h index 57a2660604..458317a1cc 100644 --- a/pcbnew/router/pns_diff_pair_placer.h +++ b/pcbnew/router/pns_diff_pair_placer.h @@ -265,6 +265,7 @@ private: VECTOR2I m_currentEnd, m_currentStart; DIFF_PAIR m_currentTrace; + bool m_currentTraceOk; ITEM* m_currentEndItem; PNS_MODE m_currentMode;