diff --git a/reference/speeduino.ini b/reference/speeduino.ini index 16a8a7c6..05cfa6c1 100644 --- a/reference/speeduino.ini +++ b/reference/speeduino.ini @@ -304,7 +304,11 @@ page = 2 baroMax = scalar, U16, 65, "kpa", 1.0, 0.0, 0.0, 25500, 0 EMAPMin = scalar, S08, 67, "kpa", 1.0, 0.0, -100, 127.0, 0 EMAPMax = scalar, U16, 68, "kpa", 1.0, 0.0, 0.0, 25500, 0 - unused2-67 = array, U08, 70, [57], "%", 1.0, 0.0, 0.0, 255, 0 + + fanWhenOff = bits, U08, 70, [0:0], "No", "Yes" + unused_fan_bits = bits, U08, 70,[1:7] + + unused2-67 = array, U08, 71, [56], "%", 1.0, 0.0, 0.0, 255, 0 ;-------------------------------------------------- @@ -532,7 +536,7 @@ page = 6 ; Begin fan control vairables fanInv = bits, U08, 120, [0:0], "No", "Yes" fanEnable = bits, U08, 120, [1:1], "Off", "On/Off" - fanPin = bits , U08, 120, [2:7], "Board Default", "INVALID", "INVALID", "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", "A8", "A9", "A10", "A11", "A12", "A13", "A14", "A15", "INVALID" + fanPin = bits, U08, 120, [2:7], "Board Default", "INVALID", "INVALID", "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", "A8", "A9", "A10", "A11", "A12", "A13", "A14", "A15", "INVALID" #if CELSIUS fanSP = scalar, U08, 121, "C", 1.0, -40, -40, 215.0, 0 fanHyster = scalar, U08, 122, "C", 1.0, 0.0, 0.0, 40, 0 @@ -547,7 +551,6 @@ page = 6 fanPWMBins = array, U08, 124, [4], "F", 1.8, -22.23, -40, 215, 0 #endif - ;-------------------------------------------------- ;Boost and vvt maps (Page 7) ;-------------------------------------------------- @@ -1708,6 +1711,7 @@ menuDialog = main dialog = fanSettings,"Fan Settings",7 field = "Fan Mode", fanEnable + field = "Fan when off", fanWhenOff, { fanEnable } field = "Fan output pin", fanPin, { fanEnable } field = "Fan Output Inverted", fanInv , { fanEnable } field = "Fan temperature SP", fanSP, { fanEnable } diff --git a/speeduino/auxiliaries.ino b/speeduino/auxiliaries.ino index e578f16a..2b48c08e 100644 --- a/speeduino/auxiliaries.ino +++ b/speeduino/auxiliaries.ino @@ -32,15 +32,19 @@ void fanControl() { int onTemp = (int)configPage6.fanSP - CALIBRATION_TEMPERATURE_OFFSET; int offTemp = onTemp - configPage6.fanHyster; + bool fanPermit = false; - if ( currentStatus.coolant >= onTemp ) + if ( configPage2.fanWhenOff ) { fanPermit = true; } + else { fanPermit = BIT_CHECK(currentStatus.engine, BIT_ENGINE_RUN); } + + if ( currentStatus.coolant >= onTemp && fanPermit ) { //Fan needs to be turned on. Checked for normal or inverted fan signal if( configPage6.fanInv == 0 ) { FAN_PIN_HIGH(); } else { FAN_PIN_LOW(); } currentStatus.fanOn = true; } - else if ( currentStatus.coolant <= offTemp ) + else if ( currentStatus.coolant <= offTemp || !fanPermit ) { //Fan needs to be turned off. Checked for normal or inverted fan signal if( configPage6.fanInv == 0 ) { FAN_PIN_LOW(); } diff --git a/speeduino/globals.h b/speeduino/globals.h index 8ffea6ea..5962f1a5 100644 --- a/speeduino/globals.h +++ b/speeduino/globals.h @@ -522,7 +522,11 @@ struct config2 { int8_t EMAPMin; //Must be signed uint16_t EMAPMax; - byte unused1_70[58]; + + byte fanWhenOff : 1; // Only run fan when engine is running + byte fanUnused : 7; + + byte unused1_70[57]; #if defined(CORE_AVR) }; @@ -692,6 +696,7 @@ struct config6 { byte fanHyster; // Fan hysteresis byte fanFreq; // Fan PWM frequency byte fanPWMBins[4]; //Temperature Bins for the PWM fan control + #if defined(CORE_AVR) }; #else