From b743b2d1d0eb149fa6fd97167aadfdd5ef6ebfde Mon Sep 17 00:00:00 2001 From: Fredrik Johansson Date: Sat, 14 Feb 2015 18:04:00 +0100 Subject: [PATCH] Make the code compileable with eclipseArduino --- comms.ino | 4 ++++ corrections.ino | 2 ++ globals.h | 20 ++++++++++++++++++++ scheduler.ino | 3 ++- speeduino.ino | 4 ++-- storage.ino | 3 +++ table.ino | 3 +++ timers.ino | 2 ++ utils.ino | 2 ++ 9 files changed, 40 insertions(+), 3 deletions(-) diff --git a/comms.ino b/comms.ino index 3e9cda10..f79efedb 100644 --- a/comms.ino +++ b/comms.ino @@ -3,6 +3,10 @@ This is called when a command is received over serial from TunerStudio / Megatun It parses the command and calls the relevant function A detailed description of each call can be found at: http://www.msextra.com/doc/ms1extra/COM_RS232.htm */ +#include "comms.h" +#include "globals.h" +#include "storage.h" + void command() { switch (Serial.read()) diff --git a/corrections.ino b/corrections.ino index 84efb54a..e6efaee5 100644 --- a/corrections.ino +++ b/corrections.ino @@ -7,6 +7,8 @@ Flood clear mode etc. */ //************************************************************************************************************ +#include "corrections.h" +#include "globals.h" /* correctionsTotal() calls all the other corrections functions and combines their results. diff --git a/globals.h b/globals.h index 81a8b0bc..a6d6207c 100644 --- a/globals.h +++ b/globals.h @@ -273,4 +273,24 @@ struct config3 { #define pinO2 A4 //O2 Sensor pin */ +// global variables // from speeduino.ino +extern struct statuses currentStatus; // from speeduino.ino +extern struct table3D fuelTable; //8x8 fuel map +extern struct table3D ignitionTable; //8x8 ignition map +extern struct table3D afrTable; //8x8 afr target map +extern struct table2D taeTable; //4 bin TPS Acceleration Enrichment map +extern struct table2D WUETable; //10 bin Warm Up Enrichment map (2D) +extern struct config1 configPage1; +extern struct config2 configPage2; +extern struct config3 configPage3; +extern unsigned long currentLoopTime; //The time the current loop started (uS) +extern unsigned long previousLoopTime; //The time the previous loop started (uS) +extern byte ignitionCount; +extern byte cltCalibrationTable[CALIBRATION_TABLE_SIZE]; +extern byte iatCalibrationTable[CALIBRATION_TABLE_SIZE]; +extern byte o2CalibrationTable[CALIBRATION_TABLE_SIZE]; +extern volatile int toothHistory[512]; +extern volatile int toothHistoryIndex; + + #endif // GLOBALS_H diff --git a/scheduler.ino b/scheduler.ino index 5a208892..2c74e71c 100644 --- a/scheduler.ino +++ b/scheduler.ino @@ -1,4 +1,5 @@ - +#include "scheduler.h" +#include "globals.h" void initialiseSchedulers() diff --git a/speeduino.ino b/speeduino.ino index 7b995652..a08a4c46 100644 --- a/speeduino.ino +++ b/speeduino.ino @@ -550,7 +550,7 @@ void trigger() curTime = micros(); curGap = curTime - toothLastToothTime; - if ( curGap < triggerFilterTime) { interrupts(); return; } //Debounce check. Pulses should never be less than triggerFilterTime, so if they are it means a false trigger. (A 36-1 wheel at 8000pm will have triggers approx. every 200uS) + if ( curGap < static_cast(triggerFilterTime) ) { interrupts(); return; } //Debounce check. Pulses should never be less than triggerFilterTime, so if they are it means a false trigger. (A 36-1 wheel at 8000pm will have triggers approx. every 200uS) toothCurrentCount++; //Increment the tooth counter //High speed tooth logging history @@ -566,7 +566,7 @@ void trigger() if(configPage2.triggerMissingTeeth == 1) { targetGap = (3 * (toothLastToothTime - toothLastMinusOneToothTime)) >> 1; } //Multiply by 1.5 (Checks for a gap 1.5x greater than the last one) (Uses bitshift to multiply by 3 then divide by 2. Much faster than multiplying by 1.5) //else { targetGap = (10 * (toothLastToothTime - toothLastMinusOneToothTime)) >> 2; } //Multiply by 2.5 (Checks for a gap 2.5x greater than the last one) else { targetGap = ((toothLastToothTime - toothLastMinusOneToothTime)) * 2; } //Multiply by 2 (Checks for a gap 2x greater than the last one) - if ( curGap > targetGap ) + if ( curGap > static_cast(targetGap) ) { toothCurrentCount = 1; toothOneMinusOneTime = toothOneTime; diff --git a/storage.ino b/storage.ino index bd97061f..39df0c2f 100644 --- a/storage.ino +++ b/storage.ino @@ -1,6 +1,9 @@ #include +#include "storage.h" +#include "globals.h" //#include "table.h" + /* Takes the current configuration (config pages and maps) and writes them to EEPROM as per the layout defined in storage.h diff --git a/table.ino b/table.ino index 909d0041..1f38228f 100644 --- a/table.ino +++ b/table.ino @@ -2,6 +2,9 @@ Because the size of the table is dynamic, this functino is required to reallocate the array sizes Note that this may clear some of the existing values of the table */ +#include "table.h" +#include "globals.h" + void table2D_setSize(struct table2D* targetTable, byte newSize) { //2D tables can contain either bytes or ints, depending on the value of the valueSize field diff --git a/timers.ino b/timers.ino index 552a113d..12eb1895 100644 --- a/timers.ino +++ b/timers.ino @@ -4,6 +4,8 @@ They should not be confused with Schedulers, which are for performing an action Timers are typically low resolution (Compared to Schedulers), with maximum frequency currently being approximately every 10ms */ +#include "timers.h" +#include "globals.h" void initialiseTimers() { diff --git a/utils.ino b/utils.ino index 8a184e7d..6f23a144 100644 --- a/utils.ino +++ b/utils.ino @@ -1,6 +1,8 @@ /* Returns how much free dynamic memory exists (between heap and stack) */ +#include "utils.h" + int freeRam () { extern int __heap_start, *__brkval;