From 7d28b454c3841acee9b64d19653f739a06575bc8 Mon Sep 17 00:00:00 2001 From: Josh Stewart Date: Sun, 24 May 2020 21:36:28 +1000 Subject: [PATCH] Final minor cleanup --- speeduino/sensors.ino | 2 +- speeduino/updates.ino | 20 +++++++++++++------- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/speeduino/sensors.ino b/speeduino/sensors.ino index f1a6a157..80a8a7e3 100644 --- a/speeduino/sensors.ino +++ b/speeduino/sensors.ino @@ -541,7 +541,7 @@ uint16_t getSpeed() pulseTime = temp_vssLastPulseTime - temp_vssLastMinusOnePulseTime; tempSpeed = 3600000000UL / (pulseTime * configPage2.vssPulsesPerKm); //Convert the pulse gap into km/h tempSpeed = ADC_FILTER(tempSpeed, configPage2.vssSmoothing, currentStatus.vss); //Apply speed smoothing factor - if(tempSpeed > 1000) { tempSpeed = 0; } //Safety check. This usually occurs when there is a hardware issue + if(tempSpeed > 1000) { tempSpeed = currentStatus.vss; } //Safety check. This usually occurs when there is a hardware issue } } } diff --git a/speeduino/updates.ino b/speeduino/updates.ino index a5f97d1a..3f081767 100644 --- a/speeduino/updates.ino +++ b/speeduino/updates.ino @@ -301,7 +301,7 @@ void doUpdates() if(EEPROM.read(EEPROM_DATA_VERSION) == 13) { - //202003-dev + //202005 //Cranking enrichment range 0..1275% instead of older 0.255, so need to divide old values by 5 configPage10.crankingEnrichValues[0] = configPage10.crankingEnrichValues[0] / 5; configPage10.crankingEnrichValues[1] = configPage10.crankingEnrichValues[1] / 5; @@ -336,12 +336,18 @@ void doUpdates() configPage2.aeColdTaperMax = 100; //New PID resolution, old resolution was 100% for each increase, 100% now is stored as 32 - configPage6.idleKP = configPage6.idleKP<<5; - configPage6.idleKI = configPage6.idleKI<<5; - configPage6.idleKD = configPage6.idleKD<<5; - configPage10.vvtCLKP = configPage10.vvtCLKP<<5; - configPage10.vvtCLKI = configPage10.vvtCLKI<<5; - configPage10.vvtCLKD = configPage10.vvtCLKD<<5; + if(configPage6.idleKP >= 8) { configPage6.idleKP = 255; } + else { configPage6.idleKP = configPage6.idleKP<<5; } + if(configPage6.idleKI >= 8) { configPage6.idleKI = 255; } + else { configPage6.idleKI = configPage6.idleKI<<5; } + if(configPage6.idleKD >= 8) { configPage6.idleKD = 255; } + else { configPage6.idleKD = configPage6.idleKD<<5; } + if(configPage10.vvtCLKP >= 8) { configPage10.vvtCLKP = 255; } + else { configPage10.vvtCLKP = configPage10.vvtCLKP<<5; } + if(configPage10.vvtCLKI >= 8) { configPage10.vvtCLKI = 255; } + else { configPage10.vvtCLKI = configPage10.vvtCLKI<<5; } + if(configPage10.vvtCLKD >= 8) { configPage10.vvtCLKD = 255; } + else { configPage10.vvtCLKD = configPage10.vvtCLKD<<5; } //Cranking enrichment to run taper added. Default it to 0,1 secs configPage10.crankingEnrichTaper = 1;