add fanWhenOff option

This commit is contained in:
unknown 2019-01-14 15:28:13 -05:00
parent 0c434004d6
commit eb30daebf5
3 changed files with 10 additions and 5 deletions

View File

@ -151,7 +151,7 @@
endianness = little
nPages = 10
pageSize = 288, 128, 288, 128, 288, 128, 240, 192, 192, 192
pageSize = 288, 128, 288, 128, 288, 136, 240, 192, 192, 192
;burnCommand = "B"
;pageActivate = "P\001", "P\002", "P\003", "P\004", "P\005", "P\006", "P\007", "P\010", "P\011", "P\012", "P\013"
@ -532,7 +532,8 @@ 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"
fanWhenOff = bits, U08, 128, [0:0], "No", "Yes"
#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
@ -1708,6 +1709,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 }

View File

@ -32,15 +32,16 @@ void fanControl()
{
int onTemp = (int)configPage6.fanSP - CALIBRATION_TEMPERATURE_OFFSET;
int offTemp = onTemp - configPage6.fanHyster;
bool fanPermit = fanWhenOff ? true : BIT_CHECK(currentStatus.engine, BIT_ENGINE_RUN)
if ( currentStatus.coolant >= onTemp )
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(); }

View File

@ -208,7 +208,7 @@ const char TSfirmwareVersion[] PROGMEM = "Speeduino";
const byte data_structure_version = 2; //This identifies the data structure when reading / writing.
//const byte page_size = 64;
const int16_t npage_size[11] PROGMEM = {0,288,128,288,128,288,128,240,192,192,192};
const int16_t npage_size[11] PROGMEM = {0,288,128,288,128,288,136,240,192,192,192};
//const byte page11_size = 128;
#define MAP_PAGE_SIZE 288
@ -692,6 +692,8 @@ struct config6 {
byte fanHyster; // Fan hysteresis
byte fanFreq; // Fan PWM frequency
byte fanPWMBins[4]; //Temperature Bins for the PWM fan control
byte fanWhenOff : 1; // Only run fan when engine is running
#if defined(CORE_AVR)
};
#else