Prevent low probability race condition when disabling pending schedules
This commit is contained in:
parent
70c83077d9
commit
a6201f3b72
|
@ -1550,6 +1550,7 @@ inline void ignitionSchedule8Interrupt(void)
|
|||
|
||||
void disablePendingFuelSchedule(byte channel)
|
||||
{
|
||||
noInterrupts();
|
||||
switch(channel)
|
||||
{
|
||||
case 0:
|
||||
|
@ -1577,9 +1578,11 @@ void disablePendingFuelSchedule(byte channel)
|
|||
if(fuelSchedule8.Status == PENDING) { fuelSchedule8.Status = OFF; }
|
||||
break;
|
||||
}
|
||||
interrupts();
|
||||
}
|
||||
void disablePendingIgnSchedule(byte channel)
|
||||
{
|
||||
noInterrupts();
|
||||
switch(channel)
|
||||
{
|
||||
case 0:
|
||||
|
@ -1607,4 +1610,5 @@ void disablePendingIgnSchedule(byte channel)
|
|||
if(ignitionSchedule8.Status == PENDING) { ignitionSchedule8.Status = OFF; }
|
||||
break;
|
||||
}
|
||||
interrupts();
|
||||
}
|
||||
|
|
|
@ -807,7 +807,7 @@ void loop(void)
|
|||
if( (configPage4.sparkMode != IGN_MODE_SEQUENTIAL) || (configPage2.injLayout != INJ_SEQUENTIAL) ) { revolutionsToCut *= 2; } //4 stroke and non-sequential will cut for 4 revolutions minimum. This is to ensure no half fuel ignition cycles take place
|
||||
|
||||
if(rollingCutLastRev == 0) { rollingCutLastRev = currentStatus.startRevolutions; } //First time check
|
||||
if ( (currentStatus.startRevolutions >= (rollingCutLastRev + revolutionsToCut)) || (currentStatus.RPM > maxAllowedRPM) ) //If current RPM is over the max allowed RPM always cure, otherwise check if the required number of revolutions have passed since the last cut
|
||||
if ( (currentStatus.startRevolutions >= (rollingCutLastRev + revolutionsToCut)) || (currentStatus.RPM > maxAllowedRPM) ) //If current RPM is over the max allowed RPM always cut, otherwise check if the required number of revolutions have passed since the last cut
|
||||
{
|
||||
uint8_t cutPercent = 0;
|
||||
int16_t rpmDelta = currentStatus.RPM - maxAllowedRPM;
|
||||
|
@ -867,7 +867,7 @@ void loop(void)
|
|||
|
||||
//Check whether there are any ignition channels that are waiting for injection pulses to occur before being turned back on. This can only occur when at least 2 revolutions have taken place since the fuel was turned back on
|
||||
//Note that ignitionChannelsPending can only be >0 on 4 stroke, non-sequential fuel when protect type is Both
|
||||
if( (ignitionChannelsPending > 0) && (currentStatus.startRevolutions >= (rollingCutLastRev + 2)))
|
||||
if( (ignitionChannelsPending > 0) && (currentStatus.startRevolutions >= (rollingCutLastRev + 2)) )
|
||||
{
|
||||
ignitionChannelsOn = fuelChannelsOn;
|
||||
ignitionChannelsPending = 0;
|
||||
|
|
Loading…
Reference in New Issue