Make the code compileable with eclipseArduino

This commit is contained in:
Fredrik Johansson 2015-02-14 18:04:00 +01:00
parent 4dd9b2a4a5
commit b743b2d1d0
9 changed files with 40 additions and 3 deletions

View File

@ -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 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 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() void command()
{ {
switch (Serial.read()) switch (Serial.read())

View File

@ -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. correctionsTotal() calls all the other corrections functions and combines their results.

View File

@ -273,4 +273,24 @@ struct config3 {
#define pinO2 A4 //O2 Sensor pin #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 #endif // GLOBALS_H

View File

@ -1,4 +1,5 @@
#include "scheduler.h"
#include "globals.h"
void initialiseSchedulers() void initialiseSchedulers()

View File

@ -550,7 +550,7 @@ void trigger()
curTime = micros(); curTime = micros();
curGap = curTime - toothLastToothTime; 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<int>(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 toothCurrentCount++; //Increment the tooth counter
//High speed tooth logging history //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) 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 = (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) 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<int>(targetGap) )
{ {
toothCurrentCount = 1; toothCurrentCount = 1;
toothOneMinusOneTime = toothOneTime; toothOneMinusOneTime = toothOneTime;

View File

@ -1,6 +1,9 @@
#include <EEPROM.h> #include <EEPROM.h>
#include "storage.h"
#include "globals.h"
//#include "table.h" //#include "table.h"
/* /*
Takes the current configuration (config pages and maps) Takes the current configuration (config pages and maps)
and writes them to EEPROM as per the layout defined in storage.h and writes them to EEPROM as per the layout defined in storage.h

View File

@ -2,6 +2,9 @@
Because the size of the table is dynamic, this functino is required to reallocate the array sizes 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 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) void table2D_setSize(struct table2D* targetTable, byte newSize)
{ {
//2D tables can contain either bytes or ints, depending on the value of the valueSize field //2D tables can contain either bytes or ints, depending on the value of the valueSize field

View File

@ -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 Timers are typically low resolution (Compared to Schedulers), with maximum frequency currently being approximately every 10ms
*/ */
#include "timers.h"
#include "globals.h"
void initialiseTimers() void initialiseTimers()
{ {

View File

@ -1,6 +1,8 @@
/* /*
Returns how much free dynamic memory exists (between heap and stack) Returns how much free dynamic memory exists (between heap and stack)
*/ */
#include "utils.h"
int freeRam () int freeRam ()
{ {
extern int __heap_start, *__brkval; extern int __heap_start, *__brkval;