analog temperature inputs validation for quality control

This commit is contained in:
rusefi 2020-07-27 22:49:59 -04:00
parent 6bbb1bc610
commit a4155bc554
2 changed files with 21 additions and 4 deletions

View File

@ -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<const uint8_t*>(configError), strlen(configError));
break;

View File

@ -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
}