From 3bf97976209bcf036dd1b376acff2d7adbe0c49b Mon Sep 17 00:00:00 2001 From: Roberto Fernandez Bautista Date: Mon, 7 Aug 2023 17:44:33 +0200 Subject: [PATCH] PNS: add new "EnableRouterDump" kicad_advanced setting --- common/advanced_config.cpp | 9 +++++++++ include/advanced_config.h | 5 +++++ pcbnew/router/router_tool.cpp | 13 ++++++++----- 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/common/advanced_config.cpp b/common/advanced_config.cpp index bcbf19320a..082db729a2 100644 --- a/common/advanced_config.cpp +++ b/common/advanced_config.cpp @@ -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 ) ); diff --git a/include/advanced_config.h b/include/advanced_config.h index 2dfef6c308..3be51d43b6 100644 --- a/include/advanced_config.h +++ b/include/advanced_config.h @@ -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". */ diff --git a/pcbnew/router/router_tool.cpp b/pcbnew/router/router_tool.cpp index 966d343cdb..ef459e3def 100644 --- a/pcbnew/router/router_tool.cpp +++ b/pcbnew/router/router_tool.cpp @@ -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;