diff --git a/firmware/controllers/settings.cpp b/firmware/controllers/settings.cpp index 5a16580068..4e2bbb4876 100644 --- a/firmware/controllers/settings.cpp +++ b/firmware/controllers/settings.cpp @@ -472,6 +472,10 @@ static void setCrankingFuel(float timeMs) { } static void setGlobalTriggerAngleOffset(float value) { + if (cisnan(value)) { + warning(OBD_PCM_Processor_Fault, "Invalid argument"); + return; + } engineConfiguration->globalTriggerAngleOffset = value; incrementGlobalConfigurationVersion(); doPrintConfiguration(engine); diff --git a/firmware/controllers/trigger/rpm_calculator.cpp b/firmware/controllers/trigger/rpm_calculator.cpp index 1402505162..43f34ba3c0 100644 --- a/firmware/controllers/trigger/rpm_calculator.cpp +++ b/firmware/controllers/trigger/rpm_calculator.cpp @@ -306,6 +306,7 @@ void initRpmCalculator(Logging *sharedLogger, Engine *engine) { */ void scheduleByAngle(int rpm, scheduling_s *timer, angle_t angle, schfunc_t callback, void *param, RpmCalculator *calc) { + efiAssertVoid(!cisnan(angle), "NaN angle?"); efiAssertVoid(isValidRpm(rpm), "RPM check expected"); float delayUs = calc->oneDegreeUs * angle; efiAssertVoid(!cisnan(delayUs), "NaN delay?");