38 #define OUTPUTSCHEDULER_C
79 unsigned char outputEvent;
133 endOfPulseTimingToUseForThisChannel = 0;
148 unsigned short codeAngleOfIgnition = 0;
162 unsigned char lastGoodEvent =
ONES;
163 if(codeAngleOfIgnition == 0){
168 unsigned char possibleEvent;
170 if(
eventAngles[possibleEvent] < codeAngleOfIgnition){
171 lastGoodEvent = possibleEvent;
177 unsigned char possibleEvent;
179 unsigned long ticksBetweenEventAndSpark =
LONGMAX;
180 if(codeAngleOfIgnition >
eventAngles[lastGoodEvent]){
186 if(ticksBetweenEventAndSpark > ((
unsigned long)pulsewidthToUseForThisChannel +
decoderMaxCodeTime)){
188 unsigned char mappedEvent = 0xFF;
190 mappedEvent = lastGoodEvent;
196 unsigned char eventBeforeCurrent = 0;
203 unsigned long potentialDelay = ticksBetweenEventAndSpark - pulsewidthToUseForThisChannel;
240 unsigned char numberOfRepeats = potentialDelay /
SHORTMAX;
241 unsigned short finalPeriod = potentialDelay %
SHORTMAX;
247 unsigned short shortagePerRepeat = (
decoderMaxCodeTime - finalPeriod) / numberOfRepeats;
248 unsigned short repeatPeriod = (
SHORTMAX - 1) - shortagePerRepeat;
249 finalPeriod += (shortagePerRepeat + 1) * numberOfRepeats;
266 if(lastGoodEvent > 0){
269 lastGoodEvent = numberOfVirtualEvents - 1;