Added testing functions and further comments
This commit is contained in:
parent
022e66b618
commit
24e79171af
|
@ -16,14 +16,17 @@ Need to calculate the req_fuel figure here, preferably in pre-processor macro
|
|||
|
||||
//The following lines are configurable, but the defaults are probably pretty good for most applications
|
||||
#define engineInjectorDeadTime 1.5 //Time in ms that the injector takes to open
|
||||
#define engineSquirtsPerCycle 2 //Probably would be 1 for a 2 stroke
|
||||
#define engineSquirtsPerCycle 2 //Would be 1 for a 2 stroke
|
||||
//**************************************************************************************************
|
||||
|
||||
#include "utils.h"
|
||||
#include "table.h"
|
||||
#include "testing.h"
|
||||
|
||||
int req_fuel = ((engineCapacity / engineInjectorSize) / engineCylinders / engineStoich) * 100; // This doesn't seem quite correct, but I can't find why. It will be close enough to start an engine
|
||||
|
||||
|
||||
|
||||
// Setup section
|
||||
// These aren't really configuration options, more so a description of how the hardware is setup. These are things that will be defined in the recommended hardware setup
|
||||
int triggerActualTeeth = triggerTeeth - triggerMissingTeeth; //The number of physical teeth on the wheel. Doing this here saves us a calculation each time in the interrupt
|
||||
|
@ -64,6 +67,7 @@ void setup() {
|
|||
attachInterrupt(triggerInterrupt, trigger, RISING); // Attach the crank trigger wheel interrupt
|
||||
//End crank triger interrupt attachment
|
||||
|
||||
req_fuel = req_fuel / engineSquirtsPerCycle; //The req_fuel calculation above gives the total required fuel (At VE 100%) in the full cycle. If we're doing more than 1 squirt per cycle then we need to split the amount accordingly. (Note that in a non-sequential 4-stroke setup you cannot have less than 2 squirts as you cannot determine the stroke to make the single squirt on)
|
||||
|
||||
|
||||
|
||||
|
|
24
table.h
24
table.h
|
@ -8,11 +8,31 @@ struct table {
|
|||
const static int ySize = 8;
|
||||
|
||||
int values[xSize][ySize];
|
||||
int axisX[xSize];
|
||||
int axisY[ySize];
|
||||
//static boolean useInterp = false; //Whether or not interpolation should be used (Assuming we have enough CPU for it)
|
||||
|
||||
};
|
||||
|
||||
int getTableValue(struct table fromTable, int X, int Y)
|
||||
/*
|
||||
Tables have an origin (0,0) in the top left hand corner. Vertical axis is expressed first.
|
||||
Eg: 2x2 table
|
||||
-----
|
||||
|2 7|
|
||||
|1 4|
|
||||
-----
|
||||
|
||||
(0,1) = 7
|
||||
(0,0) = 2
|
||||
(1,0) = 1
|
||||
|
||||
*/
|
||||
|
||||
int getTableValue(struct table fromTable, int Y, int X)
|
||||
{
|
||||
return 1;
|
||||
for (int x = 0; x < fromTable.xSize; x++)
|
||||
{
|
||||
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
/*
|
||||
This file has a few functions that are helpful for testing such as creating dummy maps and faking interrupts
|
||||
*/
|
||||
|
||||
/*
|
||||
Aim is to create an 8x8 table that looks like the below:
|
||||
VE
|
||||
_____________________________________________
|
||||
|100| | | | | | | | 90 |
|
||||
| 88|
|
||||
| 75|
|
||||
| 63|
|
||||
| 50|
|
||||
| 38|
|
||||
| 25|
|
||||
| 13|
|
||||
| 1| 15 | 20 |
|
||||
| | 500|1500|2000|2500|3000|4000|5000|6000| RPM
|
||||
|
||||
This is a fairly standard 8x8 VE vs RPM 2D map
|
||||
|
||||
*/
|
||||
|
||||
void dummyFuelTable()
|
||||
{
|
||||
table myFuelTable;
|
||||
|
||||
//myFuelTable.values
|
||||
//myFuelTable.axisY = {100,88,75,63,50,38,25,13,1};
|
||||
//myFuelTable.axisX = {500,1500,2500,3000,4000,5000,6000};
|
||||
}
|
Loading…
Reference in New Issue