Init tuning pattern settings from BOARD_DESIGN_SETTINGS.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/16819
This commit is contained in:
Jeff Young 2024-01-30 12:45:37 +00:00
parent 88cc029ad3
commit 5b5c6f0474
5 changed files with 27 additions and 20 deletions

View File

@ -666,9 +666,9 @@ public:
*/
TEARDROP_PARAMETERS_LIST m_TeardropParamsList;
PNS::MEANDER_SETTINGS m_singleTrackMeanderSettings;
PNS::MEANDER_SETTINGS m_diffPairMeanderSettings;
PNS::MEANDER_SETTINGS m_skewMeanderSettings;
PNS::MEANDER_SETTINGS m_SingleTrackMeanderSettings;
PNS::MEANDER_SETTINGS m_DiffPairMeanderSettings;
PNS::MEANDER_SETTINGS m_SkewMeanderSettings;
VIATYPE m_CurrentViaType; ///< (VIA_BLIND_BURIED, VIA_THROUGH, VIA_MICROVIA)

View File

@ -617,9 +617,9 @@ BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS( JSON_SETTINGS* aParent, const std:
return entry;
};
js["single_track_defaults"] = make_settings( m_singleTrackMeanderSettings );
js["diff_pair_defaults"] = make_settings( m_diffPairMeanderSettings );
js["diff_pair_skew_defaults"] = make_settings( m_skewMeanderSettings );
js["single_track_defaults"] = make_settings( m_SingleTrackMeanderSettings );
js["diff_pair_defaults"] = make_settings( m_DiffPairMeanderSettings );
js["diff_pair_skew_defaults"] = make_settings( m_SkewMeanderSettings );
return js;
},
@ -655,13 +655,13 @@ BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS( JSON_SETTINGS* aParent, const std:
};
if( aObj.contains( "single_track_defaults" ) )
m_singleTrackMeanderSettings = read_settings( aObj["single_track_defaults"] );
m_SingleTrackMeanderSettings = read_settings( aObj["single_track_defaults"] );
if( aObj.contains( "diff_pair_defaults" ) )
m_diffPairMeanderSettings = read_settings( aObj["diff_pair_defaults"] );
m_DiffPairMeanderSettings = read_settings( aObj["diff_pair_defaults"] );
if( aObj.contains( "diff_pair_skew_defaults" ) )
m_skewMeanderSettings = read_settings( aObj["diff_pair_skew_defaults"] );
m_SkewMeanderSettings = read_settings( aObj["diff_pair_skew_defaults"] );
},
{} ) );

View File

@ -169,9 +169,9 @@ DIALOG_BOARD_SETUP::DIALOG_BOARD_SETUP( PCB_EDIT_FRAME* aFrame ) :
BOARD_DESIGN_SETTINGS& bds = m_frame->GetBoard()->GetDesignSettings();
return new PANEL_SETUP_TUNING_PATTERNS( aParent, m_frame,
bds.m_singleTrackMeanderSettings,
bds.m_diffPairMeanderSettings,
bds.m_skewMeanderSettings );
bds.m_SingleTrackMeanderSettings,
bds.m_DiffPairMeanderSettings,
bds.m_SkewMeanderSettings );
}, _( "Length-tuning Patterns" ) );
m_netclassesPage = m_treebook->GetPageCount();

View File

@ -117,9 +117,9 @@ void PANEL_SETUP_TUNING_PATTERNS::ImportSettingsFrom( BOARD* aBoard )
PNS::MEANDER_SETTINGS savedDPSettings = m_dpSettings;
PNS::MEANDER_SETTINGS savedSkewSettings = m_skewSettings;
m_trackSettings = aBoard->GetDesignSettings().m_singleTrackMeanderSettings;
m_dpSettings = aBoard->GetDesignSettings().m_diffPairMeanderSettings;
m_skewSettings = aBoard->GetDesignSettings().m_skewMeanderSettings;
m_trackSettings = aBoard->GetDesignSettings().m_SingleTrackMeanderSettings;
m_dpSettings = aBoard->GetDesignSettings().m_DiffPairMeanderSettings;
m_skewSettings = aBoard->GetDesignSettings().m_SkewMeanderSettings;
TransferDataToWindow();
m_trackSettings = std::move( savedTrackSettings );

View File

@ -635,17 +635,24 @@ PCB_TUNING_PATTERN* PCB_TUNING_PATTERN::CreateNew( GENERATOR_TOOL* aTool,
BOARD_CONNECTED_ITEM* aStartItem,
LENGTH_TUNING_MODE aMode )
{
BOARD* board = aStartItem->GetBoard();
std::shared_ptr<DRC_ENGINE>& drcEngine = board->GetDesignSettings().m_DRCEngine;
DRC_CONSTRAINT constraint;
PCB_LAYER_ID layer = aStartItem->GetLayer();
BOARD* board = aStartItem->GetBoard();
BOARD_DESIGN_SETTINGS& bds = board->GetDesignSettings();
DRC_CONSTRAINT constraint;
PCB_LAYER_ID layer = aStartItem->GetLayer();
if( aMode == SINGLE && board->DpCoupledNet( aStartItem->GetNet() ) )
aMode = DIFF_PAIR;
PCB_TUNING_PATTERN* pattern = new PCB_TUNING_PATTERN( board, layer, aMode );
constraint = drcEngine->EvalRules( LENGTH_CONSTRAINT, aStartItem, nullptr, layer );
switch( aMode )
{
case SINGLE: pattern->m_settings = bds.m_SingleTrackMeanderSettings; break;
case DIFF_PAIR: pattern->m_settings = bds.m_DiffPairMeanderSettings; break;
case DIFF_PAIR_SKEW: pattern->m_settings = bds.m_SkewMeanderSettings; break;
}
constraint = bds.m_DRCEngine->EvalRules( LENGTH_CONSTRAINT, aStartItem, nullptr, layer );
if( !constraint.IsNull() )
{