Allow mega2560 builds with non-standard _CHANNELS values

This commit is contained in:
Josh Stewart 2023-10-06 20:43:15 +11:00
parent fc536d15f0
commit 55c98cab22
2 changed files with 8 additions and 3 deletions

View File

@ -746,7 +746,9 @@ void initialiseAll(void)
channel2IgnDegrees = 72;
channel3IgnDegrees = 144;
channel4IgnDegrees = 216;
#if (IGN_CHANNELS >= 5)
channel5IgnDegrees = 288;
#endif
maxIgnOutputs = 5; //Only 4 actual outputs, so that's all that can be cut
maxInjOutputs = 4; //Is updated below to 5 if there are enough channels
@ -755,7 +757,9 @@ void initialiseAll(void)
channel2IgnDegrees = 144;
channel3IgnDegrees = 288;
channel4IgnDegrees = 432;
#if (IGN_CHANNELS >= 5)
channel5IgnDegrees = 576;
#endif
CRANK_ANGLE_MAX_IGN = 720;
}
@ -879,9 +883,8 @@ void initialiseAll(void)
channel8InjDegrees = channel4InjDegrees;
#else
//This is an invalid config as there are not enough outputs to support sequential + staging
//Put the staging output to the non-existant channel 7
maxInjOutputs = 7;
channel7InjDegrees = channel1InjDegrees;
//No staging output will be active
maxInjOutputs = 6;
#endif
}
}

View File

@ -1405,7 +1405,9 @@ void calculateIgnitionAngles(int dwellAngle)
calculateIgnitionAngle(dwellAngle, channel2IgnDegrees, currentStatus.advance, &ignition2EndAngle, &ignition2StartAngle);
calculateIgnitionAngle(dwellAngle, channel3IgnDegrees, currentStatus.advance, &ignition3EndAngle, &ignition3StartAngle);
calculateIgnitionAngle(dwellAngle, channel4IgnDegrees, currentStatus.advance, &ignition4EndAngle, &ignition4StartAngle);
#if (IGN_CHANNELS >= 5)
calculateIgnitionAngle(dwellAngle, channel5IgnDegrees, currentStatus.advance, &ignition5EndAngle, &ignition5StartAngle);
#endif
break;
//6 cylinders
case 6: