diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index 29fe313d87..a9499eb123 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -665,6 +665,7 @@ set( PCB_COMMON_SRCS ${CMAKE_SOURCE_DIR}/pcbnew/board_connected_item.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/router/pns_meander.cpp #needed by board_design_settings.cpp ${CMAKE_SOURCE_DIR}/pcbnew/board.cpp ${CMAKE_SOURCE_DIR}/pcbnew/board_item.cpp ${CMAKE_SOURCE_DIR}/pcbnew/pcb_dimension.cpp diff --git a/pcbnew/generators/pcb_tuning_pattern.cpp b/pcbnew/generators/pcb_tuning_pattern.cpp index 0e47658196..372b3cb7ee 100644 --- a/pcbnew/generators/pcb_tuning_pattern.cpp +++ b/pcbnew/generators/pcb_tuning_pattern.cpp @@ -682,13 +682,6 @@ PCB_TUNING_PATTERN* PCB_TUNING_PATTERN::CreateNew( GENERATOR_TOOL* aTool, else 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 ); diff --git a/pcbnew/router/pns_meander.cpp b/pcbnew/router/pns_meander.cpp index 19d56679eb..a878536dc2 100644 --- a/pcbnew/router/pns_meander.cpp +++ b/pcbnew/router/pns_meander.cpp @@ -28,6 +28,87 @@ 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::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& 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::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& 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 { return m_placer->MeanderSettings(); diff --git a/pcbnew/router/pns_meander.h b/pcbnew/router/pns_meander.h index ee562ee5a9..ff17549816 100644 --- a/pcbnew/router/pns_meander.h +++ b/pcbnew/router/pns_meander.h @@ -67,80 +67,16 @@ enum MEANDER_SIDE class MEANDER_SETTINGS { public: - static const long long int DEFAULT_TOLERANCE = 100000; - static const long long int LENGTH_UNCONSTRAINED = std::numeric_limits::max(); + static const long long int DEFAULT_TOLERANCE; + static const long long int LENGTH_UNCONSTRAINED; - 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; - } + MEANDER_SETTINGS(); - void SetTargetLength( long long int aOpt ) - { - m_targetLength.SetOpt( aOpt ); + void SetTargetLength( long long int aOpt ); + void SetTargetLength( const MINOPTMAX& aConstraint ); - if( aOpt == std::numeric_limits::max() ) - { - 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& 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::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& aConstraint ) - { - SetTargetSkew( aConstraint.Opt() ); - - if( aConstraint.HasMin() ) - m_targetSkew.SetMin( aConstraint.Min() ); - - if( aConstraint.HasMax() ) - m_targetSkew.SetMax( aConstraint.Max() ); - } + void SetTargetSkew( int aOpt ); + void SetTargetSkew( const MINOPTMAX& aConstraint ); ///< Minimum meandering amplitude. int m_minAmplitude;