diff --git a/firmware/controllers/algo/engine2.cpp b/firmware/controllers/algo/engine2.cpp index f14d2fcf6b..416a7a9d1a 100644 --- a/firmware/controllers/algo/engine2.cpp +++ b/firmware/controllers/algo/engine2.cpp @@ -69,6 +69,7 @@ MockAdcState::MockAdcState() { #if EFI_ENABLE_MOCK_ADC void MockAdcState::setMockVoltage(int hwChannel, float voltage DECLARE_ENGINE_PARAMETER_SUFFIX) { + efiAssertVoid(OBD_PCM_Processor_Fault, hwChannel >= 0 && hwChannel < MOCK_ADC_SIZE, "hwChannel out of bounds"); scheduleMsg(&engineLogger, "fake voltage: channel %d value %.2f", hwChannel, voltage); fakeAdcValues[hwChannel] = voltsToAdc(voltage); @@ -245,6 +246,7 @@ SensorsState::SensorsState() { } int MockAdcState::getMockAdcValue(int hwChannel) const { + efiAssertVoid(OBD_PCM_Processor_Fault, hwChannel >= 0 && hwChannel < MOCK_ADC_SIZE, "hwChannel out of bounds"); return fakeAdcValues[hwChannel]; } diff --git a/firmware/controllers/algo/engine_parts.h b/firmware/controllers/algo/engine_parts.h index 846efd63e6..4ddc9f5510 100644 --- a/firmware/controllers/algo/engine_parts.h +++ b/firmware/controllers/algo/engine_parts.h @@ -12,7 +12,7 @@ #include "cyclic_buffer.h" #include "thermistor_generated.h" -#define MOCK_ADC_SIZE 16 +#define MOCK_ADC_SIZE 26 class MockAdcState { public: diff --git a/unit_tests/engine_test_helper.cpp b/unit_tests/engine_test_helper.cpp index 02ce9a4336..cfdff4f97f 100644 --- a/unit_tests/engine_test_helper.cpp +++ b/unit_tests/engine_test_helper.cpp @@ -67,6 +67,7 @@ EngineTestHelper::EngineTestHelper(engine_type_e engineType, configuration_callb engine->engineConfigurationPtr->iat.adcChannel = TEST_IAT_CHANNEL; // magic voltage to get nice CLT testCltValue = 1.492964; + //todosetMockCltVoltage(1.492964 PASS_ENGINE_PARAMETER_SUFFIX); // magic voltage to get nice IAT testIatValue = 4.03646;