Minor cleanups or warnings and error (from last commit)

This commit is contained in:
Josh Stewart 2017-02-14 01:07:05 +11:00
parent 650a096175
commit 0ae02e23f1
4 changed files with 52 additions and 50 deletions

View File

@ -221,7 +221,7 @@ static inline bool correctionDFCO()
{ {
if ( !configPage2.dfcoEnabled ) { return false; } //If the DFCO option isn't turned on, always return false (off) 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 ); } if ( bitRead(currentStatus.squirt, BIT_SQUIRT_DFCO) ) { return ( currentStatus.RPM > ( configPage2.dfcoRPM * 10) ) && ( currentStatus.TPS < configPage2.dfcoTPSThresh ); }
else { return ( currentStatus.RPM > ( (configPage2.dfcoRPM * 10) + configPage2.dfcoHyster) ) && ( currentStatus.TPS < configPage2.dfcoTPSThresh ); } else { return ( currentStatus.RPM > (unsigned int)( (configPage2.dfcoRPM * 10) + configPage2.dfcoHyster) ) && ( currentStatus.TPS < configPage2.dfcoTPSThresh ); }
} }
/* /*
@ -393,4 +393,3 @@ static inline int8_t correctionSoftFlatShift(int8_t advance)
BIT_CLEAR(currentStatus.spark2, BIT_SPARK2_FLATSS); BIT_CLEAR(currentStatus.spark2, BIT_SPARK2_FLATSS);
return advance; return advance;
} }

View File

@ -1340,7 +1340,7 @@ Note:
*/ */
void triggerSetup_Nissan360() void triggerSetup_Nissan360()
{ {
triggerFilterTime = (int)(1000000 / (MAX_RPM / 60 * 360)); //Trigger filter time is the shortest possible time (in uS) that there can be between crank teeth (ie at max RPM). Any pulses that occur faster than this time will be disgarded as noise triggerFilterTime = (1000000 / (MAX_RPM / 60 * 360UL)); //Trigger filter time is the shortest possible time (in uS) that there can be between crank teeth (ie at max RPM). Any pulses that occur faster than this time will be disgarded as noise
triggerSecFilterTime = (int)(1000000 / (MAX_RPM / 60 * 2)) / 2; //Same as above, but fixed at 2 teeth on the secondary input and divided by 2 (for cam speed) triggerSecFilterTime = (int)(1000000 / (MAX_RPM / 60 * 2)) / 2; //Same as above, but fixed at 2 teeth on the secondary input and divided by 2 (for cam speed)
secondaryToothCount = 0; //Initially set to 0 prior to calculating the secondary window duration secondaryToothCount = 0; //Initially set to 0 prior to calculating the secondary window duration
secondDerivEnabled = false; secondDerivEnabled = false;

View File

@ -1,6 +1,9 @@
#ifndef SENSORS_H #ifndef SENSORS_H
#define SENSORS_H #define SENSORS_H
#include "Arduino.h"
#include "globals.h"
// The following are alpha values for the ADC filters. // The following are alpha values for the ADC filters.
// Their values are from 0 to 255 with 0 being no filtering and 255 being maximum // Their values are from 0 to 255 with 0 being no filtering and 255 being maximum
#define ADCFILTER_TPS 128 #define ADCFILTER_TPS 128

View File

@ -459,7 +459,7 @@ void setup()
if(configPage2.TrigEdge == 0) { attachInterrupt(triggerInterrupt, trigger, RISING); } // Attach the crank trigger wheel interrupt (Hall sensor drags to ground when triggering) if(configPage2.TrigEdge == 0) { attachInterrupt(triggerInterrupt, trigger, RISING); } // Attach the crank trigger wheel interrupt (Hall sensor drags to ground when triggering)
else { attachInterrupt(triggerInterrupt, trigger, FALLING); } else { attachInterrupt(triggerInterrupt, trigger, FALLING); }
attachInterrupt(triggerInterrupt2, triggerSec_Nissan360, CHANGING); attachInterrupt(triggerInterrupt2, triggerSec_Nissan360, CHANGE);
break; break;
default: default: