Programmatically remove EnginePtr/inject, EXPAND_Engine, and WITH_ENGINE_TEST_HELPER* (#3560)
* Programmatically remove EnginePtr/inject, EXPAND_Engine, and WITH_ENGINE_TEST_HELPER* for i in ": public EnginePtr " ", public EnginePtr" "EXPAND_Engine;" "EXPAND_Engine"; do git grep -l "$i" | xargs sed -i "s/$i//g" done git grep -l "inject" | xargs sed -i "/inject[(][)]/d" for i in WITH_ENGINE_TEST_HELPER_SENS WITH_ENGINE_TEST_HELPER_BOARD_CALLBACK WITH_ENGINE_TEST_HELPER; do git grep -l "$i" | xargs sed -i "s/$i/EngineTestHelper eth/g" done git checkout firmware/controllers/core/engine_ptr.h git checkout unit_tests/global.h * Review fixups.
This commit is contained in:
parent
17d4646dce
commit
cc95bd6c8e
|
@ -12,7 +12,7 @@
|
||||||
|
|
||||||
struct IPwm;
|
struct IPwm;
|
||||||
|
|
||||||
class BoostController : public ClosedLoopController<float, percent_t>, public EnginePtr {
|
class BoostController : public ClosedLoopController<float, percent_t> {
|
||||||
public:
|
public:
|
||||||
void init(IPwm* pmw, const ValueProvider3D* openLoopMap, const ValueProvider3D* closedLoopTargetMap, pid_s* pidParams);
|
void init(IPwm* pmw, const ValueProvider3D* openLoopMap, const ValueProvider3D* closedLoopTargetMap, pid_s* pidParams);
|
||||||
void update();
|
void update();
|
||||||
|
|
|
@ -956,7 +956,6 @@ void doInitElectronicThrottle() {
|
||||||
auto pid = getEtbPidForFunction(func);
|
auto pid = getEtbPidForFunction(func);
|
||||||
|
|
||||||
anyEtbConfigured |= controller->init(func, motor, pid, &pedal2tpsMap, shouldInitThrottles);
|
anyEtbConfigured |= controller->init(func, motor, pid, &pedal2tpsMap, shouldInitThrottles);
|
||||||
engine->etbControllers[i]->inject();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,7 @@ struct pid_s;
|
||||||
class ValueProvider3D;
|
class ValueProvider3D;
|
||||||
struct pid_state_s;
|
struct pid_state_s;
|
||||||
|
|
||||||
class IEtbController : public ClosedLoopController<percent_t, percent_t>, public EnginePtr {
|
class IEtbController : public ClosedLoopController<percent_t, percent_t> {
|
||||||
public:
|
public:
|
||||||
// Initialize the throttle.
|
// Initialize the throttle.
|
||||||
// returns true if the throttle was initialized, false otherwise.
|
// returns true if the throttle was initialized, false otherwise.
|
||||||
|
|
|
@ -42,7 +42,6 @@ void initGpPwm() {
|
||||||
tables[i]->init(cfg.table, cfg.loadBins, cfg.rpmBins);
|
tables[i]->init(cfg.table, cfg.loadBins, cfg.rpmBins);
|
||||||
|
|
||||||
// Finally configure the channel
|
// Finally configure the channel
|
||||||
channels[i].inject();
|
|
||||||
channels[i].init(usePwm, &outputs[i], &pins[i], tables[i], &cfg);
|
channels[i].init(usePwm, &outputs[i], &pins[i], tables[i], &cfg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@ class OutputPin;
|
||||||
struct IPwm;
|
struct IPwm;
|
||||||
class ValueProvider3D;
|
class ValueProvider3D;
|
||||||
|
|
||||||
class GppwmChannel : public EnginePtr {
|
class GppwmChannel {
|
||||||
public:
|
public:
|
||||||
void init(bool usePwm, IPwm* pwm, OutputPin* outputPin, const ValueProvider3D* table, const gppwm_channel* config);
|
void init(bool usePwm, IPwm* pwm, OutputPin* outputPin, const ValueProvider3D* table, const gppwm_channel* config);
|
||||||
float update();
|
float update();
|
||||||
|
|
|
@ -566,9 +566,7 @@ void startIdleBench(void) {
|
||||||
#endif /* EFI_UNIT_TEST */
|
#endif /* EFI_UNIT_TEST */
|
||||||
|
|
||||||
void startIdleThread() {
|
void startIdleThread() {
|
||||||
idleControllerInstance.inject();
|
|
||||||
idleControllerInstance.init(&CONFIG(idleTimingPid));
|
idleControllerInstance.init(&CONFIG(idleTimingPid));
|
||||||
industrialWithOverrideIdlePid.inject();
|
|
||||||
|
|
||||||
ENGINE(idleController) = &idleControllerInstance;
|
ENGINE(idleController) = &idleControllerInstance;
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@ struct IIdleController {
|
||||||
virtual float getCrankingTaperFraction() const = 0;
|
virtual float getCrankingTaperFraction() const = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
class IdleController : public IIdleController, public EnginePtr {
|
class IdleController : public IIdleController {
|
||||||
public:
|
public:
|
||||||
void init(pid_s* idlePidConfig);
|
void init(pid_s* idlePidConfig);
|
||||||
|
|
||||||
|
|
|
@ -140,7 +140,6 @@ void initAuxPid() {
|
||||||
config->vvtTable2RpmBins);
|
config->vvtTable2RpmBins);
|
||||||
|
|
||||||
for (int i = 0;i < CAM_INPUTS_COUNT;i++) {
|
for (int i = 0;i < CAM_INPUTS_COUNT;i++) {
|
||||||
instances[i].inject();
|
|
||||||
|
|
||||||
int camIndex = i % CAMS_PER_BANK;
|
int camIndex = i % CAMS_PER_BANK;
|
||||||
int bankIndex = i / CAMS_PER_BANK;
|
int bankIndex = i / CAMS_PER_BANK;
|
||||||
|
|
|
@ -19,7 +19,7 @@ void initAuxPid();
|
||||||
void startVvtControlPins();
|
void startVvtControlPins();
|
||||||
void stopVvtControlPins();
|
void stopVvtControlPins();
|
||||||
|
|
||||||
class VvtController : public PeriodicTimerController, public ClosedLoopController<angle_t, percent_t>, public EnginePtr {
|
class VvtController : public PeriodicTimerController, public ClosedLoopController<angle_t, percent_t> {
|
||||||
public:
|
public:
|
||||||
void init(int index, int bankIndex, int camIndex, const ValueProvider3D* targetMap);
|
void init(int index, int bankIndex, int camIndex, const ValueProvider3D* targetMap);
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ struct AirmassModelBase {
|
||||||
virtual AirmassResult getAirmass(int rpm) = 0;
|
virtual AirmassResult getAirmass(int rpm) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
class AirmassVeModelBase : public AirmassModelBase, public EnginePtr {
|
class AirmassVeModelBase : public AirmassModelBase {
|
||||||
public:
|
public:
|
||||||
explicit AirmassVeModelBase(const ValueProvider3D& veTable);
|
explicit AirmassVeModelBase(const ValueProvider3D& veTable);
|
||||||
|
|
||||||
|
|
|
@ -146,7 +146,6 @@ int getDynoviewPower() {
|
||||||
void updateDynoView() {
|
void updateDynoView() {
|
||||||
if (isBrainPinValid(CONFIG(vehicleSpeedSensorInputPin)) &&
|
if (isBrainPinValid(CONFIG(vehicleSpeedSensorInputPin)) &&
|
||||||
(!CONFIG(enableCanVss))) {
|
(!CONFIG(enableCanVss))) {
|
||||||
dynoInstance.inject();
|
|
||||||
dynoInstance.update(ICU);
|
dynoInstance.update(ICU);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@ typedef enum{
|
||||||
CAN,
|
CAN,
|
||||||
}vssSrc;
|
}vssSrc;
|
||||||
|
|
||||||
class DynoView : public EnginePtr {
|
class DynoView {
|
||||||
public:
|
public:
|
||||||
// Update the state of the launch control system
|
// Update the state of the launch control system
|
||||||
void update(vssSrc src);
|
void update(vssSrc src);
|
||||||
|
|
|
@ -130,7 +130,6 @@ static void initVvtShape(int camIndex, TriggerState &initState) {
|
||||||
|
|
||||||
void Engine::initializeTriggerWaveform() {
|
void Engine::initializeTriggerWaveform() {
|
||||||
static TriggerState initState;
|
static TriggerState initState;
|
||||||
initState.inject();
|
|
||||||
|
|
||||||
// Re-read config in case it's changed
|
// Re-read config in case it's changed
|
||||||
primaryTriggerConfiguration.update();
|
primaryTriggerConfiguration.update();
|
||||||
|
@ -463,23 +462,13 @@ void Engine::OnTriggerSyncronization(bool wasSynchronized) {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void Engine::injectEngineReferences() {
|
void Engine::injectEngineReferences() {
|
||||||
triggerCentral.inject();
|
|
||||||
primaryTriggerConfiguration.inject();
|
|
||||||
for (int camIndex = 0;camIndex < CAMS_PER_BANK;camIndex++) {
|
|
||||||
vvtTriggerConfiguration[camIndex].inject();
|
|
||||||
}
|
|
||||||
limpManager.inject();
|
|
||||||
knockController.inject();
|
|
||||||
|
|
||||||
primaryTriggerConfiguration.update();
|
primaryTriggerConfiguration.update();
|
||||||
for (int camIndex = 0;camIndex < CAMS_PER_BANK;camIndex++) {
|
for (int camIndex = 0;camIndex < CAMS_PER_BANK;camIndex++) {
|
||||||
vvtTriggerConfiguration[camIndex].update();
|
vvtTriggerConfiguration[camIndex].update();
|
||||||
}
|
}
|
||||||
triggerCentral.init();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Engine::setConfig() {
|
void Engine::setConfig() {
|
||||||
inject();
|
|
||||||
efi::clear(config);
|
efi::clear(config);
|
||||||
|
|
||||||
injectEngineReferences();
|
injectEngineReferences();
|
||||||
|
|
|
@ -87,7 +87,7 @@ protected:
|
||||||
|
|
||||||
#define DEFAULT_MOCK_SPEED -1
|
#define DEFAULT_MOCK_SPEED -1
|
||||||
|
|
||||||
class Engine final : public TriggerStateListener, public EnginePtr {
|
class Engine final : public TriggerStateListener {
|
||||||
public:
|
public:
|
||||||
Engine();
|
Engine();
|
||||||
AcState acState;
|
AcState acState;
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
class Engine;
|
class Engine;
|
||||||
|
|
||||||
class InjectionEvent : public EnginePtr {
|
class InjectionEvent {
|
||||||
public:
|
public:
|
||||||
InjectionEvent();
|
InjectionEvent();
|
||||||
|
|
||||||
|
@ -92,7 +92,7 @@ public:
|
||||||
|
|
||||||
#define MAX_OUTPUTS_FOR_IGNITION 2
|
#define MAX_OUTPUTS_FOR_IGNITION 2
|
||||||
|
|
||||||
class IgnitionEvent : public EnginePtr {
|
class IgnitionEvent {
|
||||||
public:
|
public:
|
||||||
IgnitionEvent();
|
IgnitionEvent();
|
||||||
IgnitionOutputPin *outputs[MAX_OUTPUTS_FOR_IGNITION];
|
IgnitionOutputPin *outputs[MAX_OUTPUTS_FOR_IGNITION];
|
||||||
|
@ -139,7 +139,7 @@ public:
|
||||||
bool isReady = false;
|
bool isReady = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
class AuxActor : public EnginePtr {
|
class AuxActor {
|
||||||
public:
|
public:
|
||||||
int phaseIndex;
|
int phaseIndex;
|
||||||
int valveIndex;
|
int valveIndex;
|
||||||
|
|
|
@ -9,7 +9,7 @@ struct IFuelComputer {
|
||||||
};
|
};
|
||||||
|
|
||||||
// This contains the math of the fuel model, but doesn't actually read any configuration
|
// This contains the math of the fuel model, but doesn't actually read any configuration
|
||||||
class FuelComputerBase : public IFuelComputer, public EnginePtr {
|
class FuelComputerBase : public IFuelComputer {
|
||||||
public:
|
public:
|
||||||
mass_t getCycleFuel(mass_t airmass, int rpm, float load) const override;
|
mass_t getCycleFuel(mass_t airmass, int rpm, float load) const override;
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ private:
|
||||||
float m_massFlowRate = 0;
|
float m_massFlowRate = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
class InjectorModel : public InjectorModelBase, public EnginePtr {
|
class InjectorModel : public InjectorModelBase {
|
||||||
public:
|
public:
|
||||||
void postState(float deadtime) const override;
|
void postState(float deadtime) const override;
|
||||||
floatms_t getDeadtime() const override;
|
floatms_t getDeadtime() const override;
|
||||||
|
|
|
@ -305,12 +305,7 @@ static InjectorModel injectorModel;
|
||||||
* is to prepare the fuel map data structure for 3d interpolation
|
* is to prepare the fuel map data structure for 3d interpolation
|
||||||
*/
|
*/
|
||||||
void initFuelMap() {
|
void initFuelMap() {
|
||||||
sdAirmass.inject();
|
|
||||||
mafAirmass.inject();
|
|
||||||
alphaNAirmass.inject();
|
|
||||||
|
|
||||||
fuelComputer.inject();
|
|
||||||
injectorModel.inject();
|
|
||||||
|
|
||||||
ENGINE(fuelComputer) = &fuelComputer;
|
ENGINE(fuelComputer) = &fuelComputer;
|
||||||
ENGINE(injectorModel) = &injectorModel;
|
ENGINE(injectorModel) = &injectorModel;
|
||||||
|
|
|
@ -155,7 +155,6 @@ bool SoftSparkLimiter::shouldSkip() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void initLaunchControl() {
|
void initLaunchControl() {
|
||||||
engine->launchController.inject();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* EFI_LAUNCH_CONTROL */
|
#endif /* EFI_LAUNCH_CONTROL */
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
|
|
||||||
void initLaunchControl();
|
void initLaunchControl();
|
||||||
|
|
||||||
class LaunchControlBase : public EnginePtr {
|
class LaunchControlBase {
|
||||||
public:
|
public:
|
||||||
// Update the state of the launch control system
|
// Update the state of the launch control system
|
||||||
void update();
|
void update();
|
||||||
|
|
|
@ -85,5 +85,4 @@ void ButtonShiftController::update() {
|
||||||
void initButtonShift() {
|
void initButtonShift() {
|
||||||
buttonShiftController.init();
|
buttonShiftController.init();
|
||||||
engine->gearController = &buttonShiftController;
|
engine->gearController = &buttonShiftController;
|
||||||
buttonShiftController.inject();
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,7 +71,6 @@ void initAuxValves() {
|
||||||
actor->valveIndex = valveIndex;
|
actor->valveIndex = valveIndex;
|
||||||
actor->extra = phaseIndex * 360 + valveIndex * 180;
|
actor->extra = phaseIndex * 360 + valveIndex * 180;
|
||||||
|
|
||||||
actor->inject();
|
|
||||||
scheduleOpen(actor);
|
scheduleOpen(actor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -96,7 +96,6 @@ bool FuelSchedule::addFuelEventsForCylinder(int i ) {
|
||||||
bool isSimultanious = mode == IM_SIMULTANEOUS;
|
bool isSimultanious = mode == IM_SIMULTANEOUS;
|
||||||
|
|
||||||
InjectionEvent *ev = &elements[i];
|
InjectionEvent *ev = &elements[i];
|
||||||
ev->inject();
|
|
||||||
|
|
||||||
ev->ownIndex = i;
|
ev->ownIndex = i;
|
||||||
ev->outputs[0] = output;
|
ev->outputs[0] = output;
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
|
|
||||||
int getCylinderKnockBank(uint8_t cylinderIndex);
|
int getCylinderKnockBank(uint8_t cylinderIndex);
|
||||||
|
|
||||||
class KnockController : public EnginePtr {
|
class KnockController {
|
||||||
public:
|
public:
|
||||||
// onKnockSenseCompleted is the callback from the knock sense driver to report a sensed knock level
|
// onKnockSenseCompleted is the callback from the knock sense driver to report a sensed knock level
|
||||||
bool onKnockSenseCompleted(uint8_t cylinderIndex, float dbv, efitick_t lastKnockTime);
|
bool onKnockSenseCompleted(uint8_t cylinderIndex, float dbv, efitick_t lastKnockTime);
|
||||||
|
|
|
@ -99,7 +99,6 @@ void InjectorOutputPin::open(efitick_t nowNt) {
|
||||||
#if EFI_TOOTH_LOGGER
|
#if EFI_TOOTH_LOGGER
|
||||||
LogTriggerInjectorState(nowNt, true);
|
LogTriggerInjectorState(nowNt, true);
|
||||||
#endif // EFI_TOOTH_LOGGER
|
#endif // EFI_TOOTH_LOGGER
|
||||||
this->inject();
|
|
||||||
setHigh();
|
setHigh();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -441,7 +440,6 @@ static bool isPrimeInjectionPulseSkipped() {
|
||||||
* See testStartOfCrankingPrimingPulse()
|
* See testStartOfCrankingPrimingPulse()
|
||||||
*/
|
*/
|
||||||
void startPrimeInjectionPulse() {
|
void startPrimeInjectionPulse() {
|
||||||
engine->primeInjEvent.inject();
|
|
||||||
|
|
||||||
// First, we need a protection against 'fake' ignition switch on and off (i.e. no engine started), to avoid repeated prime pulses.
|
// First, we need a protection against 'fake' ignition switch on and off (i.e. no engine started), to avoid repeated prime pulses.
|
||||||
// So we check and update the ignition switch counter in non-volatile backup-RAM
|
// So we check and update the ignition switch counter in non-volatile backup-RAM
|
||||||
|
|
|
@ -275,9 +275,6 @@ void mapAveragingTriggerCallback(
|
||||||
|
|
||||||
scheduling_s *starTimer = &startTimers[i][structIndex];
|
scheduling_s *starTimer = &startTimers[i][structIndex];
|
||||||
scheduling_s *endTimer = &endTimers[i][structIndex];
|
scheduling_s *endTimer = &endTimers[i][structIndex];
|
||||||
mapAveragingPin.inject();
|
|
||||||
starTimer->inject();
|
|
||||||
endTimer->inject();
|
|
||||||
|
|
||||||
// at the moment we schedule based on time prediction based on current RPM and angle
|
// at the moment we schedule based on time prediction based on current RPM and angle
|
||||||
// we are loosing precision in case of changing RPM - the further away is the event the worse is precision
|
// we are loosing precision in case of changing RPM - the further away is the event the worse is precision
|
||||||
|
|
|
@ -364,7 +364,6 @@ float getCrankshaftAngleNt(efitick_t timeNt) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void initRpmCalculator() {
|
void initRpmCalculator() {
|
||||||
ENGINE(rpmCalculator).inject();
|
|
||||||
|
|
||||||
#if ! HW_CHECK_MODE
|
#if ! HW_CHECK_MODE
|
||||||
if (hasFirmwareError()) {
|
if (hasFirmwareError()) {
|
||||||
|
|
|
@ -42,7 +42,7 @@ typedef enum {
|
||||||
RUNNING,
|
RUNNING,
|
||||||
} spinning_state_e;
|
} spinning_state_e;
|
||||||
|
|
||||||
class RpmCalculator : public StoredValueSensor, public EnginePtr {
|
class RpmCalculator : public StoredValueSensor {
|
||||||
public:
|
public:
|
||||||
#if !EFI_PROD_CODE
|
#if !EFI_PROD_CODE
|
||||||
int mockRpm;
|
int mockRpm;
|
||||||
|
|
|
@ -251,7 +251,6 @@ static void startDwellByTurningSparkPinHigh(IgnitionEvent *event, IgnitionOutput
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
output->inject();
|
|
||||||
output->setHigh();
|
output->setHigh();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -273,7 +272,6 @@ void turnSparkPinHigh(IgnitionEvent *event) {
|
||||||
|
|
||||||
if (CONFIG(enableTrailingSparks)) {
|
if (CONFIG(enableTrailingSparks)) {
|
||||||
IgnitionOutputPin *output = &enginePins.trailingCoils[event->cylinderNumber];
|
IgnitionOutputPin *output = &enginePins.trailingCoils[event->cylinderNumber];
|
||||||
output->inject();
|
|
||||||
// Trailing sparks are enabled - schedule an event for the corresponding trailing coil
|
// Trailing sparks are enabled - schedule an event for the corresponding trailing coil
|
||||||
scheduleByAngle(
|
scheduleByAngle(
|
||||||
&event->trailingSparkCharge, nowNt, ENGINE(engineState.trailingSparkAngle),
|
&event->trailingSparkCharge, nowNt, ENGINE(engineState.trailingSparkAngle),
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
#include "gear_controller.h"
|
#include "gear_controller.h"
|
||||||
|
|
||||||
void GearControllerBase::init() {
|
void GearControllerBase::init() {
|
||||||
transmissionController.inject();
|
|
||||||
transmissionController.init();
|
transmissionController.init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
#include "globalaccess.h"
|
#include "globalaccess.h"
|
||||||
#include "simple_tcu.h"
|
#include "simple_tcu.h"
|
||||||
|
|
||||||
class GearControllerBase : public EnginePtr {
|
class GearControllerBase {
|
||||||
public:
|
public:
|
||||||
virtual void update();
|
virtual void update();
|
||||||
gear_e getDesiredGear() const;
|
gear_e getDesiredGear() const;
|
||||||
|
|
|
@ -23,7 +23,7 @@ private:
|
||||||
bool m_value = true;
|
bool m_value = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
class LimpManager : public EnginePtr {
|
class LimpManager {
|
||||||
public:
|
public:
|
||||||
// This is called from periodicFastCallback to update internal state
|
// This is called from periodicFastCallback to update internal state
|
||||||
void updateState(int rpm, efitick_t nowNt);
|
void updateState(int rpm, efitick_t nowNt);
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
#include "pch.h"
|
#include "pch.h"
|
||||||
#include "sensor_converter_func.h"
|
#include "sensor_converter_func.h"
|
||||||
|
|
||||||
class TurbochargerSpeedConverter : public SensorConverter, public EnginePtr {
|
class TurbochargerSpeedConverter : public SensorConverter {
|
||||||
public:
|
public:
|
||||||
SensorResult convert(float frequency) const override {
|
SensorResult convert(float frequency) const override {
|
||||||
auto hz = frequency * engineConfiguration->turboSpeedSensorMultiplier;
|
auto hz = frequency * engineConfiguration->turboSpeedSensorMultiplier;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#include "pch.h"
|
#include "pch.h"
|
||||||
#include "sensor_converter_func.h"
|
#include "sensor_converter_func.h"
|
||||||
|
|
||||||
class VehicleSpeedConverter : public SensorConverter, public EnginePtr {
|
class VehicleSpeedConverter : public SensorConverter {
|
||||||
public:
|
public:
|
||||||
SensorResult convert(float frequency) const override {
|
SensorResult convert(float frequency) const override {
|
||||||
auto speed = frequency * engineConfiguration->vehicleSpeedCoef;
|
auto speed = frequency * engineConfiguration->vehicleSpeedCoef;
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
#include "tcu.h"
|
#include "tcu.h"
|
||||||
|
|
||||||
class SimpleTransmissionController: public TransmissionControllerBase, public EnginePtr {
|
class SimpleTransmissionController: public TransmissionControllerBase {
|
||||||
public:
|
public:
|
||||||
void update(gear_e);
|
void update(gear_e);
|
||||||
void init();
|
void init();
|
||||||
|
|
|
@ -89,7 +89,7 @@ private:
|
||||||
/**
|
/**
|
||||||
* OutputPin which is reported on Engine Sniffer
|
* OutputPin which is reported on Engine Sniffer
|
||||||
*/
|
*/
|
||||||
class NamedOutputPin : public virtual OutputPin, public EnginePtr {
|
class NamedOutputPin : public virtual OutputPin {
|
||||||
public:
|
public:
|
||||||
NamedOutputPin();
|
NamedOutputPin();
|
||||||
explicit NamedOutputPin(const char *name);
|
explicit NamedOutputPin(const char *name);
|
||||||
|
@ -155,7 +155,7 @@ public:
|
||||||
RegisteredNamedOutputPin(const char *name, short pinOffset, short pinModeOffset);
|
RegisteredNamedOutputPin(const char *name, short pinOffset, short pinModeOffset);
|
||||||
};
|
};
|
||||||
|
|
||||||
class EnginePins : public EnginePtr {
|
class EnginePins {
|
||||||
public:
|
public:
|
||||||
EnginePins();
|
EnginePins();
|
||||||
void startPins();
|
void startPins();
|
||||||
|
|
|
@ -39,7 +39,7 @@ private:
|
||||||
* This structure holds information about an event scheduled in the future: when to execute what callback with what parameters
|
* This structure holds information about an event scheduled in the future: when to execute what callback with what parameters
|
||||||
*/
|
*/
|
||||||
#pragma pack(push, 4)
|
#pragma pack(push, 4)
|
||||||
struct scheduling_s : public EnginePtr {
|
struct scheduling_s {
|
||||||
#if EFI_SIGNAL_EXECUTOR_SLEEP
|
#if EFI_SIGNAL_EXECUTOR_SLEEP
|
||||||
virtual_timer_t timer;
|
virtual_timer_t timer;
|
||||||
#endif /* EFI_SIGNAL_EXECUTOR_SLEEP */
|
#endif /* EFI_SIGNAL_EXECUTOR_SLEEP */
|
||||||
|
|
|
@ -51,15 +51,6 @@ TriggerCentral::TriggerCentral() : trigger_central_s(),
|
||||||
noiseFilter.resetAccumSignalData();
|
noiseFilter.resetAccumSignalData();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TriggerCentral::init() {
|
|
||||||
triggerState.inject();
|
|
||||||
for (int bankIndex = 0; bankIndex < BANKS_COUNT; bankIndex++) {
|
|
||||||
for (int camIndex = 0; camIndex < CAMS_PER_BANK; camIndex++) {
|
|
||||||
vvtState[bankIndex][camIndex].inject();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void TriggerNoiseFilter::resetAccumSignalData() {
|
void TriggerNoiseFilter::resetAccumSignalData() {
|
||||||
memset(lastSignalTimes, 0xff, sizeof(lastSignalTimes)); // = -1
|
memset(lastSignalTimes, 0xff, sizeof(lastSignalTimes)); // = -1
|
||||||
memset(accumSignalPeriods, 0, sizeof(accumSignalPeriods));
|
memset(accumSignalPeriods, 0, sizeof(accumSignalPeriods));
|
||||||
|
|
|
@ -37,10 +37,9 @@ public:
|
||||||
* Probably not: we have an instance of TriggerState which is used for trigger initialization,
|
* Probably not: we have an instance of TriggerState which is used for trigger initialization,
|
||||||
* also composition probably better than inheritance here
|
* also composition probably better than inheritance here
|
||||||
*/
|
*/
|
||||||
class TriggerCentral final : public trigger_central_s, public EnginePtr {
|
class TriggerCentral final : public trigger_central_s {
|
||||||
public:
|
public:
|
||||||
TriggerCentral();
|
TriggerCentral();
|
||||||
void init();
|
|
||||||
void handleShaftSignal(trigger_event_e signal, efitick_t timestamp);
|
void handleShaftSignal(trigger_event_e signal, efitick_t timestamp);
|
||||||
int getHwEventCounter(int index) const;
|
int getHwEventCounter(int index) const;
|
||||||
void resetCounters();
|
void resetCounters();
|
||||||
|
|
|
@ -24,7 +24,7 @@ struct TriggerStateListener {
|
||||||
#endif // EFI_SHAFT_POSITION_INPUT
|
#endif // EFI_SHAFT_POSITION_INPUT
|
||||||
};
|
};
|
||||||
|
|
||||||
class TriggerConfiguration : public EnginePtr {
|
class TriggerConfiguration {
|
||||||
public:
|
public:
|
||||||
explicit TriggerConfiguration(const char* printPrefix) : PrintPrefix(printPrefix) {}
|
explicit TriggerConfiguration(const char* printPrefix) : PrintPrefix(printPrefix) {}
|
||||||
void update();
|
void update();
|
||||||
|
@ -74,7 +74,7 @@ typedef struct {
|
||||||
/**
|
/**
|
||||||
* @see TriggerWaveform for trigger wheel shape definition
|
* @see TriggerWaveform for trigger wheel shape definition
|
||||||
*/
|
*/
|
||||||
class TriggerState : public trigger_state_s, public EnginePtr {
|
class TriggerState : public trigger_state_s {
|
||||||
public:
|
public:
|
||||||
TriggerState();
|
TriggerState();
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
/**
|
/**
|
||||||
* @brief rusEfi console sniffer data buffer
|
* @brief rusEfi console sniffer data buffer
|
||||||
*/
|
*/
|
||||||
class WaveChart : public EnginePtr {
|
class WaveChart {
|
||||||
public:
|
public:
|
||||||
WaveChart();
|
WaveChart();
|
||||||
void init();
|
void init();
|
||||||
|
|
|
@ -80,7 +80,7 @@ public:
|
||||||
#define DEFINE_PARAM_SUFFIX(x) , x
|
#define DEFINE_PARAM_SUFFIX(x) , x
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
class HIP9011 : public EnginePtr {
|
class HIP9011 {
|
||||||
public:
|
public:
|
||||||
explicit HIP9011(Hip9011HardwareInterface *hardware);
|
explicit HIP9011(Hip9011HardwareInterface *hardware);
|
||||||
int sendCommand(uint8_t cmd);
|
int sendCommand(uint8_t cmd);
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
#include "adc_subscription.h"
|
#include "adc_subscription.h"
|
||||||
#include "function_pointer_sensor.h"
|
#include "function_pointer_sensor.h"
|
||||||
|
|
||||||
struct GetAfrWrapper : public EnginePtr {
|
struct GetAfrWrapper {
|
||||||
float getLambda() {
|
float getLambda() {
|
||||||
return getAfr() / 14.7f;
|
return getAfr() / 14.7f;
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,6 @@ static AemXSeriesWideband aem2(1, SensorType::Lambda2);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void initLambda() {
|
void initLambda() {
|
||||||
afrWrapper.inject();
|
|
||||||
|
|
||||||
#if EFI_CAN_SUPPORT
|
#if EFI_CAN_SUPPORT
|
||||||
if (CONFIG(enableAemXSeries)) {
|
if (CONFIG(enableAemXSeries)) {
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
#include "function_pointer_sensor.h"
|
#include "function_pointer_sensor.h"
|
||||||
#include "identity_func.h"
|
#include "identity_func.h"
|
||||||
|
|
||||||
struct GetBaroWrapper : public EnginePtr {
|
struct GetBaroWrapper {
|
||||||
float getBaro() {
|
float getBaro() {
|
||||||
return ::getBaroPressure();
|
return ::getBaroPressure();
|
||||||
}
|
}
|
||||||
|
@ -111,7 +111,6 @@ void configureMapFunction() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void initMap() {
|
void initMap() {
|
||||||
baroWrapper.inject();
|
|
||||||
|
|
||||||
auto mapChannel = engineConfiguration->map.sensor.hwChannel;
|
auto mapChannel = engineConfiguration->map.sensor.hwChannel;
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,6 @@ static TurbochargerSpeedConverter turbochargerSpeedConverter;
|
||||||
|
|
||||||
|
|
||||||
void initTurbochargerSpeedSensor() {
|
void initTurbochargerSpeedSensor() {
|
||||||
turbochargerSpeedConverter.inject();
|
|
||||||
|
|
||||||
auto pin = CONFIG(turboSpeedSensorInputPin);
|
auto pin = CONFIG(turboSpeedSensorInputPin);
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,6 @@ static FrequencySensor vehicleSpeedSensor(SensorType::VehicleSpeed, MS2NT(500));
|
||||||
static VehicleSpeedConverter vehicleSpeedConverter;
|
static VehicleSpeedConverter vehicleSpeedConverter;
|
||||||
|
|
||||||
void initVehicleSpeedSensor() {
|
void initVehicleSpeedSensor() {
|
||||||
vehicleSpeedConverter.inject();
|
|
||||||
|
|
||||||
auto pin = CONFIG(vehicleSpeedSensorInputPin);
|
auto pin = CONFIG(vehicleSpeedSensorInputPin);
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ struct pid_s;
|
||||||
/**
|
/**
|
||||||
* default basic implementation also known as PidParallelController
|
* default basic implementation also known as PidParallelController
|
||||||
*/
|
*/
|
||||||
class Pid : public pid_state_s, public EnginePtr {
|
class Pid : public pid_state_s {
|
||||||
public:
|
public:
|
||||||
Pid();
|
Pid();
|
||||||
explicit Pid(pid_s *parameters);
|
explicit Pid(pid_s *parameters);
|
||||||
|
|
|
@ -86,11 +86,9 @@ EngineTestHelper::EngineTestHelper(engine_type_e engineType, configuration_callb
|
||||||
|
|
||||||
memset(&activeConfiguration, 0, sizeof(activeConfiguration));
|
memset(&activeConfiguration, 0, sizeof(activeConfiguration));
|
||||||
|
|
||||||
enginePins.inject();
|
|
||||||
enginePins.reset();
|
enginePins.reset();
|
||||||
enginePins.unregisterPins();
|
enginePins.unregisterPins();
|
||||||
|
|
||||||
waveChart.inject();
|
|
||||||
waveChart.init();
|
waveChart.init();
|
||||||
|
|
||||||
setCurveValue(config->cltFuelCorrBins, config->cltFuelCorr, CLT_CURVE_SIZE, -40, 1.5);
|
setCurveValue(config->cltFuelCorrBins, config->cltFuelCorr, CLT_CURVE_SIZE, -40, 1.5);
|
||||||
|
|
|
@ -28,7 +28,7 @@ static void doRevolution(EngineTestHelper& eth, int periodMs) {
|
||||||
|
|
||||||
// https://github.com/rusefi/rusefi/issues/1592
|
// https://github.com/rusefi/rusefi/issues/1592
|
||||||
TEST(fuelControl, transitionIssue1592) {
|
TEST(fuelControl, transitionIssue1592) {
|
||||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
EngineTestHelper eth(TEST_ENGINE);
|
||||||
ENGINE(tdcMarkEnabled) = false;
|
ENGINE(tdcMarkEnabled) = false;
|
||||||
setupSimpleTestEngineWithMafAndTT_ONE_trigger(ð, IM_SEQUENTIAL);
|
setupSimpleTestEngineWithMafAndTT_ONE_trigger(ð, IM_SEQUENTIAL);
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
|
|
||||||
TEST(scheduler, dwellIssue796) {
|
TEST(scheduler, dwellIssue796) {
|
||||||
|
|
||||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
EngineTestHelper eth(TEST_ENGINE);
|
||||||
setupSimpleTestEngineWithMafAndTT_ONE_trigger(ð, IM_SEQUENTIAL);
|
setupSimpleTestEngineWithMafAndTT_ONE_trigger(ð, IM_SEQUENTIAL);
|
||||||
|
|
||||||
eth.fireTriggerEvents2(4 /* count */ , 600 /* ms */);
|
eth.fireTriggerEvents2(4 /* count */ , 600 /* ms */);
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
using ::testing::_;
|
using ::testing::_;
|
||||||
|
|
||||||
TEST(fuelCut, coasting) {
|
TEST(fuelCut, coasting) {
|
||||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
EngineTestHelper eth(TEST_ENGINE);
|
||||||
EXPECT_CALL(eth.mockAirmass, getAirmass(_))
|
EXPECT_CALL(eth.mockAirmass, getAirmass(_))
|
||||||
.WillRepeatedly(Return(AirmassResult{0.1008f, 50.0f}));
|
.WillRepeatedly(Return(AirmassResult{0.1008f, 50.0f}));
|
||||||
|
|
||||||
|
|
|
@ -14,10 +14,9 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
TEST(FuelComputer, getCycleFuel) {
|
TEST(FuelComputer, getCycleFuel) {
|
||||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
EngineTestHelper eth(TEST_ENGINE);
|
||||||
|
|
||||||
MockFuelComputer dut;
|
MockFuelComputer dut;
|
||||||
dut.inject();
|
|
||||||
|
|
||||||
EXPECT_CALL(dut, getTargetLambdaLoadAxis(FloatEq(0.8f)))
|
EXPECT_CALL(dut, getTargetLambdaLoadAxis(FloatEq(0.8f)))
|
||||||
.WillOnce(Return(0.8f));
|
.WillOnce(Return(0.8f));
|
||||||
|
@ -41,11 +40,10 @@ TEST(FuelComputer, LambdaLookup) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(FuelComputer, FlexFuel) {
|
TEST(FuelComputer, FlexFuel) {
|
||||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
EngineTestHelper eth(TEST_ENGINE);
|
||||||
|
|
||||||
MockVp3d lambdaTable;
|
MockVp3d lambdaTable;
|
||||||
FuelComputer dut(lambdaTable);
|
FuelComputer dut(lambdaTable);
|
||||||
dut.inject();
|
|
||||||
|
|
||||||
// easier values for testing
|
// easier values for testing
|
||||||
engineConfiguration->stoichRatioPrimary = 15;
|
engineConfiguration->stoichRatioPrimary = 15;
|
||||||
|
|
|
@ -16,7 +16,7 @@ using ::testing::FloatNear;
|
||||||
|
|
||||||
TEST(misc, testFuelMap) {
|
TEST(misc, testFuelMap) {
|
||||||
printf("Setting up FORD_ASPIRE_1996\r\n");
|
printf("Setting up FORD_ASPIRE_1996\r\n");
|
||||||
WITH_ENGINE_TEST_HELPER(FORD_ASPIRE_1996);
|
EngineTestHelper eth(FORD_ASPIRE_1996);
|
||||||
|
|
||||||
for (int i = 0; i < VBAT_INJECTOR_CURVE_SIZE; i++) {
|
for (int i = 0; i < VBAT_INJECTOR_CURVE_SIZE; i++) {
|
||||||
CONFIG(injector.battLagCorrBins[i]) = i;
|
CONFIG(injector.battLagCorrBins[i]) = i;
|
||||||
|
@ -133,7 +133,7 @@ static void configureFordAspireTriggerWaveform(TriggerWaveform * s) {
|
||||||
TEST(misc, testAngleResolver) {
|
TEST(misc, testAngleResolver) {
|
||||||
printf("*************************************************** testAngleResolver\r\n");
|
printf("*************************************************** testAngleResolver\r\n");
|
||||||
|
|
||||||
WITH_ENGINE_TEST_HELPER(FORD_ASPIRE_1996);
|
EngineTestHelper eth(FORD_ASPIRE_1996);
|
||||||
|
|
||||||
engineConfiguration->globalTriggerAngleOffset = 175;
|
engineConfiguration->globalTriggerAngleOffset = 175;
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ using ::testing::InSequence;
|
||||||
using ::testing::_;
|
using ::testing::_;
|
||||||
|
|
||||||
TEST(FuelMath, getStandardAirCharge) {
|
TEST(FuelMath, getStandardAirCharge) {
|
||||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
EngineTestHelper eth(TEST_ENGINE);
|
||||||
|
|
||||||
// Miata 1839cc 4cyl
|
// Miata 1839cc 4cyl
|
||||||
CONFIG(specs.displacement) = 1.839f;
|
CONFIG(specs.displacement) = 1.839f;
|
||||||
|
@ -36,7 +36,7 @@ TEST(FuelMath, getStandardAirCharge) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(AirmassModes, AlphaNNormal) {
|
TEST(AirmassModes, AlphaNNormal) {
|
||||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
EngineTestHelper eth(TEST_ENGINE);
|
||||||
// 4 cylinder 4 liter = easy math
|
// 4 cylinder 4 liter = easy math
|
||||||
engineConfiguration->specs.displacement = 4.0f;
|
engineConfiguration->specs.displacement = 4.0f;
|
||||||
engineConfiguration->specs.cylindersCount = 4;
|
engineConfiguration->specs.cylindersCount = 4;
|
||||||
|
@ -47,7 +47,6 @@ TEST(AirmassModes, AlphaNNormal) {
|
||||||
.WillOnce(Return(35.0f));
|
.WillOnce(Return(35.0f));
|
||||||
|
|
||||||
AlphaNAirmass dut(veTable);
|
AlphaNAirmass dut(veTable);
|
||||||
dut.inject();
|
|
||||||
|
|
||||||
Sensor::setMockValue(SensorType::Tps1, 0.71f);
|
Sensor::setMockValue(SensorType::Tps1, 0.71f);
|
||||||
|
|
||||||
|
@ -60,13 +59,12 @@ TEST(AirmassModes, AlphaNNormal) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(AirmassModes, AlphaNFailedTps) {
|
TEST(AirmassModes, AlphaNFailedTps) {
|
||||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
EngineTestHelper eth(TEST_ENGINE);
|
||||||
|
|
||||||
// Shouldn't get called
|
// Shouldn't get called
|
||||||
StrictMock<MockVp3d> veTable;
|
StrictMock<MockVp3d> veTable;
|
||||||
|
|
||||||
AlphaNAirmass dut(veTable);
|
AlphaNAirmass dut(veTable);
|
||||||
dut.inject();
|
|
||||||
|
|
||||||
// explicitly reset the sensor
|
// explicitly reset the sensor
|
||||||
Sensor::resetMockValue(SensorType::Tps1);
|
Sensor::resetMockValue(SensorType::Tps1);
|
||||||
|
@ -78,7 +76,7 @@ TEST(AirmassModes, AlphaNFailedTps) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(AirmassModes, MafNormal) {
|
TEST(AirmassModes, MafNormal) {
|
||||||
WITH_ENGINE_TEST_HELPER(FORD_ASPIRE_1996);
|
EngineTestHelper eth(FORD_ASPIRE_1996);
|
||||||
engineConfiguration->fuelAlgorithm = LM_REAL_MAF;
|
engineConfiguration->fuelAlgorithm = LM_REAL_MAF;
|
||||||
engineConfiguration->injector.flow = 200;
|
engineConfiguration->injector.flow = 200;
|
||||||
|
|
||||||
|
@ -88,7 +86,6 @@ TEST(AirmassModes, MafNormal) {
|
||||||
.WillOnce(Return(75.0f));
|
.WillOnce(Return(75.0f));
|
||||||
|
|
||||||
MafAirmass dut(veTable);
|
MafAirmass dut(veTable);
|
||||||
dut.inject();
|
|
||||||
|
|
||||||
auto airmass = dut.getAirmassImpl(200, 6000);
|
auto airmass = dut.getAirmassImpl(200, 6000);
|
||||||
|
|
||||||
|
@ -120,9 +117,8 @@ TEST(AirmassModes, VeOverride) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
EngineTestHelper eth(TEST_ENGINE);
|
||||||
DummyAirmassModel dut(veTable);
|
DummyAirmassModel dut(veTable);
|
||||||
dut.inject();
|
|
||||||
|
|
||||||
// Use default mode - will call with 10
|
// Use default mode - will call with 10
|
||||||
dut.getAirmass(0);
|
dut.getAirmass(0);
|
||||||
|
@ -138,7 +134,7 @@ TEST(AirmassModes, VeOverride) {
|
||||||
void setInjectionMode(int value);
|
void setInjectionMode(int value);
|
||||||
|
|
||||||
TEST(FuelMath, testDifferentInjectionModes) {
|
TEST(FuelMath, testDifferentInjectionModes) {
|
||||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
EngineTestHelper eth(TEST_ENGINE);
|
||||||
setupSimpleTestEngineWithMafAndTT_ONE_trigger(ð);
|
setupSimpleTestEngineWithMafAndTT_ONE_trigger(ð);
|
||||||
|
|
||||||
EXPECT_CALL(eth.mockAirmass, getAirmass(_))
|
EXPECT_CALL(eth.mockAirmass, getAirmass(_))
|
||||||
|
@ -163,7 +159,7 @@ TEST(FuelMath, testDifferentInjectionModes) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(FuelMath, deadtime) {
|
TEST(FuelMath, deadtime) {
|
||||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
EngineTestHelper eth(TEST_ENGINE);
|
||||||
|
|
||||||
setupSimpleTestEngineWithMafAndTT_ONE_trigger(ð);
|
setupSimpleTestEngineWithMafAndTT_ONE_trigger(ð);
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
#include "pch.h"
|
#include "pch.h"
|
||||||
|
|
||||||
TEST(fuel, testWallWettingEnrichmentMath) {
|
TEST(fuel, testWallWettingEnrichmentMath) {
|
||||||
WITH_ENGINE_TEST_HELPER(FORD_ASPIRE_1996);
|
EngineTestHelper eth(FORD_ASPIRE_1996);
|
||||||
|
|
||||||
engineConfiguration->wwaeTau = 1.0f;
|
engineConfiguration->wwaeTau = 1.0f;
|
||||||
engineConfiguration->wwaeBeta = 0.40f;
|
engineConfiguration->wwaeBeta = 0.40f;
|
||||||
|
@ -26,7 +26,7 @@ TEST(fuel, testWallWettingEnrichmentMath) {
|
||||||
|
|
||||||
TEST(fuel, testWallWettingEnrichmentScheduling) {
|
TEST(fuel, testWallWettingEnrichmentScheduling) {
|
||||||
|
|
||||||
WITH_ENGINE_TEST_HELPER(FORD_ASPIRE_1996);
|
EngineTestHelper eth(FORD_ASPIRE_1996);
|
||||||
|
|
||||||
setOperationMode(engineConfiguration, FOUR_STROKE_CRANK_SENSOR);
|
setOperationMode(engineConfiguration, FOUR_STROKE_CRANK_SENSOR);
|
||||||
engineConfiguration->useOnlyRisingEdgeForTrigger = true;
|
engineConfiguration->useOnlyRisingEdgeForTrigger = true;
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
using ::testing::_;
|
using ::testing::_;
|
||||||
|
|
||||||
TEST(ignition, twoCoils) {
|
TEST(ignition, twoCoils) {
|
||||||
WITH_ENGINE_TEST_HELPER(FRANKENSO_BMW_M73_F);
|
EngineTestHelper eth(FRANKENSO_BMW_M73_F);
|
||||||
|
|
||||||
// first one to fire uses first coil
|
// first one to fire uses first coil
|
||||||
ASSERT_EQ(ENGINE(ignitionPin[ID2INDEX(1)]), 0);
|
ASSERT_EQ(ENGINE(ignitionPin[ID2INDEX(1)]), 0);
|
||||||
|
@ -38,7 +38,7 @@ TEST(ignition, twoCoils) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(ignition, trailingSpark) {
|
TEST(ignition, trailingSpark) {
|
||||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
EngineTestHelper eth(TEST_ENGINE);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
// TODO #3220: this feature makes this test sad, eventually remove this line (and the ability to disable it altogether)
|
// TODO #3220: this feature makes this test sad, eventually remove this line (and the ability to disable it altogether)
|
||||||
|
|
|
@ -59,9 +59,8 @@ TEST(InjectorModel, getInjectionDurationNonlinear) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(InjectorModel, nonlinearPolynomial) {
|
TEST(InjectorModel, nonlinearPolynomial) {
|
||||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
EngineTestHelper eth(TEST_ENGINE);
|
||||||
InjectorModel dut;
|
InjectorModel dut;
|
||||||
dut.inject();
|
|
||||||
|
|
||||||
CONFIG(applyNonlinearBelowPulse) = MS2US(10);
|
CONFIG(applyNonlinearBelowPulse) = MS2US(10);
|
||||||
|
|
||||||
|
@ -80,7 +79,7 @@ TEST(InjectorModel, nonlinearPolynomial) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(InjectorModel, Deadtime) {
|
TEST(InjectorModel, Deadtime) {
|
||||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
EngineTestHelper eth(TEST_ENGINE);
|
||||||
|
|
||||||
// Some test data in the injector correction table
|
// Some test data in the injector correction table
|
||||||
for (size_t i = 0; i < efi::size(engineConfiguration->injector.battLagCorr); i++) {
|
for (size_t i = 0; i < efi::size(engineConfiguration->injector.battLagCorr); i++) {
|
||||||
|
@ -89,7 +88,6 @@ TEST(InjectorModel, Deadtime) {
|
||||||
}
|
}
|
||||||
|
|
||||||
InjectorModel dut;
|
InjectorModel dut;
|
||||||
dut.inject();
|
|
||||||
|
|
||||||
Sensor::setMockValue(SensorType::BatteryVoltage, 3);
|
Sensor::setMockValue(SensorType::BatteryVoltage, 3);
|
||||||
EXPECT_EQ(dut.getDeadtime(), 6);
|
EXPECT_EQ(dut.getDeadtime(), 6);
|
||||||
|
@ -121,8 +119,7 @@ TEST_P(FlowRateFixture, FlowRateRatio) {
|
||||||
StrictMock<TesterGetFlowRate> dut;
|
StrictMock<TesterGetFlowRate> dut;
|
||||||
EXPECT_CALL(dut, getInjectorFlowRatio()).WillOnce(Return(flowRatio));
|
EXPECT_CALL(dut, getInjectorFlowRatio()).WillOnce(Return(flowRatio));
|
||||||
|
|
||||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
EngineTestHelper eth(TEST_ENGINE);
|
||||||
dut.inject();
|
|
||||||
engineConfiguration->injector.flow = 500;
|
engineConfiguration->injector.flow = 500;
|
||||||
|
|
||||||
// 500 cc/min = 6g/s
|
// 500 cc/min = 6g/s
|
||||||
|
@ -141,8 +138,7 @@ TEST_P(FlowRateFixture, PressureRatio) {
|
||||||
StrictMock<TesterGetRailPressure> dut;
|
StrictMock<TesterGetRailPressure> dut;
|
||||||
EXPECT_CALL(dut, getAbsoluteRailPressure()).WillOnce(Return(400 * pressureRatio + fakeMap));
|
EXPECT_CALL(dut, getAbsoluteRailPressure()).WillOnce(Return(400 * pressureRatio + fakeMap));
|
||||||
|
|
||||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
EngineTestHelper eth(TEST_ENGINE);
|
||||||
dut.inject();
|
|
||||||
|
|
||||||
// Use injector compensation
|
// Use injector compensation
|
||||||
engineConfiguration->injectorCompensationMode = ICM_SensedRailPressure;
|
engineConfiguration->injectorCompensationMode = ICM_SensedRailPressure;
|
||||||
|
@ -160,8 +156,7 @@ TEST_P(FlowRateFixture, PressureRatio) {
|
||||||
TEST(InjectorModel, NegativePressureDelta) {
|
TEST(InjectorModel, NegativePressureDelta) {
|
||||||
StrictMock<TesterGetRailPressure> dut;
|
StrictMock<TesterGetRailPressure> dut;
|
||||||
|
|
||||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
EngineTestHelper eth(TEST_ENGINE);
|
||||||
dut.inject();
|
|
||||||
|
|
||||||
// Use injector compensation
|
// Use injector compensation
|
||||||
engineConfiguration->injectorCompensationMode = ICM_SensedRailPressure;
|
engineConfiguration->injectorCompensationMode = ICM_SensedRailPressure;
|
||||||
|
@ -180,8 +175,7 @@ TEST(InjectorModel, NegativePressureDelta) {
|
||||||
TEST(InjectorModel, VariableInjectorFlowModeNone) {
|
TEST(InjectorModel, VariableInjectorFlowModeNone) {
|
||||||
StrictMock<TesterGetRailPressure> dut;
|
StrictMock<TesterGetRailPressure> dut;
|
||||||
|
|
||||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
EngineTestHelper eth(TEST_ENGINE);
|
||||||
dut.inject();
|
|
||||||
|
|
||||||
engineConfiguration->injectorCompensationMode = ICM_None;
|
engineConfiguration->injectorCompensationMode = ICM_None;
|
||||||
|
|
||||||
|
@ -192,8 +186,7 @@ TEST(InjectorModel, VariableInjectorFlowModeNone) {
|
||||||
TEST(InjectorModel, RailPressureFixed) {
|
TEST(InjectorModel, RailPressureFixed) {
|
||||||
InjectorModel dut;
|
InjectorModel dut;
|
||||||
|
|
||||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
EngineTestHelper eth(TEST_ENGINE);
|
||||||
dut.inject();
|
|
||||||
|
|
||||||
// Reference pressure is 350kpa
|
// Reference pressure is 350kpa
|
||||||
engineConfiguration->fuelReferencePressure = 350;
|
engineConfiguration->fuelReferencePressure = 350;
|
||||||
|
@ -206,8 +199,7 @@ TEST(InjectorModel, RailPressureFixed) {
|
||||||
TEST(InjectorModel, RailPressureSensed) {
|
TEST(InjectorModel, RailPressureSensed) {
|
||||||
InjectorModel dut;
|
InjectorModel dut;
|
||||||
|
|
||||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
EngineTestHelper eth(TEST_ENGINE);
|
||||||
dut.inject();
|
|
||||||
|
|
||||||
// Reference pressure is 350kpa
|
// Reference pressure is 350kpa
|
||||||
engineConfiguration->injectorCompensationMode = ICM_SensedRailPressure;
|
engineConfiguration->injectorCompensationMode = ICM_SensedRailPressure;
|
||||||
|
@ -224,8 +216,7 @@ TEST(InjectorModel, RailPressureSensed) {
|
||||||
TEST(InjectorModel, FailedPressureSensor) {
|
TEST(InjectorModel, FailedPressureSensor) {
|
||||||
InjectorModel dut;
|
InjectorModel dut;
|
||||||
|
|
||||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
EngineTestHelper eth(TEST_ENGINE);
|
||||||
dut.inject();
|
|
||||||
|
|
||||||
// Reference pressure is 350kpa
|
// Reference pressure is 350kpa
|
||||||
engineConfiguration->injectorCompensationMode = ICM_SensedRailPressure;
|
engineConfiguration->injectorCompensationMode = ICM_SensedRailPressure;
|
||||||
|
@ -243,8 +234,7 @@ TEST(InjectorModel, FailedPressureSensor) {
|
||||||
TEST(InjectorModel, MissingPressureSensor) {
|
TEST(InjectorModel, MissingPressureSensor) {
|
||||||
InjectorModel dut;
|
InjectorModel dut;
|
||||||
|
|
||||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
EngineTestHelper eth(TEST_ENGINE);
|
||||||
dut.inject();
|
|
||||||
|
|
||||||
// Reference pressure is 350kpa
|
// Reference pressure is 350kpa
|
||||||
engineConfiguration->injectorCompensationMode = ICM_SensedRailPressure;
|
engineConfiguration->injectorCompensationMode = ICM_SensedRailPressure;
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
#include "advance_map.h"
|
#include "advance_map.h"
|
||||||
|
|
||||||
TEST(Multispark, DefaultConfiguration) {
|
TEST(Multispark, DefaultConfiguration) {
|
||||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
EngineTestHelper eth(TEST_ENGINE);
|
||||||
|
|
||||||
EXPECT_EQ(0, getMultiSparkCount(0 ));
|
EXPECT_EQ(0, getMultiSparkCount(0 ));
|
||||||
EXPECT_EQ(0, getMultiSparkCount(100 ));
|
EXPECT_EQ(0, getMultiSparkCount(100 ));
|
||||||
|
@ -37,7 +37,7 @@ static void multisparkCfg() {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(Multispark, EnabledNoMaxRpm) {
|
TEST(Multispark, EnabledNoMaxRpm) {
|
||||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
EngineTestHelper eth(TEST_ENGINE);
|
||||||
|
|
||||||
multisparkCfg();
|
multisparkCfg();
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@ TEST(Multispark, EnabledNoMaxRpm) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(Multispark, RpmLimit) {
|
TEST(Multispark, RpmLimit) {
|
||||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
EngineTestHelper eth(TEST_ENGINE);
|
||||||
|
|
||||||
multisparkCfg();
|
multisparkCfg();
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
#include "spark_logic.h"
|
#include "spark_logic.h"
|
||||||
|
|
||||||
TEST(issues, issueOneCylinderSpecialCase968) {
|
TEST(issues, issueOneCylinderSpecialCase968) {
|
||||||
WITH_ENGINE_TEST_HELPER(GY6_139QMB);
|
EngineTestHelper eth(GY6_139QMB);
|
||||||
ENGINE(tdcMarkEnabled) = false;
|
ENGINE(tdcMarkEnabled) = false;
|
||||||
// set injection_mode 1
|
// set injection_mode 1
|
||||||
engineConfiguration->injectionMode = IM_SEQUENTIAL;
|
engineConfiguration->injectionMode = IM_SEQUENTIAL;
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
#include "pch.h"
|
#include "pch.h"
|
||||||
|
|
||||||
TEST(engine, testPlainCrankingWithoutAdvancedFeatures) {
|
TEST(engine, testPlainCrankingWithoutAdvancedFeatures) {
|
||||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
EngineTestHelper eth(TEST_ENGINE);
|
||||||
|
|
||||||
ENGINE(tdcMarkEnabled) = false;
|
ENGINE(tdcMarkEnabled) = false;
|
||||||
engineConfiguration->cranking.baseFuel = 12;
|
engineConfiguration->cranking.baseFuel = 12;
|
||||||
|
@ -33,7 +33,7 @@ TEST(engine, testPlainCrankingWithoutAdvancedFeatures) {
|
||||||
|
|
||||||
|
|
||||||
TEST(engine, testStartOfCrankingPrimingPulse) {
|
TEST(engine, testStartOfCrankingPrimingPulse) {
|
||||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
EngineTestHelper eth(TEST_ENGINE);
|
||||||
|
|
||||||
engineConfiguration->startOfCrankingPrimingPulse = 4;
|
engineConfiguration->startOfCrankingPrimingPulse = 4;
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,7 @@ end
|
||||||
)";
|
)";
|
||||||
|
|
||||||
TEST(LuaHooks, Table3d) {
|
TEST(LuaHooks, Table3d) {
|
||||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
EngineTestHelper eth(TEST_ENGINE);
|
||||||
|
|
||||||
setTable(config->scriptTable2, (uint8_t)33);
|
setTable(config->scriptTable2, (uint8_t)33);
|
||||||
EXPECT_EQ(testLuaReturnsNumber(tableTest), 33);
|
EXPECT_EQ(testLuaReturnsNumber(tableTest), 33);
|
||||||
|
|
|
@ -19,7 +19,7 @@ end
|
||||||
)";
|
)";
|
||||||
|
|
||||||
TEST(LuaHooks, TestCurve) {
|
TEST(LuaHooks, TestCurve) {
|
||||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
EngineTestHelper eth(TEST_ENGINE);
|
||||||
|
|
||||||
strcpy(engineConfiguration->scriptCurveName[3], "hello");
|
strcpy(engineConfiguration->scriptCurveName[3], "hello");
|
||||||
setLinearCurve(engineConfiguration->scriptCurve4, 500, 600, 1);
|
setLinearCurve(engineConfiguration->scriptCurve4, 500, 600, 1);
|
||||||
|
|
|
@ -22,7 +22,7 @@ TEST(testCJ125, testInitialState) {
|
||||||
ASSERT_FALSE(cj.isWorkingState());
|
ASSERT_FALSE(cj.isWorkingState());
|
||||||
ASSERT_EQ(cj.heaterDuty, 0);
|
ASSERT_EQ(cj.heaterDuty, 0);
|
||||||
|
|
||||||
WITH_ENGINE_TEST_HELPER(FORD_ASPIRE_1996);
|
EngineTestHelper eth(FORD_ASPIRE_1996);
|
||||||
|
|
||||||
cj.StartHeaterControl();
|
cj.StartHeaterControl();
|
||||||
ASSERT_EQ(cj.heaterDuty, CJ125_HEATER_IDLE_RATE);
|
ASSERT_EQ(cj.heaterDuty, CJ125_HEATER_IDLE_RATE);
|
||||||
|
@ -49,7 +49,7 @@ TEST(testCJ125, testFailedIdentify) {
|
||||||
TestSpi mock;
|
TestSpi mock;
|
||||||
cj.spi = &mock;
|
cj.spi = &mock;
|
||||||
|
|
||||||
WITH_ENGINE_TEST_HELPER(FORD_ASPIRE_1996);
|
EngineTestHelper eth(FORD_ASPIRE_1996);
|
||||||
|
|
||||||
cj.cjIdentify();
|
cj.cjIdentify();
|
||||||
ASSERT_EQ(cj.errorCode, CJ125_ERROR_WRONG_IDENT);
|
ASSERT_EQ(cj.errorCode, CJ125_ERROR_WRONG_IDENT);
|
||||||
|
|
|
@ -51,7 +51,7 @@ public:
|
||||||
*/
|
*/
|
||||||
TEST_F(FrequencySensorTest, testValidWithPwm) {
|
TEST_F(FrequencySensorTest, testValidWithPwm) {
|
||||||
ASSERT_TRUE(dut.Register());
|
ASSERT_TRUE(dut.Register());
|
||||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
EngineTestHelper eth(TEST_ENGINE);
|
||||||
|
|
||||||
// Should be invalid - not set yet
|
// Should be invalid - not set yet
|
||||||
{
|
{
|
||||||
|
|
|
@ -24,7 +24,7 @@ static void postToFuncSensor(Sensor* s, float value) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(SensorInit, Tps) {
|
TEST(SensorInit, Tps) {
|
||||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
EngineTestHelper eth(TEST_ENGINE);
|
||||||
|
|
||||||
CONFIG(tpsMin) = 200; // 1 volt
|
CONFIG(tpsMin) = 200; // 1 volt
|
||||||
CONFIG(tpsMax) = 800; // 4 volts
|
CONFIG(tpsMax) = 800; // 4 volts
|
||||||
|
@ -50,7 +50,7 @@ TEST(SensorInit, Tps) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(SensorInit, TpsValuesTooClose) {
|
TEST(SensorInit, TpsValuesTooClose) {
|
||||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
EngineTestHelper eth(TEST_ENGINE);
|
||||||
|
|
||||||
// Should fail, 0.49 volts apart
|
// Should fail, 0.49 volts apart
|
||||||
CONFIG(tpsMin) = 200; // 1.00 volt
|
CONFIG(tpsMin) = 200; // 1.00 volt
|
||||||
|
@ -97,7 +97,7 @@ TEST(SensorInit, TpsValuesTooClose) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(SensorInit, Pedal) {
|
TEST(SensorInit, Pedal) {
|
||||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
EngineTestHelper eth(TEST_ENGINE);
|
||||||
|
|
||||||
CONFIG(throttlePedalPositionAdcChannel) = EFI_ADC_0;
|
CONFIG(throttlePedalPositionAdcChannel) = EFI_ADC_0;
|
||||||
CONFIG(throttlePedalUpVoltage) = 1;
|
CONFIG(throttlePedalUpVoltage) = 1;
|
||||||
|
@ -124,7 +124,7 @@ TEST(SensorInit, Pedal) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(SensorInit, DriverIntentNoPedal) {
|
TEST(SensorInit, DriverIntentNoPedal) {
|
||||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
EngineTestHelper eth(TEST_ENGINE);
|
||||||
|
|
||||||
// We have no pedal - so we should get the TPS
|
// We have no pedal - so we should get the TPS
|
||||||
CONFIG(throttlePedalPositionAdcChannel) = EFI_ADC_NONE;
|
CONFIG(throttlePedalPositionAdcChannel) = EFI_ADC_NONE;
|
||||||
|
@ -144,7 +144,7 @@ TEST(SensorInit, DriverIntentNoPedal) {
|
||||||
|
|
||||||
|
|
||||||
TEST(SensorInit, DriverIntentWithPedal) {
|
TEST(SensorInit, DriverIntentWithPedal) {
|
||||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
EngineTestHelper eth(TEST_ENGINE);
|
||||||
|
|
||||||
// We have a pedal, so we should get it
|
// We have a pedal, so we should get it
|
||||||
CONFIG(throttlePedalPositionAdcChannel) = EFI_ADC_0;
|
CONFIG(throttlePedalPositionAdcChannel) = EFI_ADC_0;
|
||||||
|
@ -163,7 +163,7 @@ TEST(SensorInit, DriverIntentWithPedal) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(SensorInit, OilPressure) {
|
TEST(SensorInit, OilPressure) {
|
||||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
EngineTestHelper eth(TEST_ENGINE);
|
||||||
|
|
||||||
CONFIG(oilPressure.hwChannel) = EFI_ADC_0;
|
CONFIG(oilPressure.hwChannel) = EFI_ADC_0;
|
||||||
CONFIG(oilPressure.v1) = 1;
|
CONFIG(oilPressure.v1) = 1;
|
||||||
|
@ -188,7 +188,7 @@ TEST(SensorInit, OilPressure) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(SensorInit, Clt) {
|
TEST(SensorInit, Clt) {
|
||||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
EngineTestHelper eth(TEST_ENGINE);
|
||||||
|
|
||||||
// 2003 neon sensor
|
// 2003 neon sensor
|
||||||
CONFIG(clt.config) = {0, 30, 100, 32500, 7550, 700, 2700};
|
CONFIG(clt.config) = {0, 30, 100, 32500, 7550, 700, 2700};
|
||||||
|
@ -210,7 +210,7 @@ TEST(SensorInit, Clt) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(SensorInit, Lambda) {
|
TEST(SensorInit, Lambda) {
|
||||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
EngineTestHelper eth(TEST_ENGINE);
|
||||||
|
|
||||||
initLambda();
|
initLambda();
|
||||||
|
|
||||||
|
@ -219,7 +219,7 @@ TEST(SensorInit, Lambda) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(SensorInit, Map) {
|
TEST(SensorInit, Map) {
|
||||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
EngineTestHelper eth(TEST_ENGINE);
|
||||||
|
|
||||||
initMap();
|
initMap();
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,6 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetUp() override {
|
void SetUp() override {
|
||||||
dut.inject();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetCoef(float new_coef) {
|
void SetCoef(float new_coef) {
|
||||||
|
|
|
@ -13,7 +13,6 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetUp() override {
|
void SetUp() override {
|
||||||
dut.inject();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetCoef(float new_coef) {
|
void SetCoef(float new_coef) {
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
TEST(fuel, testTpsAccelEnrichmentMath) {
|
TEST(fuel, testTpsAccelEnrichmentMath) {
|
||||||
printf("====================================================================================== testAccelEnrichment\r\n");
|
printf("====================================================================================== testAccelEnrichment\r\n");
|
||||||
|
|
||||||
WITH_ENGINE_TEST_HELPER(FORD_ASPIRE_1996);
|
EngineTestHelper eth(FORD_ASPIRE_1996);
|
||||||
|
|
||||||
engine->rpmCalculator.setRpmValue(600);
|
engine->rpmCalculator.setRpmValue(600);
|
||||||
engine->periodicFastCallback();
|
engine->periodicFastCallback();
|
||||||
|
@ -40,7 +40,7 @@ TEST(fuel, testTpsAccelEnrichmentMath) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(fuel, testTpsAccelEnrichmentScheduling) {
|
TEST(fuel, testTpsAccelEnrichmentScheduling) {
|
||||||
WITH_ENGINE_TEST_HELPER(FORD_ASPIRE_1996);
|
EngineTestHelper eth(FORD_ASPIRE_1996);
|
||||||
|
|
||||||
setOperationMode(engineConfiguration, FOUR_STROKE_CRANK_SENSOR);
|
setOperationMode(engineConfiguration, FOUR_STROKE_CRANK_SENSOR);
|
||||||
engineConfiguration->useOnlyRisingEdgeForTrigger = true;
|
engineConfiguration->useOnlyRisingEdgeForTrigger = true;
|
||||||
|
@ -91,7 +91,7 @@ static void doFractionalTpsIteration(int period, int divisor, int numCycles, std
|
||||||
TEST(fuel, testAccelEnrichmentFractionalTps) {
|
TEST(fuel, testAccelEnrichmentFractionalTps) {
|
||||||
printf("====================================================================================== testAccelEnrichmentFractionalTps\r\n");
|
printf("====================================================================================== testAccelEnrichmentFractionalTps\r\n");
|
||||||
|
|
||||||
WITH_ENGINE_TEST_HELPER(FORD_ASPIRE_1996);
|
EngineTestHelper eth(FORD_ASPIRE_1996);
|
||||||
|
|
||||||
// setup
|
// setup
|
||||||
engineConfiguration->tpsAccelEnrichmentThreshold = 5;
|
engineConfiguration->tpsAccelEnrichmentThreshold = 5;
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
TEST(misc, testAuxValves) {
|
TEST(misc, testAuxValves) {
|
||||||
Sensor::setMockValue(SensorType::DriverThrottleIntent, 0);
|
Sensor::setMockValue(SensorType::DriverThrottleIntent, 0);
|
||||||
|
|
||||||
WITH_ENGINE_TEST_HELPER(NISSAN_PRIMERA);
|
EngineTestHelper eth(NISSAN_PRIMERA);
|
||||||
|
|
||||||
engine->needTdcCallback = false;
|
engine->needTdcCallback = false;
|
||||||
|
|
||||||
|
|
|
@ -12,11 +12,10 @@ TEST(BoostControl, Setpoint) {
|
||||||
EXPECT_CALL(targetMap, getValue(_, _))
|
EXPECT_CALL(targetMap, getValue(_, _))
|
||||||
.WillRepeatedly([](float xRpm, float tps) { return tps * 2; });
|
.WillRepeatedly([](float xRpm, float tps) { return tps * 2; });
|
||||||
|
|
||||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
EngineTestHelper eth(TEST_ENGINE);
|
||||||
engineConfiguration->boostType = CLOSED_LOOP;
|
engineConfiguration->boostType = CLOSED_LOOP;
|
||||||
|
|
||||||
BoostController bc;
|
BoostController bc;
|
||||||
bc.inject();
|
|
||||||
|
|
||||||
// Should return unexpected without a pedal map cfg'd
|
// Should return unexpected without a pedal map cfg'd
|
||||||
EXPECT_EQ(bc.getSetpoint(), unexpected);
|
EXPECT_EQ(bc.getSetpoint(), unexpected);
|
||||||
|
@ -33,10 +32,9 @@ TEST(BoostControl, Setpoint) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(BoostControl, ObservePlant) {
|
TEST(BoostControl, ObservePlant) {
|
||||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
EngineTestHelper eth(TEST_ENGINE);
|
||||||
|
|
||||||
BoostController bc;
|
BoostController bc;
|
||||||
bc.inject();
|
|
||||||
|
|
||||||
Sensor::resetMockValue(SensorType::Map);
|
Sensor::resetMockValue(SensorType::Map);
|
||||||
// Check that invalid MAP returns unexpected
|
// Check that invalid MAP returns unexpected
|
||||||
|
@ -55,10 +53,9 @@ TEST(BoostControl, OpenLoop) {
|
||||||
EXPECT_CALL(openMap, getValue(_, _))
|
EXPECT_CALL(openMap, getValue(_, _))
|
||||||
.WillRepeatedly([](float xRpm, float tps) { return tps * 2; });
|
.WillRepeatedly([](float xRpm, float tps) { return tps * 2; });
|
||||||
|
|
||||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
EngineTestHelper eth(TEST_ENGINE);
|
||||||
|
|
||||||
BoostController bc;
|
BoostController bc;
|
||||||
bc.inject();
|
|
||||||
|
|
||||||
// Without table set, should return unexpected
|
// Without table set, should return unexpected
|
||||||
EXPECT_EQ(bc.getOpenLoop(0), unexpected);
|
EXPECT_EQ(bc.getOpenLoop(0), unexpected);
|
||||||
|
@ -71,10 +68,9 @@ TEST(BoostControl, OpenLoop) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(BoostControl, ClosedLoop) {
|
TEST(BoostControl, ClosedLoop) {
|
||||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
EngineTestHelper eth(TEST_ENGINE);
|
||||||
|
|
||||||
BoostController bc;
|
BoostController bc;
|
||||||
bc.inject();
|
|
||||||
|
|
||||||
pid_s pidCfg = {
|
pid_s pidCfg = {
|
||||||
1, 0, 0, // P controller, easier to test
|
1, 0, 0, // P controller, easier to test
|
||||||
|
@ -111,12 +107,11 @@ TEST(BoostControl, ClosedLoop) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(BoostControl, SetOutput) {
|
TEST(BoostControl, SetOutput) {
|
||||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
EngineTestHelper eth(TEST_ENGINE);
|
||||||
|
|
||||||
StrictMock<MockPwm> pwm;
|
StrictMock<MockPwm> pwm;
|
||||||
StrictMock<MockEtb> etb;
|
StrictMock<MockEtb> etb;
|
||||||
BoostController bc;
|
BoostController bc;
|
||||||
bc.inject();
|
|
||||||
|
|
||||||
// ETB wastegate position & PWM should both be set
|
// ETB wastegate position & PWM should both be set
|
||||||
EXPECT_CALL(etb, setWastegatePosition(25.0f));
|
EXPECT_CALL(etb, setWastegatePosition(25.0f));
|
||||||
|
|
|
@ -13,7 +13,7 @@ TEST(misc, changeEngineType) {
|
||||||
/**
|
/**
|
||||||
* this configuration has triggerInputDebugPins defined
|
* this configuration has triggerInputDebugPins defined
|
||||||
*/
|
*/
|
||||||
WITH_ENGINE_TEST_HELPER (FORD_ASPIRE_1996);
|
EngineTestHelper eth (FORD_ASPIRE_1996);
|
||||||
|
|
||||||
brain_pin_e brainPin = engineConfiguration->triggerInputDebugPins[0];
|
brain_pin_e brainPin = engineConfiguration->triggerInputDebugPins[0];
|
||||||
ASSERT_TRUE(brainPin != GPIO_UNASSIGNED);
|
ASSERT_TRUE(brainPin != GPIO_UNASSIGNED);
|
||||||
|
|
|
@ -17,10 +17,9 @@ void printResults(DynoView *dut) {
|
||||||
|
|
||||||
|
|
||||||
TEST(DynoView, VSS_T1) {
|
TEST(DynoView, VSS_T1) {
|
||||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
EngineTestHelper eth(TEST_ENGINE);
|
||||||
|
|
||||||
DynoView dut;
|
DynoView dut;
|
||||||
dut.inject();
|
|
||||||
|
|
||||||
// Test Speed threshold
|
// Test Speed threshold
|
||||||
engineConfiguration->vehicleWeight = 900;
|
engineConfiguration->vehicleWeight = 900;
|
||||||
|
@ -37,10 +36,9 @@ TEST(DynoView, VSS_T1) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(DynoView, algo) {
|
TEST(DynoView, algo) {
|
||||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
EngineTestHelper eth(TEST_ENGINE);
|
||||||
|
|
||||||
DynoView dut;
|
DynoView dut;
|
||||||
dut.inject();
|
|
||||||
|
|
||||||
// Test Speed threshold
|
// Test Speed threshold
|
||||||
engineConfiguration->vehicleWeight = 900;
|
engineConfiguration->vehicleWeight = 900;
|
||||||
|
@ -62,10 +60,9 @@ TEST(DynoView, algo) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(DynoView, VSS_fast) {
|
TEST(DynoView, VSS_fast) {
|
||||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
EngineTestHelper eth(TEST_ENGINE);
|
||||||
|
|
||||||
DynoView dut;
|
DynoView dut;
|
||||||
dut.inject();
|
|
||||||
|
|
||||||
// Test Speed threshold
|
// Test Speed threshold
|
||||||
engineConfiguration->vehicleWeight = 900; //kg
|
engineConfiguration->vehicleWeight = 900; //kg
|
||||||
|
@ -86,10 +83,9 @@ TEST(DynoView, VSS_fast) {
|
||||||
|
|
||||||
|
|
||||||
TEST(DynoView, VSS_Torque) {
|
TEST(DynoView, VSS_Torque) {
|
||||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
EngineTestHelper eth(TEST_ENGINE);
|
||||||
|
|
||||||
DynoView dut;
|
DynoView dut;
|
||||||
dut.inject();
|
|
||||||
|
|
||||||
// Test Speed threshold
|
// Test Speed threshold
|
||||||
engineConfiguration->vehicleWeight = 900; //kg
|
engineConfiguration->vehicleWeight = 900; //kg
|
||||||
|
|
|
@ -22,7 +22,7 @@ TEST(misc, structSize) {
|
||||||
|
|
||||||
TEST(misc, testIgnitionPlanning) {
|
TEST(misc, testIgnitionPlanning) {
|
||||||
printf("*************************************************** testIgnitionPlanning\r\n");
|
printf("*************************************************** testIgnitionPlanning\r\n");
|
||||||
WITH_ENGINE_TEST_HELPER(FORD_ESCORT_GT);
|
EngineTestHelper eth(FORD_ESCORT_GT);
|
||||||
|
|
||||||
eth.engine.periodicFastCallback();
|
eth.engine.periodicFastCallback();
|
||||||
assertEqualsM("testIgnitionPlanning_AFR", 13.5, eth.engine.engineState.targetAFR);
|
assertEqualsM("testIgnitionPlanning_AFR", 13.5, eth.engine.engineState.targetAFR);
|
||||||
|
@ -33,7 +33,7 @@ TEST(misc, testIgnitionPlanning) {
|
||||||
TEST(misc, testEngineMath) {
|
TEST(misc, testEngineMath) {
|
||||||
printf("*************************************************** testEngineMath\r\n");
|
printf("*************************************************** testEngineMath\r\n");
|
||||||
|
|
||||||
WITH_ENGINE_TEST_HELPER(FORD_ESCORT_GT);
|
EngineTestHelper eth(FORD_ESCORT_GT);
|
||||||
|
|
||||||
engineConfiguration->ambiguousOperationMode = FOUR_STROKE_CAM_SENSOR;
|
engineConfiguration->ambiguousOperationMode = FOUR_STROKE_CAM_SENSOR;
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ using ::testing::StrictMock;
|
||||||
TEST(etb, initializationNoPedal) {
|
TEST(etb, initializationNoPedal) {
|
||||||
StrictMock<MockEtb> mocks[ETB_COUNT];
|
StrictMock<MockEtb> mocks[ETB_COUNT];
|
||||||
|
|
||||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
EngineTestHelper eth(TEST_ENGINE);
|
||||||
|
|
||||||
for (int i = 0; i < ETB_COUNT; i++) {
|
for (int i = 0; i < ETB_COUNT; i++) {
|
||||||
engine->etbControllers[i] = &mocks[i];
|
engine->etbControllers[i] = &mocks[i];
|
||||||
|
@ -36,7 +36,7 @@ TEST(etb, initializationNoPedal) {
|
||||||
TEST(etb, initializationMissingThrottle) {
|
TEST(etb, initializationMissingThrottle) {
|
||||||
StrictMock<MockEtb> mocks[ETB_COUNT];
|
StrictMock<MockEtb> mocks[ETB_COUNT];
|
||||||
|
|
||||||
WITH_ENGINE_TEST_HELPER_BOARD_CALLBACK(TEST_ENGINE, [](engine_configuration_s* engineConfiguration) {
|
EngineTestHelper eth(TEST_ENGINE, [](engine_configuration_s* engineConfiguration) {
|
||||||
engineConfiguration->etbFunctions[0] = ETB_None;
|
engineConfiguration->etbFunctions[0] = ETB_None;
|
||||||
engineConfiguration->etbFunctions[1] = ETB_None;
|
engineConfiguration->etbFunctions[1] = ETB_None;
|
||||||
});
|
});
|
||||||
|
@ -59,7 +59,7 @@ TEST(etb, initializationMissingThrottle) {
|
||||||
TEST(etb, initializationSingleThrottle) {
|
TEST(etb, initializationSingleThrottle) {
|
||||||
StrictMock<MockEtb> mocks[ETB_COUNT];
|
StrictMock<MockEtb> mocks[ETB_COUNT];
|
||||||
|
|
||||||
WITH_ENGINE_TEST_HELPER_BOARD_CALLBACK(TEST_ENGINE, [](engine_configuration_s* engineConfiguration) {
|
EngineTestHelper eth(TEST_ENGINE, [](engine_configuration_s* engineConfiguration) {
|
||||||
engineConfiguration->etbFunctions[0] = ETB_Throttle1;
|
engineConfiguration->etbFunctions[0] = ETB_Throttle1;
|
||||||
engineConfiguration->etbFunctions[1] = ETB_None;
|
engineConfiguration->etbFunctions[1] = ETB_None;
|
||||||
});
|
});
|
||||||
|
@ -84,7 +84,7 @@ TEST(etb, initializationSingleThrottle) {
|
||||||
TEST(etb, initializationSingleThrottleInSecondSlot) {
|
TEST(etb, initializationSingleThrottleInSecondSlot) {
|
||||||
StrictMock<MockEtb> mocks[ETB_COUNT];
|
StrictMock<MockEtb> mocks[ETB_COUNT];
|
||||||
|
|
||||||
WITH_ENGINE_TEST_HELPER_BOARD_CALLBACK(TEST_ENGINE, [](engine_configuration_s* engineConfiguration) {
|
EngineTestHelper eth(TEST_ENGINE, [](engine_configuration_s* engineConfiguration) {
|
||||||
engineConfiguration->etbFunctions[0] = ETB_None;
|
engineConfiguration->etbFunctions[0] = ETB_None;
|
||||||
engineConfiguration->etbFunctions[1] = ETB_Throttle1;
|
engineConfiguration->etbFunctions[1] = ETB_Throttle1;
|
||||||
});
|
});
|
||||||
|
@ -109,7 +109,7 @@ TEST(etb, initializationSingleThrottleInSecondSlot) {
|
||||||
TEST(etb, initializationDualThrottle) {
|
TEST(etb, initializationDualThrottle) {
|
||||||
StrictMock<MockEtb> mocks[ETB_COUNT];
|
StrictMock<MockEtb> mocks[ETB_COUNT];
|
||||||
|
|
||||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
EngineTestHelper eth(TEST_ENGINE);
|
||||||
|
|
||||||
for (int i = 0; i < ETB_COUNT; i++) {
|
for (int i = 0; i < ETB_COUNT; i++) {
|
||||||
engine->etbControllers[i] = &mocks[i];
|
engine->etbControllers[i] = &mocks[i];
|
||||||
|
@ -137,7 +137,7 @@ TEST(etb, initializationDualThrottle) {
|
||||||
TEST(etb, initializationWastegate) {
|
TEST(etb, initializationWastegate) {
|
||||||
StrictMock<MockEtb> mocks[ETB_COUNT];
|
StrictMock<MockEtb> mocks[ETB_COUNT];
|
||||||
|
|
||||||
WITH_ENGINE_TEST_HELPER_BOARD_CALLBACK(TEST_ENGINE, [](engine_configuration_s* engineConfiguration) {
|
EngineTestHelper eth(TEST_ENGINE, [](engine_configuration_s* engineConfiguration) {
|
||||||
engineConfiguration->etbFunctions[0] = ETB_Wastegate;
|
engineConfiguration->etbFunctions[0] = ETB_Wastegate;
|
||||||
engineConfiguration->etbFunctions[1] = ETB_None;
|
engineConfiguration->etbFunctions[1] = ETB_None;
|
||||||
});
|
});
|
||||||
|
@ -217,7 +217,7 @@ TEST(etb, initializationNoThrottles) {
|
||||||
// This tests the case where you don't want an ETB, and expect everything to go fine
|
// This tests the case where you don't want an ETB, and expect everything to go fine
|
||||||
EtbController duts[2];
|
EtbController duts[2];
|
||||||
|
|
||||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
EngineTestHelper eth(TEST_ENGINE);
|
||||||
|
|
||||||
for (int i = 0; i < ETB_COUNT; i++) {
|
for (int i = 0; i < ETB_COUNT; i++) {
|
||||||
engine->etbControllers[i] = &duts[i];
|
engine->etbControllers[i] = &duts[i];
|
||||||
|
@ -240,7 +240,7 @@ TEST(etb, initializationNoThrottles) {
|
||||||
TEST(etb, idlePlumbing) {
|
TEST(etb, idlePlumbing) {
|
||||||
StrictMock<MockEtb> mocks[ETB_COUNT];
|
StrictMock<MockEtb> mocks[ETB_COUNT];
|
||||||
|
|
||||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
EngineTestHelper eth(TEST_ENGINE);
|
||||||
engineConfiguration->useETBforIdleControl = true;
|
engineConfiguration->useETBforIdleControl = true;
|
||||||
|
|
||||||
Sensor::setMockValue(SensorType::AcceleratorPedal, 50.0f, true);
|
Sensor::setMockValue(SensorType::AcceleratorPedal, 50.0f, true);
|
||||||
|
@ -255,13 +255,12 @@ TEST(etb, idlePlumbing) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(etb, testSetpointOnlyPedal) {
|
TEST(etb, testSetpointOnlyPedal) {
|
||||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
EngineTestHelper eth(TEST_ENGINE);
|
||||||
|
|
||||||
// Don't use ETB for idle, we aren't testing that yet - just pedal table for now
|
// Don't use ETB for idle, we aren't testing that yet - just pedal table for now
|
||||||
engineConfiguration->useETBforIdleControl = false;
|
engineConfiguration->useETBforIdleControl = false;
|
||||||
|
|
||||||
EtbController etb;
|
EtbController etb;
|
||||||
etb.inject();
|
|
||||||
|
|
||||||
// Mock pedal map that's just passthru pedal -> target
|
// Mock pedal map that's just passthru pedal -> target
|
||||||
StrictMock<MockVp3d> pedalMap;
|
StrictMock<MockVp3d> pedalMap;
|
||||||
|
@ -325,7 +324,7 @@ TEST(etb, testSetpointOnlyPedal) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(etb, setpointIdle) {
|
TEST(etb, setpointIdle) {
|
||||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
EngineTestHelper eth(TEST_ENGINE);
|
||||||
|
|
||||||
// Use ETB for idle, but don't give it any range (yet)
|
// Use ETB for idle, but don't give it any range (yet)
|
||||||
engineConfiguration->useETBforIdleControl = true;
|
engineConfiguration->useETBforIdleControl = true;
|
||||||
|
@ -337,7 +336,6 @@ TEST(etb, setpointIdle) {
|
||||||
Sensor::setMockValue(SensorType::AcceleratorPedal, 0.0f, true);
|
Sensor::setMockValue(SensorType::AcceleratorPedal, 0.0f, true);
|
||||||
|
|
||||||
EtbController etb;
|
EtbController etb;
|
||||||
etb.inject();
|
|
||||||
|
|
||||||
// Mock pedal map that's just passthru pedal -> target
|
// Mock pedal map that's just passthru pedal -> target
|
||||||
StrictMock<MockVp3d> pedalMap;
|
StrictMock<MockVp3d> pedalMap;
|
||||||
|
@ -383,7 +381,7 @@ TEST(etb, setpointIdle) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(etb, setpointRevLimit) {
|
TEST(etb, setpointRevLimit) {
|
||||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
EngineTestHelper eth(TEST_ENGINE);
|
||||||
|
|
||||||
// Configure 5000 limit start, with 750 rpm taper
|
// Configure 5000 limit start, with 750 rpm taper
|
||||||
engineConfiguration->etbRevLimitStart = 5000;
|
engineConfiguration->etbRevLimitStart = 5000;
|
||||||
|
@ -395,7 +393,6 @@ TEST(etb, setpointRevLimit) {
|
||||||
Sensor::setMockValue(SensorType::AcceleratorPedal, 0.0f, true);
|
Sensor::setMockValue(SensorType::AcceleratorPedal, 0.0f, true);
|
||||||
|
|
||||||
EtbController etb;
|
EtbController etb;
|
||||||
etb.inject();
|
|
||||||
|
|
||||||
// Mock pedal map to just return 80%
|
// Mock pedal map to just return 80%
|
||||||
StrictMock<MockVp3d> pedalMap;
|
StrictMock<MockVp3d> pedalMap;
|
||||||
|
@ -517,7 +514,7 @@ TEST(etb, etbTpsSensor) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(etb, setOutputInvalid) {
|
TEST(etb, setOutputInvalid) {
|
||||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
EngineTestHelper eth(TEST_ENGINE);
|
||||||
|
|
||||||
// Redundant TPS & accelerator pedal required for init
|
// Redundant TPS & accelerator pedal required for init
|
||||||
Sensor::setMockValue(SensorType::Tps1Primary, 0);
|
Sensor::setMockValue(SensorType::Tps1Primary, 0);
|
||||||
|
@ -527,7 +524,6 @@ TEST(etb, setOutputInvalid) {
|
||||||
StrictMock<MockMotor> motor;
|
StrictMock<MockMotor> motor;
|
||||||
|
|
||||||
EtbController etb;
|
EtbController etb;
|
||||||
etb.inject();
|
|
||||||
etb.init(ETB_Throttle1, &motor, nullptr, nullptr, true);
|
etb.init(ETB_Throttle1, &motor, nullptr, nullptr, true);
|
||||||
|
|
||||||
// Should be disabled in case of unexpected
|
// Should be disabled in case of unexpected
|
||||||
|
@ -537,7 +533,7 @@ TEST(etb, setOutputInvalid) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(etb, setOutputValid) {
|
TEST(etb, setOutputValid) {
|
||||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
EngineTestHelper eth(TEST_ENGINE);
|
||||||
StrictMock<MockMotor> motor;
|
StrictMock<MockMotor> motor;
|
||||||
|
|
||||||
// Must have TPS & PPS initialized for ETB setup
|
// Must have TPS & PPS initialized for ETB setup
|
||||||
|
@ -546,7 +542,6 @@ TEST(etb, setOutputValid) {
|
||||||
Sensor::setMockValue(SensorType::AcceleratorPedal, 0.0f, true);
|
Sensor::setMockValue(SensorType::AcceleratorPedal, 0.0f, true);
|
||||||
|
|
||||||
EtbController etb;
|
EtbController etb;
|
||||||
etb.inject();
|
|
||||||
etb.init(ETB_Throttle1, &motor, nullptr, nullptr, true);
|
etb.init(ETB_Throttle1, &motor, nullptr, nullptr, true);
|
||||||
|
|
||||||
// Should be enabled and value set
|
// Should be enabled and value set
|
||||||
|
@ -558,7 +553,7 @@ TEST(etb, setOutputValid) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(etb, setOutputValid2) {
|
TEST(etb, setOutputValid2) {
|
||||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
EngineTestHelper eth(TEST_ENGINE);
|
||||||
StrictMock<MockMotor> motor;
|
StrictMock<MockMotor> motor;
|
||||||
|
|
||||||
// Must have TPS & PPS initialized for ETB setup
|
// Must have TPS & PPS initialized for ETB setup
|
||||||
|
@ -567,7 +562,6 @@ TEST(etb, setOutputValid2) {
|
||||||
Sensor::setMockValue(SensorType::AcceleratorPedal, 0.0f, true);
|
Sensor::setMockValue(SensorType::AcceleratorPedal, 0.0f, true);
|
||||||
|
|
||||||
EtbController etb;
|
EtbController etb;
|
||||||
etb.inject();
|
|
||||||
etb.init(ETB_Throttle1, &motor, nullptr, nullptr, true);
|
etb.init(ETB_Throttle1, &motor, nullptr, nullptr, true);
|
||||||
|
|
||||||
// Should be enabled and value set
|
// Should be enabled and value set
|
||||||
|
@ -579,7 +573,7 @@ TEST(etb, setOutputValid2) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(etb, setOutputOutOfRangeHigh) {
|
TEST(etb, setOutputOutOfRangeHigh) {
|
||||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
EngineTestHelper eth(TEST_ENGINE);
|
||||||
StrictMock<MockMotor> motor;
|
StrictMock<MockMotor> motor;
|
||||||
|
|
||||||
// Must have TPS & PPS initialized for ETB setup
|
// Must have TPS & PPS initialized for ETB setup
|
||||||
|
@ -588,7 +582,6 @@ TEST(etb, setOutputOutOfRangeHigh) {
|
||||||
Sensor::setMockValue(SensorType::AcceleratorPedal, 0.0f, true);
|
Sensor::setMockValue(SensorType::AcceleratorPedal, 0.0f, true);
|
||||||
|
|
||||||
EtbController etb;
|
EtbController etb;
|
||||||
etb.inject();
|
|
||||||
etb.init(ETB_Throttle1, &motor, nullptr, nullptr, true);
|
etb.init(ETB_Throttle1, &motor, nullptr, nullptr, true);
|
||||||
|
|
||||||
// Should be enabled and value set
|
// Should be enabled and value set
|
||||||
|
@ -600,7 +593,7 @@ TEST(etb, setOutputOutOfRangeHigh) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(etb, setOutputOutOfRangeLow) {
|
TEST(etb, setOutputOutOfRangeLow) {
|
||||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
EngineTestHelper eth(TEST_ENGINE);
|
||||||
StrictMock<MockMotor> motor;
|
StrictMock<MockMotor> motor;
|
||||||
|
|
||||||
// Must have TPS & PPS initialized for ETB setup
|
// Must have TPS & PPS initialized for ETB setup
|
||||||
|
@ -609,7 +602,6 @@ TEST(etb, setOutputOutOfRangeLow) {
|
||||||
Sensor::setMockValue(SensorType::AcceleratorPedal, 0.0f, true);
|
Sensor::setMockValue(SensorType::AcceleratorPedal, 0.0f, true);
|
||||||
|
|
||||||
EtbController etb;
|
EtbController etb;
|
||||||
etb.inject();
|
|
||||||
etb.init(ETB_Throttle1, &motor, nullptr, nullptr, true);
|
etb.init(ETB_Throttle1, &motor, nullptr, nullptr, true);
|
||||||
|
|
||||||
// Should be enabled and value set
|
// Should be enabled and value set
|
||||||
|
@ -621,7 +613,7 @@ TEST(etb, setOutputOutOfRangeLow) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(etb, setOutputPauseControl) {
|
TEST(etb, setOutputPauseControl) {
|
||||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
EngineTestHelper eth(TEST_ENGINE);
|
||||||
StrictMock<MockMotor> motor;
|
StrictMock<MockMotor> motor;
|
||||||
|
|
||||||
// Must have TPS & PPS initialized for ETB setup
|
// Must have TPS & PPS initialized for ETB setup
|
||||||
|
@ -630,7 +622,6 @@ TEST(etb, setOutputPauseControl) {
|
||||||
Sensor::setMockValue(SensorType::AcceleratorPedal, 0.0f, true);
|
Sensor::setMockValue(SensorType::AcceleratorPedal, 0.0f, true);
|
||||||
|
|
||||||
EtbController etb;
|
EtbController etb;
|
||||||
etb.inject();
|
|
||||||
etb.init(ETB_Throttle1, &motor, nullptr, nullptr, true);
|
etb.init(ETB_Throttle1, &motor, nullptr, nullptr, true);
|
||||||
|
|
||||||
// Pause control - should get no output
|
// Pause control - should get no output
|
||||||
|
@ -643,7 +634,7 @@ TEST(etb, setOutputPauseControl) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(etb, setOutputLimpHome) {
|
TEST(etb, setOutputLimpHome) {
|
||||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
EngineTestHelper eth(TEST_ENGINE);
|
||||||
StrictMock<MockMotor> motor;
|
StrictMock<MockMotor> motor;
|
||||||
|
|
||||||
// Must have TPS & PPS initialized for ETB setup
|
// Must have TPS & PPS initialized for ETB setup
|
||||||
|
@ -652,7 +643,6 @@ TEST(etb, setOutputLimpHome) {
|
||||||
Sensor::setMockValue(SensorType::AcceleratorPedal, 0.0f, true);
|
Sensor::setMockValue(SensorType::AcceleratorPedal, 0.0f, true);
|
||||||
|
|
||||||
EtbController etb;
|
EtbController etb;
|
||||||
etb.inject();
|
|
||||||
etb.init(ETB_Throttle1, &motor, nullptr, nullptr, true);
|
etb.init(ETB_Throttle1, &motor, nullptr, nullptr, true);
|
||||||
|
|
||||||
// Should be disabled when in ETB limp mode
|
// Should be disabled when in ETB limp mode
|
||||||
|
@ -694,7 +684,7 @@ TEST(etb, closedLoopPid) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(etb, openLoopThrottle) {
|
TEST(etb, openLoopThrottle) {
|
||||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
EngineTestHelper eth(TEST_ENGINE);
|
||||||
|
|
||||||
// Redundant TPS & accelerator pedal required for init
|
// Redundant TPS & accelerator pedal required for init
|
||||||
Sensor::setMockValue(SensorType::Tps1Primary, 0);
|
Sensor::setMockValue(SensorType::Tps1Primary, 0);
|
||||||
|
@ -702,7 +692,6 @@ TEST(etb, openLoopThrottle) {
|
||||||
Sensor::setMockValue(SensorType::AcceleratorPedal, 0, true);
|
Sensor::setMockValue(SensorType::AcceleratorPedal, 0, true);
|
||||||
|
|
||||||
EtbController etb;
|
EtbController etb;
|
||||||
etb.inject();
|
|
||||||
etb.init(ETB_Throttle1, nullptr, nullptr, nullptr, true);
|
etb.init(ETB_Throttle1, nullptr, nullptr, nullptr, true);
|
||||||
|
|
||||||
// Map [0, 100] -> [-50, 50]
|
// Map [0, 100] -> [-50, 50]
|
||||||
|
@ -717,7 +706,7 @@ TEST(etb, openLoopThrottle) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(etb, openLoopNonThrottle) {
|
TEST(etb, openLoopNonThrottle) {
|
||||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
EngineTestHelper eth(TEST_ENGINE);
|
||||||
|
|
||||||
// Redundant TPS & accelerator pedal required for init
|
// Redundant TPS & accelerator pedal required for init
|
||||||
Sensor::setMockValue(SensorType::Tps1Primary, 0);
|
Sensor::setMockValue(SensorType::Tps1Primary, 0);
|
||||||
|
@ -725,7 +714,6 @@ TEST(etb, openLoopNonThrottle) {
|
||||||
Sensor::setMockValue(SensorType::AcceleratorPedal, 0, true);
|
Sensor::setMockValue(SensorType::AcceleratorPedal, 0, true);
|
||||||
|
|
||||||
EtbController etb;
|
EtbController etb;
|
||||||
etb.inject();
|
|
||||||
etb.init(ETB_Wastegate, nullptr, nullptr, nullptr, false);
|
etb.init(ETB_Wastegate, nullptr, nullptr, nullptr, false);
|
||||||
|
|
||||||
// Map [0, 100] -> [-50, 50]
|
// Map [0, 100] -> [-50, 50]
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
#include "fan_control.h"
|
#include "fan_control.h"
|
||||||
|
|
||||||
TEST(FanControl, fan1) {
|
TEST(FanControl, fan1) {
|
||||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
EngineTestHelper eth(TEST_ENGINE);
|
||||||
|
|
||||||
engineConfiguration->fanOnTemperature = 90;
|
engineConfiguration->fanOnTemperature = 90;
|
||||||
engineConfiguration->fanOffTemperature = 80;
|
engineConfiguration->fanOffTemperature = 80;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#include "pch.h"
|
#include "pch.h"
|
||||||
|
|
||||||
TEST(gpio, testPinInitNonInverted) {
|
TEST(gpio, testPinInitNonInverted) {
|
||||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
EngineTestHelper eth(TEST_ENGINE);
|
||||||
|
|
||||||
OutputPin dut;
|
OutputPin dut;
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ TEST(gpio, testPinInitNonInverted) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(gpio, testPinInitInverted) {
|
TEST(gpio, testPinInitInverted) {
|
||||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
EngineTestHelper eth(TEST_ENGINE);
|
||||||
|
|
||||||
OutputPin dut;
|
OutputPin dut;
|
||||||
|
|
||||||
|
|
|
@ -74,9 +74,8 @@ TEST(GpPwm, OutputOnOff) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(GpPwm, GetOutput) {
|
TEST(GpPwm, GetOutput) {
|
||||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
EngineTestHelper eth(TEST_ENGINE);
|
||||||
GppwmChannel ch;
|
GppwmChannel ch;
|
||||||
ch.inject();
|
|
||||||
|
|
||||||
gppwm_channel cfg;
|
gppwm_channel cfg;
|
||||||
cfg.loadAxis = GPPWM_Tps;
|
cfg.loadAxis = GPPWM_Tps;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#include "pch.h"
|
#include "pch.h"
|
||||||
|
|
||||||
TEST(hardware, reinit) {
|
TEST(hardware, reinit) {
|
||||||
WITH_ENGINE_TEST_HELPER(FRANKENSO_MIATA_NA6_MAP);
|
EngineTestHelper eth(FRANKENSO_MIATA_NA6_MAP);
|
||||||
|
|
||||||
ButtonDebounce::stopConfigurationList();
|
ButtonDebounce::stopConfigurationList();
|
||||||
ButtonDebounce::startConfigurationList();
|
ButtonDebounce::startConfigurationList();
|
||||||
|
|
|
@ -19,9 +19,8 @@ using ::testing::_;
|
||||||
using ICP = IIdleController::Phase;
|
using ICP = IIdleController::Phase;
|
||||||
|
|
||||||
TEST(idle_v2, timingPid) {
|
TEST(idle_v2, timingPid) {
|
||||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
EngineTestHelper eth(TEST_ENGINE);
|
||||||
IdleController dut;
|
IdleController dut;
|
||||||
dut.inject();
|
|
||||||
|
|
||||||
engineConfiguration->useIdleTimingPidControl = true;
|
engineConfiguration->useIdleTimingPidControl = true;
|
||||||
|
|
||||||
|
@ -55,9 +54,8 @@ TEST(idle_v2, timingPid) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(idle_v2, testTargetRpm) {
|
TEST(idle_v2, testTargetRpm) {
|
||||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
EngineTestHelper eth(TEST_ENGINE);
|
||||||
IdleController dut;
|
IdleController dut;
|
||||||
dut.inject();
|
|
||||||
|
|
||||||
for (size_t i = 0; i < efi::size(engineConfiguration->cltIdleRpmBins); i++) {
|
for (size_t i = 0; i < efi::size(engineConfiguration->cltIdleRpmBins); i++) {
|
||||||
CONFIG(cltIdleRpmBins)[i] = i * 10;
|
CONFIG(cltIdleRpmBins)[i] = i * 10;
|
||||||
|
@ -69,9 +67,8 @@ TEST(idle_v2, testTargetRpm) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(idle_v2, testDeterminePhase) {
|
TEST(idle_v2, testDeterminePhase) {
|
||||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
EngineTestHelper eth(TEST_ENGINE);
|
||||||
IdleController dut;
|
IdleController dut;
|
||||||
dut.inject();
|
|
||||||
|
|
||||||
// TPS threshold 5% for easy test
|
// TPS threshold 5% for easy test
|
||||||
CONFIG(idlePidDeactivationTpsThreshold) = 5;
|
CONFIG(idlePidDeactivationTpsThreshold) = 5;
|
||||||
|
@ -115,9 +112,8 @@ TEST(idle_v2, testDeterminePhase) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(idle_v2, crankingOpenLoop) {
|
TEST(idle_v2, crankingOpenLoop) {
|
||||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
EngineTestHelper eth(TEST_ENGINE);
|
||||||
IdleController dut;
|
IdleController dut;
|
||||||
dut.inject();
|
|
||||||
|
|
||||||
engineConfiguration->crankingIACposition = 50;
|
engineConfiguration->crankingIACposition = 50;
|
||||||
|
|
||||||
|
@ -141,9 +137,8 @@ TEST(idle_v2, crankingOpenLoop) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(idle_v2, runningOpenLoopBasic) {
|
TEST(idle_v2, runningOpenLoopBasic) {
|
||||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
EngineTestHelper eth(TEST_ENGINE);
|
||||||
IdleController dut;
|
IdleController dut;
|
||||||
dut.inject();
|
|
||||||
|
|
||||||
engineConfiguration->manIdlePosition = 50;
|
engineConfiguration->manIdlePosition = 50;
|
||||||
|
|
||||||
|
@ -157,9 +152,8 @@ TEST(idle_v2, runningOpenLoopBasic) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(idle_v2, runningFanAcBump) {
|
TEST(idle_v2, runningFanAcBump) {
|
||||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
EngineTestHelper eth(TEST_ENGINE);
|
||||||
IdleController dut;
|
IdleController dut;
|
||||||
dut.inject();
|
|
||||||
|
|
||||||
engineConfiguration->manIdlePosition = 50;
|
engineConfiguration->manIdlePosition = 50;
|
||||||
engineConfiguration->acIdleExtraOffset = 9;
|
engineConfiguration->acIdleExtraOffset = 9;
|
||||||
|
@ -196,9 +190,8 @@ TEST(idle_v2, runningFanAcBump) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(idle_v2, runningOpenLoopTpsTaper) {
|
TEST(idle_v2, runningOpenLoopTpsTaper) {
|
||||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
EngineTestHelper eth(TEST_ENGINE);
|
||||||
IdleController dut;
|
IdleController dut;
|
||||||
dut.inject();
|
|
||||||
|
|
||||||
// Zero out base tempco table
|
// Zero out base tempco table
|
||||||
setArrayValues(config->cltIdleCorr, 0.0f);
|
setArrayValues(config->cltIdleCorr, 0.0f);
|
||||||
|
@ -224,9 +217,8 @@ struct MockOpenLoopIdler : public IdleController {
|
||||||
};
|
};
|
||||||
|
|
||||||
TEST(idle_v2, testOpenLoopCranking) {
|
TEST(idle_v2, testOpenLoopCranking) {
|
||||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
EngineTestHelper eth(TEST_ENGINE);
|
||||||
StrictMock<MockOpenLoopIdler> dut;
|
StrictMock<MockOpenLoopIdler> dut;
|
||||||
dut.inject();
|
|
||||||
|
|
||||||
CONFIG(overrideCrankingIacSetting) = true;
|
CONFIG(overrideCrankingIacSetting) = true;
|
||||||
|
|
||||||
|
@ -237,9 +229,8 @@ TEST(idle_v2, testOpenLoopCranking) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(idle_v2, openLoopRunningTaper) {
|
TEST(idle_v2, openLoopRunningTaper) {
|
||||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
EngineTestHelper eth(TEST_ENGINE);
|
||||||
StrictMock<MockOpenLoopIdler> dut;
|
StrictMock<MockOpenLoopIdler> dut;
|
||||||
dut.inject();
|
|
||||||
|
|
||||||
EXPECT_CALL(dut, getRunningOpenLoop(30, SensorResult(0))).WillRepeatedly(Return(25));
|
EXPECT_CALL(dut, getRunningOpenLoop(30, SensorResult(0))).WillRepeatedly(Return(25));
|
||||||
EXPECT_CALL(dut, getCrankingOpenLoop(30)).WillRepeatedly(Return(75));
|
EXPECT_CALL(dut, getCrankingOpenLoop(30)).WillRepeatedly(Return(75));
|
||||||
|
@ -262,9 +253,8 @@ TEST(idle_v2, openLoopRunningTaper) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(idle_v2, getCrankingTaperFraction) {
|
TEST(idle_v2, getCrankingTaperFraction) {
|
||||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
EngineTestHelper eth(TEST_ENGINE);
|
||||||
StrictMock<MockOpenLoopIdler> dut;
|
StrictMock<MockOpenLoopIdler> dut;
|
||||||
dut.inject();
|
|
||||||
|
|
||||||
CONFIG(afterCrankingIACtaperDuration) = 500;
|
CONFIG(afterCrankingIACtaperDuration) = 500;
|
||||||
|
|
||||||
|
@ -291,9 +281,8 @@ TEST(idle_v2, getCrankingTaperFraction) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(idle_v2, openLoopCoastingTable) {
|
TEST(idle_v2, openLoopCoastingTable) {
|
||||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
EngineTestHelper eth(TEST_ENGINE);
|
||||||
IdleController dut;
|
IdleController dut;
|
||||||
dut.inject();
|
|
||||||
|
|
||||||
// enable & configure feature
|
// enable & configure feature
|
||||||
CONFIG(useIacTableForCoasting) = true;
|
CONFIG(useIacTableForCoasting) = true;
|
||||||
|
@ -309,9 +298,8 @@ TEST(idle_v2, openLoopCoastingTable) {
|
||||||
extern int timeNowUs;
|
extern int timeNowUs;
|
||||||
|
|
||||||
TEST(idle_v2, closedLoopBasic) {
|
TEST(idle_v2, closedLoopBasic) {
|
||||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
EngineTestHelper eth(TEST_ENGINE);
|
||||||
IdleController dut;
|
IdleController dut;
|
||||||
dut.inject();
|
|
||||||
|
|
||||||
// Not testing PID here, so we can set very simple PID gains
|
// Not testing PID here, so we can set very simple PID gains
|
||||||
CONFIG(idleRpmPid).pFactor = 0.5; // 0.5 output per 1 RPM error = 50% per 100 rpm
|
CONFIG(idleRpmPid).pFactor = 0.5; // 0.5 output per 1 RPM error = 50% per 100 rpm
|
||||||
|
@ -337,9 +325,8 @@ TEST(idle_v2, closedLoopBasic) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(idle_v2, closedLoopDeadzone) {
|
TEST(idle_v2, closedLoopDeadzone) {
|
||||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
EngineTestHelper eth(TEST_ENGINE);
|
||||||
IdleController dut;
|
IdleController dut;
|
||||||
dut.inject();
|
|
||||||
|
|
||||||
// Not testing PID here, so we can set very simple PID gains
|
// Not testing PID here, so we can set very simple PID gains
|
||||||
CONFIG(idleRpmPid).pFactor = 0.5; // 0.5 output per 1 RPM error = 50% per 100 rpm
|
CONFIG(idleRpmPid).pFactor = 0.5; // 0.5 output per 1 RPM error = 50% per 100 rpm
|
||||||
|
@ -373,9 +360,8 @@ struct IntegrationIdleMock : public IdleController {
|
||||||
};
|
};
|
||||||
|
|
||||||
TEST(idle_v2, IntegrationManual) {
|
TEST(idle_v2, IntegrationManual) {
|
||||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
EngineTestHelper eth(TEST_ENGINE);
|
||||||
StrictMock<IntegrationIdleMock> dut;
|
StrictMock<IntegrationIdleMock> dut;
|
||||||
dut.inject();
|
|
||||||
|
|
||||||
SensorResult expectedTps = 1;
|
SensorResult expectedTps = 1;
|
||||||
float expectedClt = 37;
|
float expectedClt = 37;
|
||||||
|
@ -406,9 +392,8 @@ TEST(idle_v2, IntegrationManual) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(idle_v2, IntegrationAutomatic) {
|
TEST(idle_v2, IntegrationAutomatic) {
|
||||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
EngineTestHelper eth(TEST_ENGINE);
|
||||||
StrictMock<IntegrationIdleMock> dut;
|
StrictMock<IntegrationIdleMock> dut;
|
||||||
dut.inject();
|
|
||||||
|
|
||||||
CONFIG(idleMode) = IM_AUTO;
|
CONFIG(idleMode) = IM_AUTO;
|
||||||
|
|
||||||
|
@ -444,9 +429,8 @@ TEST(idle_v2, IntegrationAutomatic) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(idle_v2, IntegrationClamping) {
|
TEST(idle_v2, IntegrationClamping) {
|
||||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
EngineTestHelper eth(TEST_ENGINE);
|
||||||
StrictMock<IntegrationIdleMock> dut;
|
StrictMock<IntegrationIdleMock> dut;
|
||||||
dut.inject();
|
|
||||||
|
|
||||||
CONFIG(idleMode) = IM_AUTO;
|
CONFIG(idleMode) = IM_AUTO;
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
#include "knock_logic.h"
|
#include "knock_logic.h"
|
||||||
|
|
||||||
TEST(Knock, Retards) {
|
TEST(Knock, Retards) {
|
||||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
EngineTestHelper eth(TEST_ENGINE);
|
||||||
|
|
||||||
// Knock threshold of 20dBv
|
// Knock threshold of 20dBv
|
||||||
ENGINE(engineState).knockThreshold = 20;
|
ENGINE(engineState).knockThreshold = 20;
|
||||||
|
@ -13,7 +13,6 @@ TEST(Knock, Retards) {
|
||||||
CONFIG(knockRetardMaximum) = 8;
|
CONFIG(knockRetardMaximum) = 8;
|
||||||
|
|
||||||
KnockController dut;
|
KnockController dut;
|
||||||
dut.inject();
|
|
||||||
|
|
||||||
// No retard unless we knock
|
// No retard unless we knock
|
||||||
ASSERT_FLOAT_EQ(dut.getKnockRetard(), 0);
|
ASSERT_FLOAT_EQ(dut.getKnockRetard(), 0);
|
||||||
|
@ -40,10 +39,9 @@ TEST(Knock, Retards) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(Knock, Reapply) {
|
TEST(Knock, Reapply) {
|
||||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
EngineTestHelper eth(TEST_ENGINE);
|
||||||
|
|
||||||
KnockController dut;
|
KnockController dut;
|
||||||
dut.inject();
|
|
||||||
|
|
||||||
// Knock threshold of 20dBv
|
// Knock threshold of 20dBv
|
||||||
ENGINE(engineState).knockThreshold = 20;
|
ENGINE(engineState).knockThreshold = 20;
|
||||||
|
|
|
@ -3,10 +3,9 @@
|
||||||
#include "launch_control.h"
|
#include "launch_control.h"
|
||||||
|
|
||||||
TEST(LaunchControl, TpsCondition) {
|
TEST(LaunchControl, TpsCondition) {
|
||||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
EngineTestHelper eth(TEST_ENGINE);
|
||||||
|
|
||||||
LaunchControlBase dut;
|
LaunchControlBase dut;
|
||||||
dut.inject();
|
|
||||||
|
|
||||||
engineConfiguration->launchTpsTreshold = 10;
|
engineConfiguration->launchTpsTreshold = 10;
|
||||||
|
|
||||||
|
@ -25,10 +24,9 @@ TEST(LaunchControl, TpsCondition) {
|
||||||
|
|
||||||
|
|
||||||
TEST(LaunchControl, VSSCondition) {
|
TEST(LaunchControl, VSSCondition) {
|
||||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
EngineTestHelper eth(TEST_ENGINE);
|
||||||
|
|
||||||
LaunchControlBase dut;
|
LaunchControlBase dut;
|
||||||
dut.inject();
|
|
||||||
|
|
||||||
// Test Speed threshold
|
// Test Speed threshold
|
||||||
engineConfiguration->launchActivationMode = ALWAYS_ACTIVE_LAUNCH;
|
engineConfiguration->launchActivationMode = ALWAYS_ACTIVE_LAUNCH;
|
||||||
|
@ -43,10 +41,9 @@ TEST(LaunchControl, VSSCondition) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(LaunchControl, RPMCondition) {
|
TEST(LaunchControl, RPMCondition) {
|
||||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
EngineTestHelper eth(TEST_ENGINE);
|
||||||
|
|
||||||
LaunchControlBase dut;
|
LaunchControlBase dut;
|
||||||
dut.inject();
|
|
||||||
|
|
||||||
engineConfiguration->launchRpm = 3000;
|
engineConfiguration->launchRpm = 3000;
|
||||||
|
|
||||||
|
@ -56,10 +53,9 @@ TEST(LaunchControl, RPMCondition) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(LaunchControl, SwitchInputCondition) {
|
TEST(LaunchControl, SwitchInputCondition) {
|
||||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
EngineTestHelper eth(TEST_ENGINE);
|
||||||
|
|
||||||
LaunchControlBase dut;
|
LaunchControlBase dut;
|
||||||
dut.inject();
|
|
||||||
|
|
||||||
//activation based on VSS
|
//activation based on VSS
|
||||||
engineConfiguration->launchActivationMode = ALWAYS_ACTIVE_LAUNCH;
|
engineConfiguration->launchActivationMode = ALWAYS_ACTIVE_LAUNCH;
|
||||||
|
@ -99,10 +95,9 @@ TEST(LaunchControl, SwitchInputCondition) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(LaunchControl, CombinedCondition) {
|
TEST(LaunchControl, CombinedCondition) {
|
||||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
EngineTestHelper eth(TEST_ENGINE);
|
||||||
|
|
||||||
LaunchControlBase dut;
|
LaunchControlBase dut;
|
||||||
dut.inject();
|
|
||||||
|
|
||||||
//check VSS normal usage
|
//check VSS normal usage
|
||||||
engineConfiguration->launchActivationMode = ALWAYS_ACTIVE_LAUNCH;
|
engineConfiguration->launchActivationMode = ALWAYS_ACTIVE_LAUNCH;
|
||||||
|
@ -143,7 +138,7 @@ static void setDefaultLaunchParameters() {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(LaunchControl, CompleteRun) {
|
TEST(LaunchControl, CompleteRun) {
|
||||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
EngineTestHelper eth(TEST_ENGINE);
|
||||||
|
|
||||||
initLaunchControl();
|
initLaunchControl();
|
||||||
|
|
||||||
|
|
|
@ -21,12 +21,11 @@ TEST(limp, testFatalError) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(limp, revLimit) {
|
TEST(limp, revLimit) {
|
||||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
EngineTestHelper eth(TEST_ENGINE);
|
||||||
|
|
||||||
engineConfiguration->rpmHardLimit = 2500;
|
engineConfiguration->rpmHardLimit = 2500;
|
||||||
|
|
||||||
LimpManager dut;
|
LimpManager dut;
|
||||||
dut.inject();
|
|
||||||
|
|
||||||
// Under rev limit, inj/ign allowed
|
// Under rev limit, inj/ign allowed
|
||||||
dut.updateState(2000, 0);
|
dut.updateState(2000, 0);
|
||||||
|
@ -45,13 +44,12 @@ TEST(limp, revLimit) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(limp, boostCut) {
|
TEST(limp, boostCut) {
|
||||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
EngineTestHelper eth(TEST_ENGINE);
|
||||||
|
|
||||||
// Cut above 100kPa
|
// Cut above 100kPa
|
||||||
engineConfiguration->boostCutPressure = 100;
|
engineConfiguration->boostCutPressure = 100;
|
||||||
|
|
||||||
LimpManager dut;
|
LimpManager dut;
|
||||||
dut.inject();
|
|
||||||
|
|
||||||
// Below threshold, injection allowed
|
// Below threshold, injection allowed
|
||||||
Sensor::setMockValue(SensorType::Map, 80);
|
Sensor::setMockValue(SensorType::Map, 80);
|
||||||
|
@ -78,11 +76,10 @@ TEST(limp, boostCut) {
|
||||||
extern int timeNowUs;
|
extern int timeNowUs;
|
||||||
|
|
||||||
TEST(limp, oilPressureFailureCase) {
|
TEST(limp, oilPressureFailureCase) {
|
||||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
EngineTestHelper eth(TEST_ENGINE);
|
||||||
engineConfiguration->minOilPressureAfterStart = 200;
|
engineConfiguration->minOilPressureAfterStart = 200;
|
||||||
|
|
||||||
LimpManager dut;
|
LimpManager dut;
|
||||||
dut.inject();
|
|
||||||
|
|
||||||
// Low oil pressure!
|
// Low oil pressure!
|
||||||
Sensor::setMockValue(SensorType::OilPressure, 50);
|
Sensor::setMockValue(SensorType::OilPressure, 50);
|
||||||
|
@ -112,11 +109,10 @@ TEST(limp, oilPressureFailureCase) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(limp, oilPressureSuccessCase) {
|
TEST(limp, oilPressureSuccessCase) {
|
||||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
EngineTestHelper eth(TEST_ENGINE);
|
||||||
engineConfiguration->minOilPressureAfterStart = 200;
|
engineConfiguration->minOilPressureAfterStart = 200;
|
||||||
|
|
||||||
LimpManager dut;
|
LimpManager dut;
|
||||||
dut.inject();
|
|
||||||
|
|
||||||
// Low oil pressure!
|
// Low oil pressure!
|
||||||
Sensor::setMockValue(SensorType::OilPressure, 50);
|
Sensor::setMockValue(SensorType::OilPressure, 50);
|
||||||
|
|
|
@ -114,13 +114,13 @@ static void testExpression2(float selfValue, const char *line, float expected, E
|
||||||
ASSERT_TRUE(element != NULL) << "Not NULL expected";
|
ASSERT_TRUE(element != NULL) << "Not NULL expected";
|
||||||
LECalculator c;
|
LECalculator c;
|
||||||
|
|
||||||
EXPAND_Engine;
|
|
||||||
|
|
||||||
ASSERT_NEAR(expected, c.evaluate("test", selfValue, element), EPS4D) << line;
|
ASSERT_NEAR(expected, c.evaluate("test", selfValue, element), EPS4D) << line;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void testExpression2(float selfValue, const char *line, float expected, const std::unordered_map<SensorType, float>& sensorVals = {}) {
|
static void testExpression2(float selfValue, const char *line, float expected, const std::unordered_map<SensorType, float>& sensorVals = {}) {
|
||||||
WITH_ENGINE_TEST_HELPER_SENS(FORD_INLINE_6_1995, sensorVals);
|
EngineTestHelper eth(FORD_INLINE_6_1995, sensorVals);
|
||||||
testExpression2(selfValue, line, expected, engine);
|
testExpression2(selfValue, line, expected, engine);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -129,7 +129,7 @@ static void testExpression(const char *line, float expectedValue, const std::uno
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(fsio, testHysteresisSelf) {
|
TEST(fsio, testHysteresisSelf) {
|
||||||
WITH_ENGINE_TEST_HELPER(FORD_INLINE_6_1995);
|
EngineTestHelper eth(FORD_INLINE_6_1995);
|
||||||
|
|
||||||
LEElement thepool[TEST_POOL_SIZE];
|
LEElement thepool[TEST_POOL_SIZE];
|
||||||
LEElementPool pool(thepool, TEST_POOL_SIZE);
|
LEElementPool pool(thepool, TEST_POOL_SIZE);
|
||||||
|
@ -234,7 +234,7 @@ TEST(fsio, testLogicExpressions) {
|
||||||
testExpression("fan NOT coolant 90 > AND fan coolant 85 > AND OR", 1, sensorVals);
|
testExpression("fan NOT coolant 90 > AND fan coolant 85 > AND OR", 1, sensorVals);
|
||||||
|
|
||||||
{
|
{
|
||||||
WITH_ENGINE_TEST_HELPER_SENS(FORD_INLINE_6_1995, sensorVals);
|
EngineTestHelper eth(FORD_INLINE_6_1995, sensorVals);
|
||||||
LEElement thepool[TEST_POOL_SIZE];
|
LEElement thepool[TEST_POOL_SIZE];
|
||||||
LEElementPool pool(thepool, TEST_POOL_SIZE);
|
LEElementPool pool(thepool, TEST_POOL_SIZE);
|
||||||
LEElement * element = pool.parseExpression("fan NOT coolant 90 > AND fan coolant 85 > AND OR");
|
LEElement * element = pool.parseExpression("fan NOT coolant 90 > AND fan coolant 85 > AND OR");
|
||||||
|
@ -248,7 +248,7 @@ TEST(fsio, testLogicExpressions) {
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
WITH_ENGINE_TEST_HELPER_SENS(FORD_INLINE_6_1995, sensorVals);
|
EngineTestHelper eth(FORD_INLINE_6_1995, sensorVals);
|
||||||
engine->fsioState.mockRpm = 900;
|
engine->fsioState.mockRpm = 900;
|
||||||
engine->fsioState.mockCrankingRpm = 200;
|
engine->fsioState.mockCrankingRpm = 200;
|
||||||
testExpression2(0, "rpm", 900, engine);
|
testExpression2(0, "rpm", 900, engine);
|
||||||
|
@ -260,7 +260,7 @@ TEST(fsio, testLogicExpressions) {
|
||||||
|
|
||||||
TEST(fsio, fuelPump) {
|
TEST(fsio, fuelPump) {
|
||||||
// this will init fuel pump fsio logic
|
// this will init fuel pump fsio logic
|
||||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
EngineTestHelper eth(TEST_ENGINE);
|
||||||
|
|
||||||
// Mock a fuel pump pin
|
// Mock a fuel pump pin
|
||||||
CONFIG(fuelPumpPin) = GPIOA_0;
|
CONFIG(fuelPumpPin) = GPIOA_0;
|
||||||
|
|
|
@ -8,14 +8,14 @@
|
||||||
#include "pch.h"
|
#include "pch.h"
|
||||||
|
|
||||||
TEST(sensors, vrThreshold) {
|
TEST(sensors, vrThreshold) {
|
||||||
WITH_ENGINE_TEST_HELPER(HELLEN_128_MERCEDES_4_CYL);
|
EngineTestHelper eth(HELLEN_128_MERCEDES_4_CYL);
|
||||||
|
|
||||||
auto& cfg = CONFIG(vrThreshold)[0];
|
auto& cfg = CONFIG(vrThreshold)[0];
|
||||||
ASSERT_FLOAT_EQ(0.8 * PACK_PERCENT_BYTE_MULT, cfg.values[2]);
|
ASSERT_FLOAT_EQ(0.8 * PACK_PERCENT_BYTE_MULT, cfg.values[2]);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(sensors, mapDecoding) {
|
TEST(sensors, mapDecoding) {
|
||||||
WITH_ENGINE_TEST_HELPER(FORD_INLINE_6_1995);
|
EngineTestHelper eth(FORD_INLINE_6_1995);
|
||||||
|
|
||||||
air_pressure_sensor_config_s s;
|
air_pressure_sensor_config_s s;
|
||||||
s.type = MT_DENSO183;
|
s.type = MT_DENSO183;
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
|
|
||||||
TEST(start, startStop) {
|
TEST(start, startStop) {
|
||||||
std::unordered_map<SensorType, float> sensorVals = {{ SensorType::AcceleratorPedal, 0 }};
|
std::unordered_map<SensorType, float> sensorVals = {{ SensorType::AcceleratorPedal, 0 }};
|
||||||
WITH_ENGINE_TEST_HELPER_SENS(PROTEUS_BMW_M73, sensorVals);
|
EngineTestHelper eth(PROTEUS_BMW_M73, sensorVals);
|
||||||
eth.moveTimeForwardAndInvokeEventsSec(1); // '0' time has special meaning for implementation so let's move forward
|
eth.moveTimeForwardAndInvokeEventsSec(1); // '0' time has special meaning for implementation so let's move forward
|
||||||
|
|
||||||
// this is a pull-up, so 'true' on start-up
|
// this is a pull-up, so 'true' on start-up
|
||||||
|
|
|
@ -77,7 +77,7 @@ TEST(ClosedLoopFuel, CellSelection) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(ClosedLoopFuel, afrLimits) {
|
TEST(ClosedLoopFuel, afrLimits) {
|
||||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
EngineTestHelper eth(TEST_ENGINE);
|
||||||
|
|
||||||
engineConfiguration->stft.minAfr = 100; // 10.0 AFR
|
engineConfiguration->stft.minAfr = 100; // 10.0 AFR
|
||||||
engineConfiguration->stft.maxAfr = 180; // 18.0 AFR
|
engineConfiguration->stft.maxAfr = 180; // 18.0 AFR
|
||||||
|
|
|
@ -5,7 +5,7 @@ extern float getTachDuty(void);
|
||||||
|
|
||||||
TEST(tachometer, testPulsePerRev) {
|
TEST(tachometer, testPulsePerRev) {
|
||||||
// This engine has a tach pin set - we need that
|
// This engine has a tach pin set - we need that
|
||||||
WITH_ENGINE_TEST_HELPER(FRANKENSO_MAZDA_MIATA_2003);
|
EngineTestHelper eth(FRANKENSO_MAZDA_MIATA_2003);
|
||||||
|
|
||||||
// We don't actually care about ign/inj at all, just tach
|
// We don't actually care about ign/inj at all, just tach
|
||||||
engineConfiguration->isInjectionEnabled = false;
|
engineConfiguration->isInjectionEnabled = false;
|
||||||
|
|
|
@ -68,7 +68,7 @@ TEST(binary, testWriteCrc) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(TunerstudioCommands, writeChunkEngineConfig) {
|
TEST(TunerstudioCommands, writeChunkEngineConfig) {
|
||||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
EngineTestHelper eth(TEST_ENGINE);
|
||||||
MockTsChannel channel;
|
MockTsChannel channel;
|
||||||
|
|
||||||
uint8_t* configBytes = reinterpret_cast<uint8_t*>(config);
|
uint8_t* configBytes = reinterpret_cast<uint8_t*>(config);
|
||||||
|
@ -90,7 +90,7 @@ TEST(TunerstudioCommands, writeChunkEngineConfig) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(TunerstudioCommands, writeChunkOutsideEngineConfig) {
|
TEST(TunerstudioCommands, writeChunkOutsideEngineConfig) {
|
||||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
EngineTestHelper eth(TEST_ENGINE);
|
||||||
MockTsChannel channel;
|
MockTsChannel channel;
|
||||||
|
|
||||||
uint8_t* configBytes = reinterpret_cast<uint8_t*>(config);
|
uint8_t* configBytes = reinterpret_cast<uint8_t*>(config);
|
||||||
|
|
|
@ -6,7 +6,7 @@ using ::testing::StrictMock;
|
||||||
using ::testing::Return;
|
using ::testing::Return;
|
||||||
|
|
||||||
TEST(Vvt, setpoint) {
|
TEST(Vvt, setpoint) {
|
||||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
EngineTestHelper eth(TEST_ENGINE);
|
||||||
|
|
||||||
// Set up a mock target map
|
// Set up a mock target map
|
||||||
StrictMock<MockVp3d> targetMap;
|
StrictMock<MockVp3d> targetMap;
|
||||||
|
@ -18,7 +18,6 @@ TEST(Vvt, setpoint) {
|
||||||
engine->rpmCalculator.mockRpm = 4321;
|
engine->rpmCalculator.mockRpm = 4321;
|
||||||
|
|
||||||
VvtController dut;
|
VvtController dut;
|
||||||
dut.inject();
|
|
||||||
dut.init(0, 0, 0, &targetMap);
|
dut.init(0, 0, 0, &targetMap);
|
||||||
|
|
||||||
// Test dut
|
// Test dut
|
||||||
|
@ -26,12 +25,11 @@ TEST(Vvt, setpoint) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(Vvt, observePlant) {
|
TEST(Vvt, observePlant) {
|
||||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
EngineTestHelper eth(TEST_ENGINE);
|
||||||
|
|
||||||
engine->triggerCentral.vvtPosition[0][0] = 23;
|
engine->triggerCentral.vvtPosition[0][0] = 23;
|
||||||
|
|
||||||
VvtController dut;
|
VvtController dut;
|
||||||
dut.inject();
|
|
||||||
dut.init(0, 0, 0, nullptr);
|
dut.init(0, 0, 0, nullptr);
|
||||||
|
|
||||||
EXPECT_EQ(23, dut.observePlant().value_or(0));
|
EXPECT_EQ(23, dut.observePlant().value_or(0));
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
|
|
||||||
TEST(sensors, test2jz) {
|
TEST(sensors, test2jz) {
|
||||||
|
|
||||||
WITH_ENGINE_TEST_HELPER(TOYOTA_2JZ_GTE_VVTi);
|
EngineTestHelper eth(TOYOTA_2JZ_GTE_VVTi);
|
||||||
|
|
||||||
|
|
||||||
// this crank trigger would be easier to test, crank shape is less important for this test
|
// this crank trigger would be easier to test, crank shape is less important for this test
|
||||||
|
|
|
@ -13,7 +13,7 @@ extern WarningCodeState unitTestWarningCodeState;
|
||||||
extern WaveChart waveChart;
|
extern WaveChart waveChart;
|
||||||
|
|
||||||
TEST(trigger, testNoStartUpWarningsNoSyncronizationTrigger) {
|
TEST(trigger, testNoStartUpWarningsNoSyncronizationTrigger) {
|
||||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
EngineTestHelper eth(TEST_ENGINE);
|
||||||
// one tooth does not need synchronization it just counts tooth
|
// one tooth does not need synchronization it just counts tooth
|
||||||
eth.setTriggerType(TT_ONE);
|
eth.setTriggerType(TT_ONE);
|
||||||
ASSERT_EQ( 0, GET_RPM()) << "testNoStartUpWarnings RPM";
|
ASSERT_EQ( 0, GET_RPM()) << "testNoStartUpWarnings RPM";
|
||||||
|
@ -24,7 +24,7 @@ TEST(trigger, testNoStartUpWarningsNoSyncronizationTrigger) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(trigger, testNoStartUpWarnings) {
|
TEST(trigger, testNoStartUpWarnings) {
|
||||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
EngineTestHelper eth(TEST_ENGINE);
|
||||||
// for this test we need a trigger with isSynchronizationNeeded=true
|
// for this test we need a trigger with isSynchronizationNeeded=true
|
||||||
engineConfiguration->trigger.customTotalToothCount = 3;
|
engineConfiguration->trigger.customTotalToothCount = 3;
|
||||||
engineConfiguration->trigger.customSkippedToothCount = 1;
|
engineConfiguration->trigger.customSkippedToothCount = 1;
|
||||||
|
@ -59,7 +59,7 @@ TEST(trigger, testNoStartUpWarnings) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(trigger, testNoisyInput) {
|
TEST(trigger, testNoisyInput) {
|
||||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
EngineTestHelper eth(TEST_ENGINE);
|
||||||
|
|
||||||
ASSERT_EQ( 0, GET_RPM()) << "testNoisyInput RPM";
|
ASSERT_EQ( 0, GET_RPM()) << "testNoisyInput RPM";
|
||||||
|
|
||||||
|
@ -81,7 +81,7 @@ TEST(trigger, testNoisyInput) {
|
||||||
|
|
||||||
TEST(trigger, testCamInput) {
|
TEST(trigger, testCamInput) {
|
||||||
// setting some weird engine
|
// setting some weird engine
|
||||||
WITH_ENGINE_TEST_HELPER(FORD_ESCORT_GT);
|
EngineTestHelper eth(FORD_ESCORT_GT);
|
||||||
|
|
||||||
// changing to 'ONE TOOTH' trigger on CRANK with CAM/VVT
|
// changing to 'ONE TOOTH' trigger on CRANK with CAM/VVT
|
||||||
setOperationMode(engineConfiguration, FOUR_STROKE_CRANK_SENSOR);
|
setOperationMode(engineConfiguration, FOUR_STROKE_CRANK_SENSOR);
|
||||||
|
@ -122,7 +122,7 @@ TEST(trigger, testCamInput) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(trigger, testNB2CamInput) {
|
TEST(trigger, testNB2CamInput) {
|
||||||
WITH_ENGINE_TEST_HELPER(FRANKENSO_MAZDA_MIATA_2003);
|
EngineTestHelper eth(FRANKENSO_MAZDA_MIATA_2003);
|
||||||
|
|
||||||
// this crank trigger would be easier to test, crank shape is less important for this test
|
// this crank trigger would be easier to test, crank shape is less important for this test
|
||||||
eth.setTriggerType(TT_ONE);
|
eth.setTriggerType(TT_ONE);
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
#include "pch.h"
|
#include "pch.h"
|
||||||
|
|
||||||
TEST(cranking, testFasterEngineSpinningUp) {
|
TEST(cranking, testFasterEngineSpinningUp) {
|
||||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
EngineTestHelper eth(TEST_ENGINE);
|
||||||
ENGINE(tdcMarkEnabled) = false;
|
ENGINE(tdcMarkEnabled) = false;
|
||||||
// turn on FasterEngineSpinUp mode
|
// turn on FasterEngineSpinUp mode
|
||||||
engineConfiguration->isFasterEngineSpinUpEnabled = true;
|
engineConfiguration->isFasterEngineSpinUpEnabled = true;
|
||||||
|
@ -97,7 +97,7 @@ TEST(cranking, testFasterEngineSpinningUp) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void doTestFasterEngineSpinningUp60_2(int startUpDelayMs, int rpm1, int expectedRpm) {
|
static void doTestFasterEngineSpinningUp60_2(int startUpDelayMs, int rpm1, int expectedRpm) {
|
||||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
EngineTestHelper eth(TEST_ENGINE);
|
||||||
// turn on FasterEngineSpinUp mode
|
// turn on FasterEngineSpinUp mode
|
||||||
engineConfiguration->isFasterEngineSpinUpEnabled = true;
|
engineConfiguration->isFasterEngineSpinUpEnabled = true;
|
||||||
|
|
||||||
|
|
|
@ -9,13 +9,12 @@ using ::testing::InSequence;
|
||||||
TEST(injectionScheduling, NormalDutyCycle) {
|
TEST(injectionScheduling, NormalDutyCycle) {
|
||||||
StrictMock<MockExecutor> mockExec;
|
StrictMock<MockExecutor> mockExec;
|
||||||
|
|
||||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
EngineTestHelper eth(TEST_ENGINE);
|
||||||
engine->executor.setMockExecutor(&mockExec);
|
engine->executor.setMockExecutor(&mockExec);
|
||||||
|
|
||||||
efitick_t nowNt = 1000000;
|
efitick_t nowNt = 1000000;
|
||||||
|
|
||||||
InjectionEvent event;
|
InjectionEvent event;
|
||||||
event.inject();
|
|
||||||
InjectorOutputPin pin;
|
InjectorOutputPin pin;
|
||||||
pin.injectorIndex = 0;
|
pin.injectorIndex = 0;
|
||||||
event.outputs[0] = &pin;
|
event.outputs[0] = &pin;
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
#include "trigger_emulator_algo.h"
|
#include "trigger_emulator_algo.h"
|
||||||
|
|
||||||
TEST(miata, miata_na_tdc) {
|
TEST(miata, miata_na_tdc) {
|
||||||
WITH_ENGINE_TEST_HELPER(FRANKENSO_MIATA_NA6_MAP);
|
EngineTestHelper eth(FRANKENSO_MIATA_NA6_MAP);
|
||||||
|
|
||||||
#define TEST_REVOLUTIONS 6
|
#define TEST_REVOLUTIONS 6
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ public:
|
||||||
static void func(TriggerCallback *callback) {
|
static void func(TriggerCallback *callback) {
|
||||||
int formIndex = callback->toothIndex % callback->form->getSize();
|
int formIndex = callback->toothIndex % callback->form->getSize();
|
||||||
Engine *engine = callback->engine;
|
Engine *engine = callback->engine;
|
||||||
EXPAND_Engine;
|
|
||||||
|
|
||||||
int value = callback->form->wave->getChannelState(0, formIndex);
|
int value = callback->form->wave->getChannelState(0, formIndex);
|
||||||
efitick_t nowNt = getTimeNowNt();
|
efitick_t nowNt = getTimeNowNt();
|
||||||
|
@ -72,7 +72,7 @@ TEST(nissan, vq_vvt) {
|
||||||
// hold a reference to the heap allocated scheduling events until the test is done
|
// hold a reference to the heap allocated scheduling events until the test is done
|
||||||
std::vector<std::shared_ptr<TriggerCallback>> ptrs;
|
std::vector<std::shared_ptr<TriggerCallback>> ptrs;
|
||||||
|
|
||||||
WITH_ENGINE_TEST_HELPER (HELLEN_121_NISSAN_6_CYL);
|
EngineTestHelper eth (HELLEN_121_NISSAN_6_CYL);
|
||||||
engineConfiguration->isIgnitionEnabled = false;
|
engineConfiguration->isIgnitionEnabled = false;
|
||||||
engineConfiguration->isInjectionEnabled = false;
|
engineConfiguration->isInjectionEnabled = false;
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
#include "pch.h"
|
#include "pch.h"
|
||||||
|
|
||||||
TEST(subaru, overrideGap) {
|
TEST(subaru, overrideGap) {
|
||||||
WITH_ENGINE_TEST_HELPER(FRANKENSO_MIATA_NA6_MAP);
|
EngineTestHelper eth(FRANKENSO_MIATA_NA6_MAP);
|
||||||
|
|
||||||
CONFIG(overrideTriggerGaps) = true;
|
CONFIG(overrideTriggerGaps) = true;
|
||||||
CONFIG(gapTrackingLengthOverride) = 2;
|
CONFIG(gapTrackingLengthOverride) = 2;
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
TEST(trigger, testQuadCam) {
|
TEST(trigger, testQuadCam) {
|
||||||
// setting some weird engine
|
// setting some weird engine
|
||||||
WITH_ENGINE_TEST_HELPER(FORD_ESCORT_GT);
|
EngineTestHelper eth(FORD_ESCORT_GT);
|
||||||
|
|
||||||
setOperationMode(engineConfiguration, FOUR_STROKE_CRANK_SENSOR);
|
setOperationMode(engineConfiguration, FOUR_STROKE_CRANK_SENSOR);
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ TEST(cranking, realCrankingFromFile) {
|
||||||
int indeces[2] = {1, 0}; // this logic data file has first trigger channel in second column and second trigger channel in first column
|
int indeces[2] = {1, 0}; // this logic data file has first trigger channel in second column and second trigger channel in first column
|
||||||
reader.open("tests/trigger/resources/cranking_na_3.csv", indeces);
|
reader.open("tests/trigger/resources/cranking_na_3.csv", indeces);
|
||||||
|
|
||||||
WITH_ENGINE_TEST_HELPER (FRANKENSO_MIATA_NA6_MAP);
|
EngineTestHelper eth (FRANKENSO_MIATA_NA6_MAP);
|
||||||
|
|
||||||
ssize_t read;
|
ssize_t read;
|
||||||
|
|
||||||
|
|
|
@ -28,14 +28,14 @@ static void fireTriggerEvent(EngineTestHelper*eth, double timestampS, trigger_wh
|
||||||
}
|
}
|
||||||
|
|
||||||
Engine *engine = ð->engine;
|
Engine *engine = ð->engine;
|
||||||
EXPAND_Engine;
|
|
||||||
timeNowUs = 1'000'000 * timestampS;
|
timeNowUs = 1'000'000 * timestampS;
|
||||||
printf("MIATANA: posting time=%d event=%d\n", timeNowUs, event);
|
printf("MIATANA: posting time=%d event=%d\n", timeNowUs, event);
|
||||||
hwHandleShaftSignal((int)channel, !isFall, getTimeNowNt());
|
hwHandleShaftSignal((int)channel, !isFall, getTimeNowNt());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(cranking, hardcodedRealCranking) {
|
TEST(cranking, hardcodedRealCranking) {
|
||||||
WITH_ENGINE_TEST_HELPER(FRANKENSO_MIATA_NA6_VAF);
|
EngineTestHelper eth(FRANKENSO_MIATA_NA6_VAF);
|
||||||
|
|
||||||
#define EVENT(timestamp, channel, value) { fireTriggerEvent(ð, timestamp, channel, value); }
|
#define EVENT(timestamp, channel, value) { fireTriggerEvent(ð, timestamp, channel, value); }
|
||||||
|
|
||||||
|
@ -171,7 +171,7 @@ TEST(cranking, naCrankFromFile) {
|
||||||
int indeces[2] = {1, 0};
|
int indeces[2] = {1, 0};
|
||||||
reader.open("tests/trigger/resources/cranking_na_4.csv", indeces);
|
reader.open("tests/trigger/resources/cranking_na_4.csv", indeces);
|
||||||
|
|
||||||
WITH_ENGINE_TEST_HELPER(FRANKENSO_MIATA_NA6_VAF);
|
EngineTestHelper eth(FRANKENSO_MIATA_NA6_VAF);
|
||||||
|
|
||||||
while (reader.haveMore()) {
|
while (reader.haveMore()) {
|
||||||
reader.processLine(ð);
|
reader.processLine(ð);
|
||||||
|
|
|
@ -13,7 +13,7 @@ TEST(realCrankingVQ40, normalCranking) {
|
||||||
int indeces[] = {0};
|
int indeces[] = {0};
|
||||||
|
|
||||||
reader.open("tests/trigger/resources/nissan_vq40_cranking-1.csv", indeces);
|
reader.open("tests/trigger/resources/nissan_vq40_cranking-1.csv", indeces);
|
||||||
WITH_ENGINE_TEST_HELPER (HELLEN_121_NISSAN_6_CYL);
|
EngineTestHelper eth (HELLEN_121_NISSAN_6_CYL);
|
||||||
|
|
||||||
bool hasSeenFirstVvt = false;
|
bool hasSeenFirstVvt = false;
|
||||||
|
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue