Cleanup some compile warnings

This commit is contained in:
Josh Stewart 2017-01-11 18:30:46 +11:00
parent 5835c3c704
commit 80c46a74e3
5 changed files with 43 additions and 41 deletions

View File

@ -24,15 +24,15 @@ void canCommand()
break;
case 'G': // this is the reply command sent by the Can interface
uint8_t Gdata;
//uint8_t Gdata;
while (Serial3.available() == 0) { }
cancmdfail = Serial3.read();
if (cancmdfail == 0)
{
{
//command request failed and/or data/device was not available
}
}
while (Serial3.available() == 0) { }
Gdata= Serial3.read();
//Gdata = Serial3.read();
break;
case 'L':

View File

@ -11,17 +11,21 @@ byte correctionsFuel();
static inline byte correctionWUE(); //Warmup enrichment
static inline byte correctionASE(); //After Start Enrichment
static inline byte correctionAccel(); //Acceleration Enrichment
static inline byte correctionsFloodClear(); //Check for flood clear on cranking
static inline byte correctionsAFRClosedLoop(); //Closed loop AFR adjustment
static inline byte correctionsFlex(); //Flex fuel adjustment
static inline byte correctionFloodClear(); //Check for flood clear on cranking
static inline byte correctionAFRClosedLoop(); //Closed loop AFR adjustment
static inline byte correctionFlex(); //Flex fuel adjustment
static inline byte correctionBatVoltage(); //Battery voltage correction
static inline byte correctionIATDensity(); //Inlet temp density correction
static inline byte correctionLaunch(); //Launch control correction
static inline bool correctionDFCO(); //Decelleration fuel cutoff
byte correctionsIgn();
static inline byte correctionsFixedTiming(byte);
static inline byte correctionsCrankingFixedTiming(byte);
static inline byte correctionsFlexTiming(byte);
static inline byte correctionsIATretard(byte);
static inline byte correctionsSoftRevLimit(byte);
static inline byte correctionsSoftLaunch(byte);
static inline byte correctionFixedTiming(byte);
static inline byte correctionCrankingFixedTiming(byte);
static inline byte correctionFlexTiming(byte);
static inline byte correctionIATretard(byte);
static inline byte correctionSoftRevLimit(byte);
static inline byte correctionSoftLaunch(byte);
#endif // CORRECTIONS_H

View File

