PNS: add new "EnableRouterDump" kicad_advanced setting

This commit is contained in:
Roberto Fernandez Bautista 2023-08-07 17:44:33 +02:00
parent fc869502f4
commit 3bf9797620
3 changed files with 22 additions and 5 deletions

View File

@ -110,6 +110,11 @@ static const wxChar CoroutineStackSize[] = wxT( "CoroutineStackSize" );
*/
static const wxChar ShowRouterDebugGraphics[] = wxT( "ShowRouterDebugGraphics" );
/**
* Enable PNS router to dump state information for debug purpose (press `0` while routing)
*/
static const wxChar EnableRouterDump[] = wxT( "EnableRouterDump" );
/**
* Slide the zoom steps over for debugging things "up close".
*/
@ -295,6 +300,7 @@ ADVANCED_CFG::ADVANCED_CFG()
// then the values will remain as set here.
m_CoroutineStackSize = AC_STACK::default_stack;
m_ShowRouterDebugGraphics = false;
m_EnableRouterDump = false;
m_HyperZoom = false;
m_DrawArcAccuracy = 10.0;
m_DrawArcCenterMaxAngle = 50.0;
@ -410,6 +416,9 @@ void ADVANCED_CFG::loadSettings( wxConfigBase& aCfg )
configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::ShowRouterDebugGraphics,
&m_ShowRouterDebugGraphics, m_ShowRouterDebugGraphics ) );
configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::EnableRouterDump,
&m_EnableRouterDump, m_EnableRouterDump ) );
configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::HyperZoom,
&m_HyperZoom, m_HyperZoom ) );

View File

@ -140,6 +140,11 @@ public:
*/
bool m_ShowRouterDebugGraphics;
/**
* Enable PNS router to dump state information for debug purpose (press `0` while routing)
*/
bool m_EnableRouterDump;
/**
* Slide the zoom steps over for debugging things "up close".
*/

View File

@ -593,8 +593,11 @@ void ROUTER_TOOL::saveRouterDebugLog()
fname_settings.SetPath( cwd );
fname_settings.SetName( "pns.settings" );
wxString msg = wxString::Format( _( "Event file: %s\nBoard dump: %s" ), fname_log.GetFullPath(),
fname_log.GetFullPath() );
wxString msg = wxString::Format( _( "Path: %s\nEvent file: %s\nBoard dump: %s\nSettings dump: %s" ),
fname_log.GetPath(),
fname_log.GetFullName(),
fname_dump.GetFullName(),
fname_settings.GetFullName() );
int rv = OKOrCancelDialog( nullptr, _( "Save router log" ),
_( "Would you like to save the router\nevent log for debugging purposes?" ), msg,
@ -670,15 +673,15 @@ void ROUTER_TOOL::handleCommonEvents( TOOL_EVENT& aEvent )
m_router->SetVisibleViewArea( BOX2I( viewAreaD.GetOrigin(), viewAreaD.GetSize() ) );
}
if( !ADVANCED_CFG::GetCfg().m_EnableRouterDump )
return;
if( !aEvent.IsKeyPressed() )
return;
switch( aEvent.KeyCode() )
{
case '0':
if( !ADVANCED_CFG::GetCfg().m_ShowRouterDebugGraphics )
return;
saveRouterDebugLog();
aEvent.SetPassEvent( false );
break;