Increase unconstrained tuning length to 1km.

This commit is contained in:
Alex Shvartzkop 2024-02-09 19:25:39 +03:00
parent 1ac5666164
commit 453e185613
4 changed files with 89 additions and 78 deletions

View File

@ -665,6 +665,7 @@ set( PCB_COMMON_SRCS
${CMAKE_SOURCE_DIR}/pcbnew/board_connected_item.cpp ${CMAKE_SOURCE_DIR}/pcbnew/board_connected_item.cpp
${CMAKE_SOURCE_DIR}/pcbnew/board_design_settings.cpp ${CMAKE_SOURCE_DIR}/pcbnew/board_design_settings.cpp
${CMAKE_SOURCE_DIR}/pcbnew/teardrop/teardrop_parameters.cpp #needed by board_design_settings.cpp ${CMAKE_SOURCE_DIR}/pcbnew/teardrop/teardrop_parameters.cpp #needed by board_design_settings.cpp
${CMAKE_SOURCE_DIR}/pcbnew/router/pns_meander.cpp #needed by board_design_settings.cpp
${CMAKE_SOURCE_DIR}/pcbnew/board.cpp ${CMAKE_SOURCE_DIR}/pcbnew/board.cpp
${CMAKE_SOURCE_DIR}/pcbnew/board_item.cpp ${CMAKE_SOURCE_DIR}/pcbnew/board_item.cpp
${CMAKE_SOURCE_DIR}/pcbnew/pcb_dimension.cpp ${CMAKE_SOURCE_DIR}/pcbnew/pcb_dimension.cpp

View File

@ -682,13 +682,6 @@ PCB_TUNING_PATTERN* PCB_TUNING_PATTERN::CreateNew( GENERATOR_TOOL* aTool,
else else
pattern->m_settings.SetTargetLength( constraint.GetValue() ); pattern->m_settings.SetTargetLength( constraint.GetValue() );
} }
else
{
if( aMode == DIFF_PAIR_SKEW )
pattern->m_settings.SetTargetSkew( 0 );
else
pattern->m_settings.SetTargetLength( PNS::MEANDER_SETTINGS::LENGTH_UNCONSTRAINED );
}
pattern->SetFlags( IS_NEW ); pattern->SetFlags( IS_NEW );

View File

