parent
3bcf60427d
commit
d8073e8b27
|
@ -34,11 +34,6 @@
|
|||
#define EFI_ENABLE_ASSERTS FALSE
|
||||
#endif /* EFI_ENABLE_ASSERTS */
|
||||
|
||||
#if !defined(EFI_ENABLE_MOCK_ADC) || defined(__DOXYGEN__)
|
||||
#define EFI_ENABLE_MOCK_ADC FALSE
|
||||
#endif /* EFI_ENABLE_MOCK_ADC */
|
||||
|
||||
|
||||
#define EFI_TEXT_LOGGING TRUE
|
||||
|
||||
//#define EFI_UART_ECHO_TEST_MODE FALSE
|
||||
|
|
|
@ -33,11 +33,6 @@
|
|||
#define EFI_ENABLE_ASSERTS FALSE
|
||||
#endif /* EFI_ENABLE_ASSERTS */
|
||||
|
||||
#if !defined(EFI_ENABLE_MOCK_ADC) || defined(__DOXYGEN__)
|
||||
#define EFI_ENABLE_MOCK_ADC FALSE
|
||||
#endif /* EFI_ENABLE_MOCK_ADC */
|
||||
|
||||
|
||||
#define EFI_TEXT_LOGGING FALSE
|
||||
|
||||
//#define EFI_UART_ECHO_TEST_MODE FALSE
|
||||
|
|
|
@ -90,11 +90,6 @@
|
|||
#define EFI_ENABLE_ASSERTS TRUE
|
||||
#endif /* EFI_ENABLE_ASSERTS */
|
||||
|
||||
#if !defined(EFI_ENABLE_MOCK_ADC)
|
||||
#define EFI_ENABLE_MOCK_ADC TRUE
|
||||
#endif /* EFI_ENABLE_MOCK_ADC */
|
||||
|
||||
|
||||
#define EFI_ICU_INPUTS TRUE
|
||||
|
||||
#ifndef HAL_TRIGGER_USE_PAL
|
||||
|
|
|
@ -54,11 +54,6 @@
|
|||
#define EFI_ENABLE_ASSERTS TRUE
|
||||
#endif /* EFI_ENABLE_ASSERTS */
|
||||
|
||||
#if !defined(EFI_ENABLE_MOCK_ADC)
|
||||
#define EFI_ENABLE_MOCK_ADC TRUE
|
||||
#endif /* EFI_ENABLE_MOCK_ADC */
|
||||
|
||||
|
||||
//#define EFI_UART_ECHO_TEST_MODE TRUE
|
||||
|
||||
/**
|
||||
|
|
|
@ -56,20 +56,6 @@ bool WarningCodeState::isWarningNow(efitimesec_t now, bool forIndicator) const {
|
|||
return absI(now - timeOfPreviousWarning) < period;
|
||||
}
|
||||
|
||||
MockAdcState::MockAdcState() {
|
||||
memset(hasMockAdc, 0, sizeof(hasMockAdc));
|
||||
}
|
||||
|
||||
#if EFI_ENABLE_MOCK_ADC
|
||||
void MockAdcState::setMockVoltage(int hwChannel, float voltage) {
|
||||
efiAssertVoid(OBD_PCM_Processor_Fault, hwChannel >= 0 && hwChannel < MOCK_ADC_SIZE, "hwChannel out of bounds");
|
||||
efiPrintf("fake voltage: channel %d value %.2f", hwChannel, voltage);
|
||||
|
||||
fakeAdcValues[hwChannel] = voltsToAdc(voltage);
|
||||
hasMockAdc[hwChannel] = true;
|
||||
}
|
||||
#endif /* EFI_ENABLE_MOCK_ADC */
|
||||
|
||||
void FuelConsumptionState::consumeFuel(float grams, efitick_t nowNt) {
|
||||
m_consumedGrams += grams;
|
||||
|
||||
|
@ -206,14 +192,6 @@ void EngineState::updateTChargeK(int rpm, float tps) {
|
|||
#endif
|
||||
}
|
||||
|
||||
SensorsState::SensorsState() {
|
||||
}
|
||||
|
||||
int MockAdcState::getMockAdcValue(int hwChannel) const {
|
||||
efiAssert(OBD_PCM_Processor_Fault, hwChannel >= 0 && hwChannel < MOCK_ADC_SIZE, "hwChannel out of bounds", -1);
|
||||
return fakeAdcValues[hwChannel];
|
||||
}
|
||||
|
||||
#if EFI_SIMULATOR
|
||||
#define VCS_VERSION "123"
|
||||
#endif
|
||||
|
|
|
@ -12,18 +12,7 @@
|
|||
|
||||
#define MOCK_ADC_SIZE 26
|
||||
|
||||
class MockAdcState {
|
||||
public:
|
||||
MockAdcState();
|
||||
bool hasMockAdc[MOCK_ADC_SIZE];
|
||||
int fakeAdcValues[MOCK_ADC_SIZE];
|
||||
|
||||
void setMockVoltage(int hwChannel, float voltage);
|
||||
int getMockAdcValue(int hwChannel) const;
|
||||
};
|
||||
|
||||
class Accelerometer {
|
||||
public:
|
||||
struct Accelerometer {
|
||||
float x = 0; // G value
|
||||
float y = 0;
|
||||
float z = 0;
|
||||
|
@ -31,10 +20,7 @@ public:
|
|||
float roll = 0;
|
||||
};
|
||||
|
||||
class SensorsState {
|
||||
public:
|
||||
SensorsState();
|
||||
|
||||
struct SensorsState {
|
||||
Accelerometer accelerometer;
|
||||
};
|
||||
|
||||
|
|
|
@ -80,10 +80,6 @@ public:
|
|||
|
||||
angle_t injectionOffset = 0;
|
||||
|
||||
#if EFI_ENABLE_MOCK_ADC
|
||||
MockAdcState mockAdcState;
|
||||
#endif /* EFI_ENABLE_MOCK_ADC */
|
||||
|
||||
multispark_state multispark;
|
||||
|
||||
float targetLambda = 0.0f;
|
||||
|
|
|
@ -19,12 +19,4 @@ void initDataStructures();
|
|||
|
||||
void slowStartStopButtonCallback();
|
||||
|
||||
#if EFI_ENABLE_MOCK_ADC
|
||||
void setMockVoltage(int hwChannel, float voltage);
|
||||
#endif
|
||||
|
||||
void setMockMapVoltage(float voltage);
|
||||
void setMockAfrVoltage(float voltage);
|
||||
void setMockMafVoltage(float voltage);
|
||||
|
||||
void printCurrentState(Logging *logging, int seconds, const char *engineTypeName, const char *firmwareBuildId);
|
||||
|
|
|
@ -36,29 +36,6 @@ void irqExitHook() {}
|
|||
void contextSwitchHook() {}
|
||||
#endif /* ENABLE_PERF_TRACE */
|
||||
|
||||
#if EFI_ENABLE_MOCK_ADC
|
||||
/**
|
||||
* in 2021 the api is Sensor::setMockValue
|
||||
* todo: remove this mockAdcState https://github.com/rusefi/rusefi/issues/3672
|
||||
*/
|
||||
void setMockVoltage(int hwChannel, float voltage) {
|
||||
engine->engineState.mockAdcState.setMockVoltage(hwChannel, voltage);
|
||||
}
|
||||
|
||||
// used by HW CI testing
|
||||
void setMockMafVoltage(float voltage) {
|
||||
setMockVoltage(engineConfiguration->mafAdcChannel, voltage);
|
||||
}
|
||||
|
||||
void setMockAfrVoltage(float voltage) {
|
||||
setMockVoltage(engineConfiguration->afr.hwChannel, voltage);
|
||||
}
|
||||
|
||||
void setMockMapVoltage(float voltage) {
|
||||
setMockVoltage(engineConfiguration->map.sensor.hwChannel, voltage);
|
||||
}
|
||||
#endif /* EFI_ENABLE_MOCK_ADC */
|
||||
|
||||
#if !EFI_UNIT_TEST
|
||||
/**
|
||||
* 64-bit result would not overflow, but that's complex stuff for our 32-bit MCU
|
||||
|
|
|
@ -185,11 +185,6 @@ int getInternalAdcValue(const char *msg, adc_channel_e hwChannel) {
|
|||
warning(CUSTOM_OBD_ANALOG_INPUT_NOT_CONFIGURED, "ADC: %s input is not configured", msg);
|
||||
return -1;
|
||||
}
|
||||
#if EFI_ENABLE_MOCK_ADC
|
||||
if (engine->engineState.mockAdcState.hasMockAdc[hwChannel])
|
||||
return engine->engineState.mockAdcState.getMockAdcValue(hwChannel);
|
||||
|
||||
#endif /* EFI_ENABLE_MOCK_ADC */
|
||||
|
||||
#if EFI_USE_FAST_ADC
|
||||
if (adcHwChannelEnabled[hwChannel] == ADC_FAST) {
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
#include "adc_math.h"
|
||||
|
||||
int getAdcValue(const char *msg, int hwChannel) {
|
||||
return engine->engineState.mockAdcState.getMockAdcValue(hwChannel);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// voltage in MCU universe, from zero to VDD
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
|
||||
#define EFI_ENABLE_ASSERTS TRUE
|
||||
#define EFI_LAUNCH_CONTROL TRUE
|
||||
#define EFI_ENABLE_MOCK_ADC TRUE
|
||||
|
||||
#define ENABLE_PERF_TRACE FALSE
|
||||
|
||||
|
|
|
@ -9,19 +9,14 @@
|
|||
|
||||
#include "boards.h"
|
||||
|
||||
// see setMockVoltage
|
||||
float getVoltageDivided(const char *msg, adc_channel_e hwChannel) {
|
||||
return adcToVolts(engine->engineState.mockAdcState.getMockAdcValue(hwChannel));;
|
||||
return 0;
|
||||
}
|
||||
|
||||
float getVoltage(const char *msg, adc_channel_e hwChannel) {
|
||||
if (engine->engineState.mockAdcState.hasMockAdc[hwChannel])
|
||||
return adcToVolts(engine->engineState.mockAdcState.getMockAdcValue(hwChannel) * engineConfiguration->analogInputDividerCoefficient);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int getAdcValue(const char *msg, adc_channel_e hwChannel) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -35,8 +35,6 @@
|
|||
|
||||
#define SPARK_EXTREME_LOGGING TRUE
|
||||
|
||||
#define EFI_ENABLE_MOCK_ADC TRUE
|
||||
|
||||
#define EFI_ENABLE_CRITICAL_ENGINE_STOP TRUE
|
||||
#define EFI_ENABLE_ENGINE_WARNING TRUE
|
||||
|
||||
|
|
|
@ -114,9 +114,6 @@ EngineTestHelper::EngineTestHelper(engine_type_e engineType, configuration_callb
|
|||
|
||||
commonInitEngineController();
|
||||
|
||||
engineConfiguration->mafAdcChannel = EFI_ADC_10;
|
||||
engine.engineState.mockAdcState.setMockVoltage(EFI_ADC_10, 0);
|
||||
|
||||
// this is needed to have valid CLT and IAT.
|
||||
//todo: reuse initPeriodicEvents() method
|
||||
engine.periodicSlowCallback();
|
||||
|
|
|
@ -58,7 +58,6 @@ TEST(misc, testFuelMap) {
|
|||
|
||||
|
||||
engineConfiguration->mafAdcChannel = EFI_ADC_10;
|
||||
engine->engineState.mockAdcState.setMockVoltage(EFI_ADC_10, 5);
|
||||
|
||||
// 1005 * 2 for IAT correction
|
||||
printf("*************************************************** getRunningFuel 2\r\n");
|
||||
|
@ -68,8 +67,6 @@ TEST(misc, testFuelMap) {
|
|||
EXPECT_EQ( 42, getRunningFuel(1)) << "v1";
|
||||
EXPECT_EQ( 84, getRunningFuel(2)) << "v1";
|
||||
|
||||
engine->engineState.mockAdcState.setMockVoltage(EFI_ADC_10, 0);
|
||||
|
||||
engineConfiguration->cranking.baseFuel = 4000;
|
||||
|
||||
// Should use 20 degree correction in case of failed sensor
|
||||
|
|
Loading…
Reference in New Issue