diff --git a/firmware/console/binary/tunerstudio.cpp b/firmware/console/binary/tunerstudio.cpp index b05a22c134..3cb3af385f 100644 --- a/firmware/console/binary/tunerstudio.cpp +++ b/firmware/console/binary/tunerstudio.cpp @@ -898,10 +898,12 @@ int tunerStudioHandleCrcCommand(ts_channel_s *tsChannel, char *data, int incomin break; #endif /* ENABLE_PERF_TRACE */ case TS_GET_CONFIG_ERROR: { -#if HW_CHECK_MODE - #define configError "FACTORY_MODE_PLEASE_CONTACT_SUPPORT" -#else char * configError = getFirmwareError(); +#if HW_CHECK_MODE + // analog input errors are returned as firmware error in QC mode + if (!hasFirmwareError()) { + strcpy(configError, "FACTORY_MODE_PLEASE_CONTACT_SUPPORT"); + } #endif // HW_CHECK_MODE sr5SendResponse(tsChannel, TS_CRC, reinterpret_cast(configError), strlen(configError)); break; diff --git a/firmware/controllers/algo/engine.cpp b/firmware/controllers/algo/engine.cpp index ffdea7208c..7f20c1656f 100644 --- a/firmware/controllers/algo/engine.cpp +++ b/firmware/controllers/algo/engine.cpp @@ -130,6 +130,14 @@ static void cylinderCleanupControl(DECLARE_ENGINE_PARAMETER_SIGNATURE) { #endif } +#if HW_CHECK_MODE +static void assertCloseTo(const char * msg, float actual, float expected) { + if (actual < 0.9 * expected || actual > 1.1 * expected) { + firmwareError(OBD_PCM_Processor_Fault, "%s analog input validation failed %f vs %f", msg, actual, expected); + } +} +#endif // HW_CHECK_MODE + void Engine::periodicSlowCallback(DECLARE_ENGINE_PARAMETER_SIGNATURE) { ScopePerf perf(PE::EnginePeriodicSlowCallback); @@ -163,7 +171,14 @@ void Engine::periodicSlowCallback(DECLARE_ENGINE_PARAMETER_SIGNATURE) { } #endif - slowCallBackWasInvoked = TRUE; + slowCallBackWasInvoked = true; + +#if HW_CHECK_MODE + assertCloseTo("clt", Sensor::get(SensorType::Clt).Value, 49.3); + assertCloseTo("iat", Sensor::get(SensorType::Iat).Value, 73.2); + assertCloseTo("aut1", Sensor::get(SensorType::AuxTemp1).Value, 13.8); + assertCloseTo("aut2", Sensor::get(SensorType::AuxTemp2).Value, 6.2); +#endif // HW_CHECK_MODE }