From 329981f5e6a0555865e08ae7090d7e76e1b6be96 Mon Sep 17 00:00:00 2001 From: rusEfi Date: Wed, 12 Apr 2017 23:48:35 -0400 Subject: [PATCH] better error handling --- firmware/controllers/math/speed_density.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/firmware/controllers/math/speed_density.cpp b/firmware/controllers/math/speed_density.cpp index 928b3cee09..7dcbf1e5a0 100644 --- a/firmware/controllers/math/speed_density.cpp +++ b/firmware/controllers/math/speed_density.cpp @@ -37,6 +37,12 @@ float getTCharge(int rpm, float tps, float coolantTemp, float airTemp DECLARE_EN float Tcharge = coolantTemp * (1 - Tcharge_coff) + airTemp * Tcharge_coff; + if (cisnan(Tcharge)) { + // we can probably end up here while resetting engine state - interpolation would fail + warning(CUSTOM_ERR_6136, "getTCharge NaN"); + return coolantTemp; + } + return Tcharge; }