Merge pull request #3 from noisymime/master

update from josh 30/10/15
This commit is contained in:
Autohome2 2015-10-30 21:47:00 +00:00
commit 6c6be8b633
28 changed files with 74624 additions and 212 deletions

View File

@ -194,7 +194,7 @@ This function returns the current values of a fixed group of variables
*/ */
void sendValues(int length) void sendValues(int length)
{ {
byte packetSize = 31; byte packetSize = 33;
byte response[packetSize]; byte response[packetSize];
response[0] = currentStatus.secl; //secl is simply a counter that increments each second. Used to track unexpected resets (Which will reset this count to 0) response[0] = currentStatus.secl; //secl is simply a counter that increments each second. Used to track unexpected resets (Which will reset this count to 0)
@ -233,6 +233,10 @@ void sendValues(int length)
response[28] = currentStatus.batCorrection; //Battery voltage correction (%) response[28] = currentStatus.batCorrection; //Battery voltage correction (%)
response[29] = (byte)(currentStatus.dwell / 100); response[29] = (byte)(currentStatus.dwell / 100);
response[30] = currentStatus.O2_2; //O2 response[30] = currentStatus.O2_2; //O2
//rpmDOT must be sent as a signed integer
response[31] = lowByte(currentStatus.rpmDOT);
response[32] = highByte(currentStatus.rpmDOT);
Serial.write(response, (size_t)packetSize); Serial.write(response, (size_t)packetSize);
//Serial.flush(); //Serial.flush();
@ -816,34 +820,33 @@ Send 256 tooth log entries
*/ */
void sendToothLog(bool useChar) void sendToothLog(bool useChar)
{ {
//We need TOOTH_LOG_SIZE number of records to send to TunerStudio. If there aren't that many in the buffer then we just return and wait for the next call
//We need 256 records to send to TunerStudio. If there aren't that many in the buffer (Buffer is 512 long) then we just return and wait for the next call if (toothHistoryIndex < TOOTH_LOG_SIZE) {
if (toothHistoryIndex < 256) { return; //This should no longer ever occur since the flagging system was put in place
return; //Don't believe this is the best way to go. Just display whatever is in the buffer
} }
unsigned int tempToothHistory[512]; //Create a temporary array that will contain a copy of what is in the main toothHistory array unsigned int tempToothHistory[TOOTH_LOG_BUFFER]; //Create a temporary array that will contain a copy of what is in the main toothHistory array
//Copy the working history into the temporary buffer array. This is done so that, if the history loops whilst the values are being sent over serial, it doesn't affect the values //Copy the working history into the temporary buffer array. This is done so that, if the history loops whilst the values are being sent over serial, it doesn't affect the values
memcpy( (void*)tempToothHistory, (void*)toothHistory, sizeof(tempToothHistory) ); memcpy( (void*)tempToothHistory, (void*)toothHistory, sizeof(tempToothHistory) );
toothHistoryIndex = 0; //Reset the history index toothHistoryIndex = 0; //Reset the history index
//Loop only needs to go to 256 (Even though the buffer is 512 long) as we only ever send 256 entries at a time //Loop only needs to go to half the buffer size
if (useChar) if (useChar)
{ {
for (int x = 0; x < 256; x++) for (int x = 0; x < TOOTH_LOG_SIZE; x++)
{ {
Serial.println(tempToothHistory[x]); Serial.println(tempToothHistory[x]);
} }
} }
else else
{ {
for (int x = 0; x < 256; x++) for (int x = 0; x < TOOTH_LOG_SIZE; x++)
{ {
Serial.write(highByte(tempToothHistory[x])); Serial.write(highByte(tempToothHistory[x]));
Serial.write(lowByte(tempToothHistory[x])); Serial.write(lowByte(tempToothHistory[x]));
} }
BIT_CLEAR(currentStatus.squirt, BIT_SQUIRT_TOOTHLOG1READY);
} }
//Serial.flush();
} }

View File

@ -27,9 +27,11 @@ byte correctionsTotal()
//As the 'normal' case will be for each function to return 100, we only perform the division operation if the returned result is not equal to that //As the 'normal' case will be for each function to return 100, we only perform the division operation if the returned result is not equal to that
currentStatus.wueCorrection = correctionWUE(); currentStatus.wueCorrection = correctionWUE();
if (currentStatus.wueCorrection != 100) { sumCorrections = div((sumCorrections * currentStatus.wueCorrection), 100).quot; } //if (currentStatus.wueCorrection != 100) { sumCorrections = div((sumCorrections * currentStatus.wueCorrection), 100).quot; }
if (currentStatus.wueCorrection != 100) { sumCorrections = divs100(sumCorrections * currentStatus.wueCorrection); }
result = correctionASE(); result = correctionASE();
if (result != 100) { sumCorrections = div((sumCorrections * result), 100).quot; } //if (result != 100) { sumCorrections = div((sumCorrections * result), 100).quot; }
if (result != 100) { sumCorrections = divs100(sumCorrections * result); }
result = correctionCranking(); result = correctionCranking();
if (result != 100) { sumCorrections = div((sumCorrections * result), 100).quot; } if (result != 100) { sumCorrections = div((sumCorrections * result), 100).quot; }
currentStatus.TAEamount = correctionAccel(); currentStatus.TAEamount = correctionAccel();
@ -37,9 +39,16 @@ byte correctionsTotal()
result = correctionFloodClear(); result = correctionFloodClear();
if (result != 100) { sumCorrections = div((sumCorrections * result), 100).quot; } if (result != 100) { sumCorrections = div((sumCorrections * result), 100).quot; }
currentStatus.egoCorrection = correctionsAFRClosedLoop(); currentStatus.egoCorrection = correctionsAFRClosedLoop();
if (currentStatus.egoCorrection != 100) { sumCorrections = div((sumCorrections * currentStatus.egoCorrection), 100).quot; } //if (currentStatus.egoCorrection != 100) { sumCorrections = div((sumCorrections * currentStatus.egoCorrection), 100).quot; }
if (currentStatus.egoCorrection != 100) { sumCorrections = divs100(sumCorrections * currentStatus.egoCorrection); }
currentStatus.batCorrection = correctionsBatVoltage(); currentStatus.batCorrection = correctionsBatVoltage();
if (currentStatus.batCorrection != 100) { sumCorrections = div((sumCorrections * currentStatus.batCorrection), 100).quot; } //if (currentStatus.batCorrection != 100) { sumCorrections = div((sumCorrections * currentStatus.batCorrection), 100).quot; }
if (currentStatus.batCorrection != 100) { sumCorrections = divs100(sumCorrections * currentStatus.batCorrection); }
currentStatus.iatCorrection = correctionsIATDensity();
//if (currentStatus.iatCorrection != 100) { sumCorrections = div((sumCorrections * currentStatus.iatCorrection), 100).quot; }
if (currentStatus.iatCorrection != 100) { sumCorrections = divs100(sumCorrections * currentStatus.iatCorrection); }
currentStatus.launchCorrection = correctionsLaunch();
if (currentStatus.launchCorrection != 100) { sumCorrections = div((sumCorrections * currentStatus.launchCorrection), 100).quot; }
if(sumCorrections > 255) { sumCorrections = 255; } //This is the maximum allowable increase if(sumCorrections > 255) { sumCorrections = 255; } //This is the maximum allowable increase
return (byte)sumCorrections; return (byte)sumCorrections;
@ -157,6 +166,26 @@ byte correctionsBatVoltage()
return table2D_getValue(&injectorVCorrectionTable, currentStatus.battery10); return table2D_getValue(&injectorVCorrectionTable, currentStatus.battery10);
} }
/*
Simple temperature based corrections lookup based on the inlet air temperature.
This corrects for changes in air density from movement of the temperature
*/
byte correctionsIATDensity()
{
if ( (currentStatus.IAT + CALIBRATION_TEMPERATURE_OFFSET) > (IATDensityCorrectionTable.axisX[8])) { return IATDensityCorrectionTable.values[IATDensityCorrectionTable.xSize-1]; } //This prevents us doing the 2D lookup if the intake temp is above maximum
return table2D_getValue(&IATDensityCorrectionTable, currentStatus.IAT + CALIBRATION_TEMPERATURE_OFFSET); //currentStatus.IAT is the actual temperature, values in IATDensityCorrectionTable.axisX are temp+offset
}
/*
Launch control has a setting to increase the fuel load to assist in bringing up boost
This simple check applies the extra fuel if we're currently launching
*/
byte correctionsLaunch()
{
if(configPage3.launchEnabled && currentStatus.launching) { return (100 + configPage3.lnchFuelAdd); }
else { return 100; }
}
/* /*
Lookup the AFR target table and perform either a simple or PID adjustment based on this Lookup the AFR target table and perform either a simple or PID adjustment based on this

View File

@ -1,5 +1,3 @@
#define TOOTH_HISTORY_LENGTH 512
volatile unsigned long curTime; volatile unsigned long curTime;
volatile unsigned int curGap; volatile unsigned int curGap;
volatile unsigned long curTime2; volatile unsigned long curTime2;
@ -13,7 +11,7 @@ volatile unsigned long toothLastSecToothTime = 0; //The time (micros()) that the
volatile unsigned long toothLastMinusOneToothTime = 0; //The time (micros()) that the tooth before the last tooth was registered volatile unsigned long toothLastMinusOneToothTime = 0; //The time (micros()) that the tooth before the last tooth was registered
volatile unsigned long toothOneTime = 0; //The time (micros()) that tooth 1 last triggered volatile unsigned long toothOneTime = 0; //The time (micros()) that tooth 1 last triggered
volatile unsigned long toothOneMinusOneTime = 0; //The 2nd to last time (micros()) that tooth 1 last triggered volatile unsigned long toothOneMinusOneTime = 0; //The 2nd to last time (micros()) that tooth 1 last triggered
volatile unsigned int toothHistory[TOOTH_HISTORY_LENGTH]; volatile unsigned int toothHistory[TOOTH_LOG_BUFFER];
volatile unsigned int toothHistoryIndex = 0; volatile unsigned int toothHistoryIndex = 0;
volatile byte secondaryToothCount; //Used for identifying the current secondary (Usually cam) tooth for patterns with multiple secondary teeth volatile byte secondaryToothCount; //Used for identifying the current secondary (Usually cam) tooth for patterns with multiple secondary teeth

View File

@ -21,6 +21,28 @@ toothLastToothTime - The time (In uS) that the last primary tooth was 'seen'
*/ */
inline void addToothLogEntry(unsigned long time)
{
//High speed tooth logging history
toothHistory[toothHistoryIndex] = curGap;
if(toothHistoryIndex == (TOOTH_LOG_BUFFER-1))
{ toothHistoryIndex = 0; BIT_CLEAR(currentStatus.squirt, BIT_SQUIRT_TOOTHLOG1READY); } //The tooth log ready bit is cleared to ensure that we only get a set of concurrent values.
else
{ toothHistoryIndex++; }
}
/*
As nearly all the decoders use a common method of determining RPM (The time the last full revolution took)
A common function is simpler
*/
inline int stdGetRPM()
{
noInterrupts();
revolutionTime = (toothOneTime - toothOneMinusOneTime); //The time in uS that one revolution would take at current speed (The time tooth 1 was last seen, minus the time it was seen prior to that)
interrupts();
return (US_IN_MINUTE / revolutionTime); //Calc RPM based on last full revolution time (Faster as /)
}
/* /*
Name: Missing tooth wheel Name: Missing tooth wheel
Desc: A multi-tooth wheel with one of more 'missing' teeth. The first tooth after the missing one is considered number 1 and isthe basis for the trigger angle Desc: A multi-tooth wheel with one of more 'missing' teeth. The first tooth after the missing one is considered number 1 and isthe basis for the trigger angle
@ -43,12 +65,7 @@ void triggerPri_missingTooth()
if ( curGap < triggerFilterTime ) { 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 < triggerFilterTime ) { 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 addToothLogEntry(curGap);
toothHistory[toothHistoryIndex] = curGap;
if(toothHistoryIndex == 511)
{ toothHistoryIndex = 0; }
else
{ toothHistoryIndex++; }
//Begin the missing tooth detection //Begin the missing tooth detection
//If the time between the current tooth and the last is greater than 1.5x the time between the last tooth and the tooth before that, we make the assertion that we must be at the first tooth after the gap //If the time between the current tooth and the last is greater than 1.5x the time between the last tooth and the tooth before that, we make the assertion that we must be at the first tooth after the gap
@ -73,10 +90,7 @@ void triggerSec_missingTooth(){ return; } //This function currently is not used
int getRPM_missingTooth() int getRPM_missingTooth()
{ {
noInterrupts(); return stdGetRPM();
revolutionTime = (toothOneTime - toothOneMinusOneTime); //The time in uS that one revolution would take at current speed (The time tooth 1 was last seen, minus the time it was seen prior to that)
interrupts();
return (US_IN_MINUTE / revolutionTime); //Calc RPM based on last full revolution time (Faster as /)
} }
int getCrankAngle_missingTooth(int timePerDegree) int getCrankAngle_missingTooth(int timePerDegree)
@ -128,12 +142,7 @@ void triggerPri_DualWheel()
if ((startRevolutions & 63) == 1) { currentStatus.hasSync = false; } //Every 64 revolutions, force a resync with the cam if ((startRevolutions & 63) == 1) { currentStatus.hasSync = false; } //Every 64 revolutions, force a resync with the cam
} }
//High speed tooth logging history addToothLogEntry(curGap);
toothHistory[toothHistoryIndex] = curGap;
if(toothHistoryIndex == 511)
{ toothHistoryIndex = 0; }
else
{ toothHistoryIndex++; }
toothLastMinusOneToothTime = toothLastToothTime; toothLastMinusOneToothTime = toothLastToothTime;
toothLastToothTime = curTime; toothLastToothTime = curTime;
@ -155,10 +164,7 @@ void triggerSec_DualWheel()
int getRPM_DualWheel() int getRPM_DualWheel()
{ {
noInterrupts(); return stdGetRPM();
revolutionTime = (toothOneTime - toothOneMinusOneTime); //The time in uS that one revolution would take at current speed (The time tooth 1 was last seen, minus the time it was seen prior to that)
interrupts();
return (US_IN_MINUTE / revolutionTime); //Calc RPM based on last full revolution time (Faster as /)
} }
int getCrankAngle_DualWheel(int timePerDegree) int getCrankAngle_DualWheel(int timePerDegree)
@ -212,23 +218,15 @@ void triggerPri_BasicDistributor()
} }
else { toothCurrentCount++; } //Increment the tooth counter else { toothCurrentCount++; } //Increment the tooth counter
//High speed tooth logging history addToothLogEntry(curGap);
toothHistory[toothHistoryIndex] = curGap;
if(toothHistoryIndex == 511)
{ toothHistoryIndex = 0; }
else
{ toothHistoryIndex++; }
toothLastMinusOneToothTime = toothLastToothTime; toothLastMinusOneToothTime = toothLastToothTime;
toothLastToothTime = curTime; toothLastToothTime = curTime;
} }
void triggerSec_BasicDistributor() { return; } //Not required void triggerSec_BasicDistributor() { return; } //Not required
int getRPM_BasicDistributor() int getRPM_BasicDistributor()
{ {
noInterrupts(); return stdGetRPM();
revolutionTime = (toothOneTime - toothOneMinusOneTime); //The time in uS that one revolution would take at current speed (The time tooth 1 was last seen, minus the time it was seen prior to that)
interrupts();
return ldiv(US_IN_MINUTE, revolutionTime).quot; //Calc RPM based on last full revolution time (uses ldiv rather than div as US_IN_MINUTE is a long)
} }
int getCrankAngle_BasicDistributor(int timePerDegree) int getCrankAngle_BasicDistributor(int timePerDegree)
{ {
@ -265,12 +263,7 @@ void triggerPri_GM7X()
curGap = curTime - toothLastToothTime; curGap = curTime - toothLastToothTime;
toothCurrentCount++; //Increment the tooth counter toothCurrentCount++; //Increment the tooth counter
//High speed tooth logging history addToothLogEntry(curGap);
toothHistory[toothHistoryIndex] = curGap;
if(toothHistoryIndex == 511)
{ toothHistoryIndex = 0; }
else
{ toothHistoryIndex++; }
// //
if( toothCurrentCount > 7 ) if( toothCurrentCount > 7 )
@ -296,10 +289,7 @@ void triggerPri_GM7X()
void triggerSec_GM7X() { return; } //Not required void triggerSec_GM7X() { return; } //Not required
int getRPM_GM7X() int getRPM_GM7X()
{ {
noInterrupts(); return stdGetRPM();
revolutionTime = (toothOneTime - toothOneMinusOneTime); //The time in uS that one revolution would take at current speed (The time tooth 1 was last seen, minus the time it was seen prior to that)
interrupts();
return ldiv(US_IN_MINUTE, revolutionTime).quot; //Calc RPM based on last full revolution time (uses ldiv rather than div as US_IN_MINUTE is a long)
} }
int getCrankAngle_GM7X(int timePerDegree) int getCrankAngle_GM7X(int timePerDegree)
{ {
@ -338,7 +328,7 @@ int getCrankAngle_GM7X(int timePerDegree)
Name: Mitsubishi 4G63 / NA/NB Miata + MX-5 / 4/2 Name: Mitsubishi 4G63 / NA/NB Miata + MX-5 / 4/2
Desc: TBA Desc: TBA
Note: https://raw.githubusercontent.com/noisymime/speeduino/master/reference/wiki/decoders/4g63_trace.png Note: https://raw.githubusercontent.com/noisymime/speeduino/master/reference/wiki/decoders/4g63_trace.png
Tooth #1 is defined as the next crank tooth after the crank signal is LOW when the cam signal is rising. Tooth #1 is defined as the next crank tooth after the crank signal is HIGH when the cam signal is falling.
Tooth number one is at 355* ATDC Tooth number one is at 355* ATDC
*/ */
void triggerSetup_4G63() void triggerSetup_4G63()
@ -382,12 +372,7 @@ void triggerPri_4G63()
else if (!currentStatus.hasSync) { return; } else if (!currentStatus.hasSync) { return; }
else { toothCurrentCount++; } else { toothCurrentCount++; }
//High speed tooth logging history addToothLogEntry(curGap);
toothHistory[toothHistoryIndex] = curGap;
if(toothHistoryIndex == 511)
{ toothHistoryIndex = 0; }
else
{ toothHistoryIndex++; }
toothLastMinusOneToothTime = toothLastToothTime; toothLastMinusOneToothTime = toothLastToothTime;
toothLastToothTime = curTime; toothLastToothTime = curTime;
@ -403,9 +388,13 @@ void triggerSec_4G63()
{ {
//Check the status of the crank trigger //Check the status of the crank trigger
bool crank = digitalRead(pinTrigger); bool crank = digitalRead(pinTrigger);
triggerFilterTime = 1; if(crank == HIGH)
if(crank == HIGH) { toothCurrentCount = 4; } //If the crank trigger is currently HIGH, it means we're on tooth #1 {
triggerFilterTime = 1; //Effectively turns off the trigger filter for now
toothCurrentCount = 4; //If the crank trigger is currently HIGH, it means we're on tooth #1
}
} }
else { triggerFilterTime = 1500; } //reset filter time (ugly)
return; return;
} }
@ -494,12 +483,7 @@ void triggerPri_24X()
toothCurrentCount++; //Increment the tooth counter toothCurrentCount++; //Increment the tooth counter
} }
//High speed tooth logging history addToothLogEntry(curGap);
toothHistory[toothHistoryIndex] = curGap;
if(toothHistoryIndex == 511)
{ toothHistoryIndex = 0; }
else
{ toothHistoryIndex++; }
toothLastToothTime = curTime; toothLastToothTime = curTime;
} }
@ -511,10 +495,7 @@ void triggerSec_24X()
int getRPM_24X() int getRPM_24X()
{ {
noInterrupts(); return stdGetRPM();
revolutionTime = (toothOneTime - toothOneMinusOneTime); //The time in uS that one revolution would take at current speed (The time tooth 1 was last seen, minus the time it was seen prior to that)
interrupts();
return ldiv(US_IN_MINUTE, revolutionTime).quot; //Calc RPM based on last full revolution time (uses ldiv rather than div as US_IN_MINUTE is a long)
} }
int getCrankAngle_24X(int timePerDegree) int getCrankAngle_24X(int timePerDegree)
{ {
@ -581,12 +562,7 @@ void triggerPri_Jeep2000()
toothCurrentCount++; //Increment the tooth counter toothCurrentCount++; //Increment the tooth counter
} }
//High speed tooth logging history addToothLogEntry(curGap);
toothHistory[toothHistoryIndex] = curGap;
if(toothHistoryIndex == 511)
{ toothHistoryIndex = 0; }
else
{ toothHistoryIndex++; }
toothLastToothTime = curTime; toothLastToothTime = curTime;
} }
@ -598,10 +574,7 @@ void triggerSec_Jeep2000()
int getRPM_Jeep2000() int getRPM_Jeep2000()
{ {
noInterrupts(); return stdGetRPM();
revolutionTime = (toothOneTime - toothOneMinusOneTime); //The time in uS that one revolution would take at current speed (The time tooth 1 was last seen, minus the time it was seen prior to that)
interrupts();
return ldiv(US_IN_MINUTE, revolutionTime).quot; //Calc RPM based on last full revolution time (uses ldiv rather than div as US_IN_MINUTE is a long)
} }
int getCrankAngle_Jeep2000(int timePerDegree) int getCrankAngle_Jeep2000(int timePerDegree)
{ {

View File

@ -24,13 +24,17 @@ const int map_page_size = 288;
#define BIT_ENGINE_IDLE 7 // idle on #define BIT_ENGINE_IDLE 7 // idle on
//Define masks for Squirt //Define masks for Squirt
#define BIT_SQUIRT_INJ1 0 //inj1 Squirt #define BIT_SQUIRT_INJ1 0 //inj1 Squirt
#define BIT_SQUIRT_INJ2 1 //inj2 Squirt #define BIT_SQUIRT_INJ2 1 //inj2 Squirt
#define BIT_SQUIRT_SCHSQRT 2 //Scheduled to squirt #define BIT_SQUIRT_INJ3 2 //inj3 Squirt
#define BIT_SQUIRT_SQRTING 3 //Squirting #define BIT_SQUIRT_INJ4 3 //inj4 Squirt
#define BIT_SQUIRT_INJ2SCHED 4 #define BIT_SQUIRT_INJ2SCHED 4
#define BIT_SQUIRT_INJ2SQRT 5 //Injector2 (Schedule2) #define BIT_SQUIRT_INJ2SQRT 5 //Injector2 (Schedule2)
#define BIT_SQUIRT_BOOSTCTRLOFF 6 //Squirting Injector 2 #define BIT_SQUIRT_TOOTHLOG1READY 6 //Used to flag if tooth log 1 is ready
#define BIT_SQUIRT_TOOTHLOG2READY 7 //Used to flag if tooth log 2 is ready (Log is not currently used)
#define TOOTH_LOG_SIZE 128
#define TOOTH_LOG_BUFFER 256
#define SIZE_BYTE 8 #define SIZE_BYTE 8
#define SIZE_INT 16 #define SIZE_INT 16
@ -51,6 +55,9 @@ volatile byte inj3_pin_mask;
volatile byte *inj4_pin_port; volatile byte *inj4_pin_port;
volatile byte inj4_pin_mask; volatile byte inj4_pin_mask;
volatile byte *ign1_pin_port;
volatile byte ign1_pin_mask;
//The status struct contains the current values for all 'live' variables //The status struct contains the current values for all 'live' variables
//In current version this is 64 bytes //In current version this is 64 bytes
struct statuses { struct statuses {
@ -64,6 +71,7 @@ struct statuses {
unsigned long TPSlast_time; //The time the previous TPS sample was taken unsigned long TPSlast_time; //The time the previous TPS sample was taken
byte tpsADC; //0-255 byte representation of the TPS byte tpsADC; //0-255 byte representation of the TPS
byte tpsDOT; byte tpsDOT;
int rpmDOT;
byte VE; byte VE;
byte O2; byte O2;
byte O2_2; byte O2_2;
@ -83,6 +91,8 @@ struct statuses {
byte egoCorrection; //The amount of closed loop AFR enrichment currently being applied byte egoCorrection; //The amount of closed loop AFR enrichment currently being applied
byte wueCorrection; //The amount of warmup enrichment currently being applied byte wueCorrection; //The amount of warmup enrichment currently being applied
byte batCorrection; //The amount of battery voltage enrichment currently being applied byte batCorrection; //The amount of battery voltage enrichment currently being applied
byte iatCorrection; //The amount of inlet air temperature adjustment currently being applied
byte launchCorrection; //The amount of correction being applied if launch control is active
byte afrTarget; byte afrTarget;
unsigned long TAEEndTime; //The target end time used whenever TAE is turned on unsigned long TAEEndTime; //The target end time used whenever TAE is turned on
volatile byte squirt; volatile byte squirt;
@ -92,6 +102,7 @@ struct statuses {
volatile byte runSecs; //Counter of seconds since cranking commenced (overflows at 255 obviously) volatile byte runSecs; //Counter of seconds since cranking commenced (overflows at 255 obviously)
volatile byte secl; //Continous volatile byte secl; //Continous
volatile int loopsPerSecond; volatile int loopsPerSecond;
boolean launching; //True when in launch control mode
int freeRAM; int freeRAM;
//Helpful bitwise operations: //Helpful bitwise operations:
@ -211,7 +222,8 @@ struct config2 {
byte dwellCont : 1; //Fixed duty dwell control byte dwellCont : 1; //Fixed duty dwell control
byte useDwellLim : 1; //Whether the dwell limiter is off or on byte useDwellLim : 1; //Whether the dwell limiter is off or on
byte dwellUnused : 6; byte sparkMode : 2; //Spark output mode (Eg Wasted spark, single channel or Wasted COP)
byte dwellUnused : 4;
byte dwellCrank; //Dwell time whilst cranking byte dwellCrank; //Dwell time whilst cranking
byte dwellRun; //Dwell time whilst running byte dwellRun; //Dwell time whilst running
@ -279,11 +291,15 @@ struct config3 {
byte boostFreq; //Frequency of the boost PWM valve byte boostFreq; //Frequency of the boost PWM valve
byte vvtFreq; //Frequency of the vvt PWM valve byte vvtFreq; //Frequency of the vvt PWM valve
byte idleFreq; byte idleFreq;
byte unused48;
byte unused49; byte launchPin : 6;
byte unused50; byte launchEnabled : 1;
byte unused51; byte unused48h : 1;
byte unused452;
byte lnchSoftLim;
byte lnchRetard;
byte lnchHardLim;
byte lnchFuelAdd;
byte unused53; byte unused53;
byte unused54; byte unused54;
byte unused55; byte unused55;
@ -375,6 +391,7 @@ byte pinVVt_2; // vvt output 2
byte pinFan; // Cooling fan output byte pinFan; // Cooling fan output
byte pinStepperDir; //Direction pin for the stepper motor driver byte pinStepperDir; //Direction pin for the stepper motor driver
byte pinStepperStep; //Step pin for the stepper motor driver byte pinStepperStep; //Step pin for the stepper motor driver
byte pinLaunch;
// global variables // from speeduino.ino // global variables // from speeduino.ino
extern struct statuses currentStatus; // from speeduino.ino extern struct statuses currentStatus; // from speeduino.ino

View File

@ -0,0 +1,26 @@
G04 MADE WITH FRITZING*
G04 WWW.FRITZING.ORG*
G04 DOUBLE SIDED*
G04 HOLES PLATED*
G04 CONTOUR ON CENTER OF CONTOUR VECTOR*
%ASAXBY*%
%FSLAX23Y23*%
%MOIN*%
%OFA0B0*%
%SFA1.0B1.0*%
%ADD10R,1.574800X3.937010*%
%ADD11C,0.008000*%
%ADD10C,0.008*%
%LNCONTOUR*%
G90*
G70*
G54D10*
G54D11*
X4Y3933D02*
X1571Y3933D01*
X1571Y4D01*
X4Y4D01*
X4Y3933D01*
D02*
G04 End of contour*
M02*

View File

@ -0,0 +1,128 @@
; NON-PLATED HOLES START AT T1
; THROUGH (PLATED) HOLES START AT T100
M48
INCH
T1C0.137795
T100C0.015748
T101C0.040000
T102C0.043307
T103C0.035000
T104C0.035433
T105C0.042000
%
T1
X012991Y021143
X012991Y003106
X012991Y036440
T100
X006491Y028366
X005241Y012866
T101
X002741Y018116
X003991Y030834
X001741Y011116
X001741Y024116
X002741Y011116
X001741Y016116
X002741Y024116
X001741Y008116
X002741Y016116
X002741Y008116
X001741Y022116
X001741Y014116
X003991Y028866
X002741Y022116
X001741Y006116
X002741Y014116
X001741Y019116
X003241Y035866
X002741Y006116
X002741Y019116
X001741Y020116
X001741Y012116
X002741Y020116
X001741Y025116
X002741Y012116
X001741Y017116
X002741Y025116
X003241Y033866
X001741Y009116
X002741Y017116
X002741Y009116
X001741Y010116
X001741Y023116
X002741Y010116
X001741Y015116
X002741Y023116
X001741Y007116
X002741Y015116
X003241Y036866
X002741Y007116
X001741Y021116
X001741Y013116
X002741Y021116
X002741Y013116
X001741Y018116
X003241Y034866
T102
X010537Y023801
X008760Y006717
X010482Y010477
X008732Y010467
X008782Y034662
X008755Y011649
X008782Y029694
X010496Y014000
X008745Y015176
X010510Y005348
X010533Y029704
X008782Y026153
X008782Y032065
X010519Y034671
X010496Y012815
X010496Y017556
X010533Y022579
X008760Y008094
X010533Y026162
X008782Y022570
X008763Y009286
X010533Y028518
X010533Y032074
X008745Y013991
X010510Y006726
X008755Y018750
X010533Y024977
X008755Y020139
X010505Y011658
X010533Y030889
X008782Y030880
X008787Y023792
X008745Y017546
X008745Y012806
X010496Y016370
X008782Y028523
X010533Y027333
X008760Y005339
X010505Y018759
X008782Y024982
X010510Y008104
X008782Y033287
X010496Y015185
X010513Y009295
X008782Y027338
X008745Y016361
X010533Y033296
X010505Y020148
T103
X010991Y002866
X006491Y029616
X006991Y002866
X006491Y033616
T104
X006241Y022866
X007491Y022866
T105
X002491Y002866
X005471Y002866
T00
M30

View File

@ -0,0 +1,150 @@
G04 MADE WITH FRITZING*
G04 WWW.FRITZING.ORG*
G04 DOUBLE SIDED*
G04 HOLES PLATED*
G04 CONTOUR ON CENTER OF CONTOUR VECTOR*
%ASAXBY*%
%FSLAX23Y23*%
%MOIN*%
%OFA0B0*%
%SFA1.0B1.0*%
%ADD10C,0.085433*%
%ADD11C,0.049370*%
%ADD12C,0.085000*%
%ADD13C,0.092000*%
%ADD14C,0.090000*%
%ADD15C,0.084000*%
%ADD16C,0.147795*%
%ADD17C,0.093307*%
%ADD18R,0.092000X0.092000*%
%ADD19R,0.090000X0.090000*%
%ADD20R,0.084000X0.084000*%
%LNMASK0*%
G90*
G70*
G54D10*
X624Y2287D03*
G54D11*
X649Y2837D03*
G54D12*
X1099Y287D03*
X699Y287D03*
X649Y3362D03*
X649Y2962D03*
G54D13*
X249Y287D03*
X547Y287D03*
G54D10*
X749Y2287D03*
G54D11*
X524Y1287D03*
G54D14*
X324Y3387D03*
X324Y3487D03*
X324Y3587D03*
X324Y3687D03*
X399Y2887D03*
X399Y3083D03*
G54D15*
X274Y2512D03*
X274Y2412D03*
X274Y2312D03*
X274Y2212D03*
X274Y2112D03*
X274Y2012D03*
X274Y1912D03*
X274Y1812D03*
X274Y1712D03*
X274Y1612D03*
X274Y1512D03*
X274Y1412D03*
X274Y1312D03*
X274Y1212D03*
X274Y1112D03*
X274Y1012D03*
X274Y912D03*
X274Y812D03*
X274Y712D03*
X274Y612D03*
X174Y2512D03*
X174Y2412D03*
X174Y2312D03*
X174Y2212D03*
X174Y2112D03*
X174Y2012D03*
X174Y1912D03*
X174Y1812D03*
X174Y1712D03*
X174Y1612D03*
X174Y1512D03*
X174Y1412D03*
X174Y1312D03*
X174Y1212D03*
X174Y1112D03*
X174Y1012D03*
X174Y912D03*
X174Y812D03*
X174Y712D03*
X174Y612D03*
G54D16*
X1299Y311D03*
X1299Y2114D03*
X1299Y3644D03*
G54D17*
X876Y534D03*
X876Y672D03*
X876Y809D03*
X876Y929D03*
X873Y1047D03*
X876Y1165D03*
X875Y1281D03*
X875Y1399D03*
X875Y1518D03*
X875Y1636D03*
X875Y1755D03*
X876Y1875D03*
X1051Y535D03*
X1051Y673D03*
X1051Y810D03*
X1051Y930D03*
X1048Y1048D03*
X1051Y1166D03*
X1050Y1282D03*
X1050Y1400D03*
X1050Y1519D03*
X1050Y1637D03*
X1050Y1756D03*
X1051Y1876D03*
X1051Y2015D03*
X876Y2014D03*
X878Y2257D03*
X1053Y2258D03*
X879Y2379D03*
X1054Y2380D03*
X878Y2498D03*
X1053Y2498D03*
X878Y2615D03*
X1053Y2616D03*
X878Y2734D03*
X1053Y2733D03*
X878Y2852D03*
X1053Y2852D03*
X878Y2969D03*
X1053Y2970D03*
X878Y3088D03*
X1053Y3089D03*
X878Y3207D03*
X1053Y3207D03*
X878Y3329D03*
X1053Y3330D03*
X878Y3466D03*
X1052Y3467D03*
G54D18*
X248Y287D03*
G54D19*
X324Y3387D03*
X399Y2887D03*
G54D20*
X174Y2512D03*
G04 End of Mask0*
M02*

View File

@ -0,0 +1,150 @@
G04 MADE WITH FRITZING*
G04 WWW.FRITZING.ORG*
G04 DOUBLE SIDED*
G04 HOLES PLATED*
G04 CONTOUR ON CENTER OF CONTOUR VECTOR*
%ASAXBY*%
%FSLAX23Y23*%
%MOIN*%
%OFA0B0*%
%SFA1.0B1.0*%
%ADD10C,0.085433*%
%ADD11C,0.049370*%
%ADD12C,0.085000*%
%ADD13C,0.092000*%
%ADD14C,0.090000*%
%ADD15C,0.084000*%
%ADD16C,0.147795*%
%ADD17C,0.093307*%
%ADD18R,0.092000X0.092000*%
%ADD19R,0.090000X0.090000*%
%ADD20R,0.084000X0.084000*%
%LNMASK1*%
G90*
G70*
G54D10*
X624Y2287D03*
G54D11*
X649Y2837D03*
G54D12*
X1099Y287D03*
X699Y287D03*
X649Y3362D03*
X649Y2962D03*
G54D13*
X249Y287D03*
X547Y287D03*
G54D10*
X749Y2287D03*
G54D11*
X524Y1287D03*
G54D14*
X324Y3387D03*
X324Y3487D03*
X324Y3587D03*
X324Y3687D03*
X399Y2887D03*
X399Y3083D03*
G54D15*
X274Y2512D03*
X274Y2412D03*
X274Y2312D03*
X274Y2212D03*
X274Y2112D03*
X274Y2012D03*
X274Y1912D03*
X274Y1812D03*
X274Y1712D03*
X274Y1612D03*
X274Y1512D03*
X274Y1412D03*
X274Y1312D03*
X274Y1212D03*
X274Y1112D03*
X274Y1012D03*
X274Y912D03*
X274Y812D03*
X274Y712D03*
X274Y612D03*
X174Y2512D03*
X174Y2412D03*
X174Y2312D03*
X174Y2212D03*
X174Y2112D03*
X174Y2012D03*
X174Y1912D03*
X174Y1812D03*
X174Y1712D03*
X174Y1612D03*
X174Y1512D03*
X174Y1412D03*
X174Y1312D03*
X174Y1212D03*
X174Y1112D03*
X174Y1012D03*
X174Y912D03*
X174Y812D03*
X174Y712D03*
X174Y612D03*
G54D16*
X1299Y311D03*
X1299Y2114D03*
X1299Y3644D03*
G54D17*
X876Y534D03*
X876Y672D03*
X876Y809D03*
X876Y929D03*
X873Y1047D03*
X876Y1165D03*
X875Y1281D03*
X875Y1399D03*
X875Y1518D03*
X875Y1636D03*
X875Y1755D03*
X876Y1875D03*
X1051Y535D03*
X1051Y673D03*
X1051Y810D03*
X1051Y930D03*
X1048Y1048D03*
X1051Y1166D03*
X1050Y1282D03*
X1050Y1400D03*
X1050Y1519D03*
X1050Y1637D03*
X1050Y1756D03*
X1051Y1876D03*
X1051Y2015D03*
X876Y2014D03*
X878Y2257D03*
X1053Y2258D03*
X879Y2379D03*
X1054Y2380D03*
X878Y2498D03*
X1053Y2498D03*
X878Y2615D03*
X1053Y2616D03*
X878Y2734D03*
X1053Y2733D03*
X878Y2852D03*
X1053Y2852D03*
X878Y2969D03*
X1053Y2970D03*
X878Y3088D03*
X1053Y3089D03*
X878Y3207D03*
X1053Y3207D03*
X878Y3329D03*
X1053Y3330D03*
X878Y3466D03*
X1052Y3467D03*
G54D18*
X248Y287D03*
G54D19*
X324Y3387D03*
X399Y2887D03*
G54D20*
X174Y2512D03*
G04 End of Mask1*
M02*

View File

@ -0,0 +1,193 @@
*Pick And Place List
*Company=
*Author=
*eMail=
*
*Project=NA Miata 48 pin
*Date=22:21:53
*CreatedBy=Fritzing 0.9.2b.11.19.8d2d5970658f0bed09c661c9ea9a515b5f40f44c
*
*
*Coordinates in mm, always center of component
*Origin 0/0=Lower left corner of PCB
*Rotation in degree (0-360, math. pos.)
*
*No;Value;Package;X;Y;Rotation;Side;Name
1;;THT;22.3088;-84.5501;0;Bottom;1C
2;;;9.1948;-73.3427;0;Bottom;Copper Fill99
3;;THT;26.7656;-60.4555;0;Bottom;1T
4;;;3.3782;-54.915;0;Bottom;Copper Fill13
5;;;5.6896;-19.355;0;Bottom;Copper Fill89
6;;;9.1948;-73.3427;0;Bottom;Copper Fill56
7;;;5.6896;-54.915;0;Bottom;Copper Fill69
8;;;5.6896;-26.975;0;Bottom;Copper Fill38
9;;;13.3129;-32.6801;0;Bottom;Via2
10;;;27.559;-47.6887;0;Bottom;Copper Fill60
11;;THT;22.2147;-44.5689;0;Bottom;2E
12;;;25.8826;-64.948;0;Bottom;Copper Fill8
13;;THT;26.7046;-23.6103;0;Bottom;2T
14;;;25.8826;-73.965;0;Bottom;Copper Fill4
15;;;2.8448;-39.9798;0;Bottom;Copper Fill72
16;;;15.8496;-53.8482;0;Bottom;Copper Fill48
17;;;25.8572;-46.1266;0;Bottom;Copper Fill21
18;;;17.272;-85.4331;0;Bottom;Copper Fill104
19;;;3.3782;-52.375;0;Bottom;Copper Fill15
20;;;3.429;-8.2552;0;Bottom;Copper Fill91
21;;;5.6896;-52.375;0;Bottom;Copper Fill70
22;;;16.4465;-84.6076;0;Bottom;Copper Fill102
23;;;32.9979;-92.5582;0;Bottom;Hole1
24;;;5.6896;-49.835;0;Bottom;Copper Fill71
25;;;3.3782;-19.355;0;Bottom;Copper Fill43
26;;;16.4465;-86.284;0;Bottom;Copper Fill57
27;;THT;22.2523;-17.0616;-90;Bottom;2W
28;;;5.6896;-44.755;0;Bottom;Copper Fill74
29;;;13.3096;-18.6946;0;Bottom;Copper Fill87
30;;THT;22.2523;-13.562;-90;Bottom;2Y
31;;;2.8448;-24.1048;0;Bottom;Copper Fill83
32;;;25.8572;-76.9622;0;Bottom;Copper Fill3
33;;;2.397;-90.9186;0;Bottom;TXT2
34;;THT;26.6973;-17.0847;0;Bottom;2X
35;;;1.83257;-73.1386;0;Bottom;TXT4
36;;;33.9569;-73.3406;-90;Bottom;IMG1
37;;;3.3782;-42.215;0;Bottom;Copper Fill24
38;;;20.1168;-42.85;0;Bottom;Copper Fill75
39;;;12.6746;-67.5896;0;Bottom;Copper Fill6
40;;;19.9898;-50.0128;0;Bottom;Copper Fill92
41;;;10.0965;-72.4664;0;Bottom;Copper Fill55
42;;;5.6896;-49.835;0;Bottom;Copper Fill18
43;;;5.6896;-16.815;0;Bottom;Copper Fill90
44;;;3.3782;-49.835;0;Bottom;Copper Fill17
45;;THT;22.2382;-47.6262;0;Bottom;2C
46;;;5.6896;-32.055;0;Bottom;Copper Fill34
47;;;16.4879;-72.05;0;Bottom;Via3
48;;;5.6896;-59.995;0;Bottom;Copper Fill67
49;;THT;26.7538;-57.351;0;Bottom;1V
50;;;16.9164;-72.0727;0;Bottom;Copper Fill97
51;;THT;22.3088;-63.4541;0;Bottom;1Q
52;;;3.3782;-39.675;0;Bottom;Copper Fill26
53;;;5.6896;-29.515;0;Bottom;Copper Fill36
54;;;5.6896;-47.295;0;Bottom;Copper Fill20
55;;;32.9979;-7.89138;0;Bottom;Hole3
56;;THT;26.6597;-38.5711;0;Bottom;2J
57;;;25.8572;-79.9594;0;Bottom;Copper Fill2
58;;THT;26.7185;-88.0661;0;Bottom;1B
59;;;20.447;-33.6298;0;Bottom;Copper Fill77
60;;;5.6896;-57.455;0;Bottom;Copper Fill12
61;15k;THT;22.838;-7.28003;180;Bottom;R1
62;;;21.2344;-47.6887;0;Bottom;Copper Fill101
63;;;5.6896;-39.675;0;Bottom;Copper Fill27
64;;;3.3782;-21.895;0;Bottom;Copper Fill41
65;;;16.4465;-71.6028;0;Bottom;Copper Fill52
66;;THT;26.7538;-81.4692;0;Bottom;1F
67;;THT;22.2596;-23.5871;-90;Bottom;2S
68;;;16.4465;-71.6028;0;Bottom;Copper Fill95
69;;;5.6896;-54.915;0;Bottom;Copper Fill14
70;;;13.8557;-6.401;0;Bottom;Copper Fill106
71;;THT;22.3088;-75.425;0;Bottom;1I
72;;;16.9164;-72.0727;0;Bottom;Copper Fill53
73;;;2.66706;-85.7659;0;Bottom;TXT2
74;;;10.1346;-17.1198;0;Bottom;Copper Fill45
75;;;3.3782;-26.975;0;Bottom;Copper Fill37
76;;;1.79225;-78.2589;0;Bottom;TXT4
77;;THT;26.7538;-66.4527;0;Bottom;1P
78;;;26.6065;-52.1972;0;Bottom;Copper Fill61
79;;;5.6896;-24.435;0;Bottom;Copper Fill85
80;;THT;26.6832;-51.1772;0;Bottom;2B
81;;THT;22.2147;-38.548;0;Bottom;2I
82;;THT;26.6597;-35.561;0;Bottom;2L
83;;;10.9982;-73.3427;0;Bottom;Copper Fill100
84;;;5.6896;-29.515;0;Bottom;Copper Fill82
85;;;5.6896;-37.135;0;Bottom;Copper Fill79
86;;THT;26.6973;-13.5852;0;Bottom;2Z
87;;THT;26.7538;-78.4588;0;Bottom;1H
88;;THT;26.7538;-69.4276;0;Bottom;1N
89;;;3.3782;-24.435;0;Bottom;Copper Fill39
90;;300 mil [THT];10.1126;-7.28003;0;Bottom;D1
91;;;2.63283;-88.5802;0;Bottom;TXT2
92;;;5.6896;-16.815;0;Bottom;Copper Fill47
93;;;5.6896;-42.215;0;Bottom;Copper Fill76
94;;;5.6896;-47.295;0;Bottom;Copper Fill73
95;;;25.8826;-61.9254;0;Bottom;Copper Fill9
96;;THT;22.3088;-81.4457;0;Bottom;1E
97;;;7.7724;-20.6631;0;Bottom;Copper Fill105
98;;;3.3782;-47.295;0;Bottom;Copper Fill19
99;;THT;26.6832;-47.6494;0;Bottom;2D
100;;;5.6896;-42.215;0;Bottom;Copper Fill25
101;;THT;22.3088;-72.4499;0;Bottom;1K
102;;;19.9898;-50.0128;0;Bottom;Copper Fill49
103;;THT;22.2147;-35.5378;0;Bottom;2K
104;;;5.6896;-59.7664;0;Bottom;Copper Fill10
105;;THT;26.7538;-84.5736;0;Bottom;1D
106;;;5.6896;-37.135;0;Bottom;Copper Fill29
107;;THT;22.2382;-51.1537;0;Bottom;2A
108;;;5.6896;-52.375;0;Bottom;Copper Fill16
109;;;16.4465;-84.6076;0;Bottom;Copper Fill58
110;;;3.3782;-37.135;0;Bottom;Copper Fill28
111;;;30.4546;-66.6244;0;Bottom;Copper Fill66
112;;;11.4554;-88.2652;0;Bottom;Copper Fill1
113;;;15.9512;-72.0727;0;Bottom;Copper Fill96
114;;THT;22.2384;-29.59;-90;Bottom;2O
115;;THT;26.7538;-63.4423;0;Bottom;1R
116;;;5.6896;-34.595;0;Bottom;Copper Fill31
117;;;5.6896;-32.055;0;Bottom;Copper Fill81
118;;THT;7.72496;-89.703;180;Bottom;J2
119;;;5.6896;-24.435;0;Bottom;Copper Fill40
120;;;22.1869;-52.1464;0;Bottom;Copper Fill50
121;;;5.6896;-34.595;0;Bottom;Copper Fill80
122;;;16.4465;-72.5934;0;Bottom;Copper Fill51
123;;THT;9.12196;-75.693;180;Bottom;J3
124;;;10.0965;-72.4664;0;Bottom;Copper Fill98
125;;;15.853;-58.0799;0;Bottom;Via4
126;;;22.1794;-53.2353;0;Bottom;TXT1
127;;;2.70367;-93.3681;0;Bottom;TXT5
128;;THT;22.3088;-88.0426;0;Bottom;1A
129;;THT;22.2523;-20.5611;-90;Bottom;2U
130;;;3.3782;-16.815;0;Bottom;Copper Fill46
131;;;3.3782;-57.455;0;Bottom;Copper Fill11
132;;THT;26.6597;-44.5921;0;Bottom;2F
133;;THT;26.6244;-26.6117;0;Bottom;2R
134;;THT;26.7538;-72.4381;0;Bottom;1L
135;;THT;22.3206;-60.4321;0;Bottom;1S
136;;;22.1098;-90.6514;0;Bottom;TXT1
137;;;5.6896;-21.895;0;Bottom;Copper Fill42
138;;;15.5956;-85.4331;0;Bottom;Copper Fill103
139;;THT;26.6597;-32.5505;0;Bottom;2N
140;;;25.8572;-67.9452;0;Bottom;Copper Fill7
141;;THT;26.6834;-29.6131;0;Bottom;2P
142;;;21.2344;-51.1939;0;Bottom;Copper Fill93
143;;;32.9979;-53.7056;0;Bottom;Hole2
144;;;13.8557;-6.401;0;Bottom;Copper Fill64
145;;THT;26.6973;-20.5843;0;Bottom;2V
146;;;3.3782;-29.515;0;Bottom;Copper Fill35
147;;;16.4465;-72.5934;0;Bottom;Copper Fill94
148;;;5.6896;-21.895;0;Bottom;Copper Fill88
149;;;5.6896;-39.675;0;Bottom;Copper Fill78
150;;THT;26.6597;-41.5816;0;Bottom;2H
151;;;25.8826;-70.917;0;Bottom;Copper Fill5
152;;THT;5.81996;-39.665;0;Bottom;J1
153;;;20.039;-3.47325;0;Bottom;TXT6
154;;THT;22.2147;-32.5273;-90;Bottom;2M
155;;;3.3782;-34.595;0;Bottom;Copper Fill30
156;;;5.6896;-57.455;0;Bottom;Copper Fill68
157;;;3.3782;-44.755;0;Bottom;Copper Fill22
158;;THT;26.7538;-75.4484;0;Bottom;1J
159;;THT;22.1794;-26.5885;-90;Bottom;2Q
160;;;5.6896;-44.755;0;Bottom;Copper Fill23
161;;THT;22.3088;-66.4293;0;Bottom;1O
162;;;3.3782;-32.055;0;Bottom;Copper Fill33
163;;;19.028;-58.0799;0;Bottom;Via1
164;;;12.9032;-7.3535;0;Bottom;Copper Fill107
165;;;5.6896;-26.975;0;Bottom;Copper Fill84
166;;THT;22.3088;-57.3276;0;Bottom;1U
167;;;12.9032;-7.3535;0;Bottom;Copper Fill65
168;10k;THT;16.488;-80.305;90;Bottom;R2
169;;;17.272;-85.4331;0;Bottom;Copper Fill59
170;;THT;22.2147;-41.5585;0;Bottom;2G
171;;THT;22.3088;-78.4353;0;Bottom;1G
172;;;10.0965;-74.2698;0;Bottom;Copper Fill54
173;;;5.6896;-19.355;0;Bottom;Copper Fill44
174;;THT;22.3088;-69.4395;0;Bottom;1M
175;;;27.559;-51.2447;0;Bottom;Copper Fill62
176;;;9.4996;-25.9844;0;Bottom;Copper Fill32
177;;;7.7724;-20.6631;0;Bottom;Copper Fill63
178;;;12.6746;-24.435;0;Bottom;Copper Fill86

View File

@ -0,0 +1,24 @@
G04 MADE WITH FRITZING*
G04 WWW.FRITZING.ORG*
G04 DOUBLE SIDED*
G04 HOLES PLATED*
G04 CONTOUR ON CENTER OF CONTOUR VECTOR*
%ASAXBY*%
%FSLAX23Y23*%
%MOIN*%
%OFA0B0*%
%SFA1.0B1.0*%
%ADD10R,1.574800X3.937010X1.558800X3.921010*%
%ADD11C,0.008000*%
%LNSILK0*%
G90*
G70*
G54D11*
X4Y3933D02*
X1571Y3933D01*
X1571Y4D01*
X4Y4D01*
X4Y3933D01*
D02*
G04 End of Silk0*
M02*

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 MiB

After

Width:  |  Height:  |  Size: 1.5 MiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 539 KiB

View File

@ -217,6 +217,7 @@ page = 4
;running dwell variable railed to 8 - who needs more than 8ms? ;running dwell variable railed to 8 - who needs more than 8ms?
dwellcont = bits, U08, 12, [0:0], "INVALID", "Dwell control" dwellcont = bits, U08, 12, [0:0], "INVALID", "Dwell control"
useDwellLim= bits, U08, 12, [1:1], "Off", "On" useDwellLim= bits, U08, 12, [1:1], "Off", "On"
sparkMode = bits, U08, 12, [2:3], "Wasted Spark", "Single Channel", "Wasted COP", "INVALID"
dwellcrank = scalar, U08, 13, "ms", 0.1, 0, 0, 25, 1 dwellcrank = scalar, U08, 13, "ms", 0.1, 0, 0, 25, 1
dwellrun = scalar, U08, 14, "ms", 0.1, 0, 0, 8, 1 dwellrun = scalar, U08, 14, "ms", 0.1, 0, 0, 8, 1
numteeth = scalar, U08, 15, "teeth", 1.0, 0.0, 0.0, 255, 0 numteeth = scalar, U08, 15, "teeth", 1.0, 0.0, 0.0, 255, 0
@ -281,6 +282,8 @@ page = 6
egoType = bits , U08, 0, [2:3], "Disabled", "Narrow Band", "Wide Band", "INVALID" ; egoOption egoType = bits , U08, 0, [2:3], "Disabled", "Narrow Band", "Wide Band", "INVALID" ; egoOption
boostEnabled= bits, U08, 0, [4:4], "Off", "On" boostEnabled= bits, U08, 0, [4:4], "Off", "On"
vvtEnabled = bits, U08, 0, [5:5], "Off", "On" vvtEnabled = bits, U08, 0, [5:5], "Off", "On"
; vvtEnabled = bits, U08, 0, [5:6], "Off", "On/Off", "PWM","Centred PID"
; vvtChannels = bits, U08, 0, [7:7], "1", "2";
egoKP = scalar, U08, 1, "%", 1.0, 0.0, 0.0, 200.0, 0 ; * ( 1 byte) egoKP = scalar, U08, 1, "%", 1.0, 0.0, 0.0, 200.0, 0 ; * ( 1 byte)
egoKI = scalar, U08, 2, "%", 1.0, 0.0, 0.0, 200.0, 0 ; * ( 1 byte) egoKI = scalar, U08, 2, "%", 1.0, 0.0, 0.0, 200.0, 0 ; * ( 1 byte)
egoKD = scalar, U08, 3, "%", 1.0, 0.0, 0.0, 200.0, 0 ; * ( 1 byte) egoKD = scalar, U08, 3, "%", 1.0, 0.0, 0.0, 200.0, 0 ; * ( 1 byte)
@ -403,12 +406,15 @@ page = 8
requiresPowerCycle = iacAlgorithm requiresPowerCycle = iacAlgorithm
requiresPowerCycle = boostEnabled requiresPowerCycle = boostEnabled
requiresPowerCycle = vvtEnabled requiresPowerCycle = vvtEnabled
; requiresPowerCycle = vvtChannels
requiresPowerCycle = boostFreq requiresPowerCycle = boostFreq
requiresPowerCycle = vvtFreq requiresPowerCycle = vvtFreq
requiresPowerCycle = idleFreq requiresPowerCycle = idleFreq
requiresPowerCycle = sparkMode
defaultValue = pinLayout, 1 defaultValue = pinLayout, 1
defaultValue = TrigPattern, 0 defaultValue = TrigPattern, 0
defaultValue = sparkMode, 0
defaultValue = inj1Ang, 355 defaultValue = inj1Ang, 355
defaultValue = inj2Ang, 355 defaultValue = inj2Ang, 355
defaultValue = inj3Ang, 355 defaultValue = inj3Ang, 355
@ -508,13 +514,40 @@ page = 8
subMenu = veTable1Map, "Fuel Table" subMenu = veTable1Map, "Fuel Table"
subMenu = sparkMap, "Spark Table", 3 subMenu = sparkMap, "Spark Table", 3
subMenu = afrTable1Map, "AFR Target Table" subMenu = afrTable1Map, "AFR Target Table"
menu = "Help"
subMenu = helpGeneral, "Speeduino Help"
;------------------------------------------------------------------------------- ;-------------------------------------------------------------------------------
[UserDefined] [UserDefined]
; define a MegaTune compatible version here ; define a MegaTune compatible version here
; no need to for std_enrichments, it is built in. ; no need to for std_enrichments, it is built in.
[SettingContextHelp]
; constantName = "Help Text"
; tool tips tooltips
;Ensure all settings are defined as some MS2/BG words shipped with TS are not applicable.
nCylinders = "The number of cylinders in your engine."
engineType = "Most engines are Even Fire. Typical odd-fire engines are V-twin, some V4, Vmax, some V6, V10."
twoStroke = "Four-Stroke (most engines), Two-stroke."
nInjectors = "Number of primary injectors."
mapSample = "The method used for calculating the MAP reading\nFor 1-2 Cylinder engines, Cycle Minimum is recommended.\nFor more than 2 cylinders Cycle Average is recommended"
TrigPattern = "The type of input trigger decoder to be used."
numteeth = "Number of teeth on Primary Wheel."
TrigSpeed = "Primary trigger speed."
onetwo = "Number of Missing teeth on Primary Wheel."
TrigAng = "The Angle ATDC when tooth No:1 on the primary wheel passes the primary sensor."
StgCycles = "The number of revolutions that will be skipped during cranking before the injectors and coils are fired."
TrigEdge = "The Trigger edge of the primary sensor.\nLeading.\nTrailing."
sparkMode = "Wasted Spark: Ignition outputs are on the channels <= half the number of cylinders. Eg 4 cylinder outputs on IGN1 and IGN2.\nSingle Channel: All ignition pulses are output on IGN1.\nWasted COP: Ignition pulses are output on all ignition channels up to the number of cylinders. Eg 4 cylinder outputs on all ignition channels. No valid for >4 cylinders"
iacStepTime = "Time between each stepper motor step.\nIncrease this if the motor appears to behave intermittently."
iacStepHome = "On startup the stepper motor moves this many steps to return to its home position. Set this value to a few more than the actual number to ensure the motor has returned to its full position."
iacStepHyster = "The minimum number of steps to move in any one go."
iacAlgorithm = "Selects method of idle control.\nNone = no idle control valve.\nOn/Off valve.\nPWM valve (2,3 wire).\nStepper Valve (4,6,8 wire)."
[UserDefinedTS] [UserDefinedTS]
; Enhanced TunerStudio dialogs can be defined here ; Enhanced TunerStudio dialogs can be defined here
@ -537,6 +570,7 @@ page = 8
; dialogs can be nested and can be mixed with fields ; dialogs can be nested and can be mixed with fields
dialog = engine_constants_south dialog = engine_constants_south
topicHelp = Mhelp
field = "Injector Timing", injTiming, { nCylinders <= 4 } field = "Injector Timing", injTiming, { nCylinders <= 4 }
field = "Board Layout", pinLayout field = "Board Layout", pinLayout
field = "MAP Sample method", mapSample field = "MAP Sample method", mapSample
@ -563,7 +597,7 @@ page = 8
dialog = injChars, "Injector Characteristics" dialog = injChars, "Injector Characteristics"
field = "Injector Open Time", injOpen field = "Injector Open Time", injOpen
field = "Injector close times" field = "Injector close angle"
field = "Channel 1", inj1Ang field = "Channel 1", inj1Ang
field = "Channel 2", inj2Ang, { nCylinders > 1 } field = "Channel 2", inj2Ang, { nCylinders > 1 }
field = "Channel 3", inj3Ang, { nCylinders > 4 || nCylinders == 3 } field = "Channel 3", inj3Ang, { nCylinders > 4 || nCylinders == 3 }
@ -605,7 +639,8 @@ page = 8
field = "Idle valve frequency", idleFreq, { iacAlgorithm == 2 || iacAlgorithm == 3 } field = "Idle valve frequency", idleFreq, { iacAlgorithm == 2 || iacAlgorithm == 3 }
dialog = idleSettings, "Idle Settings" dialog = idleSettings, "Idle Settings"
field = "Idle control type", iacAlgorithm topicHelp = "http://speeduino.com/wiki/index.php/Idle"
field = "Idle control type", iacAlgorithm
field = "#Fast Idle" field = "#Fast Idle"
field = "Fast idle temp", iacFastTemp, { iacAlgorithm == 1 } field = "Fast idle temp", iacFastTemp, { iacAlgorithm == 1 }
panel = pwm_idle panel = pwm_idle
@ -639,7 +674,7 @@ page = 8
dialog = triggerSettings,"Trigger Settings",4 dialog = triggerSettings,"Trigger Settings",4
topicHelp = Shelp3 topicHelp = "http://speeduino.com/wiki/index.php/Decoders"
field = "Trigger Pattern", TrigPattern field = "Trigger Pattern", TrigPattern
field = "Primary base teeth", numteeth, { TrigPattern == 0 || TrigPattern == 2 } field = "Primary base teeth", numteeth, { TrigPattern == 0 || TrigPattern == 2 }
field = "Primary trigger speed", TrigSpeed, { TrigPattern == 0 } field = "Primary trigger speed", TrigSpeed, { TrigPattern == 0 }
@ -655,7 +690,7 @@ page = 8
field = "Trigger edge", TrigEdge field = "Trigger edge", TrigEdge
dialog = sparkSettings,"Spark Settings",4 dialog = sparkSettings,"Spark Settings",4
topicHelp = Shelp3 field = "Spark output mode", sparkMode
field = "Cranking advance Angle", CrankAng field = "Cranking advance Angle", CrankAng
;field = "Hold Ignition", IgHold ;field = "Hold Ignition", IgHold
field = "Spark Outputs triggers", IgInv field = "Spark Outputs triggers", IgInv
@ -731,77 +766,21 @@ page = 8
field = "VVT solenoid freq.", vvtFreq field = "VVT solenoid freq.", vvtFreq
;-------------------------------------------------------------------------------
; General help text
help = helpGeneral, "Speeduino General Help"
webHelp = "http://speeduino.com/wiki/index.php/Speeduino"
text = "For current WIKI documentation, click the Web Help button,"
text = "or visit http://www.speeduino.com/."
text = "<br>"
text = "<br>why not visit our forum http://speeduino.com/forum/"
;------------------------------------------------------------------------------
; ------------------------------------------------------------- ; -------------------------------------------------------------
; Help down here ; Help down here
help = helpEnrichments, "Enrichments Help" [SettingContextHelp]
text = "<strong>Priming Pulse</strong><br><br>"
text = "The duration in milliseconds of a priming pulse that is applied when the Speeduino controller is powered up. If you dont want a priming pulse, set this field to zero.<br>"
text = "<br><strong>Cranking Pulsewidth</strong><br><br>"
text = "Cranking pulse width determines how long the injector will be open in milliseconds for each pulse while the engine is cranking (i.e., the RPM is below 300). The actual pulse width is determined by performing linear interpolation on the line described by the end points you enter for the "-40 degrees F" and "170 degrees F" values. For instance, if you enter 10.0 ms as the pulse width at -40 F and 2.0 ms at 170 F, the pulse width will be 6.0 ms when you start your engine at 65 F.<br>"
text = "Note: Cranking pulse occur at every ignition event, while running pulses only occur at the interval specified on the constants page; if you have a 4 cylinder engine and are taking the tachometer signal from the coil, then you will get four (4) cranking pulses per cycle and depending on settings one injection per cycle while running.<br>"
text = "<br><strong>Afterstart Enrichment</strong><br>"
text = "<br><strong>Exhaust Gas Oxygen Sensor Parameters</strong><br>"
text = "These parameters define the closed loop behavior of Speeduino. You must have a narrow band O2 sensor hooked up for this mode to work in v.1.0 controller code; either a narrow band or wide band will work with v.2.0 of controller code. To disable closed loop operation altogether, set the EGO Step value to zero.<br>"
text = "<br><strong>EGO Sensor Type</strong><br>"
text = "Specify either a narrow band sensor or wide band sensor. Functionally this merely sets the direction sense of the sensor voltage. For narrow band sensors, the voltage rises as the mixture is richening and drops as the mixture becomes lean. The wide band setting corresponds to the opposite sense, i.e., voltage drops to indicate enrichment (this is how the DIY-WB operates, not necessarily all WB sensors!). (Available in v 2.0 controller code.)<br>"
text = "<br><strong>EGO Switch Point (v)</strong><br>"
text = "This is the switching point voltage that indicates stoichiometric combustion (approximately 14.7:1 with gasoline). For narrow band sensors this is 0.5 v*; for the DIY-WB wideband sensor it is 2.5 v (for other wideband sensors this voltage may be quite different). (This value is only active in v 2.0 controller code.)<br>"
text = "*This is true for zirconia NB sensors, which are used almost exclusively in modern vehicles. The titania NB sensor has a different voltage range (1-5 v), but is rarely used.<br>"
text = "<br><strong>Coolant Temp Activation (°F)</strong><br>"
text = "This is the temperature below which closed loop operation is disabled. If this value is too low, then closed loop will try to lean out the warmup enrichments and you may experience rough running. Typical value is 160 F and should somewhat above the point at which warmup enrichment stops (see the Warmup Enrichment Bins settings and find the lowest on which contains 100).<br>"
text = "The value "EGOTEMP" stores this quantity.<br>"
text = "<br><strong>Ignition Events Per Step</strong><br>"
text = "This value determines the rate at which the closed loop algorithm applies correction. The default value of 32, when used on a four cylinder engine with four ignition events per cycle, wait for 8 cycles before changing the current correction factor.<br>"
text = "<br><strong>EGO Step (percent)</strong><br>"
text = "Once the closed loop algorithm has decided to change the correction factor, it adds or subtracts this percentage from the current value. This should move slowly to avoid unstable response, so make sure it is small, 1% being the default.<br>"
text = "<br><strong>EGO Limit (%)</strong><br>"
text = "Closed loop operation should not be substituted for proper tuning! This value limits the correction that can be made by the closed loop algorithm, the default of 10% indicates the correction factor cannot go outside the range 90-110%.<br>"
text = "<br><strong>EGO Active Above RPM</strong><br>"
text = "This value specifies the lower limit above which closed loop operation occurs. Typically, your engine will idle best when it is richer than stoich, so turning off closed loop for low RPMs allows this to happen. The default value for the RPM limit is 1200. (Available only in v 2.0 MS, older versions have a fixed 1200 RPM value in the controller code.)<br>"
text = "<br><strong>Warmup Enrichment Bins</strong><br>"
text = "Warmup enrichment is based on coolant temperature. Since warmup enrichment requirements are usually non-linear, several bins are provided to specify different rates in different temperature domains.<br>"
text = "Place values in the "-40" through "160 degrees F" fields, typically running from about 120 at -40 F to 100 at 100 F; make sure the values are all 100 or greater.<br>"
text = "The SD array "WWU" contains these enrichment values.<br>"
text = "<br><strong>Acceleration Enrichment</strong><br>"
text = "Acceleration enrichment (AE) occurs when you open the throttle "rapidly" to avoid bogging the engine. this is done solely based upon the rate of change in the throttle position sensor (also called TPSDOT).<br>"
text = "<br><strong>TPSDOT Thresh</strong><br>"
text = "This is the threshold in v/sec below which no acceleration enrichment will occur (you can move the throttle from idle to full open without acceleration enrichment, if you open it slowly enough). Depends grossly upon the range of your TPS, a typical value might be 1.2 v/sec.<br>"
text = "<strong>Tuning Note:</strong> While you are tuning the VE table you should set this threshold artificially high (maybe 40.0) to disable acceleration enrichment completely. After the VE table is fairly well-defined, set this back to 1.2 and begin tuning AE.<br>"
text = "SD stores this value in the "TPSTHRESH" variable.<br>"
text = "<br><strong>Cold Accel Enrichment (ms)</strong><br>"
text = "The acceleration enrichment pulse also varies depending upon coolant temperature. The value specified here is the pulse width added to the value from the bin calculations at -40 F. The Cold Acceleration Enrichment amount is linearly interpolated from full amount at -40 F down to zero at 165 F. A typical value might be 2.0 ms.<br>"
text = "<br><strong>Cold Accel Multiplier (%)</strong><br>"
text = "Another means for increasing the amount of fuel delivered by the acceleration enrichment pulse is supplied by this value; it is likewise interpolated from the full specified amount at 40F down to zero at 165 F. Before the Cold Acceleration Enrichment value is added to the base acceleration enrichment pulsewidth, it is multiplied by this value.<br>"
text = "Total AE = Base AE * CAM + CAE<br>"
text = "The difference between the two types of AE cold modify can be easily seen with a few examples:<br>"
text = "1) Assume we have a calculated AE pulse of 5.0 ms. Say our coolant temperature is 40 F, giving a CAE pulse of 2.0 ms and CAM is turned off (100%). The result is 5.0+2.0 = 7.0 ms.<br>"
text = "2) Assume same base AE and temperature, but now we turn off CAE (0.0 ms) and set CAM to give 140%. The result is the same, we get 5.0*1.4 = 7.0 ms.<br>"
text = "3) Take the first case, but hit the accelerator faster, giving 8.0 ms base AE pulse. We now have a result of 8.0+2.0 = 10.0 ms.<br>"
text = "4) Take case 2, but with the higher base AE pulse, giving 8.0*1.4 = 11.2 ms.<br>"
text = "The bottom line is that the CAE modifier is constant and independent of the base pulse, where on the other hand, the CAM modifier has a proportional effect on the AE, bigger base pulse means bigger result.<br>"
text = "<br><strong>Decel Fuel Amount (%)</strong><br>"
text = "When you let off the throttle rapidly (that is the closing rate exceeds TPSDOT Thresh) and the engine is turning faster than 1500 RPM, then deceleration fuel cutoff is performed. Deceleration fuel amount is multiplied by the "normal" pulse width, that is, if the calculated pulse is 12.0 ms and you have 20% decel amount, then the resulting pulse width is 2.4 ms. A value of 100% causes the fuel to remain at its calculated value, and can cure bucking on deceleration in vehicles with manual transmissions; those with automatic transmissions may benefit in fuel economy by using values below 100%.<br>"
text = "<br><strong>Acceleration Enrichment Bins (ms)</strong><br>"
text = "These bins specify the actual enrichment in terms of pulse width. They are linearly interpolated to determine a value that is ultimately added to the computed pulse width.<br>"
[CurveEditor] [CurveEditor]
@ -835,7 +814,7 @@ help = helpEnrichments, "Enrichments Help"
; Correction curve for Air Density vs temperature ; Correction curve for Air Density vs temperature
curve = airdensity_curve, "IAT density correction" curve = airdensity_curve, "IAT density correction"
columnLabel = "Air Temperature", "C" columnLabel = "Air Temperature", "C"
xAxis = -40, 215, 6 xAxis = -40, 160, 6
yAxis = 0, 255, 6 yAxis = 0, 255, 6
xBins = airDenBins, iat xBins = airDenBins, iat
yBins = airDenRates yBins = airDenRates
@ -875,7 +854,8 @@ help = helpEnrichments, "Enrichments Help"
[TableEditor] [TableEditor]
; table_id, map3d_id, "title", page ; table_id, map3d_id, "title", page
table = veTable1Tbl, veTable1Map, "VE Table", 1 table = veTable1Tbl, veTable1Map, "VE Table", 1
; constant, variable topicHelp = "http://speeduino.com/wiki/index.php/Tuning"
; constant, variable
xBins = rpmBins, rpm xBins = rpmBins, rpm
#if SPEED_DENSITY #if SPEED_DENSITY
yBins = mapBins, map yBins = mapBins, map
@ -976,14 +956,11 @@ help = helpEnrichments, "Enrichments Help"
accelEnrichGauge = accelEnrich, "Accel Enrich", "%", 50, 150, -1, -1, 999, 999, 0, 0 accelEnrichGauge = accelEnrich, "Accel Enrich", "%", 50, 150, -1, -1, 999, 999, 0, 0
afrGauge = afr, "Air:Fuel Ratio", "", 7, 25, 12, 13, 15, 16, 2, 2 afrGauge = afr, "Air:Fuel Ratio", "", 7, 25, 12, 13, 15, 16, 2, 2
afrGauge2 = afr2, "Air:Fuel Ratio 2", "", 7, 25, 12, 13, 15, 16, 2, 2 afrGauge2 = afr2, "Air:Fuel Ratio 2", "", 7, 25, 12, 13, 15, 16, 2, 2
clockGauge = secl, "Clock", "Seconds", 0, 255, 10, 10, 245, 245, 0, 0
deadGauge = deadValue, "---", "", 0, 1, -1, -1, 2, 2, 0, 0
dutyCycleGauge = dutyCycle, "Duty Cycle", "%", 0, 100, -1, -1, 70, 80, 1, 1 dutyCycleGauge = dutyCycle, "Duty Cycle", "%", 0, 100, -1, -1, 70, 80, 1, 1
egoCorrGauge = egoCorrection, "EGO Correction", "%", 50, 150, 90, 99, 101, 110, 0, 0 egoCorrGauge = egoCorrection, "EGO Correction", "%", 50, 150, 90, 99, 101, 110, 0, 0
gammaEnrichGauge = gammaEnrich, "Gamma Enrichment", "%", 50, 150, -1, -1, 151, 151, 0, 0 gammaEnrichGauge = gammaEnrich, "Gamma Enrichment", "%", 50, 150, -1, -1, 151, 151, 0, 0
mapGauge = map, "Engine MAP", "kPa", 0, 255, 0, 20, 200, 245, 0, 0
pulseWidthGauge = pulseWidth, "Pulse Width", "mSec", 0, 25.5, 1.0, 1.2, 20, 25, 1, 1 pulseWidthGauge = pulseWidth, "Pulse Width", "mSec", 0, 25.5, 1.0, 1.2, 20, 25, 1, 1
tachometer = rpm, "Engine Speed", "RPM", 0, 8000, 300, 600, 3000, 5000, 0, 0 tachometer = rpm, "Engine Speed", "RPM", 0, 8000, 300, 600, 3000, 5000, 0, 0
throttleGauge = throttle, "Throttle Position", "%TPS", 0, 100, -1, 1, 90, 100, 0, 0 throttleGauge = throttle, "Throttle Position", "%TPS", 0, 100, -1, 1, 90, 100, 0, 0
@ -993,6 +970,8 @@ help = helpEnrichments, "Enrichments Help"
voltMeter = batteryVoltage,"Battery Voltage", "volts", 0, 25, 8, 9, 15, 16, 2, 2 voltMeter = batteryVoltage,"Battery Voltage", "volts", 0, 25, 8, 9, 15, 16, 2, 2
warmupEnrichGauge = warmupEnrich, "Warmup Enrichment", "%", 100, 200, 130, 140, 140, 150, 0, 0 warmupEnrichGauge = warmupEnrich, "Warmup Enrichment", "%", 100, 200, 130, 140, 140, 150, 0, 0
gaugeCategory = "Sensor inputs"
mapGauge = map, "Engine MAP", "kPa", 0, 255, 0, 20, 200, 245, 0, 0
#if CELSIUS #if CELSIUS
cltGauge = coolant, "Coolant Temp", "TEMP", -40, 215, -15, 0, 95, 105, 0, 0 cltGauge = coolant, "Coolant Temp", "TEMP", -40, 215, -15, 0, 95, 105, 0, 0
iatGauge = iat, "Inlet Air Temp", "TEMP", -40, 215, -15, 0, 95, 100, 0, 0 iatGauge = iat, "Inlet Air Temp", "TEMP", -40, 215, -15, 0, 95, 100, 0, 0
@ -1001,6 +980,10 @@ help = helpEnrichments, "Enrichments Help"
iatGauge = iat, "Inlet Air Temp", "TEMP", -40, 215, 0, 30, 200, 210, 0, 0 iatGauge = iat, "Inlet Air Temp", "TEMP", -40, 215, 0, 30, 200, 210, 0, 0
#endif #endif
advanceGauge = advance, "Spark Advance", "deg BTDC", 50, -10, 0, 0, 35, 45, 0, advanceGauge = advance, "Spark Advance", "deg BTDC", 50, -10, 0, 0, 35, 45, 0,
gaugeCategory = "Other"
clockGauge = secl, "Clock", "Seconds", 0, 255, 10, 10, 245, 245, 0, 0
deadGauge = deadValue, "---", "", 0, 1, -1, -1, 2, 2, 0, 0
loopGauge = loopsPerSecond,"Main loop speed", "Loops/S" , 0, 20000, -1, 500,1800, 4000, 0, 0 loopGauge = loopsPerSecond,"Main loop speed", "Loops/S" , 0, 20000, -1, 500,1800, 4000, 0, 0
memoryGauge = freeRAM, "Free memory", "bytes" , 0, 8000, -1, 1000,8000, 1000, 0, 0 memoryGauge = freeRAM, "Free memory", "bytes" , 0, 8000, -1, 1000,8000, 1000, 0, 0
@ -1118,19 +1101,27 @@ help = helpEnrichments, "Enrichments Help"
ochGetCommand = "A" ochGetCommand = "A"
ochBlockSize = 31 ochBlockSize = 33
secl = scalar, U08, 0, "sec", 1.000, 0.000 secl = scalar, U08, 0, "sec", 1.000, 0.000
squirt = scalar, U08, 1, "bits", 1.000, 0.000 squirt = scalar, U08, 1, "bits", 1.000, 0.000
inj1Status = bits, U08, 1, [0:0]
inj2Status = bits, U08, 1, [1:1]
inj3Status = bits, U08, 1, [2:2]
inj4Status = bits, U08, 1, [3:3]
unusedSquirt1 = bits, U08, 1, [4:4]
unusedSquirt1 = bits, U08, 1, [5:5]
toothLog1Ready = bits, U08, 1, [6:6]
toothLog2Ready = bits, U08, 1, [7:7]
engine = scalar, U08, 2, "bits", 1.000, 0.000 engine = scalar, U08, 2, "bits", 1.000, 0.000
ready = bits, U08, 2, [0:0] ready = bits, U08, 2, [0:0]
crank = bits, U08, 2, [1:1] crank = bits, U08, 2, [1:1]
startw = bits, U08, 2, [2:2] startw = bits, U08, 2, [2:2]
warmup = bits, U08, 2, [3:3] warmup = bits, U08, 2, [3:3]
tpsaccaen = bits, U08, 2, [4:4] tpsaccaen = bits, U08, 2, [4:4]
tpsaccden = bits, U08, 2, [5:5] tpsaccden = bits, U08, 2, [5:5]
mapaccaen = bits, U08, 2, [6:6] mapaccaen = bits, U08, 2, [6:6]
mapaccden = bits, U08, 2, [7:7] mapaccden = bits, U08, 2, [7:7]
dwell = scalar, U08, 3, "ms", 0.100, 0.000 dwell = scalar, U08, 3, "ms", 0.100, 0.000
map = scalar, U08, 4, "kpa", 2.000, 0.000 map = scalar, U08, 4, "kpa", 2.000, 0.000
#if CELSIUS #if CELSIUS
@ -1142,7 +1133,6 @@ help = helpEnrichments, "Enrichments Help"
#endif #endif
tpsADC = scalar, U08, 7, "ADC", 1.000, 0.000 tpsADC = scalar, U08, 7, "ADC", 1.000, 0.000
batteryVoltage = scalar, U08, 8, "V", 0.100, 0.000 batteryVoltage = scalar, U08, 8, "V", 0.100, 0.000
#egoADC = scalar, U08, 9, "ADC", 1.000, 0.000
afr = scalar, U08, 9, "O2", 0.100, 0.000 afr = scalar, U08, 9, "O2", 0.100, 0.000
egoCorrection = scalar, U08, 10, "%", 1.000, 0.000 egoCorrection = scalar, U08, 10, "%", 1.000, 0.000
airCorrection = scalar, U08, 11, "%", 1.000, 0.000 airCorrection = scalar, U08, 11, "%", 1.000, 0.000
@ -1162,6 +1152,7 @@ help = helpEnrichments, "Enrichments Help"
batCorrection = scalar, U08, 28, "%", 1.000, 0.000 batCorrection = scalar, U08, 28, "%", 1.000, 0.000
dwell = scalar, U08, 29, "ms", 0.1, 0.000 dwell = scalar, U08, 29, "ms", 0.1, 0.000
afr2 = scalar, U08, 30, "O2", 0.100, 0.000 afr2 = scalar, U08, 30, "O2", 0.100, 0.000
rpmDOT = scalar, S16, 31, "rpm/s", 1.000, 0.000
; Computed output channels. See "megatuneExamples.ini" for all the ; Computed output channels. See "megatuneExamples.ini" for all the
; pre-defined variables, search for "???" and you'll see them. ; pre-defined variables, search for "???" and you'll see them.
@ -1254,6 +1245,7 @@ help = helpEnrichments, "Enrichments Help"
entry = TPSdot, "TPS DOT", int, "%d" entry = TPSdot, "TPS DOT", int, "%d"
entry = advance, "Ignition Advance", int,"%d" entry = advance, "Ignition Advance", int,"%d"
entry = batteryVoltage, "Battery V", float, "%.1f" entry = batteryVoltage, "Battery V", float, "%.1f"
entry = rpmDOT, "rpm/s", int, "%d"
[LoggerDefinition] [LoggerDefinition]
; valid logger types: composite, tooth, trigger, csv ; valid logger types: composite, tooth, trigger, csv
@ -1262,9 +1254,9 @@ help = helpEnrichments, "Enrichments Help"
loggerDef = tooth, "Tooth Logger", tooth loggerDef = tooth, "Tooth Logger", tooth
;dataReadCommand = "r\\x00\\xf4\\x00\\x00\\x04\\x00" ; standard TS command format ;dataReadCommand = "r\\x00\\xf4\\x00\\x00\\x04\\x00" ; standard TS command format
dataReadCommand = "T" ; Basic TS command format dataReadCommand = "T" ; Basic TS command format
dataReadTimeout = 10000 ; time in ms dataReadTimeout = 15000 ; time in ms
;dataReadyCondition = { ( status3 & 0x02 ) == 0x02 } dataReadyCondition = { toothLog1Ready }
dataLength = 512 ; in bytes, including headers, footers and data (not used) dataLength = 256 ; in bytes, including headers, footers and data (not used)
;recordDef = headerLen. footerLen, recordLen ;recordDef = headerLen. footerLen, recordLen
recordDef = 0, 0, 2; in bytes, the recordLen is for each record, currently limited to 4 bytes recordDef = 0, 0, 2; in bytes, the recordLen is for each record, currently limited to 4 bytes

Binary file not shown.

After

Width:  |  Height:  |  Size: 136 KiB

View File

@ -128,8 +128,8 @@ void setIgnitionSchedule1(void (*startCallback)(), unsigned long timeout, unsign
//sreg = SREG; //sreg = SREG;
//noInterrupts(); //noInterrupts();
//unsigned int absoluteTimeout = TCNT5 + (timeout >> 4); //As above, but with bit shift instead of / 16 //unsigned int absoluteTimeout = TCNT5 + (timeout >> 4); //As above, but with bit shift instead of / 16
unsigned int absoluteTimeout = TCNT5 + (timeout >> 2); //As above, but with bit shift instead of / 16 OCR5A = TCNT5 + (timeout >> 2); //Divid timeout by 4 (Each tick represent 4uS)
OCR5A = absoluteTimeout;
//SREG = sreg; //SREG = sreg;
ignitionSchedule1.duration = duration; ignitionSchedule1.duration = duration;
ignitionSchedule1.StartCallback = startCallback; //Name the start callback function ignitionSchedule1.StartCallback = startCallback; //Name the start callback function

View File

@ -51,7 +51,7 @@ struct config3 configPage3;
struct config4 configPage4; struct config4 configPage4;
int req_fuel_uS, inj_opentime_uS; int req_fuel_uS, inj_opentime_uS;
#define MAX_RPM 10000 //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 #define MAX_RPM 15000 //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 startRevolutions = 0; //A counter for how many revolutions have been completed since sync was achieved.
volatile byte ign1LastRev; volatile byte ign1LastRev;
@ -76,6 +76,7 @@ struct table2D taeTable; //4 bin TPS Acceleration Enrichment map (2D)
struct table2D WUETable; //10 bin Warm Up Enrichment map (2D) struct table2D WUETable; //10 bin Warm Up Enrichment map (2D)
struct table2D dwellVCorrectionTable; //6 bin dwell voltage correction (2D) struct table2D dwellVCorrectionTable; //6 bin dwell voltage correction (2D)
struct table2D injectorVCorrectionTable; //6 bin injector voltage correction (2D) struct table2D injectorVCorrectionTable; //6 bin injector voltage correction (2D)
struct table2D IATDensityCorrectionTable; //9 bin inlet air temperature density correction (2D)
byte cltCalibrationTable[CALIBRATION_TABLE_SIZE]; byte cltCalibrationTable[CALIBRATION_TABLE_SIZE];
byte iatCalibrationTable[CALIBRATION_TABLE_SIZE]; byte iatCalibrationTable[CALIBRATION_TABLE_SIZE];
byte o2CalibrationTable[CALIBRATION_TABLE_SIZE]; byte o2CalibrationTable[CALIBRATION_TABLE_SIZE];
@ -106,6 +107,17 @@ int channel1InjDegrees; //The number of crank degrees until cylinder 1 is at TDC
int channel2InjDegrees; //The number of crank degrees until cylinder 2 (and 5/6/7/8) is at TDC int channel2InjDegrees; //The number of crank degrees until cylinder 2 (and 5/6/7/8) is at TDC
int channel3InjDegrees; //The number of crank degrees until cylinder 3 (and 5/6/7/8) is at TDC int channel3InjDegrees; //The number of crank degrees until cylinder 3 (and 5/6/7/8) is at TDC
int channel4InjDegrees; //The number of crank degrees until cylinder 4 (and 5/6/7/8) is at TDC int channel4InjDegrees; //The number of crank degrees until cylinder 4 (and 5/6/7/8) is at TDC
//These are the functions the get called to begin and end the ignition coil charging. They are required for the various spark output modes
void (*ign1StartFunction)();
void (*ign1EndFunction)();
void (*ign2StartFunction)();
void (*ign2EndFunction)();
void (*ign3StartFunction)();
void (*ign3EndFunction)();
void (*ign4StartFunction)();
void (*ign4EndFunction)();
int timePerDegree; int timePerDegree;
byte degreesPerLoop; //The number of crank degrees that pass for each mainloop of the program byte degreesPerLoop; //The number of crank degrees that pass for each mainloop of the program
@ -151,6 +163,10 @@ void setup()
injectorVCorrectionTable.xSize = 6; injectorVCorrectionTable.xSize = 6;
injectorVCorrectionTable.values = configPage3.injVoltageCorrectionValues; injectorVCorrectionTable.values = configPage3.injVoltageCorrectionValues;
injectorVCorrectionTable.axisX = configPage3.voltageCorrectionBins; injectorVCorrectionTable.axisX = configPage3.voltageCorrectionBins;
IATDensityCorrectionTable.valueSize = SIZE_BYTE;
IATDensityCorrectionTable.xSize = 9;
IATDensityCorrectionTable.values = configPage3.airDenRates;
IATDensityCorrectionTable.axisX = configPage3.airDenBins;
//Setup the calibration tables //Setup the calibration tables
loadCalibration(); loadCalibration();
@ -440,6 +456,74 @@ void setup()
break; break;
} }
switch(configPage2.sparkMode)
{
case 0:
//Wasted Spark (Normal mode)
ign1StartFunction = beginCoil1Charge;
ign1EndFunction = endCoil1Charge;
ign2StartFunction = beginCoil2Charge;
ign2EndFunction = endCoil2Charge;
ign3StartFunction = beginCoil3Charge;
ign3EndFunction = endCoil3Charge;
ign4StartFunction = beginCoil4Charge;
ign4EndFunction = endCoil4Charge;
break;
case 1:
//Single channel mode. All ignition pulses are on channel 1
ign1StartFunction = beginCoil1Charge;
ign1EndFunction = endCoil1Charge;
ign2StartFunction = beginCoil1Charge;
ign2EndFunction = endCoil1Charge;
ign3StartFunction = beginCoil1Charge;
ign3EndFunction = endCoil1Charge;
ign4StartFunction = beginCoil1Charge;
ign4EndFunction = endCoil1Charge;
break;
case 2:
//Wasted COP mode. Ignition channels 1&3 and 2&4 are paired together
//This is not a valid mode for >4 cylinders
if( configPage1.nCylinders <= 4 )
{
ign1StartFunction = beginCoil1and3Charge;
ign1EndFunction = endCoil1and3Charge;
ign2StartFunction = beginCoil2and4Charge;
ign2EndFunction = endCoil2and4Charge;
ign3StartFunction = nullCallback;
ign3EndFunction = nullCallback;
ign4StartFunction = nullCallback;
ign4EndFunction = nullCallback;
}
else
{
//If the person has inadvertantly selected this when running more than 4 cylinders, just use standard Wasted spark mode
ign1StartFunction = beginCoil1Charge;
ign1EndFunction = endCoil1Charge;
ign2StartFunction = beginCoil2Charge;
ign2EndFunction = endCoil2Charge;
ign3StartFunction = beginCoil3Charge;
ign3EndFunction = endCoil3Charge;
ign4StartFunction = beginCoil4Charge;
ign4EndFunction = endCoil4Charge;
}
break;
default:
//Wasted spark (Shouldn't ever happen anyway)
ign1StartFunction = beginCoil1Charge;
ign1EndFunction = endCoil1Charge;
ign2StartFunction = beginCoil2Charge;
ign2EndFunction = endCoil2Charge;
ign3StartFunction = beginCoil3Charge;
ign3EndFunction = endCoil3Charge;
ign4StartFunction = beginCoil4Charge;
ign4EndFunction = endCoil4Charge;
break;
}
//Perform the priming pulses. Set these to run at an arbitrary time in the future (100us). The prime pulse value is in ms*10, so need to multiple by 100 to get to uS //Perform the priming pulses. Set these to run at an arbitrary time in the future (100us). The prime pulse value is in ms*10, so need to multiple by 100 to get to uS
setFuelSchedule1(openInjector1and4, 100, (unsigned long)(configPage1.primePulse * 100), closeInjector1and4); setFuelSchedule1(openInjector1and4, 100, (unsigned long)(configPage1.primePulse * 100), closeInjector1and4);
setFuelSchedule2(openInjector2and3, 100, (unsigned long)(configPage1.primePulse * 100), closeInjector2and3); setFuelSchedule2(openInjector2and3, 100, (unsigned long)(configPage1.primePulse * 100), closeInjector2and3);
@ -468,8 +552,10 @@ void loop()
long timeToLastTooth = (currentLoopTime - toothLastToothTime); long timeToLastTooth = (currentLoopTime - toothLastToothTime);
if ( (timeToLastTooth < 500000L) || (toothLastToothTime > currentLoopTime) ) //Check how long ago the last tooth was seen compared to now. If it was more than half a second ago then the engine is probably stopped. toothLastToothTime can be greater than currentLoopTime if a pulse occurs between getting the lastest time and doing the comparison if ( (timeToLastTooth < 500000L) || (toothLastToothTime > currentLoopTime) ) //Check how long ago the last tooth was seen compared to now. If it was more than half a second ago then the engine is probably stopped. toothLastToothTime can be greater than currentLoopTime if a pulse occurs between getting the lastest time and doing the comparison
{ {
int lastRPM = currentStatus.RPM; //Need to record this for rpmDOT calculation
currentStatus.RPM = getRPM(); currentStatus.RPM = getRPM();
if(fuelPumpOn == false) { digitalWrite(pinFuelPump, HIGH); fuelPumpOn = true; } //Check if the fuel pump is on and turn it on if it isn't. if(fuelPumpOn == false) { digitalWrite(pinFuelPump, HIGH); fuelPumpOn = true; } //Check if the fuel pump is on and turn it on if it isn't.
currentStatus.rpmDOT = ldiv(1000000, (currentLoopTime - previousLoopTime)).quot * (currentStatus.RPM - lastRPM); //This is the RPM per second that the engine has accelerated/decelleratedin the last loop
} }
else else
{ {
@ -481,6 +567,7 @@ void loop()
currentStatus.runSecs = 0; //Reset the counter for number of seconds running. currentStatus.runSecs = 0; //Reset the counter for number of seconds running.
secCounter = 0; //Reset our seconds counter. secCounter = 0; //Reset our seconds counter.
startRevolutions = 0; startRevolutions = 0;
currentStatus.rpmDOT = 0;
ignitionOn = false; ignitionOn = false;
fuelOn = false; fuelOn = false;
digitalWrite(pinFuelPump, LOW); //Turn off the fuel pump digitalWrite(pinFuelPump, LOW); //Turn off the fuel pump
@ -549,13 +636,19 @@ void loop()
currentStatus.TPSlast_time = currentStatus.TPS_time; currentStatus.TPSlast_time = currentStatus.TPS_time;
currentStatus.tpsADC = fastMap1023toX(analogRead(pinTPS), 0, 1023, 0, 255); //Get the current raw TPS ADC value and map it into a byte currentStatus.tpsADC = fastMap1023toX(analogRead(pinTPS), 0, 1023, 0, 255); //Get the current raw TPS ADC value and map it into a byte
currentStatus.TPS = map(currentStatus.tpsADC, configPage1.tpsMin, configPage1.tpsMax, 0, 100); //Take the raw TPS ADC value and convert it into a TPS% based on the calibrated values currentStatus.TPS = map(currentStatus.tpsADC, configPage1.tpsMin, configPage1.tpsMax, 0, 100); //Take the raw TPS ADC value and convert it into a TPS% based on the calibrated values
currentStatus.TPS_time = currentLoopTime; currentStatus.TPS_time = currentLoopTime;
//Check for launch in (clutch) can be done around here too
currentStatus.launching = !digitalRead(pinLaunch);
//And check whether the tooth log buffer is ready
if(toothHistoryIndex > TOOTH_LOG_SIZE) { BIT_SET(currentStatus.squirt, BIT_SQUIRT_TOOTHLOG1READY); }
} }
//The IAT and CLT readings can be done less frequently. This still runs about 4 times per second //The IAT and CLT readings can be done less frequently. This still runs about 4 times per second
if ((mainLoopCount & 255) == 1) if ((mainLoopCount & 255) == 1)
{ {
currentStatus.cltADC = map(analogRead(pinCLT), 0, 1023, 0, 511); //Get the current raw CLT value //currentStatus.cltADC = map(analogRead(pinCLT), 0, 1023, 0, 511); //Get the current raw CLT value
currentStatus.cltADC = fastMap1023toX(analogRead(pinCLT), 0, 1023, 0, 511); //Get the current raw CLT value
currentStatus.iatADC = map(analogRead(pinIAT), 0, 1023, 0, 511); //Get the current raw IAT value currentStatus.iatADC = map(analogRead(pinIAT), 0, 1023, 0, 511); //Get the current raw IAT value
currentStatus.O2ADC = map(analogRead(pinO2), 0, 1023, 0, 511); //Get the current O2 value. Calibration is from AFR values 7.35 to 22.4. This is the correct calibration for an Innovate Wideband 0v - 5V unit. Proper calibration is still a WIP currentStatus.O2ADC = map(analogRead(pinO2), 0, 1023, 0, 511); //Get the current O2 value. Calibration is from AFR values 7.35 to 22.4. This is the correct calibration for an Innovate Wideband 0v - 5V unit. Proper calibration is still a WIP
currentStatus.O2_2ADC = map(analogRead(pinO2_2), 0, 1023, 0, 511); //Get the current O2 value. Calibration is from AFR values 7.35 to 22.4. This is the correct calibration for an Innovate Wideband 0v - 5V unit. Proper calibration is still a WIP currentStatus.O2_2ADC = map(analogRead(pinO2_2), 0, 1023, 0, 511); //Get the current O2 value. Calibration is from AFR values 7.35 to 22.4. This is the correct calibration for an Innovate Wideband 0v - 5V unit. Proper calibration is still a WIP
@ -694,6 +787,7 @@ void loop()
//*********************************************************************************************** //***********************************************************************************************
//| BEGIN IGNITION CALCULATIONS //| BEGIN IGNITION CALCULATIONS
if (currentStatus.RPM > ((unsigned int)(configPage2.SoftRevLim) * 100) ) { currentStatus.advance = configPage2.SoftLimRetard; } //Softcut RPM limit (If we're above softcut limit, delay timing by configured number of degrees) if (currentStatus.RPM > ((unsigned int)(configPage2.SoftRevLim) * 100) ) { currentStatus.advance = configPage2.SoftLimRetard; } //Softcut RPM limit (If we're above softcut limit, delay timing by configured number of degrees)
if (configPage3.launchEnabled && currentStatus.launching && (currentStatus.RPM > ((unsigned int)(configPage3.lnchSoftLim) * 100)) ) { currentStatus.advance = configPage3.lnchRetard; } //SoftCut rev limit for 2-step launch control
//Set dwell //Set dwell
//Dwell is stored as ms * 10. ie Dwell of 4.3ms would be 43 in configPage2. This number therefore needs to be multiplied by 100 to get dwell in uS //Dwell is stored as ms * 10. ie Dwell of 4.3ms would be 43 in configPage2. This number therefore needs to be multiplied by 100 to get dwell in uS
@ -849,15 +943,16 @@ void loop()
//Likewise for the ignition //Likewise for the ignition
//Perform an initial check to see if the ignition is turned on (Ignition only turns on after a preset number of cranking revolutions and: //Perform an initial check to see if the ignition is turned on (Ignition only turns on after a preset number of cranking revolutions and:
//Check for hard cut rev limit (If we're above the hardcut limit, we simply don't set a spark schedule) //Check for hard cut rev limit (If we're above the hardcut limit, we simply don't set a spark schedule)
crankAngle = getCrankAngle(timePerDegree); //Refresh with the latest crank angle
if(ignitionOn && (currentStatus.RPM < ((unsigned int)(configPage2.HardRevLim) * 100) )) if(ignitionOn && (currentStatus.RPM < ((unsigned int)(configPage2.HardRevLim) * 100) ))
{ {
//if ( (ignition1StartAngle > crankAngle) && ign1LastRev != startRevolutions) //if ( (ignition1StartAngle > crankAngle) && ign1LastRev != startRevolutions)
if ( (ignition1StartAngle > crankAngle) && ign1LastRev != startRevolutions) if ( (ignition1StartAngle > crankAngle) && ign1LastRev != startRevolutions)
{ {
setIgnitionSchedule1(beginCoil1Charge, setIgnitionSchedule1(ign1StartFunction,
((unsigned long)(ignition1StartAngle - crankAngle) * (unsigned long)timePerDegree), ((unsigned long)(ignition1StartAngle - crankAngle) * (unsigned long)timePerDegree),
currentStatus.dwell, currentStatus.dwell,
endCoil1Charge ign1EndFunction
); );
} }
@ -867,10 +962,10 @@ void loop()
if ( tempStartAngle < 0) { tempStartAngle += 360; } if ( tempStartAngle < 0) { tempStartAngle += 360; }
if ( (tempStartAngle > tempCrankAngle) && ign2LastRev != startRevolutions) if ( (tempStartAngle > tempCrankAngle) && ign2LastRev != startRevolutions)
{ {
setIgnitionSchedule2(beginCoil2Charge, setIgnitionSchedule2(ign2StartFunction,
((unsigned long)(tempStartAngle - tempCrankAngle) * (unsigned long)timePerDegree), ((unsigned long)(tempStartAngle - tempCrankAngle) * (unsigned long)timePerDegree),
currentStatus.dwell, currentStatus.dwell,
endCoil2Charge ign2EndFunction
); );
} }
@ -880,10 +975,10 @@ void loop()
if ( tempStartAngle < 0) { tempStartAngle += 360; } if ( tempStartAngle < 0) { tempStartAngle += 360; }
if (tempStartAngle > tempCrankAngle) if (tempStartAngle > tempCrankAngle)
{ {
setIgnitionSchedule3(beginCoil3Charge, setIgnitionSchedule3(ign3StartFunction,
((unsigned long)(tempStartAngle - tempCrankAngle) * (unsigned long)timePerDegree), ((unsigned long)(tempStartAngle - tempCrankAngle) * (unsigned long)timePerDegree),
currentStatus.dwell, currentStatus.dwell,
endCoil3Charge ign3EndFunction
); );
} }
@ -893,10 +988,10 @@ void loop()
if ( tempStartAngle < 0) { tempStartAngle += 360; } if ( tempStartAngle < 0) { tempStartAngle += 360; }
if (tempStartAngle > tempCrankAngle) if (tempStartAngle > tempCrankAngle)
{ {
setIgnitionSchedule4(beginCoil4Charge, setIgnitionSchedule4(ign4StartFunction,
((unsigned long)(tempStartAngle - tempCrankAngle) * (unsigned long)timePerDegree), ((unsigned long)(tempStartAngle - tempCrankAngle) * (unsigned long)timePerDegree),
currentStatus.dwell, currentStatus.dwell,
endCoil4Charge ign4EndFunction
); );
} }
@ -911,27 +1006,29 @@ void loop()
//These functions simply trigger the injector/coil driver off or on. //These functions simply trigger the injector/coil driver off or on.
//NOTE: squirt status is changed as per http://www.msextra.com/doc/ms1extra/COM_RS232.htm#Acmd //NOTE: squirt status is changed as per http://www.msextra.com/doc/ms1extra/COM_RS232.htm#Acmd
void openInjector1() { digitalWrite(pinInjector1, HIGH); BIT_SET(currentStatus.squirt, 0); } void openInjector1() { digitalWrite(pinInjector1, HIGH); BIT_SET(currentStatus.squirt, BIT_SQUIRT_INJ1); }
void closeInjector1() { digitalWrite(pinInjector1, LOW); BIT_CLEAR(currentStatus.squirt, 0); } void closeInjector1() { digitalWrite(pinInjector1, LOW); BIT_CLEAR(currentStatus.squirt, BIT_SQUIRT_INJ1); }
//void openInjector1() { *inj1_pin_port |= (inj1_pin_mask); ; BIT_SET(currentStatus.squirt, 0); } //void openInjector1() { *inj1_pin_port |= (inj1_pin_mask); ; BIT_SET(currentStatus.squirt, 0); }
//void closeInjector1() { *inj1_pin_port &= ~(inj1_pin_mask); BIT_CLEAR(currentStatus.squirt, 0); } //void closeInjector1() { *inj1_pin_port &= ~(inj1_pin_mask); BIT_CLEAR(currentStatus.squirt, 0); }
void beginCoil1Charge() { digitalWrite(pinCoil1, coilHIGH); BIT_SET(currentStatus.spark, 0); digitalWrite(pinTachOut, LOW); } void beginCoil1Charge() { digitalWrite(pinCoil1, coilHIGH); BIT_SET(currentStatus.spark, 0); digitalWrite(pinTachOut, LOW); }
void endCoil1Charge() { digitalWrite(pinCoil1, coilLOW); BIT_CLEAR(currentStatus.spark, 0); } void endCoil1Charge() { digitalWrite(pinCoil1, coilLOW); BIT_CLEAR(currentStatus.spark, 0); }
//void beginCoil1Charge() { *ign1_pin_port |= (ign1_pin_mask); }
//void endCoil1Charge() { *ign1_pin_port &= ~(ign1_pin_mask); }
void openInjector2() { digitalWrite(pinInjector2, HIGH); BIT_SET(currentStatus.squirt, 1); } //Sets the relevant pin HIGH and changes the current status bit for injector 2 (2nd bit of currentStatus.squirt) void openInjector2() { digitalWrite(pinInjector2, HIGH); BIT_SET(currentStatus.squirt, BIT_SQUIRT_INJ2); } //Sets the relevant pin HIGH and changes the current status bit for injector 2 (2nd bit of currentStatus.squirt)
void closeInjector2() { digitalWrite(pinInjector2, LOW); BIT_CLEAR(currentStatus.squirt, 1); } void closeInjector2() { digitalWrite(pinInjector2, LOW); BIT_CLEAR(currentStatus.squirt, BIT_SQUIRT_INJ2); }
//void openInjector2() { *inj2_pin_port |= (inj2_pin_mask); ; BIT_SET(currentStatus.squirt, 0); } //void openInjector2() { *inj2_pin_port |= (inj2_pin_mask); ; BIT_SET(currentStatus.squirt, 0); }
//void closeInjector2() { *inj2_pin_port &= ~(inj2_pin_mask); BIT_CLEAR(currentStatus.squirt, 0); } //void closeInjector2() { *inj2_pin_port &= ~(inj2_pin_mask); BIT_CLEAR(currentStatus.squirt, 0); }
void beginCoil2Charge() { digitalWrite(pinCoil2, coilHIGH); BIT_SET(currentStatus.spark, 1); digitalWrite(pinTachOut, LOW); } void beginCoil2Charge() { digitalWrite(pinCoil2, coilHIGH); BIT_SET(currentStatus.spark, 1); digitalWrite(pinTachOut, LOW); }
void endCoil2Charge() { digitalWrite(pinCoil2, coilLOW); BIT_CLEAR(currentStatus.spark, 1);} void endCoil2Charge() { digitalWrite(pinCoil2, coilLOW); BIT_CLEAR(currentStatus.spark, 1);}
void openInjector3() { digitalWrite(pinInjector3, HIGH); BIT_SET(currentStatus.squirt, 2); } //Sets the relevant pin HIGH and changes the current status bit for injector 3 (3rd bit of currentStatus.squirt) void openInjector3() { digitalWrite(pinInjector3, HIGH); BIT_SET(currentStatus.squirt, BIT_SQUIRT_INJ3); } //Sets the relevant pin HIGH and changes the current status bit for injector 3 (3rd bit of currentStatus.squirt)
void closeInjector3() { digitalWrite(pinInjector3, LOW); BIT_CLEAR(currentStatus.squirt, 2); } void closeInjector3() { digitalWrite(pinInjector3, LOW); BIT_CLEAR(currentStatus.squirt, BIT_SQUIRT_INJ3); }
void beginCoil3Charge() { digitalWrite(pinCoil3, coilHIGH); BIT_SET(currentStatus.spark, 2); digitalWrite(pinTachOut, LOW); } void beginCoil3Charge() { digitalWrite(pinCoil3, coilHIGH); BIT_SET(currentStatus.spark, 2); digitalWrite(pinTachOut, LOW); }
void endCoil3Charge() { digitalWrite(pinCoil3, coilLOW); BIT_CLEAR(currentStatus.spark, 2); } void endCoil3Charge() { digitalWrite(pinCoil3, coilLOW); BIT_CLEAR(currentStatus.spark, 2); }
void openInjector4() { digitalWrite(pinInjector4, HIGH); BIT_SET(currentStatus.squirt, 3); } //Sets the relevant pin HIGH and changes the current status bit for injector 4 (4th bit of currentStatus.squirt) void openInjector4() { digitalWrite(pinInjector4, HIGH); BIT_SET(currentStatus.squirt, BIT_SQUIRT_INJ4); } //Sets the relevant pin HIGH and changes the current status bit for injector 4 (4th bit of currentStatus.squirt)
void closeInjector4() { digitalWrite(pinInjector4, LOW); BIT_CLEAR(currentStatus.squirt, 3); } void closeInjector4() { digitalWrite(pinInjector4, LOW); BIT_CLEAR(currentStatus.squirt, BIT_SQUIRT_INJ4); }
void beginCoil4Charge() { digitalWrite(pinCoil4, coilHIGH); BIT_SET(currentStatus.spark, 3); digitalWrite(pinTachOut, LOW); } void beginCoil4Charge() { digitalWrite(pinCoil4, coilHIGH); BIT_SET(currentStatus.spark, 3); digitalWrite(pinTachOut, LOW); }
void endCoil4Charge() { digitalWrite(pinCoil4, coilLOW); BIT_CLEAR(currentStatus.spark, 3); } void endCoil4Charge() { digitalWrite(pinCoil4, coilLOW); BIT_CLEAR(currentStatus.spark, 3); }
@ -940,5 +1037,13 @@ void openInjector1and4() { digitalWrite(pinInjector1, HIGH); digitalWrite(pinInj
void closeInjector1and4() { digitalWrite(pinInjector1, LOW); digitalWrite(pinInjector4, LOW);BIT_CLEAR(currentStatus.squirt, 0); } void closeInjector1and4() { digitalWrite(pinInjector1, LOW); digitalWrite(pinInjector4, LOW);BIT_CLEAR(currentStatus.squirt, 0); }
void openInjector2and3() { digitalWrite(pinInjector2, HIGH); digitalWrite(pinInjector3, HIGH); BIT_SET(currentStatus.squirt, 1); } void openInjector2and3() { digitalWrite(pinInjector2, HIGH); digitalWrite(pinInjector3, HIGH); BIT_SET(currentStatus.squirt, 1); }
void closeInjector2and3() { digitalWrite(pinInjector2, LOW); digitalWrite(pinInjector3, LOW); BIT_CLEAR(currentStatus.squirt, 1); } void closeInjector2and3() { digitalWrite(pinInjector2, LOW); digitalWrite(pinInjector3, LOW); BIT_CLEAR(currentStatus.squirt, 1); }
//As above but for ignition (Wasted COP mode)
void beginCoil1and3Charge() { digitalWrite(pinCoil1, coilHIGH); digitalWrite(pinCoil3, coilHIGH); BIT_SET(currentStatus.spark, 0); BIT_SET(currentStatus.spark, 2); digitalWrite(pinTachOut, LOW); }
void endCoil1and3Charge() { digitalWrite(pinCoil1, coilLOW); digitalWrite(pinCoil3, coilLOW); BIT_CLEAR(currentStatus.spark, 0); BIT_CLEAR(currentStatus.spark, 2); }
void beginCoil2and4Charge() { digitalWrite(pinCoil2, coilHIGH); digitalWrite(pinCoil4, coilHIGH); BIT_SET(currentStatus.spark, 1); BIT_SET(currentStatus.spark, 3); digitalWrite(pinTachOut, LOW); }
void endCoil2and4Charge() { digitalWrite(pinCoil2, coilLOW); digitalWrite(pinCoil4, coilLOW); BIT_CLEAR(currentStatus.spark, 1); BIT_CLEAR(currentStatus.spark, 3); }
void nullCallback() { return; }

View File

@ -223,6 +223,8 @@ void setPinMapping(byte boardID)
pinDisplayReset = 48; // OLED reset pin pinDisplayReset = 48; // OLED reset pin
break; break;
} }
//Finally, set the relevant pin modes for outputs //Finally, set the relevant pin modes for outputs
pinMode(pinCoil1, OUTPUT); pinMode(pinCoil1, OUTPUT);
@ -237,6 +239,7 @@ void setPinMapping(byte boardID)
pinMode(pinIdle1, OUTPUT); pinMode(pinIdle1, OUTPUT);
pinMode(pinIdle2, OUTPUT); pinMode(pinIdle2, OUTPUT);
pinMode(pinFuelPump, OUTPUT); pinMode(pinFuelPump, OUTPUT);
pinMode(pinLaunch, INPUT_PULLUP);
inj1_pin_port = portOutputRegister(digitalPinToPort(pinInjector1)); inj1_pin_port = portOutputRegister(digitalPinToPort(pinInjector1));
inj1_pin_mask = digitalPinToBitMask(pinInjector1); inj1_pin_mask = digitalPinToBitMask(pinInjector1);
@ -246,6 +249,9 @@ void setPinMapping(byte boardID)
inj3_pin_mask = digitalPinToBitMask(pinInjector3); inj3_pin_mask = digitalPinToBitMask(pinInjector3);
inj4_pin_port = portOutputRegister(digitalPinToPort(pinInjector4)); inj4_pin_port = portOutputRegister(digitalPinToPort(pinInjector4));
inj4_pin_mask = digitalPinToBitMask(pinInjector4); inj4_pin_mask = digitalPinToBitMask(pinInjector4);
ign1_pin_port = portOutputRegister(digitalPinToPort(pinCoil1));
ign1_pin_mask = digitalPinToBitMask(pinCoil1);
//And for inputs //And for inputs
pinMode(pinMAP, INPUT); pinMode(pinMAP, INPUT);