Move to new output triggering method (Injectors only for now)
This commit is contained in:
parent
3dc0ebf15a
commit
19ec917b94
|
@ -16,8 +16,8 @@ inline void closeInjector3();
|
||||||
inline void beginCoil3Charge();
|
inline void beginCoil3Charge();
|
||||||
inline void endCoil3Charge();
|
inline void endCoil3Charge();
|
||||||
|
|
||||||
inline void openInjector4();
|
//inline void openInjector4();
|
||||||
inline void closeInjector4();
|
//inline void closeInjector4();
|
||||||
inline void beginCoil4Charge();
|
inline void beginCoil4Charge();
|
||||||
inline void endCoil4Charge();
|
inline void endCoil4Charge();
|
||||||
|
|
||||||
|
@ -26,5 +26,41 @@ inline void closeInjector5();
|
||||||
inline void beginCoil5Charge();
|
inline void beginCoil5Charge();
|
||||||
inline void endCoil5Charge();
|
inline void endCoil5Charge();
|
||||||
|
|
||||||
#endif
|
/*
|
||||||
|
#define openInjector1() *inj1_pin_port |= (inj1_pin_mask); BIT_SET(currentStatus.squirt, BIT_SQUIRT_INJ1)
|
||||||
|
#define closeInjector1() *inj1_pin_port &= ~(inj1_pin_mask); BIT_CLEAR(currentStatus.squirt, BIT_SQUIRT_INJ1)
|
||||||
|
#define openInjector2() *inj2_pin_port |= (inj2_pin_mask); BIT_SET(currentStatus.squirt, BIT_SQUIRT_INJ2)
|
||||||
|
#define closeInjector2() *inj2_pin_port &= ~(inj2_pin_mask); BIT_CLEAR(currentStatus.squirt, BIT_SQUIRT_INJ2)
|
||||||
|
#define openInjector3() *inj3_pin_port |= (inj3_pin_mask); BIT_SET(currentStatus.squirt, BIT_SQUIRT_INJ3)
|
||||||
|
#define closeInjector3() *inj3_pin_port &= ~(inj3_pin_mask); BIT_CLEAR(currentStatus.squirt, BIT_SQUIRT_INJ3)
|
||||||
|
#define openInjector4() *inj4_pin_port |= (inj4_pin_mask); BIT_SET(currentStatus.squirt, BIT_SQUIRT_INJ4)
|
||||||
|
#define closeInjector4() *inj4_pin_port &= ~(inj4_pin_mask); BIT_CLEAR(currentStatus.squirt, BIT_SQUIRT_INJ4)
|
||||||
|
|
||||||
|
#define openInjector1and4() openInjector1(); openInjector4()
|
||||||
|
#define closeInjector1and4() closeInjector1(); closeInjector4()
|
||||||
|
#define openInjector2and3() openInjector2(); openInjector2()
|
||||||
|
#define closeInjector2and3() closeInjector2(); closeInjector2()
|
||||||
|
|
||||||
|
//5 cylinder support doubles up injector 3 as being closese to inj 5 (Crank angle)
|
||||||
|
#define openInjector3and5() openInjector3(); openInjector5()
|
||||||
|
#define closeInjector3and5() closeInjector3(); closeInjector5()
|
||||||
|
*/
|
||||||
|
#define openInjector1() *inj1_pin_port |= (inj1_pin_mask); BIT_SET(currentStatus.squirt, BIT_SQUIRT_INJ1)
|
||||||
|
#define closeInjector1() *inj1_pin_port &= ~(inj1_pin_mask); BIT_CLEAR(currentStatus.squirt, BIT_SQUIRT_INJ1)
|
||||||
|
#define openInjector2() *inj2_pin_port |= (inj2_pin_mask); BIT_SET(currentStatus.squirt, BIT_SQUIRT_INJ2)
|
||||||
|
#define closeInjector2() *inj2_pin_port &= ~(inj2_pin_mask); BIT_CLEAR(currentStatus.squirt, BIT_SQUIRT_INJ2)
|
||||||
|
#define openInjector3() *inj3_pin_port |= (inj3_pin_mask); BIT_SET(currentStatus.squirt, BIT_SQUIRT_INJ3)
|
||||||
|
#define closeInjector3() *inj3_pin_port &= ~(inj3_pin_mask); BIT_CLEAR(currentStatus.squirt, BIT_SQUIRT_INJ3)
|
||||||
|
#define openInjector4() *inj4_pin_port |= (inj4_pin_mask); BIT_SET(currentStatus.squirt, BIT_SQUIRT_INJ4)
|
||||||
|
#define closeInjector4() *inj4_pin_port &= ~(inj4_pin_mask); BIT_CLEAR(currentStatus.squirt, BIT_SQUIRT_INJ4)
|
||||||
|
|
||||||
|
#define openInjector1and4() openInjector1(); openInjector4()
|
||||||
|
#define closeInjector1and4() closeInjector1(); closeInjector4()
|
||||||
|
#define openInjector2and3() openInjector2(); openInjector2()
|
||||||
|
#define closeInjector2and3() closeInjector2(); closeInjector2()
|
||||||
|
|
||||||
|
//5 cylinder support doubles up injector 3 as being closese to inj 5 (Crank angle)
|
||||||
|
#define openInjector3and5() openInjector3(); openInjector5()
|
||||||
|
#define closeInjector3and5() closeInjector3(); closeInjector5()
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
@ -37,23 +37,23 @@ volatile bool tachoAlt = true;
|
||||||
#define TACH_PULSE_HIGH() *tach_pin_port |= (tach_pin_mask)
|
#define TACH_PULSE_HIGH() *tach_pin_port |= (tach_pin_mask)
|
||||||
#define TACH_PULSE_LOW() if( (configPage1.tachoDiv == 0) || tachoAlt ) *tach_pin_port &= ~(tach_pin_mask); tachoAlt = !tachoAlt
|
#define TACH_PULSE_LOW() if( (configPage1.tachoDiv == 0) || tachoAlt ) *tach_pin_port &= ~(tach_pin_mask); tachoAlt = !tachoAlt
|
||||||
|
|
||||||
inline void openInjector1() { digitalWrite(pinInjector1, HIGH); BIT_SET(currentStatus.squirt, BIT_SQUIRT_INJ1); }
|
//inline void openInjector1() { digitalWrite(pinInjector1, HIGH); BIT_SET(currentStatus.squirt, BIT_SQUIRT_INJ1); }
|
||||||
inline void closeInjector1() { digitalWrite(pinInjector1, LOW); BIT_CLEAR(currentStatus.squirt, BIT_SQUIRT_INJ1); }
|
//inline void closeInjector1() { digitalWrite(pinInjector1, LOW); BIT_CLEAR(currentStatus.squirt, BIT_SQUIRT_INJ1); }
|
||||||
inline void beginCoil1Charge() { digitalWrite(pinCoil1, coilHIGH); TACH_PULSE_LOW(); }
|
inline void beginCoil1Charge() { digitalWrite(pinCoil1, coilHIGH); TACH_PULSE_LOW(); }
|
||||||
inline void endCoil1Charge() { digitalWrite(pinCoil1, coilLOW); TACH_PULSE_HIGH(); }
|
inline void endCoil1Charge() { digitalWrite(pinCoil1, coilLOW); TACH_PULSE_HIGH(); }
|
||||||
|
|
||||||
inline 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)
|
//inline 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)
|
||||||
inline void closeInjector2() { digitalWrite(pinInjector2, LOW); BIT_CLEAR(currentStatus.squirt, BIT_SQUIRT_INJ2); }
|
//inline void closeInjector2() { digitalWrite(pinInjector2, LOW); BIT_CLEAR(currentStatus.squirt, BIT_SQUIRT_INJ2); }
|
||||||
inline void beginCoil2Charge() { digitalWrite(pinCoil2, coilHIGH); TACH_PULSE_LOW(); }
|
inline void beginCoil2Charge() { digitalWrite(pinCoil2, coilHIGH); TACH_PULSE_LOW(); }
|
||||||
inline void endCoil2Charge() { digitalWrite(pinCoil2, coilLOW); TACH_PULSE_HIGH(); }
|
inline void endCoil2Charge() { digitalWrite(pinCoil2, coilLOW); TACH_PULSE_HIGH(); }
|
||||||
|
|
||||||
inline 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)
|
//inline 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)
|
||||||
inline void closeInjector3() { digitalWrite(pinInjector3, LOW); BIT_CLEAR(currentStatus.squirt, BIT_SQUIRT_INJ3); }
|
//inline void closeInjector3() { digitalWrite(pinInjector3, LOW); BIT_CLEAR(currentStatus.squirt, BIT_SQUIRT_INJ3); }
|
||||||
inline void beginCoil3Charge() { digitalWrite(pinCoil3, coilHIGH); TACH_PULSE_LOW(); }
|
inline void beginCoil3Charge() { digitalWrite(pinCoil3, coilHIGH); TACH_PULSE_LOW(); }
|
||||||
inline void endCoil3Charge() { digitalWrite(pinCoil3, coilLOW); TACH_PULSE_HIGH(); }
|
inline void endCoil3Charge() { digitalWrite(pinCoil3, coilLOW); TACH_PULSE_HIGH(); }
|
||||||
|
|
||||||
inline 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)
|
//inline 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)
|
||||||
inline void closeInjector4() { digitalWrite(pinInjector4, LOW); BIT_CLEAR(currentStatus.squirt, BIT_SQUIRT_INJ4); }
|
//inline void closeInjector4() { digitalWrite(pinInjector4, LOW); BIT_CLEAR(currentStatus.squirt, BIT_SQUIRT_INJ4); }
|
||||||
inline void beginCoil4Charge() { digitalWrite(pinCoil4, coilHIGH); TACH_PULSE_LOW(); }
|
inline void beginCoil4Charge() { digitalWrite(pinCoil4, coilHIGH); TACH_PULSE_LOW(); }
|
||||||
inline void endCoil4Charge() { digitalWrite(pinCoil4, coilLOW); TACH_PULSE_HIGH(); }
|
inline void endCoil4Charge() { digitalWrite(pinCoil4, coilLOW); TACH_PULSE_HIGH(); }
|
||||||
|
|
||||||
|
@ -66,6 +66,7 @@ volatile bool tachoAlt = true;
|
||||||
|
|
||||||
|
|
||||||
//Combination functions for semi-sequential injection
|
//Combination functions for semi-sequential injection
|
||||||
|
/*
|
||||||
void openInjector1and4() { digitalWrite(pinInjector1, HIGH); digitalWrite(pinInjector4, HIGH); BIT_SET(currentStatus.squirt, 0); }
|
void openInjector1and4() { digitalWrite(pinInjector1, HIGH); digitalWrite(pinInjector4, HIGH); BIT_SET(currentStatus.squirt, 0); }
|
||||||
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); }
|
||||||
|
@ -73,6 +74,7 @@ void closeInjector2and3() { digitalWrite(pinInjector2, LOW); digitalWrite(pinInj
|
||||||
//Below functions are used for 5 cylinder support
|
//Below functions are used for 5 cylinder support
|
||||||
void openInjector3and5() { digitalWrite(pinInjector3, HIGH); digitalWrite(pinInjector5, HIGH); BIT_SET(currentStatus.squirt, 0); }
|
void openInjector3and5() { digitalWrite(pinInjector3, HIGH); digitalWrite(pinInjector5, HIGH); BIT_SET(currentStatus.squirt, 0); }
|
||||||
void closeInjector3and5() { digitalWrite(pinInjector3, LOW); digitalWrite(pinInjector5, LOW);BIT_CLEAR(currentStatus.squirt, 0); }
|
void closeInjector3and5() { digitalWrite(pinInjector3, LOW); digitalWrite(pinInjector5, LOW);BIT_CLEAR(currentStatus.squirt, 0); }
|
||||||
|
*/
|
||||||
|
|
||||||
//As above but for ignition (Wasted COP mode)
|
//As above but for ignition (Wasted COP mode)
|
||||||
void beginCoil1and3Charge() { digitalWrite(pinCoil1, coilHIGH); digitalWrite(pinCoil3, coilHIGH); digitalWrite(pinTachOut, LOW); }
|
void beginCoil1and3Charge() { digitalWrite(pinCoil1, coilHIGH); digitalWrite(pinCoil3, coilHIGH); digitalWrite(pinTachOut, LOW); }
|
||||||
|
@ -81,4 +83,3 @@ void beginCoil2and4Charge() { digitalWrite(pinCoil2, coilHIGH); digitalWrite(pin
|
||||||
void endCoil2and4Charge() { digitalWrite(pinCoil2, coilLOW); digitalWrite(pinCoil4, coilLOW); }
|
void endCoil2and4Charge() { digitalWrite(pinCoil2, coilLOW); digitalWrite(pinCoil4, coilLOW); }
|
||||||
|
|
||||||
void nullCallback() { return; }
|
void nullCallback() { return; }
|
||||||
|
|
||||||
|
|
|
@ -224,12 +224,13 @@ timeout: The number of uS in the future that the startCallback should be trigger
|
||||||
duration: The number of uS after startCallback is called before endCallback is called
|
duration: The number of uS after startCallback is called before endCallback is called
|
||||||
endCallback: This function is called once the duration time has been reached
|
endCallback: This function is called once the duration time has been reached
|
||||||
*/
|
*/
|
||||||
void setFuelSchedule1(void (*startCallback)(), unsigned long timeout, unsigned long duration, void(*endCallback)())
|
//void setFuelSchedule1(void (*startCallback)(), unsigned long timeout, unsigned long duration, void(*endCallback)())
|
||||||
|
void setFuelSchedule1(unsigned long timeout, unsigned long duration)
|
||||||
{
|
{
|
||||||
if(fuelSchedule1.Status == RUNNING) { return; } //Check that we're not already part way through a schedule
|
if(fuelSchedule1.Status == RUNNING) { return; } //Check that we're not already part way through a schedule
|
||||||
|
|
||||||
fuelSchedule1.StartCallback = startCallback; //Name the start callback function
|
//fuelSchedule1.StartCallback = startCallback; //Name the start callback function
|
||||||
fuelSchedule1.EndCallback = endCallback; //Name the end callback function
|
//fuelSchedule1.EndCallback = endCallback; //Name the end callback function
|
||||||
fuelSchedule1.duration = duration;
|
fuelSchedule1.duration = duration;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -249,12 +250,12 @@ void setFuelSchedule1(void (*startCallback)(), unsigned long timeout, unsigned l
|
||||||
interrupts();
|
interrupts();
|
||||||
FUEL1_TIMER_ENABLE();
|
FUEL1_TIMER_ENABLE();
|
||||||
}
|
}
|
||||||
void setFuelSchedule2(void (*startCallback)(), unsigned long timeout, unsigned long duration, void(*endCallback)())
|
void setFuelSchedule2(unsigned long timeout, unsigned long duration)
|
||||||
{
|
{
|
||||||
if(fuelSchedule2.Status == RUNNING) { return; } //Check that we're not already part way through a schedule
|
if(fuelSchedule2.Status == RUNNING) { return; } //Check that we're not already part way through a schedule
|
||||||
|
|
||||||
fuelSchedule2.StartCallback = startCallback; //Name the start callback function
|
//fuelSchedule2.StartCallback = startCallback; //Name the start callback function
|
||||||
fuelSchedule2.EndCallback = endCallback; //Name the end callback function
|
//fuelSchedule2.EndCallback = endCallback; //Name the end callback function
|
||||||
fuelSchedule2.duration = duration;
|
fuelSchedule2.duration = duration;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -272,12 +273,13 @@ void setFuelSchedule2(void (*startCallback)(), unsigned long timeout, unsigned l
|
||||||
interrupts();
|
interrupts();
|
||||||
FUEL2_TIMER_ENABLE();
|
FUEL2_TIMER_ENABLE();
|
||||||
}
|
}
|
||||||
void setFuelSchedule3(void (*startCallback)(), unsigned long timeout, unsigned long duration, void(*endCallback)())
|
//void setFuelSchedule3(void (*startCallback)(), unsigned long timeout, unsigned long duration, void(*endCallback)())
|
||||||
|
void setFuelSchedule3(unsigned long timeout, unsigned long duration)
|
||||||
{
|
{
|
||||||
if(fuelSchedule3.Status == RUNNING) { return; } //Check that we're not already part way through a schedule
|
if(fuelSchedule3.Status == RUNNING) { return; } //Check that we're not already part way through a schedule
|
||||||
|
|
||||||
fuelSchedule3.StartCallback = startCallback; //Name the start callback function
|
//fuelSchedule3.StartCallback = startCallback; //Name the start callback function
|
||||||
fuelSchedule3.EndCallback = endCallback; //Name the end callback function
|
//fuelSchedule3.EndCallback = endCallback; //Name the end callback function
|
||||||
fuelSchedule3.duration = duration;
|
fuelSchedule3.duration = duration;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -295,12 +297,13 @@ void setFuelSchedule3(void (*startCallback)(), unsigned long timeout, unsigned l
|
||||||
interrupts();
|
interrupts();
|
||||||
FUEL3_TIMER_ENABLE();
|
FUEL3_TIMER_ENABLE();
|
||||||
}
|
}
|
||||||
void setFuelSchedule4(void (*startCallback)(), unsigned long timeout, unsigned long duration, void(*endCallback)()) //Uses timer 4 compare B
|
//void setFuelSchedule4(void (*startCallback)(), unsigned long timeout, unsigned long duration, void(*endCallback)()) //Uses timer 4 compare B
|
||||||
|
void setFuelSchedule4(unsigned long timeout, unsigned long duration) //Uses timer 4 compare B
|
||||||
{
|
{
|
||||||
if(fuelSchedule4.Status == RUNNING) { return; } //Check that we're not already part way through a schedule
|
if(fuelSchedule4.Status == RUNNING) { return; } //Check that we're not already part way through a schedule
|
||||||
|
|
||||||
fuelSchedule4.StartCallback = startCallback; //Name the start callback function
|
//fuelSchedule4.StartCallback = startCallback; //Name the start callback function
|
||||||
fuelSchedule4.EndCallback = endCallback; //Name the end callback function
|
//fuelSchedule4.EndCallback = endCallback; //Name the end callback function
|
||||||
fuelSchedule4.duration = duration;
|
fuelSchedule4.duration = duration;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -463,13 +466,17 @@ static inline void fuelSchedule1Interrupt() //Most ARM chips can simply call a f
|
||||||
if (timer3Aqueue[0]->Status == OFF) { FUEL1_TIMER_DISABLE(); return; } //Safety check. Turn off this output compare unit and return without performing any action
|
if (timer3Aqueue[0]->Status == OFF) { FUEL1_TIMER_DISABLE(); return; } //Safety check. Turn off this output compare unit and return without performing any action
|
||||||
if (timer3Aqueue[0]->Status == PENDING) //Check to see if this schedule is turn on
|
if (timer3Aqueue[0]->Status == PENDING) //Check to see if this schedule is turn on
|
||||||
{
|
{
|
||||||
timer3Aqueue[0]->StartCallback();
|
//timer3Aqueue[0]->StartCallback();
|
||||||
|
if (configPage1.injLayout == INJ_SEMISEQUENTIAL) { openInjector1and4(); }
|
||||||
|
else { openInjector1(); }
|
||||||
timer3Aqueue[0]->Status = RUNNING; //Set the status to be in progress (ie The start callback has been called, but not the end callback)
|
timer3Aqueue[0]->Status = RUNNING; //Set the status to be in progress (ie The start callback has been called, but not the end callback)
|
||||||
FUEL1_COMPARE = popQueue(timer3Aqueue);
|
FUEL1_COMPARE = popQueue(timer3Aqueue);
|
||||||
}
|
}
|
||||||
else if (timer3Aqueue[0]->Status == RUNNING)
|
else if (timer3Aqueue[0]->Status == RUNNING)
|
||||||
{
|
{
|
||||||
timer3Aqueue[0]->EndCallback();
|
//timer3Aqueue[0]->EndCallback();
|
||||||
|
if (configPage1.injLayout == INJ_SEMISEQUENTIAL) { closeInjector1and4(); }
|
||||||
|
else { closeInjector1(); }
|
||||||
timer3Aqueue[0]->Status = OFF; //Turn off the schedule
|
timer3Aqueue[0]->Status = OFF; //Turn off the schedule
|
||||||
timer3Aqueue[0]->schedulesSet = 0;
|
timer3Aqueue[0]->schedulesSet = 0;
|
||||||
FUEL1_COMPARE = popQueue(timer3Aqueue);
|
FUEL1_COMPARE = popQueue(timer3Aqueue);
|
||||||
|
@ -484,13 +491,17 @@ static inline void fuelSchedule2Interrupt() //Most ARM chips can simply call a f
|
||||||
{
|
{
|
||||||
if (fuelSchedule2.Status == PENDING) //Check to see if this schedule is turn on
|
if (fuelSchedule2.Status == PENDING) //Check to see if this schedule is turn on
|
||||||
{
|
{
|
||||||
fuelSchedule2.StartCallback();
|
//fuelSchedule2.StartCallback();
|
||||||
|
if (configPage1.injLayout == INJ_SEMISEQUENTIAL) { openInjector2and3(); }
|
||||||
|
else { openInjector2(); }
|
||||||
fuelSchedule2.Status = RUNNING; //Set the status to be in progress (ie The start callback has been called, but not the end callback)
|
fuelSchedule2.Status = RUNNING; //Set the status to be in progress (ie The start callback has been called, but not the end callback)
|
||||||
FUEL2_COMPARE = fuelSchedule2.endCompare;
|
FUEL2_COMPARE = fuelSchedule2.endCompare;
|
||||||
}
|
}
|
||||||
else if (fuelSchedule2.Status == RUNNING)
|
else if (fuelSchedule2.Status == RUNNING)
|
||||||
{
|
{
|
||||||
fuelSchedule2.EndCallback();
|
//fuelSchedule2.EndCallback();
|
||||||
|
if (configPage1.injLayout == INJ_SEMISEQUENTIAL) { closeInjector2and3(); }
|
||||||
|
else { closeInjector2(); }
|
||||||
fuelSchedule2.Status = OFF; //Turn off the schedule
|
fuelSchedule2.Status = OFF; //Turn off the schedule
|
||||||
fuelSchedule2.schedulesSet = 0;
|
fuelSchedule2.schedulesSet = 0;
|
||||||
FUEL2_TIMER_DISABLE();
|
FUEL2_TIMER_DISABLE();
|
||||||
|
@ -505,13 +516,19 @@ static inline void fuelSchedule3Interrupt() //Most ARM chips can simply call a f
|
||||||
{
|
{
|
||||||
if (fuelSchedule3.Status == PENDING) //Check to see if this schedule is turn on
|
if (fuelSchedule3.Status == PENDING) //Check to see if this schedule is turn on
|
||||||
{
|
{
|
||||||
fuelSchedule3.StartCallback();
|
//fuelSchedule3.StartCallback();
|
||||||
|
//Hack for 5 cylinder
|
||||||
|
if(channel5InjEnabled) { openInjector3and5(); }
|
||||||
|
else { openInjector3(); }
|
||||||
fuelSchedule3.Status = RUNNING; //Set the status to be in progress (ie The start callback has been called, but not the end callback)
|
fuelSchedule3.Status = RUNNING; //Set the status to be in progress (ie The start callback has been called, but not the end callback)
|
||||||
FUEL3_COMPARE = fuelSchedule3.endCompare;
|
FUEL3_COMPARE = fuelSchedule3.endCompare;
|
||||||
}
|
}
|
||||||
else if (fuelSchedule3.Status == RUNNING)
|
else if (fuelSchedule3.Status == RUNNING)
|
||||||
{
|
{
|
||||||
fuelSchedule3.EndCallback();
|
//fuelSchedule3.EndCallback();
|
||||||
|
//Hack for 5 cylinder
|
||||||
|
if(channel5InjEnabled) { closeInjector3and5(); }
|
||||||
|
else { closeInjector3and5(); }
|
||||||
fuelSchedule3.Status = OFF; //Turn off the schedule
|
fuelSchedule3.Status = OFF; //Turn off the schedule
|
||||||
fuelSchedule3.schedulesSet = 0;
|
fuelSchedule3.schedulesSet = 0;
|
||||||
FUEL3_TIMER_DISABLE();
|
FUEL3_TIMER_DISABLE();
|
||||||
|
@ -526,13 +543,15 @@ static inline void fuelSchedule4Interrupt() //Most ARM chips can simply call a f
|
||||||
{
|
{
|
||||||
if (fuelSchedule4.Status == PENDING) //Check to see if this schedule is turn on
|
if (fuelSchedule4.Status == PENDING) //Check to see if this schedule is turn on
|
||||||
{
|
{
|
||||||
fuelSchedule4.StartCallback();
|
//fuelSchedule4.StartCallback();
|
||||||
|
openInjector4();
|
||||||
fuelSchedule4.Status = RUNNING; //Set the status to be in progress (ie The start callback has been called, but not the end callback)
|
fuelSchedule4.Status = RUNNING; //Set the status to be in progress (ie The start callback has been called, but not the end callback)
|
||||||
FUEL4_COMPARE = fuelSchedule4.endCompare;
|
FUEL4_COMPARE = fuelSchedule4.endCompare;
|
||||||
}
|
}
|
||||||
else if (fuelSchedule4.Status == RUNNING)
|
else if (fuelSchedule4.Status == RUNNING)
|
||||||
{
|
{
|
||||||
fuelSchedule4.EndCallback();
|
//fuelSchedule4.EndCallback();
|
||||||
|
closeInjector4();
|
||||||
fuelSchedule4.Status = OFF; //Turn off the schedule
|
fuelSchedule4.Status = OFF; //Turn off the schedule
|
||||||
fuelSchedule4.schedulesSet = 0;
|
fuelSchedule4.schedulesSet = 0;
|
||||||
FUEL4_TIMER_DISABLE();
|
FUEL4_TIMER_DISABLE();
|
||||||
|
|
|
@ -712,7 +712,7 @@ void setup()
|
||||||
channel1IgnDegrees = channel1InjDegrees = 0;
|
channel1IgnDegrees = channel1InjDegrees = 0;
|
||||||
channel2IgnDegrees = channel2InjDegrees = 90;
|
channel2IgnDegrees = channel2InjDegrees = 90;
|
||||||
channel3IgnDegrees = channel3InjDegrees = 180;
|
channel3IgnDegrees = channel3InjDegrees = 180;
|
||||||
channel4IgnDegrees = channel3InjDegrees = 270;
|
channel4IgnDegrees = channel4InjDegrees = 270;
|
||||||
|
|
||||||
//For alternatiing injection, the squirt occurs at different times for each channel
|
//For alternatiing injection, the squirt occurs at different times for each channel
|
||||||
/*
|
/*
|
||||||
|
@ -832,8 +832,10 @@ void setup()
|
||||||
digitalWrite(pinFuelPump, HIGH);
|
digitalWrite(pinFuelPump, HIGH);
|
||||||
fuelPumpOn = true;
|
fuelPumpOn = true;
|
||||||
//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(100, (unsigned long)(configPage1.primePulse * 100));
|
||||||
setFuelSchedule2(openInjector2and3, 100, (unsigned long)(configPage1.primePulse * 100), closeInjector2and3);
|
setFuelSchedule2(100, (unsigned long)(configPage1.primePulse * 100));
|
||||||
|
setFuelSchedule3(100, (unsigned long)(configPage1.primePulse * 100));
|
||||||
|
setFuelSchedule4(100, (unsigned long)(configPage1.primePulse * 100));
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop()
|
void loop()
|
||||||
|
@ -1366,6 +1368,7 @@ void loop()
|
||||||
if (injector1StartAngle <= crankAngle && fuelSchedule1.schedulesSet == 0) { injector1StartAngle += CRANK_ANGLE_MAX_INJ; }
|
if (injector1StartAngle <= crankAngle && fuelSchedule1.schedulesSet == 0) { injector1StartAngle += CRANK_ANGLE_MAX_INJ; }
|
||||||
if (injector1StartAngle > crankAngle)
|
if (injector1StartAngle > crankAngle)
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
if (configPage1.injLayout == INJ_SEMISEQUENTIAL)
|
if (configPage1.injLayout == INJ_SEMISEQUENTIAL)
|
||||||
{
|
{
|
||||||
setFuelSchedule1(openInjector1and4,
|
setFuelSchedule1(openInjector1and4,
|
||||||
|
@ -1381,7 +1384,11 @@ void loop()
|
||||||
(unsigned long)currentStatus.PW1,
|
(unsigned long)currentStatus.PW1,
|
||||||
closeInjector1
|
closeInjector1
|
||||||
);
|
);
|
||||||
}
|
}*/
|
||||||
|
setFuelSchedule1(
|
||||||
|
((unsigned long)(injector1StartAngle - crankAngle) * (unsigned long)timePerDegree),
|
||||||
|
(unsigned long)currentStatus.PW1
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------------------
|
/*-----------------------------------------------------------------------------------------
|
||||||
|
@ -1404,7 +1411,8 @@ void loop()
|
||||||
if (tempStartAngle <= tempCrankAngle && fuelSchedule2.schedulesSet == 0) { tempStartAngle += CRANK_ANGLE_MAX_INJ; }
|
if (tempStartAngle <= tempCrankAngle && fuelSchedule2.schedulesSet == 0) { tempStartAngle += CRANK_ANGLE_MAX_INJ; }
|
||||||
if ( tempStartAngle > tempCrankAngle )
|
if ( tempStartAngle > tempCrankAngle )
|
||||||
{
|
{
|
||||||
if (configPage1.injLayout == 1)
|
/*
|
||||||
|
if (configPage1.injLayout == INJ_SEMISEQUENTIAL)
|
||||||
{
|
{
|
||||||
setFuelSchedule2(openInjector2and3,
|
setFuelSchedule2(openInjector2and3,
|
||||||
((unsigned long)(tempStartAngle - tempCrankAngle) * (unsigned long)timePerDegree),
|
((unsigned long)(tempStartAngle - tempCrankAngle) * (unsigned long)timePerDegree),
|
||||||
|
@ -1420,6 +1428,11 @@ void loop()
|
||||||
closeInjector2
|
closeInjector2
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
setFuelSchedule2(
|
||||||
|
((unsigned long)(tempStartAngle - tempCrankAngle) * (unsigned long)timePerDegree),
|
||||||
|
(unsigned long)currentStatus.PW2
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1432,10 +1445,15 @@ void loop()
|
||||||
if (tempStartAngle <= tempCrankAngle && fuelSchedule3.schedulesSet == 0) { tempStartAngle += CRANK_ANGLE_MAX_INJ; }
|
if (tempStartAngle <= tempCrankAngle && fuelSchedule3.schedulesSet == 0) { tempStartAngle += CRANK_ANGLE_MAX_INJ; }
|
||||||
if ( tempStartAngle > tempCrankAngle )
|
if ( tempStartAngle > tempCrankAngle )
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
setFuelSchedule3(openInjector3,
|
setFuelSchedule3(openInjector3,
|
||||||
((unsigned long)(tempStartAngle - tempCrankAngle) * (unsigned long)timePerDegree),
|
((unsigned long)(tempStartAngle - tempCrankAngle) * (unsigned long)timePerDegree),
|
||||||
(unsigned long)currentStatus.PW3,
|
(unsigned long)currentStatus.PW3,
|
||||||
closeInjector3
|
closeInjector3
|
||||||
|
);*/
|
||||||
|
setFuelSchedule3(
|
||||||
|
((unsigned long)(tempStartAngle - tempCrankAngle) * (unsigned long)timePerDegree),
|
||||||
|
(unsigned long)currentStatus.PW3
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1449,11 +1467,17 @@ void loop()
|
||||||
if (tempStartAngle <= tempCrankAngle && fuelSchedule4.schedulesSet == 0) { tempStartAngle += CRANK_ANGLE_MAX_INJ; }
|
if (tempStartAngle <= tempCrankAngle && fuelSchedule4.schedulesSet == 0) { tempStartAngle += CRANK_ANGLE_MAX_INJ; }
|
||||||
if ( tempStartAngle > tempCrankAngle )
|
if ( tempStartAngle > tempCrankAngle )
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
setFuelSchedule4(openInjector4,
|
setFuelSchedule4(openInjector4,
|
||||||
((unsigned long)(tempStartAngle - tempCrankAngle) * (unsigned long)timePerDegree),
|
((unsigned long)(tempStartAngle - tempCrankAngle) * (unsigned long)timePerDegree),
|
||||||
(unsigned long)currentStatus.PW4,
|
(unsigned long)currentStatus.PW4,
|
||||||
closeInjector4
|
closeInjector4
|
||||||
);
|
);
|
||||||
|
*/
|
||||||
|
setFuelSchedule4(
|
||||||
|
((unsigned long)(tempStartAngle - tempCrankAngle) * (unsigned long)timePerDegree),
|
||||||
|
(unsigned long)currentStatus.PW4
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1467,10 +1491,15 @@ void loop()
|
||||||
if ( tempStartAngle > tempCrankAngle )
|
if ( tempStartAngle > tempCrankAngle )
|
||||||
{
|
{
|
||||||
//Note the hacky use of fuel schedule 3 below
|
//Note the hacky use of fuel schedule 3 below
|
||||||
|
/*
|
||||||
setFuelSchedule3(openInjector3and5,
|
setFuelSchedule3(openInjector3and5,
|
||||||
((unsigned long)(tempStartAngle - tempCrankAngle) * (unsigned long)timePerDegree),
|
((unsigned long)(tempStartAngle - tempCrankAngle) * (unsigned long)timePerDegree),
|
||||||
(unsigned long)currentStatus.PW1,
|
(unsigned long)currentStatus.PW1,
|
||||||
closeInjector3and5
|
closeInjector3and5
|
||||||
|
);*/
|
||||||
|
setFuelSchedule3(
|
||||||
|
((unsigned long)(tempStartAngle - tempCrankAngle) * (unsigned long)timePerDegree),
|
||||||
|
(unsigned long)currentStatus.PW1
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue