Added VVT Min Coolant Condition (#649)

The VVT Minimum coolant condition

Update auxiliaries.ino

Co-authored-by: Josh Stewart <josh@noisymime.org>
This commit is contained in:
shiznit304 2021-09-10 01:34:19 -05:00 committed by GitHub
parent a0a994acdd
commit 46e0742b79
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 30 additions and 4 deletions

View File

@ -557,7 +557,13 @@ page = 4
ANGLEFILTER_VVT = scalar, U08, 124, "%", 1.0, 0.0, 0, 100, 0
FILTER_FLEX = scalar, U08, 125, "%", 1.0, 0.0, 0, 240, 0
unused4_124 = array, U08, 126, [2], "%", 1.0, 0.0, 0.0, 255, 0
#if CELSIUS
vvtMinClt = array, U08, 126, "C", 1.0, -40, -40, 215, 0
#else
vvtMinClt = scalar, U08, 126, "F", 1.8, -22.23, -40, 215, 0
#endif
vvtDelay = scalar, U08, 127, "S", 5.0, 0.0, 0, 1275, 0
;--------------------------------------------------
;Start AFR page
@ -1466,6 +1472,8 @@ page = 14
defaultValue = ANGLEFILTER_VVT, 0
defaultValue = idleAdvStartDelay, 0.2 ;0.2S for a quick gear change without change the table advance
defaultValue = boostByGearEnabled, 0
defaultValue = vvtMinClt, 160
defaultValue = vvtDelay, 60
;Default pins
defaultValue = fanPin, 0
@ -2088,6 +2096,8 @@ menuDialog = main
vvtCLMinAng = "Safety limit for minimum expected cam angle value. If cam angle gets smaller or equal to this, it triggers VVT error state, closed loop adjustment is disabled and VVT output duty drops to 0%"
vvtCLMaxAng = "Safety limit for maximum expected cam angle value. If cam angle gets bigger than this, it triggers VVT error state, closed loop adjustment is disabled and VVT output duty drops to 0%"
ANGLEFILTER_VVT = "Can be used to smooth out cam angle readings if needed. Only supported on specific decoders that have cam angle reading capability"
vvtMinClt = "Minimum coolant temp to activate VVT"
vvtDelay = "Time to wait after reaching minimum coolant temp (additional time for oil warmup)"
stagedInjSizePri= "Size of the primary injectors. The sum of the Pri and Sec injectors values MUST match the value used in the req_fuel calculation"
stagedInjSizeSec= "Size of the secondary injectors. The sum of the Pri and Sec injectors values MUST match the value used in the req_fuel calculation"
@ -2860,6 +2870,8 @@ menuDialog = main
dialog = vvtSettings, "VVT Control"
field = "VVT Control Enabled", vvtEnabled
field = "VVT Minimum CLT", vvtMinClt, { vvtEnabled }
field = "VVT Delay", vvtDelay, { vvtEnabled }
field = "VVT Mode", vvtMode, { vvtEnabled }
field = "#Please note that closed loop is currently experimental for Miata and missing tooth patterns ONLY"
field = "Load source", vvtLoadSource, { vvtEnabled }

View File

@ -9,6 +9,9 @@ A full copy of the license may be found in the projects root directory
#include "src/PID_v1/PID_v1.h"
#include "decoders.h"
uint32_t vvtTime;
bool vvtHot;
bool vvtTimeHold;
//Old PID method. Retained incase the new one has issues
//integerPID boostPID(&MAPx100, &boost_pwm_target_value, &boostTargetx100, configPage6.boostKP, configPage6.boostKI, configPage6.boostKD, DIRECT);
integerPID_ideal boostPID(&currentStatus.MAP, &currentStatus.boostDuty , &currentStatus.boostTarget, &configPage10.boostSens, &configPage10.boostIntv, configPage6.boostKP, configPage6.boostKI, configPage6.boostKD, DIRECT); //This is the PID object if that algorithm is used. Needs to be global as it maintains state outside of each function call
@ -127,6 +130,8 @@ void initialiseAuxPWM()
ENABLE_VVT_TIMER(); //Turn on the B compare unit (ie turn on the interrupt)
BIT_CLEAR(currentStatus.status4, BIT_STATUS4_VVT1_ERROR);
BIT_CLEAR(currentStatus.status4, BIT_STATUS4_VVT2_ERROR);
vvtTimeHold=false;
if (currentStatus.coolant >= (int)(configPage4.vvtMinClt - CALIBRATION_TEMPERATURE_OFFSET)) {vvtHot=true;} //Checks to see if coolant's already at operating temperature
}
if( (configPage6.vvtEnabled == 0) && (configPage10.wmiEnabled >= 1) )
{
@ -299,8 +304,15 @@ void boostControl()
void vvtControl()
{
if( (configPage6.vvtEnabled == 1) && (BIT_CHECK(currentStatus.engine, BIT_ENGINE_RUN)) )
if( (configPage6.vvtEnabled == 1) && (currentStatus.coolant >= (int)(configPage4.vvtMinClt - CALIBRATION_TEMPERATURE_OFFSET)) && (BIT_CHECK(currentStatus.engine, BIT_ENGINE_RUN)))
{
if (vvtTimeHold==false)
{
vvtTime = runSecsX10;
vvtTimeHold=true;
}
if (((runSecsX10 - vvtTime) >= (configPage4.vvtDelay * 50)) || (vvtHot==true)) {
vvtHot=true;
//currentStatus.vvt1Duty = 0;
//Calculate the current cam angle
if( configPage4.TrigPattern == 9 ) { currentStatus.vvt1Angle = getCamAngle_Miata9905(); }
@ -439,6 +451,7 @@ void vvtControl()
if(currentStatus.vvt2Duty < 200) { vvt2_max_pwm = false; }
}
}
}
else
{
@ -452,6 +465,7 @@ void vvtControl()
vvt1_max_pwm = false;
vvt2_pwm_state = false;
vvt2_max_pwm = false;
vvtTimeHold=false;
}
}

View File

@ -974,8 +974,8 @@ struct config4 {
byte unusedBits4 : 7;
byte ANGLEFILTER_VVT;
byte FILTER_FLEX;
byte unused4_124[2];
byte vvtMinClt;
byte vvtDelay;
#if defined(CORE_AVR)
};