Length tuning: fix status popup display when unconstrained.

This commit is contained in:
Alex Shvartzkop 2024-02-08 18:55:25 +03:00
parent b979f52364
commit f4cf23e5cf
1 changed files with 14 additions and 11 deletions

View File

@ -66,6 +66,9 @@
#include <dialogs/dialog_tuning_pattern_properties.h> #include <dialogs/dialog_tuning_pattern_properties.h>
#define LENGTH_UNCONSTRAINED std::numeric_limits<int>::max()
enum LENGTH_TUNING_MODE enum LENGTH_TUNING_MODE
{ {
SINGLE, SINGLE,
@ -457,7 +460,6 @@ protected:
VECTOR2I m_end; VECTOR2I m_end;
PNS::MEANDER_SETTINGS m_settings; PNS::MEANDER_SETTINGS m_settings;
bool m_unconstrained;
std::optional<SHAPE_LINE_CHAIN> m_baseLine; std::optional<SHAPE_LINE_CHAIN> m_baseLine;
std::optional<SHAPE_LINE_CHAIN> m_baseLineCoupled; std::optional<SHAPE_LINE_CHAIN> m_baseLineCoupled;
@ -573,7 +575,6 @@ static std::string sideToString( const PNS::MEANDER_SIDE aValue )
PCB_TUNING_PATTERN::PCB_TUNING_PATTERN( BOARD_ITEM* aParent, PCB_LAYER_ID aLayer, PCB_TUNING_PATTERN::PCB_TUNING_PATTERN( BOARD_ITEM* aParent, PCB_LAYER_ID aLayer,
LENGTH_TUNING_MODE aMode ) : LENGTH_TUNING_MODE aMode ) :
PCB_GENERATOR( aParent, aLayer ), PCB_GENERATOR( aParent, aLayer ),
m_unconstrained( false ),
m_trackWidth( 0 ), m_trackWidth( 0 ),
m_diffPairGap( 0 ), m_diffPairGap( 0 ),
m_tuningMode( aMode ), m_tuningMode( aMode ),
@ -679,8 +680,7 @@ PCB_TUNING_PATTERN* PCB_TUNING_PATTERN::CreateNew( GENERATOR_TOOL* aTool,
} }
else else
{ {
pattern->m_settings.SetTargetLength( std::numeric_limits<int>::max() ); pattern->m_settings.SetTargetLength( LENGTH_UNCONSTRAINED );
pattern->m_unconstrained = true;
} }
} }
@ -1841,19 +1841,22 @@ std::vector<EDA_ITEM*> PCB_TUNING_PATTERN::GetPreviewItems( GENERATOR_TOOL* aToo
TUNING_STATUS_VIEW_ITEM* statusItem = new TUNING_STATUS_VIEW_ITEM( aFrame ); TUNING_STATUS_VIEW_ITEM* statusItem = new TUNING_STATUS_VIEW_ITEM( aFrame );
if( m_unconstrained ) if( m_tuningMode == DIFF_PAIR_SKEW )
{
statusItem->ClearMinMax();
}
else if( m_tuningMode == DIFF_PAIR_SKEW )
{ {
statusItem->SetMinMax( m_settings.m_targetSkew.Min(), m_settings.m_targetSkew.Max() ); statusItem->SetMinMax( m_settings.m_targetSkew.Min(), m_settings.m_targetSkew.Max() );
} }
else else
{
if( m_settings.m_targetLength.Opt() == LENGTH_UNCONSTRAINED )
{
statusItem->ClearMinMax();
}
else
{ {
statusItem->SetMinMax( (double) m_settings.m_targetLength.Min(), statusItem->SetMinMax( (double) m_settings.m_targetLength.Min(),
(double) m_settings.m_targetLength.Max() ); (double) m_settings.m_targetLength.Max() );
} }
}
if( m_tuningMode == DIFF_PAIR_SKEW ) if( m_tuningMode == DIFF_PAIR_SKEW )
statusItem->SetCurrent( (double) placer->TuningResult(), _( "current skew" ) ); statusItem->SetCurrent( (double) placer->TuningResult(), _( "current skew" ) );