From 2ee0a91c0babd44b0fe0615ec92e8d58d633656b Mon Sep 17 00:00:00 2001 From: Josh Stewart Date: Wed, 18 Jan 2017 17:37:55 +1100 Subject: [PATCH] BIG cleanup of #includes to be more C compliant --- corrections.h | 1 + decoders.h | 1 + decoders.ino | 25 +++++++++++---------- errors.ino | 2 ++ globals.h | 49 +++++++++++++++++++++++++++++------------ idle.h | 6 +++++ idle.ino | 1 + reference/speeduino.ini | 3 ++- scheduler.ino | 10 ++++----- sensors.h | 4 ++++ sensors.ino | 9 ++++---- speeduino.ino | 27 ++--------------------- storage.ino | 4 +--- utils.h | 2 -- 14 files changed, 78 insertions(+), 66 deletions(-) diff --git a/corrections.h b/corrections.h index 83b3d820..7149e383 100644 --- a/corrections.h +++ b/corrections.h @@ -9,6 +9,7 @@ void initialiseCorrections(); byte correctionsFuel(); static inline byte correctionWUE(); //Warmup enrichment +static inline byte correctionCranking(); //Cranking enrichment static inline byte correctionASE(); //After Start Enrichment static inline byte correctionAccel(); //Acceleration Enrichment static inline byte correctionFloodClear(); //Check for flood clear on cranking diff --git a/decoders.h b/decoders.h index cfd23198..85ed33c1 100644 --- a/decoders.h +++ b/decoders.h @@ -18,6 +18,7 @@ void triggerSec_DualWheel(); int getRPM_DualWheel(); int getCrankAngle_DualWheel(int timePerDegree); +unsigned long MAX_STALL_TIME = 500000UL; //The maximum time (in uS) that the system will continue to function before the engine is considered stalled/stopped. This is unique to each decoder, depending on the number of teeth etc. 500000 (half a second) is used as the default value, most decoders will be much less. volatile unsigned long curTime; volatile unsigned long curGap; diff --git a/decoders.ino b/decoders.ino index d6d2cea6..3bc07d6c 100644 --- a/decoders.ino +++ b/decoders.ino @@ -20,6 +20,7 @@ toothLastToothTime - The time (In uS) that the last primary tooth was 'seen' * */ +#include "decoders.h" static inline void addToothLogEntry(unsigned long toothTime) { @@ -123,7 +124,7 @@ void triggerPri_missingTooth() toothOneMinusOneTime = toothOneTime; toothOneTime = curTime; currentStatus.hasSync = true; - startRevolutions++; //Counter + currentStatus.startRevolutions++; //Counter triggerFilterTime = 0; //This is used to prevent a condition where serious intermitent signals (Eg someone furiously plugging the sensor wire in and out) can leave the filter in an unrecoverable state } else @@ -214,7 +215,7 @@ void triggerPri_DualWheel() revolutionOne = !revolutionOne; //Flip sequential revolution tracker toothOneMinusOneTime = toothOneTime; toothOneTime = curTime; - startRevolutions++; //Counter + currentStatus.startRevolutions++; //Counter } setFilter(curGap); //Recalc the new filter value @@ -313,7 +314,7 @@ void triggerPri_BasicDistributor() toothOneMinusOneTime = toothOneTime; toothOneTime = curTime; currentStatus.hasSync = true; - startRevolutions++; //Counter + currentStatus.startRevolutions++; //Counter } else { @@ -409,7 +410,7 @@ void triggerPri_GM7X() { toothCurrentCount = 3; currentStatus.hasSync = true; - startRevolutions++; //Counter + currentStatus.startRevolutions++; //Counter return; //We return here so that the tooth times below don't get set (The magical 3rd tooth should not be considered for any calculations that use those times) } } @@ -523,7 +524,7 @@ void triggerPri_4G63() toothOneMinusOneTime = toothOneTime; toothOneTime = curTime; currentStatus.hasSync = true; - startRevolutions++; //Counter + currentStatus.startRevolutions++; //Counter //if ((startRevolutions & 15) == 1) { currentStatus.hasSync = false; } //Every 64 revolutions, force a resync with the cam } else if (!currentStatus.hasSync) { return; } @@ -591,7 +592,7 @@ int getRPM_4G63() if(!currentStatus.hasSync) { return 0; } if(currentStatus.RPM < configPage2.crankRPM) { - if(startRevolutions < 2) { return 0; } //Need at least 2 full revolutions to prevent crazy initial rpm value + if(currentStatus.startRevolutions < 2) { return 0; } //Need at least 2 full revolutions to prevent crazy initial rpm value int tempToothAngle; noInterrupts(); tempToothAngle = triggerToothAngle; @@ -687,7 +688,7 @@ void triggerPri_24X() toothOneMinusOneTime = toothOneTime; toothOneTime = curTime; currentStatus.hasSync = true; - startRevolutions++; //Counter + currentStatus.startRevolutions++; //Counter } else { @@ -777,7 +778,7 @@ void triggerPri_Jeep2000() toothOneMinusOneTime = toothOneTime; toothOneTime = curTime; currentStatus.hasSync = true; - startRevolutions++; //Counter + currentStatus.startRevolutions++; //Counter } else { @@ -863,7 +864,7 @@ void triggerPri_Audi135() toothCurrentCount = 1; toothOneMinusOneTime = toothOneTime; toothOneTime = curTime; - startRevolutions++; //Counter + currentStatus.startRevolutions++; //Counter } setFilter(curGap); //Recalc the new filter value @@ -951,7 +952,7 @@ void triggerPri_HondaD17() { toothOneMinusOneTime = toothOneTime; toothOneTime = curTime; - startRevolutions++; //Counter + currentStatus.startRevolutions++; //Counter } else { @@ -1046,7 +1047,7 @@ void triggerPri_Miata9905() toothOneMinusOneTime = toothOneTime; toothOneTime = curTime; currentStatus.hasSync = true; - startRevolutions++; //Counter + currentStatus.startRevolutions++; //Counter //if ((startRevolutions & 15) == 1) { currentStatus.hasSync = false; } //Every 64 revolutions, force a resync with the cam } else if (!currentStatus.hasSync) { return; } @@ -1169,7 +1170,7 @@ void triggerPri_MazdaAU() toothOneMinusOneTime = toothOneTime; toothOneTime = curTime; currentStatus.hasSync = true; - startRevolutions++; //Counter + currentStatus.startRevolutions++; //Counter //if ((startRevolutions & 15) == 1) { currentStatus.hasSync = false; } //Every 64 revolutions, force a resync with the cam. For testing only! } else if (!currentStatus.hasSync) { return; } diff --git a/errors.ino b/errors.ino index 01083730..dfcabb10 100644 --- a/errors.ino +++ b/errors.ino @@ -8,6 +8,8 @@ A full copy of the license may be found in the projects root directory * Sets the next available error * Returns the error number or 0 if there is no more room for errors */ +#include "errors.h" + byte setError(byte errorID) { if(errorCount < MAX_ERRORS) diff --git a/globals.h b/globals.h index 35732faa..50ec1901 100644 --- a/globals.h +++ b/globals.h @@ -1,27 +1,20 @@ #ifndef GLOBALS_H #define GLOBALS_H #include +#include "table.h" #if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) || defined(__AVR_ATmega2561__) #define CORE_AVR #endif -//const byte ms_version = 20; -const byte signature = 20; - -//const char signature[] = "speeduino"; -const char displaySignature[] = "speeduino 201609-dev"; -const char TSfirmwareVersion[] = "Speeduino 2016.09"; - -const byte data_structure_version = 2; //This identifies the data structure when reading / writing. -const byte page_size = 64; -const int map_page_size = 288; - //Handy bitsetting macros #define BIT_SET(a,b) ((a) |= (1<<(b))) #define BIT_CLEAR(a,b) ((a) &= ~(1<<(b))) #define BIT_CHECK(var,pos) ((var) & (1<<(pos))) +#define MS_IN_MINUTE 60000 +#define US_IN_MINUTE 60000000 + //Define bit positions within engine virable #define BIT_ENGINE_RUN 0 // Engine running #define BIT_ENGINE_CRANK 1 // Engine cranking @@ -61,7 +54,6 @@ const int map_page_size = 288; #define BIT_SPARK2_UNUSED7 6 #define BIT_SPARK2_UNUSED8 7 - #define VALID_MAP_MAX 1022 //The largest ADC value that is valid for the MAP sensor #define VALID_MAP_MIN 2 //The smallest ADC value that is valid for the MAP sensor @@ -84,6 +76,8 @@ const int map_page_size = 288; #define EVEN_FIRE 0 #define ODD_FIRE 1 +#define MAX_RPM 18000 //This is the maximum rpm that the ECU will attempt to run at. It is NOT related to the rev limiter, but is instead dictates how fast certain operations will be allowed to run. Lower number gives better performance + //Table sizes #define CALIBRATION_TABLE_SIZE 512 #define CALIBRATION_TEMPERATURE_OFFSET 40 // All temperature measurements are stored offset by 40 degrees. This is so we can use an unsigned byte (0-255) to represent temperature ranges from -40 to 215 @@ -91,6 +85,32 @@ const int map_page_size = 288; #define SERIAL_BUFFER_THRESHOLD 32 // When the serial buffer is filled to greater than this threshold value, the serial processing operations will be performed more urgently in order to avoid it overflowing. Serial buffer is 64 bytes long, so the threshold is set at half this as a reasonable figure +const byte signature = 20; + +//const char signature[] = "speeduino"; +const char displaySignature[] = "speeduino 201609-dev"; +const char TSfirmwareVersion[] = "Speeduino 2016.09"; + +const byte data_structure_version = 2; //This identifies the data structure when reading / writing. +const byte page_size = 64; +const int map_page_size = 288; + +struct table3D fuelTable; //16x16 fuel map +struct table3D ignitionTable; //16x16 ignition map +struct table3D afrTable; //16x16 afr target map +struct table3D boostTable; //8x8 boost map +struct table3D vvtTable; //8x8 vvt map +struct table3D trim1Table; //6x6 Fuel trim 1 map +struct table3D trim2Table; //6x6 Fuel trim 2 map +struct table3D trim3Table; //6x6 Fuel trim 3 map +struct table3D trim4Table; //6x6 Fuel trim 4 map +struct table2D taeTable; //4 bin TPS Acceleration Enrichment map (2D) +struct table2D WUETable; //10 bin Warm Up Enrichment map (2D) +struct table2D dwellVCorrectionTable; //6 bin dwell voltage correction (2D) +struct table2D injectorVCorrectionTable; //6 bin injector voltage correction (2D) +struct table2D IATDensityCorrectionTable; //9 bin inlet air temperature density correction (2D) +struct table2D IATRetardTable; //6 bin ignition adjustment based on inlet air temperature (2D) + //These are for the direct port manipulation of the injectors and coils volatile byte *inj1_pin_port; volatile byte inj1_pin_mask; @@ -146,7 +166,7 @@ struct statuses { int dwell; byte dwellCorrection; //The amount of correction being applied to the dwell time. byte battery10; //The current BRV in volts (multiplied by 10. Eg 12.5V = 125) - byte advance; + int8_t advance; //Signed 8 bit as advance can now go negative (ATDC) byte corrections; byte TAEamount; //The amount of accleration enrichment currently being applied byte egoCorrection; //The amount of closed loop AFR enrichment currently being applied @@ -177,6 +197,7 @@ struct statuses { int freeRAM; unsigned int clutchEngagedRPM; bool flatShiftingHard; + volatile byte startRevolutions = 0; //A counter for how many revolutions have been completed since sync was achieved. //Helpful bitwise operations: //Useful reference: http://playground.arduino.cc/Code/BitMath @@ -185,7 +206,7 @@ struct statuses { // x |= (1 << n); // forces nth bit of x to be 1. all other bits left alone. }; - +struct statuses currentStatus; //The global status object //Page 1 of the config - See the ini file for further reference //This mostly covers off variables that are required for fuel diff --git a/idle.h b/idle.h index e948a683..f2ae4d66 100644 --- a/idle.h +++ b/idle.h @@ -1,4 +1,8 @@ +#ifndef IDLE_H +#define IDLE_H + #include "globals.h" +#include "table.h" #define STEPPER_FORWARD 0 #define STEPPER_BACKWARD 1 @@ -40,3 +44,5 @@ long idle_cl_target_rpm; void initialiseIdle(); static inline void disableIdle(); static inline void enableIdle(); + +#endif diff --git a/idle.ino b/idle.ino index 2045fa3a..04a551fa 100644 --- a/idle.ino +++ b/idle.ino @@ -3,6 +3,7 @@ Speeduino - Simple engine management for the Arduino Mega 2560 platform Copyright (C) Josh Stewart A full copy of the license may be found in the projects root directory */ +#include "idle.h" /* These functions cover the PWM and stepper idle control diff --git a/reference/speeduino.ini b/reference/speeduino.ini index c6d9b1c5..720aca00 100644 --- a/reference/speeduino.ini +++ b/reference/speeduino.ini @@ -1585,7 +1585,8 @@ menuDialog = main afrTarget = scalar, U08, 19, "O2", 0.100, 0.000 pulseWidth = scalar, U08, 20, "ms", 0.1, 0.000 TPSdot = scalar, U08, 21, "%/s", 10.00, 0.000 - advance = scalar, U08, 22, "deg", 1.000, 0.000 + ;advance = scalar, U08, 22, "deg", 1.000, 0.000 + advance = scalar, S08, 22, "deg", 1.000, 0.000 tps = scalar, U08, 23, "%", 1.000, 0.000 loopsPerSecond = scalar, U16, 24, "loops", 1.000, 0.000 freeRAM = scalar, S16, 26, "bytes", 1.000, 0.000 diff --git a/scheduler.ino b/scheduler.ino index 90094488..a958bf1b 100644 --- a/scheduler.ino +++ b/scheduler.ino @@ -494,7 +494,7 @@ static inline void ignitionSchedule1Interrupt() //Most ARM chips can simply call ignitionSchedule1.StartCallback(); ignitionSchedule1.Status = RUNNING; //Set the status to be in progress (ie The start callback has been called, but not the end callback) ignitionSchedule1.startTime = micros(); - ign1LastRev = startRevolutions; + ign1LastRev = currentStatus.startRevolutions; IGN1_COMPARE = ignitionSchedule1.endCompare; //OCR5A = TCNT5 + (ignitionSchedule1.duration >> 2); //Divide by 4 } else if (ignitionSchedule1.Status == RUNNING) @@ -518,7 +518,7 @@ static inline void ignitionSchedule2Interrupt() //Most ARM chips can simply call ignitionSchedule2.StartCallback(); ignitionSchedule2.Status = RUNNING; //Set the status to be in progress (ie The start callback has been called, but not the end callback) ignitionSchedule2.startTime = micros(); - ign2LastRev = startRevolutions; + ign2LastRev = currentStatus.startRevolutions; IGN2_COMPARE = ignitionSchedule2.endCompare; //OCR5B = TCNT5 + (ignitionSchedule2.duration >> 2); } else if (ignitionSchedule2.Status == RUNNING) @@ -542,7 +542,7 @@ static inline void ignitionSchedule3Interrupt() //Most ARM chips can simply call ignitionSchedule3.StartCallback(); ignitionSchedule3.Status = RUNNING; //Set the status to be in progress (ie The start callback has been called, but not the end callback) ignitionSchedule3.startTime = micros(); - ign3LastRev = startRevolutions; + ign3LastRev = currentStatus.startRevolutions; IGN3_COMPARE = ignitionSchedule3.endCompare; //OCR5C = TCNT5 + (ignitionSchedule3.duration >> 2); } else if (ignitionSchedule3.Status == RUNNING) @@ -566,7 +566,7 @@ static inline void ignitionSchedule4Interrupt() //Most ARM chips can simply call ignitionSchedule4.StartCallback(); ignitionSchedule4.Status = RUNNING; //Set the status to be in progress (ie The start callback has been called, but not the end callback) ignitionSchedule4.startTime = micros(); - ign4LastRev = startRevolutions; + ign4LastRev = currentStatus.startRevolutions; IGN4_COMPARE = ignitionSchedule4.endCompare; //OCR4A = TCNT4 + (ignitionSchedule4.duration >> 4); //Divide by 16 } else if (ignitionSchedule4.Status == RUNNING) @@ -590,7 +590,7 @@ static inline void ignitionSchedule5Interrupt() //Most ARM chips can simply call ignitionSchedule5.StartCallback(); ignitionSchedule5.Status = RUNNING; //Set the status to be in progress (ie The start callback has been called, but not the end callback) ignitionSchedule5.startTime = micros(); - ign5LastRev = startRevolutions; + ign5LastRev = currentStatus.startRevolutions; IGN5_COMPARE = ignitionSchedule5.endCompare; } else if (ignitionSchedule5.Status == RUNNING) diff --git a/sensors.h b/sensors.h index 81353a11..5b2805d5 100644 --- a/sensors.h +++ b/sensors.h @@ -19,6 +19,10 @@ volatile byte flexCounter = 0; volatile int AnChannel[15]; +unsigned long MAPrunningValue; //Used for tracking either the total of all MAP readings in this cycle (Event average) or the lowest value detected in this cycle (event minimum) +unsigned int MAPcount; //Number of samples taken in the current MAP cycle +byte MAPcurRev = 0; //Tracks which revolution we're sampling on + /* * Simple low pass IIR filter macro for the analog inputs * This is effectively implementing the smooth filter from http://playground.arduino.cc/Main/Smooth diff --git a/sensors.ino b/sensors.ino index e54f4a34..018075b9 100644 --- a/sensors.ino +++ b/sensors.ino @@ -3,6 +3,7 @@ Speeduino - Simple engine management for the Arduino Mega 2560 platform Copyright (C) Josh Stewart A full copy of the license may be found in the projects root directory */ +#include "sensors.h" void initialiseADC() { @@ -75,7 +76,7 @@ void readMAP() if (currentStatus.RPM < 1) { instanteneousMAPReading(); return; } //If the engine isn't running, fall back to instantaneous reads - if( (MAPcurRev == startRevolutions) || (MAPcurRev == startRevolutions+1) ) //2 revolutions are looked at for 4 stroke. 2 stroke not currently catered for. + if( (MAPcurRev == currentStatus.startRevolutions) || (MAPcurRev == currentStatus.startRevolutions+1) ) //2 revolutions are looked at for 4 stroke. 2 stroke not currently catered for. { #if defined(ANALOG_ISR) tempReading = AnChannel[pinMAP-A0]; @@ -97,7 +98,7 @@ void readMAP() //Reaching here means that the last cylce has completed and the MAP value should be calculated currentStatus.mapADC = ldiv(MAPrunningValue, MAPcount).quot; currentStatus.MAP = fastMap1023toX(currentStatus.mapADC, configPage1.mapMax); //Get the current MAP value - MAPcurRev = startRevolutions; //Reset the current rev count + MAPcurRev = currentStatus.startRevolutions; //Reset the current rev count MAPrunningValue = 0; MAPcount = 0; } @@ -107,7 +108,7 @@ void readMAP() //Minimum reading in a cycle if (currentStatus.RPM < 1) { instanteneousMAPReading(); return; } //If the engine isn't running, fall back to instantaneous reads - if( (MAPcurRev == startRevolutions) || (MAPcurRev == startRevolutions+1) ) //2 revolutions are looked at for 4 stroke. 2 stroke not currently catered for. + if( (MAPcurRev == currentStatus.startRevolutions) || (MAPcurRev == currentStatus.startRevolutions+1) ) //2 revolutions are looked at for 4 stroke. 2 stroke not currently catered for. { #if defined(ANALOG_ISR) tempReading = AnChannel[pinMAP-A0]; @@ -127,7 +128,7 @@ void readMAP() //Reaching here means that the last cylce has completed and the MAP value should be calculated currentStatus.mapADC = MAPrunningValue; currentStatus.MAP = fastMap1023toX(currentStatus.mapADC, configPage1.mapMax); //Get the current MAP value - MAPcurRev = startRevolutions; //Reset the current rev count + MAPcurRev = currentStatus.startRevolutions; //Reset the current rev count MAPrunningValue = 1023; //Reset the latest value so the next reading will always be lower } break; diff --git a/speeduino.ino b/speeduino.ino index ea4b64f7..5649a38a 100644 --- a/speeduino.ino +++ b/speeduino.ino @@ -53,9 +53,7 @@ struct config3 configPage3; struct config4 configPage4; int req_fuel_uS, inj_opentime_uS; -#define MAX_RPM 18000 //This is the maximum rpm that the ECU will attempt to run at. It is NOT related to the rev limiter, but is instead dictates how fast certain operations will be allowed to run. Lower number gives better performance -volatile byte startRevolutions = 0; //A counter for how many revolutions have been completed since sync was achieved. volatile byte ign1LastRev; volatile byte ign2LastRev; volatile byte ign3LastRev; @@ -70,21 +68,6 @@ void (*triggerSecondary)(); //Pointer for the secondary trigger function (Gets p int (*getRPM)(); //Pointer to the getRPM function (Gets pointed to the relevant decoder) int (*getCrankAngle)(int); //Pointer to the getCrank Angle function (Gets pointed to the relevant decoder) -struct table3D fuelTable; //16x16 fuel map -struct table3D ignitionTable; //16x16 ignition map -struct table3D afrTable; //16x16 afr target map -struct table3D boostTable; //8x8 boost map -struct table3D vvtTable; //8x8 vvt map -struct table3D trim1Table; //6x6 Fuel trim 1 map -struct table3D trim2Table; //6x6 Fuel trim 2 map -struct table3D trim3Table; //6x6 Fuel trim 3 map -struct table3D trim4Table; //6x6 Fuel trim 4 map -struct table2D taeTable; //4 bin TPS Acceleration Enrichment map (2D) -struct table2D WUETable; //10 bin Warm Up Enrichment map (2D) -struct table2D dwellVCorrectionTable; //6 bin dwell voltage correction (2D) -struct table2D injectorVCorrectionTable; //6 bin injector voltage correction (2D) -struct table2D IATDensityCorrectionTable; //9 bin inlet air temperature density correction (2D) -struct table2D IATRetardTable; //6 bin ignition adjustment based on inlet air temperature (2D) byte cltCalibrationTable[CALIBRATION_TABLE_SIZE]; byte iatCalibrationTable[CALIBRATION_TABLE_SIZE]; byte o2CalibrationTable[CALIBRATION_TABLE_SIZE]; @@ -98,10 +81,6 @@ unsigned long counter; unsigned long currentLoopTime; //The time the current loop started (uS) unsigned long previousLoopTime; //The time the previous loop started (uS) -unsigned long MAPrunningValue; //Used for tracking either the total of all MAP readings in this cycle (Event average) or the lowest value detected in this cycle (event minimum) -unsigned int MAPcount; //Number of samples taken in the current MAP cycle -byte MAPcurRev = 0; //Tracks which revolution we're sampling on - int CRANK_ANGLE_MAX = 720; int CRANK_ANGLE_MAX_IGN = 360, CRANK_ANGLE_MAX_INJ = 360; // The number of crank degrees that the system track over. 360 for wasted / timed batch and 720 for sequential //bool useSequentialFuel; // Whether sequential fueling is to be used (1 squirt per cycle) @@ -112,7 +91,6 @@ static byte coilLOW = LOW; static byte fanHIGH = HIGH; // Used to invert the cooling fan output static byte fanLOW = LOW; // Used to invert the cooling fan output -struct statuses currentStatus; volatile int mainLoopCount; byte deltaToothCount = 0; //The last tooth that was used with the deltaV calc int rpmDelta; @@ -122,7 +100,6 @@ bool clutchTrigger; bool previousClutchTrigger; unsigned long secCounter; //The next time to incremen 'runSecs' counter. -unsigned long MAX_STALL_TIME = 500000UL; //The maximum time (in uS) that the system will continue to function before the engine is considered stalled/stopped. This is unique to each decoder, depending on the number of teeth etc. 500000 (half a second) is used as the default value, most decoders will be much less. int channel1IgnDegrees; //The number of crank degrees until cylinder 1 is at TDC (This is obviously 0 for virtually ALL engines, but there's some weird ones) int channel2IgnDegrees; //The number of crank degrees until cylinder 2 (and 5/6/7/8) is at TDC int channel3IgnDegrees; //The number of crank degrees until cylinder 3 (and 5/6/7/8) is at TDC @@ -848,7 +825,7 @@ void loop() currentStatus.hasSync = false; currentStatus.runSecs = 0; //Reset the counter for number of seconds running. secCounter = 0; //Reset our seconds counter. - startRevolutions = 0; + currentStatus.startRevolutions = 0; MAPcurRev = 0; currentStatus.rpmDOT = 0; ignitionOn = false; @@ -934,7 +911,7 @@ void loop() //Main loop runs within this clause if (currentStatus.hasSync && (currentStatus.RPM > 0)) { - if(startRevolutions >= configPage2.StgCycles) { ignitionOn = true; fuelOn = true;} //Enable the fuel and ignition, assuming staging revolutions are complete + if(currentStatus.startRevolutions >= configPage2.StgCycles) { ignitionOn = true; fuelOn = true;} //Enable the fuel and ignition, assuming staging revolutions are complete //If it is, check is we're running or cranking if(currentStatus.RPM > ((unsigned int)configPage2.crankRPM * 100)) //Crank RPM stored in byte as RPM / 100 { diff --git a/storage.ino b/storage.ino index bd2b5986..8f6351fb 100644 --- a/storage.ino +++ b/storage.ino @@ -4,11 +4,9 @@ Copyright (C) Josh Stewart A full copy of the license may be found in the projects root directory */ -#include #include "storage.h" #include "globals.h" -//#include "table.h" - +#include "table.h" /* Takes the current configuration (config pages and maps) diff --git a/utils.h b/utils.h index f869895a..308a51c1 100644 --- a/utils.h +++ b/utils.h @@ -5,8 +5,6 @@ These are some utility functions and variables used through the main code #define UTILS_H #include -#define MS_IN_MINUTE 60000 -#define US_IN_MINUTE 60000000 int freeRam (); void setPinMapping(byte boardID);