Skip to content

Commit

Permalink
Allow mega2560 builds with non-standard _CHANNELS values
Browse files Browse the repository at this point in the history
  • Loading branch information
noisymime committed Oct 6, 2023
1 parent fc536d1 commit 55c98ca
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 6 additions & 3 deletions speeduino/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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;
}
Expand Down Expand Up @@ -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
}
}
Expand Down
2 changes: 2 additions & 0 deletions speeduino/speeduino.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 55c98ca

Please sign in to comment.