@ -28,6 +28,87 @@
namespace PNS { namespace PNS {
const long long int MEANDER_SETTINGS::DEFAULT_TOLERANCE( pcbIUScale.mmToIU( 0.1 ) );
const long long int MEANDER_SETTINGS::LENGTH_UNCONSTRAINED( 1000000 * pcbIUScale.IU_PER_MM );
MEANDER_SETTINGS::MEANDER_SETTINGS()
{
m_minAmplitude = 100000;
m_maxAmplitude = 1000000;
m_step = 50000;
m_lenPadToDie = 0;
m_spacing = 600000;
SetTargetLength( LENGTH_UNCONSTRAINED );
SetTargetSkew( 0 );
m_overrideCustomRules = false;
m_cornerStyle = MEANDER_STYLE_ROUND;
m_cornerRadiusPercentage = 100;
m_singleSided = false;
m_initialSide = MEANDER_SIDE_LEFT;
m_lengthTolerance = 0;
m_keepEndpoints = false;
}
void MEANDER_SETTINGS::SetTargetLength( long long int aOpt )
{
m_targetLength.SetOpt( aOpt );
if( aOpt == std::numeric_limits<long long int>::max() )
{
m_targetLength.SetMin( 0 );
m_targetLength.SetMax( aOpt );
}
else
{
m_targetLength.SetMin( aOpt - DEFAULT_TOLERANCE );
m_targetLength.SetMax( aOpt + DEFAULT_TOLERANCE );
}
}
void MEANDER_SETTINGS::SetTargetLength( const MINOPTMAX<int>& aConstraint )
{
SetTargetLength( aConstraint.Opt() );
if( aConstraint.HasMin() )
m_targetLength.SetMin( aConstraint.Min() );
if( aConstraint.HasMax() )
m_targetLength.SetMax( aConstraint.Max() );
}
void MEANDER_SETTINGS::SetTargetSkew( int aOpt )
{
m_targetSkew.SetOpt( aOpt );
if( aOpt == std::numeric_limits<int>::max() )
{
m_targetSkew.SetMin( 0 );
m_targetSkew.SetMax( aOpt );
}
else
{
m_targetSkew.SetMin( aOpt - DEFAULT_TOLERANCE );
m_targetSkew.SetMax( aOpt + DEFAULT_TOLERANCE );
}
}
void MEANDER_SETTINGS::SetTargetSkew( const MINOPTMAX<int>& aConstraint )
{
SetTargetSkew( aConstraint.Opt() );
if( aConstraint.HasMin() )
m_targetSkew.SetMin( aConstraint.Min() );
if( aConstraint.HasMax() )
m_targetSkew.SetMax( aConstraint.Max() );
}
const MEANDER_SETTINGS& MEANDER_SHAPE::Settings() const const MEANDER_SETTINGS& MEANDER_SHAPE::Settings() const
{ {
return m_placer->MeanderSettings(); return m_placer->MeanderSettings();

View File

@ -67,80 +67,16 @@ enum MEANDER_SIDE
class MEANDER_SETTINGS class MEANDER_SETTINGS
{ {
public: public:
static const long long int DEFAULT_TOLERANCE = 100000; static const long long int DEFAULT_TOLERANCE;
static const long long int LENGTH_UNCONSTRAINED = std::numeric_limits<int>::max(); static const long long int LENGTH_UNCONSTRAINED;
MEANDER_SETTINGS() MEANDER_SETTINGS();
{
m_minAmplitude = 100000;
m_maxAmplitude = 1000000;
m_step = 50000;
m_lenPadToDie = 0;
m_spacing = 600000;
SetTargetLength( LENGTH_UNCONSTRAINED );
SetTargetSkew( 0 );
m_overrideCustomRules = false;
m_cornerStyle = MEANDER_STYLE_ROUND;
m_cornerRadiusPercentage = 100;
m_singleSided = false;
m_initialSide = MEANDER_SIDE_LEFT;
m_lengthTolerance = 0;
m_keepEndpoints = false;
}
void SetTargetLength( long long int aOpt ) void SetTargetLength( long long int aOpt );
{ void SetTargetLength( const MINOPTMAX<int>& aConstraint );
m_targetLength.SetOpt( aOpt );
if( aOpt == std::numeric_limits<long long int>::max() ) void SetTargetSkew( int aOpt );
{ void SetTargetSkew( const MINOPTMAX<int>& aConstraint );
m_targetLength.SetMin( 0 );
m_targetLength.SetMax( aOpt );
}
else
{
m_targetLength.SetMin( aOpt - DEFAULT_TOLERANCE );
m_targetLength.SetMax( aOpt + DEFAULT_TOLERANCE );
}
}
void SetTargetLength( const MINOPTMAX<int>& aConstraint )
{
SetTargetLength( aConstraint.Opt() );
if( aConstraint.HasMin() )
m_targetLength.SetMin( aConstraint.Min() );
if( aConstraint.HasMax() )
m_targetLength.SetMax( aConstraint.Max() );
}
void SetTargetSkew( int aOpt )
{
m_targetSkew.SetOpt( aOpt );
if( aOpt == std::numeric_limits<int>::max() )
{
m_targetSkew.SetMin( 0 );
m_targetSkew.SetMax( aOpt );
}
else
{
m_targetSkew.SetMin( aOpt - DEFAULT_TOLERANCE );
m_targetSkew.SetMax( aOpt + DEFAULT_TOLERANCE );
}
}
void SetTargetSkew( const MINOPTMAX<int>& aConstraint )
{
SetTargetSkew( aConstraint.Opt() );
if( aConstraint.HasMin() )
m_targetSkew.SetMin( aConstraint.Min() );
if( aConstraint.HasMax() )
m_targetSkew.SetMax( aConstraint.Max() );
}
///< Minimum meandering amplitude. ///< Minimum meandering amplitude.
int m_minAmplitude; int m_minAmplitude;