From d32b9c1c2588ffeb22cf7b3ee1dfe28b51d863a9 Mon Sep 17 00:00:00 2001 From: Jon Evans Date: Sun, 6 Jun 2021 15:44:42 -0400 Subject: [PATCH] Use debug group for line placer debug --- pcbnew/router/pns_line_placer.cpp | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/pcbnew/router/pns_line_placer.cpp b/pcbnew/router/pns_line_placer.cpp index b846ceb451..9d02e5131a 100644 --- a/pcbnew/router/pns_line_placer.cpp +++ b/pcbnew/router/pns_line_placer.cpp @@ -550,9 +550,13 @@ bool LINE_PLACER::rhWalkOnly( const VECTOR2I& aP, LINE& aNewHead ) walkaround.SetLogger( Logger() ); walkaround.SetIterationLimit( Settings().WalkaroundIterationLimit() ); + char name[50]; int round = 0; do { + snprintf( name, sizeof( name ), "walk-round-%d", round ); + PNS_DBG( Dbg(), BeginGroup, name ); + viaOk = buildInitialLine( walkP, initTrack, round == 0 ); double initialLength = initTrack.CLine().Length(); @@ -568,8 +572,8 @@ bool LINE_PLACER::rhWalkOnly( const VECTOR2I& aP, LINE& aNewHead ) int len_cw = wr.statusCw == WALKAROUND::DONE ? l_cw.Length() : INT_MAX; int len_ccw = wr.statusCcw == WALKAROUND::DONE ? l_ccw.Length() : INT_MAX; - Dbg()->AddLine( wr.lineCw.CLine(), CYAN, 10000, "wf-result-cw" ); - Dbg()->AddLine( wr.lineCcw.CLine(), BLUE, 20000, "wf-result-ccw" ); + PNS_DBG( Dbg(), AddLine, wr.lineCw.CLine(), CYAN, 10000, "wf-result-cw" ); + PNS_DBG( Dbg(), AddLine, wr.lineCcw.CLine(), BLUE, 20000, "wf-result-ccw" ); int bestLength = len_cw < len_ccw ? len_cw : len_ccw; @@ -596,8 +600,8 @@ bool LINE_PLACER::rhWalkOnly( const VECTOR2I& aP, LINE& aNewHead ) { int idx_ccw = l_ccw.Split( p_ccw ); l_ccw = l_ccw.Slice( 0, idx_ccw ); - Dbg()->AddPoint( p_ccw, BLUE, 500000, "hug-target-ccw" ); - Dbg()->AddLine( l_ccw, MAGENTA, 200000, "wh-result-ccw" ); + PNS_DBG( Dbg(), AddPoint, p_ccw, BLUE, 500000, "hug-target-ccw" ); + PNS_DBG( Dbg(), AddLine, l_ccw, MAGENTA, 200000, "wh-result-ccw" ); } } if( wr.statusCw == WALKAROUND::ALMOST_DONE ) @@ -607,8 +611,8 @@ bool LINE_PLACER::rhWalkOnly( const VECTOR2I& aP, LINE& aNewHead ) { int idx_cw = l_cw.Split( p_cw ); l_cw = l_cw.Slice( 0, idx_cw ); - Dbg()->AddPoint( p_cw, YELLOW, 500000, "hug-target-cw" ); - Dbg()->AddLine( l_cw, BLUE, 200000, "wh-result-cw" ); + PNS_DBG( Dbg(), AddPoint, p_cw, YELLOW, 500000, "hug-target-cw" ); + PNS_DBG( Dbg(), AddLine, l_cw, BLUE, 200000, "wh-result-cw" ); } } @@ -624,18 +628,22 @@ bool LINE_PLACER::rhWalkOnly( const VECTOR2I& aP, LINE& aNewHead ) } else { + PNS_DBGN( Dbg(), EndGroup ); return false; } } else if ( wr.statusCcw == WALKAROUND::STUCK || wr.statusCw == WALKAROUND::STUCK ) { + PNS_DBGN( Dbg(), EndGroup ); return false; } + PNS_DBGN( Dbg(), EndGroup ); + round++; } while( round < 2 && m_placingVia ); - Dbg()->AddLine( walkFull.CLine(), GREEN, 200000, "walk-full" ); + PNS_DBG( Dbg(), AddLine, walkFull.CLine(), GREEN, 200000, "walk-full" ); switch( Settings().OptimizerEffort() ) {