Respect DRCEpsilon in diff-pair coupling test.

Fixes https://gitlab.com/kicad/code/kicad/issues/12587
This commit is contained in:
Jeff Young 2022-10-06 20:57:46 +01:00
parent d6c7f46842
commit 9119b5072a
1 changed files with 5 additions and 4 deletions

View File

@ -18,15 +18,14 @@
*/ */
#include <common.h>
#include <board.h> #include <board.h>
#include <board_design_settings.h>
#include <pcb_track.h> #include <pcb_track.h>
#include <drc/drc_engine.h> #include <drc/drc_engine.h>
#include <drc/drc_item.h> #include <drc/drc_item.h>
#include <drc/drc_rule.h> #include <drc/drc_rule.h>
#include <drc/drc_test_provider.h> #include <drc/drc_test_provider.h>
#include <drc/drc_length_report.h>
#include <drc/drc_rtree.h> #include <drc/drc_rtree.h>
#include <geometry/shape_segment.h> #include <geometry/shape_segment.h>
@ -272,6 +271,8 @@ bool test::DRC_TEST_PROVIDER_DIFF_PAIR_COUPLING::Run()
{ {
m_board = m_drcEngine->GetBoard(); m_board = m_drcEngine->GetBoard();
int epsilon = m_board->GetDesignSettings().GetDRCEpsilon();
std::map<DIFF_PAIR_KEY, DIFF_PAIR_ITEMS> dpRuleMatches; std::map<DIFF_PAIR_KEY, DIFF_PAIR_ITEMS> dpRuleMatches;
auto evaluateDpConstraints = auto evaluateDpConstraints =
@ -399,10 +400,10 @@ bool test::DRC_TEST_PROVIDER_DIFF_PAIR_COUPLING::Run()
const MINOPTMAX<int>& val = gapConstraint->GetValue(); const MINOPTMAX<int>& val = gapConstraint->GetValue();
bool insideRange = true; bool insideRange = true;
if( val.HasMin() && gap < val.Min() ) if( val.HasMin() && gap < val.Min() - epsilon )
insideRange = false; insideRange = false;
if( val.HasMax() && gap > val.Max() ) if( val.HasMax() && gap > val.Max() + epsilon )
insideRange = false; insideRange = false;
dp.couplingOK = insideRange; dp.couplingOK = insideRange;