Expose some pieces of flex info to TunerStudio

This commit is contained in:
Josh Stewart 2016-12-26 20:53:37 +11:00
parent 173f875868
commit b3a04cc19b
4 changed files with 15 additions and 7 deletions

View File

@ -258,7 +258,9 @@ void sendValues(int packetlength, byte portNum)
response[32] = highByte(currentStatus.rpmDOT);
response[33] = currentStatus.ethanolPct; //Flex sensor value (or 0 if not used)
response[34] = getNextError();
response[34] = currentStatus.flexCorrection; //Flex fuel correction (% above or below 100)
response[35] = currentStatus.flexIgnCorrection; //Ignition correction (Increased degrees of advance) for flex fuel
response[36] = getNextError();
//cli();
if (portNum == 0) { Serial.write(response, (size_t)packetlength); }

View File

@ -22,6 +22,7 @@ PID egoPID(&PID_O2, &PID_output, &PID_AFRTarget, configPage3.egoKP, configPage3.
void initialiseCorrections()
{
egoPID.SetMode(AUTOMATIC); //Turn O2 PID on
currentStatus.flexIgnCorrection = 0;
}
/*
@ -344,7 +345,8 @@ static inline byte correctionsFlexTiming(byte advance)
{
if(!configPage1.flexEnabled) { return advance; } //Check for flex being enabled
byte flexRange = configPage1.flexAdvHigh - configPage1.flexAdvLow;
return advance + percentage(currentStatus.ethanolPct, flexRange);
currentStatus.flexIgnCorrection = percentage(currentStatus.ethanolPct, flexRange);
return advance + currentStatus.flexIgnCorrection;
}
static inline byte correctionsIATretard(byte advance)

View File

@ -143,6 +143,7 @@ struct statuses {
byte iatCorrection; //The amount of inlet air temperature adjustment currently being applied
byte launchCorrection; //The amount of correction being applied if launch control is active
byte flexCorrection; //Amount of correction being applied to compensate for ethanol content
byte flexIgnCorrection; //Amount of additional advance being applied based on flex
byte afrTarget;
byte idleDuty;
bool fanOn; //Whether or not the fan is turned on

View File

@ -1393,7 +1393,8 @@ menuDialog = main
cltGauge = coolant, "Coolant Temp", "TEMP", -40, 215, 0, 30, 200, 220, 0, 0
iatGauge = iat, "Inlet Air Temp", "TEMP", -40, 215, 0, 30, 200, 210, 0, 0
#endif
advanceGauge = advance, "Spark Advance", "deg BTDC", 50, -10, 0, 0, 35, 45, 0,
advanceGauge = advance, "Spark Advance", "deg BTDC", 50, -10, 0, 0, 35, 45, 0, 0
flexGauge = flex, "Flex sensor", "%", 0, 100, -1, -1, 999, 999, 0, 0
gaugeCategory = "Other"
clockGauge = secl, "Clock", "Seconds", 0, 255, 10, 10, 245, 245, 0, 0
@ -1524,7 +1525,7 @@ menuDialog = main
ochGetCommand = "A"
ochBlockSize = 35
ochBlockSize = 37
secl = scalar, U08, 0, "sec", 1.000, 0.000
squirt = scalar, U08, 1, "bits", 1.000, 0.000
@ -1580,9 +1581,11 @@ menuDialog = main
afr2 = scalar, U08, 30, "O2", 0.100, 0.000
rpmDOT = scalar, S16, 31, "rpm/s", 1.000, 0.000
flex = scalar, U08, 33, "%", 1.000, 0.000
errors = scalar, U08, 34, "bits", 1.000, 0.000
errorNum = bits, U08, 34, [0:1]
currentError = bits, U08, 34, [2:7]
flexFuelCor = scalar, U08, 34, "%", 1.000, 0.000
flexIgnCor = scalar, U08, 35, "deg", 1.000, 0.000
errors = scalar, U08, 36, "bits", 1.000, 0.000
errorNum = bits, U08, 36, [0:1]
currentError = bits, U08, 36, [2:7]
; Computed output channels. See "megatuneExamples.ini" for all the
; pre-defined variables, search for "???" and you'll see them.