@ -54,26 +54,26 @@ byte correctionsFuel()
if (result != 100) { sumCorrections = (sumCorrections * result); activeCorrections++; }
if (activeCorrections == 3) { sumCorrections = sumCorrections / powint(100,activeCorrections); activeCorrections = 0; }
currentStatus.egoCorrection = correctionsAFRClosedLoop();
currentStatus.egoCorrection = correctionAFRClosedLoop();
if (currentStatus.egoCorrection != 100) { sumCorrections = (sumCorrections * currentStatus.egoCorrection); activeCorrections++; }
if (activeCorrections == 3) { sumCorrections = sumCorrections / powint(100,activeCorrections); activeCorrections = 0; }
currentStatus.batCorrection = correctionsBatVoltage();
currentStatus.batCorrection = correctionBatVoltage();
if (currentStatus.batCorrection != 100) { sumCorrections = (sumCorrections * currentStatus.batCorrection); activeCorrections++; }
if (activeCorrections == 3) { sumCorrections = sumCorrections / powint(100,activeCorrections); activeCorrections = 0; }
currentStatus.iatCorrection = correctionsIATDensity();
currentStatus.iatCorrection = correctionIATDensity();
if (currentStatus.iatCorrection != 100) { sumCorrections = (sumCorrections * currentStatus.iatCorrection); activeCorrections++; }
if (activeCorrections == 3) { sumCorrections = sumCorrections / powint(100,activeCorrections); activeCorrections = 0; }
currentStatus.flexCorrection = correctionsFlex();
currentStatus.flexCorrection = correctionFlex();
if (currentStatus.flexCorrection != 100) { sumCorrections = (sumCorrections * currentStatus.flexCorrection); activeCorrections++; }
if (activeCorrections == 3) { sumCorrections = sumCorrections / powint(100,activeCorrections); activeCorrections = 0; }
currentStatus.launchCorrection = correctionsLaunch();
currentStatus.launchCorrection = correctionLaunch();
if (currentStatus.launchCorrection != 100) { sumCorrections = (sumCorrections * currentStatus.launchCorrection); activeCorrections++; }
bitWrite(currentStatus.squirt, BIT_SQUIRT_DFCO, correctionsDFCO());
bitWrite(currentStatus.squirt, BIT_SQUIRT_DFCO, correctionDFCO());
if ( bitRead(currentStatus.squirt, BIT_SQUIRT_DFCO) ) { sumCorrections = 0; }
sumCorrections = sumCorrections / powint(100,activeCorrections);
@ -188,7 +188,7 @@ static inline byte correctionFloodClear()
Battery Voltage correction
Uses a 2D enrichment table (WUETable) where the X axis is engine temp and the Y axis is the amount of extra fuel to add
*/
static inline byte correctionsBatVoltage()
static inline byte correctionBatVoltage()
{
if (currentStatus.battery10 > (injectorVCorrectionTable.axisX[5])) { return injectorVCorrectionTable.values[injectorVCorrectionTable.xSize-1]; } //This prevents us doing the 2D lookup if the voltage is above maximum
return table2D_getValue(&injectorVCorrectionTable, currentStatus.battery10);
@ -198,7 +198,7 @@ static inline byte correctionsBatVoltage()
Simple temperature based corrections lookup based on the inlet air temperature.
This corrects for changes in air density from movement of the temperature
*/
static inline byte correctionsIATDensity()
static inline byte correctionIATDensity()
{
if ( (currentStatus.IAT + CALIBRATION_TEMPERATURE_OFFSET) > (IATDensityCorrectionTable.axisX[8])) { return IATDensityCorrectionTable.values[IATDensityCorrectionTable.xSize-1]; } //This prevents us doing the 2D lookup if the intake temp is above maximum
return table2D_getValue(&IATDensityCorrectionTable, currentStatus.IAT + CALIBRATION_TEMPERATURE_OFFSET); //currentStatus.IAT is the actual temperature, values in IATDensityCorrectionTable.axisX are temp+offset
@ -208,7 +208,7 @@ static inline byte correctionsIATDensity()
Launch control has a setting to increase the fuel load to assist in bringing up boost
This simple check applies the extra fuel if we're currently launching
*/
static inline byte correctionsLaunch()
static inline byte correctionLaunch()
{
if(currentStatus.launchingHard || currentStatus.launchingSoft) { return (100 + configPage3.lnchFuelAdd); }
else { return 100; }
@ -217,7 +217,7 @@ static inline byte correctionsLaunch()
/*
* Returns true if decelleration fuel cutoff should be on, false if its off
*/
static inline bool correctionsDFCO()
static inline bool correctionDFCO()
{
if ( !configPage2.dfcoEnabled ) { return false; } //If the DFCO option isn't turned on, always return false (off)
if ( bitRead(currentStatus.squirt, BIT_SQUIRT_DFCO) ) { return ( currentStatus.RPM > ( configPage2.dfcoRPM * 10) ) && ( currentStatus.TPS < configPage2.dfcoTPSThresh ); }
@ -228,7 +228,7 @@ static inline bool correctionsDFCO()
* Flex fuel adjustment to vary fuel based on ethanol content
* The amount of extra fuel required is a linear relationship based on the % of ethanol.
*/
static inline byte correctionsFlex()
static inline byte correctionFlex()
{
if(!configPage1.flexEnabled) { return 100; } //Check for flex being enabled
byte flexRange = configPage1.flexFuelHigh - configPage1.flexFuelLow;
@ -249,7 +249,7 @@ PID (Best suited to wideband sensors):
*/
static inline byte correctionsAFRClosedLoop()
static inline byte correctionAFRClosedLoop()
{
if( (configPage3.egoType == 0)) { return 100; } //egoType of 0 means no O2 sensor
@ -317,30 +317,30 @@ static inline byte correctionsAFRClosedLoop()
byte correctionsIgn(byte advance)
{
advance = correctionsFlexTiming(advance);
advance = correctionsIATretard(advance);
advance = correctionsSoftRevLimit(advance);
advance = correctionsSoftLaunch(advance);
advance = correctionFlexTiming(advance);
advance = correctionIATretard(advance);
advance = correctionSoftRevLimit(advance);
advance = correctionSoftLaunch(advance);
//Fixed timing check must go last
advance = correctionsFixedTiming(advance);
advance = correctionsCrankingFixedTiming(advance); //This overrrides the regular fixed timing, must come last
advance = correctionFixedTiming(advance);
advance = correctionCrankingFixedTiming(advance); //This overrrides the regular fixed timing, must come last
return advance;
}
static inline byte correctionsFixedTiming(byte advance)
static inline byte correctionFixedTiming(byte advance)
{
if (configPage2.FixAng != 0) { return configPage2.FixAng; } //Check whether the user has set a fixed timing angle
return advance;
}
static inline byte correctionsCrankingFixedTiming(byte advance)
static inline byte correctionCrankingFixedTiming(byte advance)
{
if ( BIT_CHECK(currentStatus.engine, BIT_ENGINE_CRANK) ) { return configPage2.CrankAng; } //Use the fixed cranking ignition angle
return advance;
}
static inline byte correctionsFlexTiming(byte advance)
static inline byte correctionFlexTiming(byte advance)
{
if(!configPage1.flexEnabled) { return advance; } //Check for flex being enabled
byte flexRange = configPage1.flexAdvHigh - configPage1.flexAdvLow;
@ -351,7 +351,7 @@ static inline byte correctionsFlexTiming(byte advance)
return advance + currentStatus.flexIgnCorrection;
}
static inline byte correctionsIATretard(byte advance)
static inline byte correctionIATretard(byte advance)
{
//Adjust the advance based on IAT. If the adjustment amount is greater than the current advance, just set advance to 0
byte advanceIATadjust = table2D_getValue(&IATRetardTable, currentStatus.IAT);
@ -359,14 +359,14 @@ static inline byte correctionsIATretard(byte advance)
else { return 0; }
}
static inline byte correctionsSoftRevLimit(byte advance)
static inline byte correctionSoftRevLimit(byte advance)
{
BIT_CLEAR(currentStatus.spark, BIT_SPARK_SFTLIM);
if (currentStatus.RPM > ((unsigned int)(configPage2.SoftRevLim) * 100) ) { BIT_SET(currentStatus.spark, BIT_SPARK_SFTLIM); return configPage2.SoftLimRetard; } //Softcut RPM limit (If we're above softcut limit, delay timing by configured number of degrees)
return advance;
}
static inline byte correctionsSoftLaunch(byte advance)
static inline byte correctionSoftLaunch(byte advance)
{
if (currentStatus.launchingSoft) { return configPage3.lnchRetard; } //SoftCut rev limit for 2-step launch control
return advance;

View File

@ -1022,7 +1022,7 @@ void loop()
long toothDeltaV = (1000000L * angle2 / toothHistory[toothHistoryIndex]) - (1000000L * angle1 / toothHistory[toothHistoryIndex-1]);
long toothDeltaT = toothHistory[toothHistoryIndex];
long timeToLastTooth = micros() - toothLastToothTime; //Cannot be unsigned
//long timeToLastTooth = micros() - toothLastToothTime; //Cannot be unsigned
rpmDelta = (toothDeltaV << 10) / (6 * toothDeltaT);
}

View File

@ -56,13 +56,11 @@ void oneMSInterval() //Most ARM chips can simply call a function
loop250ms++;
loopSec++;
//volatile unsigned long targetOverdwellTime;
//volatile unsigned long targetTachoPulseTime;
unsigned long targetOverdwellTime;
unsigned long targetTachoPulseTime;
//Overdwell check
targetOverdwellTime = micros() - dwellLimit_uS; //Set a target time in the past that all coil charging must have begun after. If the coil charge began before this time, it's been running too long
//unsigned long targetTachoPulseTime;
//targetTachoPulseTime = micros() - (1500);
//Check first whether each spark output is currently on. Only check it's dwell time if it is
/*