Skip to content

Commit

Permalink
Fixes tolerance of DELAY01 test for Gen 3
Browse files Browse the repository at this point in the history
  • Loading branch information
technobly committed Mar 11, 2019
1 parent b4e8804 commit bb09f69
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions user/tests/wiring/no_fixture/delay.cpp
Expand Up @@ -19,8 +19,15 @@ class DelayTest
}
};

test(DELAY_01_delay_1_is_within_5_percent)
test(DELAY_01_delay_1ms_is_within_tolerance)
{
// These errors are mainly due to processing overhead, which is a greater factor on NRF with a slower clock speed
#if HAL_PLATFORM_NRF52840
const uint32_t delay_us_error = 200; // 20%
#else
const uint32_t delay_us_error = 50; // 5%
#endif

DelayTest dt(10);
// on RTOS have to stop task scheduling for the delays or we may not
// be executed often enough
Expand All @@ -31,7 +38,8 @@ test(DELAY_01_delay_1_is_within_5_percent)
uint32_t end = micros();
scheduler(true);

// Serial.printlnf("total time:%lu", end-start);
assertMoreOrEqual(end-start, 1000);
assertLessOrEqual(end-start, 1050);
assertLessOrEqual(end-start, 1000 + delay_us_error);
}
}

0 comments on commit bb09f69

Please sign in to comment.