From 770da8b43e49a636bbdad6ce1ee64d5f66930c8b Mon Sep 17 00:00:00 2001 From: Josh Stewart Date: Thu, 19 Jan 2017 14:54:07 +1100 Subject: [PATCH] Selectable boost and VVT pins --- globals.h | 6 ++++-- reference/speeduino.ini | 24 +++++++++++++++--------- utils.ino | 2 ++ 3 files changed, 21 insertions(+), 11 deletions(-) diff --git a/globals.h b/globals.h index 50ec190..e6f5e85 100644 --- a/globals.h +++ b/globals.h @@ -377,8 +377,10 @@ struct config3 { byte ego_sdelay; //Time in seconds after engine starts that closed loop becomes available byte egoRPM; //RPM must be above this for closed loop to function byte egoTPSMax; //TPS must be below this for closed loop to function - byte unused6_13; - byte unused6_14; + byte boostPin : 6; + byte unused6_13 : 2; + byte vvtPin : 6; + byte unused6_14 : 2; byte voltageCorrectionBins[6]; //X axis bins for voltage correction tables byte injVoltageCorrectionValues[6]; //Correction table for injector PW vs battery voltage byte airDenBins[9]; diff --git a/reference/speeduino.ini b/reference/speeduino.ini index 720aca0..798a7b5 100644 --- a/reference/speeduino.ini +++ b/reference/speeduino.ini @@ -357,8 +357,12 @@ page = 6 ego_sdelay = scalar, U08, 10, "sec", 1, 0, 0, 120, 0 egoRPM = scalar, U08, 11, "rpm", 100, 0.0, 100, 25500, 0 egoTPSMax = scalar, U08, 12, "%", 1, 0, 0, 120, 0 - unused6-13 = scalar, U08, 13, "%", 1, 0, 0, 120, 0 - unused6-14 = scalar, U08, 14, "%", 1, 0, 0, 120, 0 + vvtPin = bits , U08, 13, [0:5], "Board Default", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31", "32", "33", "34", "35", "36", "37", "38", "39", "40", "41", "42", "43", "44", "45", "46", "47", "48", "49", "50", "51", "52", "53", "54", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID" + unused6-13e = bits, U08, 13, [6:6], "ONE", "INVALID" + unused6-13f = bits, U08, 13, [7:7], "ONE", "INVALID" + boostPin = bits , U08, 14, [0:5], "Board Default", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31", "32", "33", "34", "35", "36", "37", "38", "39", "40", "41", "42", "43", "44", "45", "46", "47", "48", "49", "50", "51", "52", "53", "54", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID" + unused6-14e = bits, U08, 14, [6:6], "ONE", "INVALID" + unused6-14f = bits, U08, 14, [7:7], "ONE", "INVALID" brvBins = array, U08, 15, [6], "V", 0.1, 0, 6, 24, 1 ; Bins for the battery reference voltage injBatRates = array, U08, 21, [6], "%", 1, 0, 0, 255, 0 ;Values for injector pulsewidth vs voltage #if CELSIUS @@ -1068,17 +1072,19 @@ menuDialog = main dialog = boostSettings, "Boost Control" field = "Boost Control Enabled", boostEnabled - field = "Boost solenoid freq.", boostFreq - field = "Boost Cut", boostCutType - field = "Boost Limit", boostLimit, { boostCutType } + field = "Boost output pin", boostPin, { boostEnabled } + field = "Boost solenoid freq.", boostFreq, { boostEnabled } + field = "Boost Cut", boostCutType, { boostEnabled } + field = "Boost Limit", boostLimit, { boostEnabled && boostCutType } field = "Closed Loop settings" - field = "P", boostKP - field = "I", boostKI - field = "D", boostKD + field = "P", boostKP, { boostEnabled } + field = "I", boostKI, { boostEnabled } + field = "D", boostKD, { boostEnabled } dialog = vvtSettings, "VVT Control" field = "VVT Control Enabled", vvtEnabled - field = "VVT solenoid freq.", vvtFreq + field = "VVT output pin", vvtPin, { vvtEnabled } + field = "VVT solenoid freq.", vvtFreq, { vvtEnabled } dialog = wc_note field = "For 99% of engines, warmup must have 100% in the final row. Typical maximum is 255% (cold)." diff --git a/utils.ino b/utils.ino index 83df495..326329f 100644 --- a/utils.ino +++ b/utils.ino @@ -331,6 +331,8 @@ void setPinMapping(byte boardID) if(configPage1.tachoPin != 0) { pinTachOut = configPage1.tachoPin; } if(configPage2.fuelPumpPin != 0) { pinFuelPump = configPage2.fuelPumpPin; } if(configPage4.fanPin != 0) { pinFan = configPage4.fanPin; } + if(configPage3.boostPin != 0) { pinBoost = configPage3.boostPin; } + if(configPage3.vvtPin != 0) { pinVVT_1 = configPage3.vvtPin; } //Finally, set the relevant pin modes for outputs pinMode(pinCoil1, OUTPUT);