PNS: Make sure log viewer uses the actual design settings
This commit is contained in:
parent
ddbefe13cd
commit
103eb556f7
|
@ -62,6 +62,7 @@ using namespace std::placeholders;
|
||||||
|
|
||||||
#include <project.h>
|
#include <project.h>
|
||||||
#include <project/project_file.h>
|
#include <project/project_file.h>
|
||||||
|
#include <project/project_local_settings.h>
|
||||||
|
|
||||||
#include "router_tool.h"
|
#include "router_tool.h"
|
||||||
#include "pns_segment.h"
|
#include "pns_segment.h"
|
||||||
|
@ -602,12 +603,12 @@ void ROUTER_TOOL::saveRouterDebugLog()
|
||||||
if( !rv )
|
if( !rv )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
FILE* f = fopen( fname_settings.GetFullPath().c_str(), "wb" );
|
FILE* f = wxFopen( fname_settings.GetFullPath(), "wb" );
|
||||||
std::string settingsStr = m_router->Settings().FormatAsString();
|
std::string settingsStr = m_router->Settings().FormatAsString();
|
||||||
fprintf( f, "%s\n", settingsStr.c_str() );
|
fprintf( f, "%s\n", settingsStr.c_str() );
|
||||||
fclose( f );
|
fclose( f );
|
||||||
|
|
||||||
f = fopen( fname_log.GetFullPath().c_str(), "wb" );
|
f = wxFopen( fname_log.GetFullPath(), "wb" );
|
||||||
|
|
||||||
fprintf(f, "mode %d\n", m_router->Mode() );
|
fprintf(f, "mode %d\n", m_router->Mode() );
|
||||||
|
|
||||||
|
@ -635,6 +636,7 @@ void ROUTER_TOOL::saveRouterDebugLog()
|
||||||
|
|
||||||
PROJECT* prj = m_iface->GetBoard()->GetProject();
|
PROJECT* prj = m_iface->GetBoard()->GetProject();
|
||||||
prj->GetProjectFile().SaveAs( cwd, "pns" );
|
prj->GetProjectFile().SaveAs( cwd, "pns" );
|
||||||
|
prj->GetLocalSettings().SaveAs( cwd, "pns" );
|
||||||
|
|
||||||
std::vector<PNS::ITEM*> added, removed, heads;
|
std::vector<PNS::ITEM*> added, removed, heads;
|
||||||
m_router->GetUpdatedItems( removed, added, heads );
|
m_router->GetUpdatedItems( removed, added, heads );
|
||||||
|
|
|
@ -34,6 +34,9 @@
|
||||||
#include <pcbnew/plugins/kicad/pcb_plugin.h>
|
#include <pcbnew/plugins/kicad/pcb_plugin.h>
|
||||||
#include <pcbnew/drc/drc_engine.h>
|
#include <pcbnew/drc/drc_engine.h>
|
||||||
|
|
||||||
|
#include <project.h>
|
||||||
|
#include <project/project_local_settings.h>
|
||||||
|
|
||||||
#include <../../tests/common/console_log.h>
|
#include <../../tests/common/console_log.h>
|
||||||
|
|
||||||
BOARD_CONNECTED_ITEM* PNS_LOG_FILE::ItemById( const PNS_LOG_FILE::EVENT_ENTRY& evt )
|
BOARD_CONNECTED_ITEM* PNS_LOG_FILE::ItemById( const PNS_LOG_FILE::EVENT_ENTRY& evt )
|
||||||
|
@ -383,6 +386,7 @@ bool PNS_LOG_FILE::Load( const wxFileName& logFileName, REPORTER* aRpt )
|
||||||
BOARD_DESIGN_SETTINGS& bds = m_board->GetDesignSettings();
|
BOARD_DESIGN_SETTINGS& bds = m_board->GetDesignSettings();
|
||||||
|
|
||||||
bds.m_DRCEngine = drcEngine;
|
bds.m_DRCEngine = drcEngine;
|
||||||
|
bds.m_UseConnectedTrackWidth = m_board->GetProject()->GetLocalSettings().m_AutoTrackWidth;
|
||||||
|
|
||||||
m_board->SynchronizeNetsAndNetClasses( true );
|
m_board->SynchronizeNetsAndNetClasses( true );
|
||||||
|
|
||||||
|
|
|
@ -56,8 +56,6 @@ void PNS_LOG_PLAYER::createRouter()
|
||||||
m_router->Settings().SetMode( PNS::RM_Walkaround );
|
m_router->Settings().SetMode( PNS::RM_Walkaround );
|
||||||
m_router->Sizes().SetTrackWidth( 250000 );
|
m_router->Sizes().SetTrackWidth( 250000 );
|
||||||
|
|
||||||
//m_router->Settings().SetOptimizeDraggedTrack( true );
|
|
||||||
|
|
||||||
m_debugDecorator = new PNS_TEST_DEBUG_DECORATOR;
|
m_debugDecorator = new PNS_TEST_DEBUG_DECORATOR;
|
||||||
m_debugDecorator->Clear();
|
m_debugDecorator->Clear();
|
||||||
m_iface->SetDebugDecorator( m_debugDecorator );
|
m_iface->SetDebugDecorator( m_debugDecorator );
|
||||||
|
@ -107,6 +105,7 @@ void PNS_LOG_PLAYER::ReplayLog( PNS_LOG_FILE* aLog, int aStartEventIndex, int aF
|
||||||
|
|
||||||
auto item = aLog->ItemById( evt );
|
auto item = aLog->ItemById( evt );
|
||||||
ITEM* ritem = item ? m_router->GetWorld()->FindItemByParent( item ) : nullptr;
|
ITEM* ritem = item ? m_router->GetWorld()->FindItemByParent( item ) : nullptr;
|
||||||
|
int routingLayer = ritem ? ritem->Layers().Start() : F_Cu;
|
||||||
|
|
||||||
eventIdx++;
|
eventIdx++;
|
||||||
|
|
||||||
|
@ -114,24 +113,36 @@ void PNS_LOG_PLAYER::ReplayLog( PNS_LOG_FILE* aLog, int aStartEventIndex, int aF
|
||||||
{
|
{
|
||||||
case LOGGER::EVT_START_ROUTE:
|
case LOGGER::EVT_START_ROUTE:
|
||||||
{
|
{
|
||||||
|
PNS::SIZES_SETTINGS sizes( m_router->Sizes() );
|
||||||
|
m_iface->SetStartLayer( routingLayer );
|
||||||
|
m_iface->ImportSizes( sizes, ritem, -1 );
|
||||||
|
m_router->UpdateSizes( sizes );
|
||||||
|
|
||||||
m_debugDecorator->NewStage( "route-start", 0, PNSLOGINFO );
|
m_debugDecorator->NewStage( "route-start", 0, PNSLOGINFO );
|
||||||
m_viewTracker->SetStage( m_debugDecorator->GetStageCount() - 1 );
|
m_viewTracker->SetStage( m_debugDecorator->GetStageCount() - 1 );
|
||||||
|
|
||||||
auto msg = wxString::Format( "event [%d/%d]: route-start (%d, %d)", eventIdx, totalEvents, evt.p.x, evt.p.y );
|
auto msg = wxString::Format( "event [%d/%d]: route-start (%d, %d)", eventIdx,
|
||||||
|
totalEvents, evt.p.x, evt.p.y );
|
||||||
|
|
||||||
m_debugDecorator->Message( msg );
|
m_debugDecorator->Message( msg );
|
||||||
m_reporter->Report( msg );
|
m_reporter->Report( msg );
|
||||||
|
|
||||||
m_router->StartRouting( evt.p, ritem, ritem ? ritem->Layers().Start() : F_Cu );
|
m_router->StartRouting( evt.p, ritem, routingLayer );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case LOGGER::EVT_START_DRAG:
|
case LOGGER::EVT_START_DRAG:
|
||||||
{
|
{
|
||||||
|
PNS::SIZES_SETTINGS sizes( m_router->Sizes() );
|
||||||
|
m_iface->SetStartLayer( routingLayer );
|
||||||
|
m_iface->ImportSizes( sizes, ritem, -1 );
|
||||||
|
m_router->UpdateSizes( sizes );
|
||||||
|
|
||||||
m_debugDecorator->NewStage( "drag-start", 0, PNSLOGINFO );
|
m_debugDecorator->NewStage( "drag-start", 0, PNSLOGINFO );
|
||||||
m_viewTracker->SetStage( m_debugDecorator->GetStageCount() - 1 );
|
m_viewTracker->SetStage( m_debugDecorator->GetStageCount() - 1 );
|
||||||
|
|
||||||
auto msg = wxString::Format( "event [%d/%d]: drag-start (%d, %d)", eventIdx, totalEvents, evt.p.x, evt.p.y );
|
auto msg = wxString::Format( "event [%d/%d]: drag-start (%d, %d)", eventIdx,
|
||||||
|
totalEvents, evt.p.x, evt.p.y );
|
||||||
|
|
||||||
m_debugDecorator->Message( msg );
|
m_debugDecorator->Message( msg );
|
||||||
m_reporter->Report( msg );
|
m_reporter->Report( msg );
|
||||||
|
|
Loading…
Reference in New Issue