unit tests progress
This commit is contained in:
parent
36fad3a21e
commit
87875d8825
|
@ -97,12 +97,19 @@ void mostCommonInitEngineController(Logging *sharedLogger DECLARE_ENGINE_PARAMET
|
||||||
#endif /* EFI_FSIO */
|
#endif /* EFI_FSIO */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EXTERN_ENGINE;
|
||||||
|
|
||||||
|
#if EFI_ENABLE_MOCK_ADC
|
||||||
|
void setMockVoltage(int hwChannel, float voltage DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||||
|
engine->engineState.mockAdcState.setMockVoltage(hwChannel, voltage PASS_ENGINE_PARAMETER_SUFFIX);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#if !EFI_UNIT_TEST
|
#if !EFI_UNIT_TEST
|
||||||
|
|
||||||
extern bool hasFirmwareErrorFlag;
|
extern bool hasFirmwareErrorFlag;
|
||||||
extern EnginePins enginePins;
|
extern EnginePins enginePins;
|
||||||
|
|
||||||
EXTERN_ENGINE;
|
|
||||||
|
|
||||||
static void doPeriodicSlowCallback(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
static void doPeriodicSlowCallback(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
||||||
|
|
||||||
|
@ -568,21 +575,17 @@ static void setFloat(const char *offsetStr, const char *valueStr) {
|
||||||
onConfigurationChanged();
|
onConfigurationChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if EFI_ENABLE_MOCK_ADC || EFI_SIMULATOR
|
#if EFI_ENABLE_MOCK_ADC
|
||||||
|
|
||||||
static void setMockVoltage(int hwChannel, float voltage) {
|
void setMockCltVoltage(float voltage DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||||
engine->engineState.mockAdcState.setMockVoltage(hwChannel, voltage);
|
|
||||||
}
|
|
||||||
|
|
||||||
void setMockCltVoltage(float voltage) {
|
|
||||||
setMockVoltage(engineConfiguration->clt.adcChannel, voltage);
|
setMockVoltage(engineConfiguration->clt.adcChannel, voltage);
|
||||||
}
|
}
|
||||||
|
|
||||||
void setMockIatVoltage(float voltage) {
|
void setMockIatVoltage(float voltage DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||||
setMockVoltage(engineConfiguration->iat.adcChannel, voltage);
|
setMockVoltage(engineConfiguration->iat.adcChannel, voltage);
|
||||||
}
|
}
|
||||||
|
|
||||||
void setMockMafVoltage(float voltage) {
|
void setMockMafVoltage(float voltage DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||||
setMockVoltage(engineConfiguration->mafAdcChannel, voltage);
|
setMockVoltage(engineConfiguration->mafAdcChannel, voltage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,8 +6,7 @@
|
||||||
* @author Andrey Belomutskiy, (c) 2012-2017
|
* @author Andrey Belomutskiy, (c) 2012-2017
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef ENGINE_STATUS_H_
|
#pragma once
|
||||||
#define ENGINE_STATUS_H_
|
|
||||||
|
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
#include "signal_executor.h"
|
#include "signal_executor.h"
|
||||||
|
@ -20,6 +19,10 @@ void initEngineContoller(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX);
|
||||||
void commonInitEngineController(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX);
|
void commonInitEngineController(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX);
|
||||||
void mostCommonInitEngineController(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX);
|
void mostCommonInitEngineController(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX);
|
||||||
|
|
||||||
|
#if EFI_ENABLE_MOCK_ADC
|
||||||
|
void setMockVoltage(int hwChannel, float voltage DECLARE_ENGINE_PARAMETER_SUFFIX);
|
||||||
|
#endif
|
||||||
|
|
||||||
void setMockVBattVoltage(float voltage);
|
void setMockVBattVoltage(float voltage);
|
||||||
void setMockMapVoltage(float voltage);
|
void setMockMapVoltage(float voltage);
|
||||||
// throttle body sensor
|
// throttle body sensor
|
||||||
|
@ -32,4 +35,3 @@ void setMockCltVoltage(float voltage);
|
||||||
|
|
||||||
void printCurrentState(Logging *logging, int seconds, const char *engineTypeName, const char *firmwareBuildId);
|
void printCurrentState(Logging *logging, int seconds, const char *engineTypeName, const char *firmwareBuildId);
|
||||||
|
|
||||||
#endif /* ENGINE_STATUS_H_ */
|
|
||||||
|
|
|
@ -11,14 +11,17 @@
|
||||||
#include "pid.h"
|
#include "pid.h"
|
||||||
#include "fsio_impl.h"
|
#include "fsio_impl.h"
|
||||||
#include "idle_thread.h"
|
#include "idle_thread.h"
|
||||||
|
#include "allsensors.h"
|
||||||
|
#include "engine_controller.h"
|
||||||
|
|
||||||
extern IdleController idleControllerInstance;
|
extern IdleController idleControllerInstance;
|
||||||
|
extern int timeNowUs;
|
||||||
|
|
||||||
#define Q(x) #x
|
#define Q(x) #x
|
||||||
#define QUOTE(x) Q(x)
|
#define QUOTE(x) Q(x)
|
||||||
|
|
||||||
TEST(idle, fsioPidParameters) {
|
TEST(idle, fsioPidParameters) {
|
||||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
WITH_ENGINE_TEST_HELPER(MIATA_NA6_MAP);
|
||||||
|
|
||||||
// todo finish this unit test!
|
// todo finish this unit test!
|
||||||
engineConfiguration->useFSIO12ForIdleOffset = true;
|
engineConfiguration->useFSIO12ForIdleOffset = true;
|
||||||
|
@ -28,6 +31,20 @@ TEST(idle, fsioPidParameters) {
|
||||||
setFsioExpression(QUOTE(MAGIC_OFFSET_FOR_IDLE_MIN_VALUE), "ac_on_switch cfg_idleRpmPid_minValue cfg_idleRpmPid2_minValue if" PASS_ENGINE_PARAMETER_SUFFIX);
|
setFsioExpression(QUOTE(MAGIC_OFFSET_FOR_IDLE_MIN_VALUE), "ac_on_switch cfg_idleRpmPid_minValue cfg_idleRpmPid2_minValue if" PASS_ENGINE_PARAMETER_SUFFIX);
|
||||||
|
|
||||||
eth.engine.periodicSlowCallback(PASS_ENGINE_PARAMETER_SIGNATURE);
|
eth.engine.periodicSlowCallback(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||||
|
|
||||||
|
ASSERT_EQ(1, hasAcToggle(PASS_ENGINE_PARAMETER_SIGNATURE));
|
||||||
|
// ASSERT_EQ(0, getAcToggle(PASS_ENGINE_PARAMETER_SIGNATURE));
|
||||||
|
|
||||||
|
// setMockVoltage(engineConfiguration->acSwitchAdc, 5 PASS_ENGINE_PARAMETER_SUFFIX);
|
||||||
|
// ASSERT_EQ(1, getAcToggle(PASS_ENGINE_PARAMETER_SIGNATURE));
|
||||||
|
|
||||||
|
// timeNowUs = MS2US(700);
|
||||||
|
|
||||||
|
// idleControllerInstance.PeriodicTask();
|
||||||
|
|
||||||
|
// ASSERT_EQ(0, engine->acSwitchLastChangeTime);
|
||||||
|
// ASSERT_EQ(1, engine->acSwitchState);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(idle, pid) {
|
TEST(idle, pid) {
|
||||||
|
|
Loading…
Reference in New Issue