Use debug group for line placer debug

This commit is contained in:
Jon Evans 2021-06-06 15:44:42 -04:00
parent f5185f6927
commit d32b9c1c25
1 changed files with 15 additions and 7 deletions

View File

@ -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() )
{