From e58ad87ed27a2c2699d872f36072e4730325616d Mon Sep 17 00:00:00 2001 From: Josh Stewart Date: Thu, 12 Jan 2017 22:33:26 +1100 Subject: [PATCH] Add check to prevent potential crash when switching IAC methods (Teensy) --- idle.h | 1 + idle.ino | 4 +++- reference/speeduino.ini | 1 - 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/idle.h b/idle.h index 5096cf97..e948a683 100644 --- a/idle.h +++ b/idle.h @@ -23,6 +23,7 @@ struct table2D iacCrankDutyTable; struct StepperIdle idleStepper; bool idleOn; //Simply tracks whether idle was on last time around +byte idleInitComplete = 99; //TRacks which idle method was initialised. 99 is a method that will never exist unsigned int iacStepTime; unsigned int completedHomeSteps; diff --git a/idle.ino b/idle.ino index f0907b9e..2045fa3a 100644 --- a/idle.ino +++ b/idle.ino @@ -110,11 +110,13 @@ void initialiseIdle() idleStepper.stepperStatus = SOFF; break; } - + idleInitComplete = configPage4.iacAlgorithm; //Sets which idle method was initialised } void idleControl() { + if(idleInitComplete != configPage4.iacAlgorithm) { initialiseIdle(); } + switch(configPage4.iacAlgorithm) { case 0: //Case 0 is no idle control ('None') diff --git a/reference/speeduino.ini b/reference/speeduino.ini index 17bae30b..ead363ff 100644 --- a/reference/speeduino.ini +++ b/reference/speeduino.ini @@ -518,7 +518,6 @@ page = 9 requiresPowerCycle = injOpen requiresPowerCycle = IgInv requiresPowerCycle = fanInv - requiresPowerCycle = iacAlgorithm requiresPowerCycle = boostEnabled requiresPowerCycle = vvtEnabled ; requiresPowerCycle = vvtChannels