add mock airmass mode

This commit is contained in:
Matthew Kennedy 2020-07-26 20:33:18 -07:00
parent 0a30f1d6f2
commit bd31eea73a
4 changed files with 13 additions and 0 deletions

View File

@ -735,6 +735,8 @@ case LM_SPEED_DENSITY:
return "LM_SPEED_DENSITY";
case LM_ALPHA_N_2:
return "LM_ALPHA_N_2";
case LM_MOCK:
return "LM_MOCK";
}
return NULL;
}

View File

@ -16,6 +16,7 @@
#include "accel_enrichment.h"
#include "trigger_central.h"
#include "local_version_holder.h"
#include "airmass.h"
#if EFI_SIGNAL_EXECUTOR_ONE_TIMER
// PROD real firmware uses this implementation
@ -334,6 +335,10 @@ public:
void knockLogic(float knockVolts DECLARE_ENGINE_PARAMETER_SUFFIX);
void printKnockState(void);
#if EFI_UNIT_TEST
AirmassModelBase* mockAirmassModel = nullptr;
#endif
private:
/**
* By the way:

View File

@ -179,6 +179,9 @@ AirmassModelBase* getAirmassModel(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
case LM_SPEED_DENSITY: return &sdAirmass;
case LM_REAL_MAF: return &mafAirmass;
case LM_ALPHA_N_2: return &alphaNAirmass;
#if EFI_UNIT_TEST
case LM_MOCK: return engine->mockAirmassModel;
#endif
default: return nullptr;
}
}

View File

@ -446,6 +446,9 @@ typedef enum {
// todo: rename after LM_ALPHA_N is removed
LM_ALPHA_N_2 = 5,
// This mode is for unit testing only, so that tests don't have to rely on a particular real airmass mode
LM_MOCK = 100,
Force_4_bytes_size_engine_load_mode = ENUM_32_BITS,
} engine_load_mode_e;