fix nonlinear correction threshold (#3060)

* s

* macro

* test has to do the inverse
This commit is contained in:
Matthew Kennedy 2021-07-25 17:42:26 -07:00 committed by GitHub
parent 17ee26293c
commit f6095b8339
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 2 deletions

View File

@ -128,7 +128,7 @@ float InjectorModel::correctShortPulse(float baseDuration) const {
}
float InjectorModel::correctInjectionPolynomial(float baseDuration) const {
if (baseDuration > CONFIG(applyNonlinearBelowPulse)) {
if (baseDuration > USF2MS(CONFIG(applyNonlinearBelowPulse))) {
// Large pulse, skip correction.
return baseDuration;
}

View File

@ -29,6 +29,8 @@
// the expensive conversions from int64 <-> float
#define USF2NT(us_float) ((us_float) * US_TO_NT_MULTIPLIER)
#define USF2MS(us_float) (0.001f * (us_float))
// And back
#define NT2US(x) ((x) / US_TO_NT_MULTIPLIER)

View File

@ -67,7 +67,7 @@ TEST(InjectorModel, nonlinearPolynomial) {
InjectorModel dut;
INJECT_ENGINE_REFERENCE(&dut);
CONFIG(applyNonlinearBelowPulse) = 10;
CONFIG(applyNonlinearBelowPulse) = MS2US(10);
for (int i = 0; i < 8; i++) {
CONFIG(injectorCorrectionPolynomial)[i] = i + 1;