Fix for missing ignition signals on channels 3 and 4
This commit is contained in:
parent
e5f654718f
commit
3b3541698e
|
@ -60,6 +60,12 @@ volatile byte inj4_pin_mask;
|
|||
|
||||
volatile byte *ign1_pin_port;
|
||||
volatile byte ign1_pin_mask;
|
||||
volatile byte *ign2_pin_port;
|
||||
volatile byte ign2_pin_mask;
|
||||
volatile byte *ign3_pin_port;
|
||||
volatile byte ign3_pin_mask;
|
||||
volatile byte *ign4_pin_port;
|
||||
volatile byte ign4_pin_mask;
|
||||
|
||||
//The status struct contains the current values for all 'live' variables
|
||||
//In current version this is 64 bytes
|
||||
|
@ -318,6 +324,7 @@ struct config3 {
|
|||
|
||||
};
|
||||
|
||||
|
||||
//Page 4 of the config mostly deals with idle control
|
||||
//See ini file for further info (Config Page 7 in the ini)
|
||||
struct config4 {
|
||||
|
|
|
@ -297,7 +297,7 @@ ISR(TIMER5_COMPC_vect, ISR_NOBLOCK) //ignitionSchedule3
|
|||
{
|
||||
//if ( ign3LastRev == startRevolutions ) { return; }
|
||||
ignitionSchedule3.Status = RUNNING; //Set the status to be in progress (ie The start callback has been called, but not the end callback)
|
||||
ignitionSchedule3.startTime = currentLoopTime;
|
||||
ignitionSchedule3.startTime = micros();
|
||||
ignitionSchedule3.StartCallback();
|
||||
ign3LastRev = startRevolutions;
|
||||
OCR5C = TCNT5 + (ignitionSchedule3.duration >> 2);
|
||||
|
@ -316,7 +316,7 @@ ISR(TIMER4_COMPA_vect, ISR_NOBLOCK) //ignitionSchedule4
|
|||
{
|
||||
//if ( ign4LastRev == startRevolutions ) { return; }
|
||||
ignitionSchedule4.Status = RUNNING; //Set the status to be in progress (ie The start callback has been called, but not the end callback)
|
||||
ignitionSchedule4.startTime = currentLoopTime;
|
||||
ignitionSchedule4.startTime = micros();
|
||||
ignitionSchedule4.StartCallback();
|
||||
ign4LastRev = startRevolutions;
|
||||
OCR4A = TCNT4 + (ignitionSchedule4.duration >> 4); //Divide by 16
|
||||
|
|
|
@ -1071,7 +1071,7 @@ void loop()
|
|||
tempCrankAngle = crankAngle - channel3IgnDegrees;
|
||||
if( tempCrankAngle < 0) { tempCrankAngle += 360; }
|
||||
tempStartAngle = ignition3StartAngle - channel3IgnDegrees;
|
||||
//if ( tempStartAngle < 0) { tempStartAngle += 360; }
|
||||
if ( tempStartAngle < 0) { tempStartAngle += 360; }
|
||||
//if (tempStartAngle > tempCrankAngle)
|
||||
{
|
||||
long ignition3StartTime = 0;
|
||||
|
@ -1091,7 +1091,7 @@ void loop()
|
|||
tempCrankAngle = crankAngle - channel4IgnDegrees;
|
||||
if( tempCrankAngle < 0) { tempCrankAngle += 360; }
|
||||
tempStartAngle = ignition4StartAngle - channel4IgnDegrees;
|
||||
//if ( tempStartAngle < 0) { tempStartAngle += 360; }
|
||||
if ( tempStartAngle < 0) { tempStartAngle += 360; }
|
||||
//if (tempStartAngle > tempCrankAngle)
|
||||
{
|
||||
|
||||
|
@ -1126,8 +1126,8 @@ void closeInjector1() { digitalWrite(pinInjector1, LOW); BIT_CLEAR(currentStatus
|
|||
//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 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 beginCoil1Charge() { *ign1_pin_port |= (ign1_pin_mask); BIT_SET(currentStatus.spark, 0); digitalWrite(pinTachOut, LOW); }
|
||||
void endCoil1Charge() { *ign1_pin_port &= ~(ign1_pin_mask); BIT_CLEAR(currentStatus.spark, 0); }
|
||||
|
||||
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, BIT_SQUIRT_INJ2); }
|
||||
|
|
|
@ -255,6 +255,12 @@ void setPinMapping(byte boardID)
|
|||
|
||||
ign1_pin_port = portOutputRegister(digitalPinToPort(pinCoil1));
|
||||
ign1_pin_mask = digitalPinToBitMask(pinCoil1);
|
||||
ign2_pin_port = portOutputRegister(digitalPinToPort(pinCoil2));
|
||||
ign2_pin_mask = digitalPinToBitMask(pinCoil2);
|
||||
ign3_pin_port = portOutputRegister(digitalPinToPort(pinCoil3));
|
||||
ign3_pin_mask = digitalPinToBitMask(pinCoil3);
|
||||
ign4_pin_port = portOutputRegister(digitalPinToPort(pinCoil4));
|
||||
ign4_pin_mask = digitalPinToBitMask(pinCoil4);
|
||||
|
||||
//And for inputs
|
||||
pinMode(pinMAP, INPUT);
|
||||
|
|
Loading…
Reference in New Issue