diff --git a/firmware/controllers/algo/engine.h b/firmware/controllers/algo/engine.h index 99701434c7..ef3498a3a2 100644 --- a/firmware/controllers/algo/engine.h +++ b/firmware/controllers/algo/engine.h @@ -166,8 +166,9 @@ public: angle_t injectionOffset; -// todo: surround with EFI_ENABLE_MOCK_ADC checks +#if EFI_ENABLE_MOCK_ADC || defined(__DOXYGEN__) MockAdcState mockAdcState; +#endif /* EFI_ENABLE_MOCK_ADC */ }; class RpmCalculator; diff --git a/firmware/controllers/sensors/map.cpp b/firmware/controllers/sensors/map.cpp index 9bce38cf48..cacf55c2a8 100644 --- a/firmware/controllers/sensors/map.cpp +++ b/firmware/controllers/sensors/map.cpp @@ -107,6 +107,12 @@ float validateMap(float mapKPa DECLARE_ENGINE_PARAMETER_S) { * @returns kPa value */ float getMapByVoltage(float voltage DECLARE_ENGINE_PARAMETER_S) { +#if EFI_ENABLE_MOCK_ADC || defined(__DOXYGEN__) + int mapChannel = engineConfiguration->map.sensor.hwChannel; + if (engine->engineState.mockAdcState.hasMockAdc[mapChannel]) + voltage = adcToVolts(engine->engineState.mockAdcState.getMockAdcValue(mapChannel) * engineConfiguration->analogInputDividerCoefficient); +#endif + // todo: migrate to mapDecoder once parameter listeners are ready air_pressure_sensor_config_s * apConfig = &engineConfiguration->map.sensor; return decodePressure(voltage, apConfig);