![]() |
Speeduino
|
#include <limits.h>#include "globals.h"#include "decoders.h"#include "scheduledIO.h"#include "scheduler.h"#include "crankMaths.h"#include "timers.h"#include "schedule_calcs.h"Macros | |
| #define | MIN_CYCLES_FOR_ENDCOMPARE 6 |
| #define | secondaryToothLastCount checkSyncToothCount |
| #define | renixSystemLastToothTime toothLastToothRisingTime |
| #define | renixSystemLastMinusOneToothTime toothLastSecToothRisingTime |
Variables | |
| void(* | triggerHandler )(void) = nullTriggerHandler |
| void(* | triggerSecondaryHandler )(void) = nullTriggerHandler |
| Pointer for the trigger function (Gets pointed to the relevant decoder) More... | |
| void(* | triggerTertiaryHandler )(void) = nullTriggerHandler |
| Pointer for the secondary trigger function (Gets pointed to the relevant decoder) More... | |
| uint16_t(* | getRPM )(void) = nullGetRPM |
| Pointer for the tertiary trigger function (Gets pointed to the relevant decoder) More... | |
| int(* | getCrankAngle )(void) = nullGetCrankAngle |
| Pointer to the getRPM function (Gets pointed to the relevant decoder) More... | |
| void(* | triggerSetEndTeeth )(void) = triggerSetEndTeeth_missingTooth |
| Pointer to the getCrank Angle function (Gets pointed to the relevant decoder) More... | |
| volatile unsigned long | curTime |
| volatile unsigned long | curGap |
| volatile unsigned long | curTime2 |
| volatile unsigned long | curGap2 |
| volatile unsigned long | curTime3 |
| volatile unsigned long | curGap3 |
| volatile unsigned long | lastGap |
| volatile unsigned long | targetGap |
| unsigned long | MAX_STALL_TIME = 500000UL |
| volatile uint16_t | toothCurrentCount = 0 |
| volatile byte | toothSystemCount = 0 |
| volatile unsigned long | toothSystemLastToothTime = 0 |
| volatile unsigned long | toothLastToothTime = 0 |
| volatile unsigned long | toothLastSecToothTime = 0 |
| volatile unsigned long | toothLastThirdToothTime = 0 |
| volatile unsigned long | toothLastMinusOneToothTime = 0 |
| volatile unsigned long | toothLastMinusOneSecToothTime = 0 |
| volatile unsigned long | toothLastToothRisingTime = 0 |
| volatile unsigned long | toothLastSecToothRisingTime = 0 |
| volatile unsigned long | targetGap2 |
| volatile unsigned long | targetGap3 |
| volatile unsigned long | toothOneTime = 0 |
| volatile unsigned long | toothOneMinusOneTime = 0 |
| volatile bool | revolutionOne = 0 |
| volatile bool | revolutionLastOne = 0 |
| volatile unsigned int | secondaryToothCount |
| volatile unsigned int | secondaryLastToothCount = 0 |
| volatile unsigned long | secondaryLastToothTime = 0 |
| volatile unsigned long | secondaryLastToothTime1 = 0 |
| volatile unsigned int | thirdToothCount |
| volatile unsigned long | thirdLastToothTime = 0 |
| volatile unsigned long | thirdLastToothTime1 = 0 |
| uint16_t | triggerActualTeeth |
| volatile unsigned long | triggerFilterTime |
| volatile unsigned long | triggerSecFilterTime |
| volatile unsigned long | triggerThirdFilterTime |
| volatile uint8_t | decoderState = 0 |
| unsigned int | triggerSecFilterTime_duration |
| volatile uint16_t | triggerToothAngle |
| byte | checkSyncToothCount |
| unsigned long | elapsedTime |
| unsigned long | lastCrankAngleCalc |
| int16_t | lastToothCalcAdvance = 99 |
| unsigned long | lastVVTtime |
| uint16_t | ignition1EndTooth = 0 |
| uint16_t | ignition2EndTooth = 0 |
| uint16_t | ignition3EndTooth = 0 |
| uint16_t | ignition4EndTooth = 0 |
| uint16_t | ignition5EndTooth = 0 |
| uint16_t | ignition6EndTooth = 0 |
| uint16_t | ignition7EndTooth = 0 |
| uint16_t | ignition8EndTooth = 0 |
| int16_t | toothAngles [24] |
| volatile unsigned long | roverMEMSTeethSeen = 0 |
Crank and Cam decoders
This file contains the various crank and cam wheel decoder functions. Each decoder must have the following 4 functions (Where xxxx is the decoder name):
Each decoder must utilise at least the following variables:
| int nullGetCrankAngle | ( | void | ) |
| uint16_t nullGetRPM | ( | void | ) |
| void nullTriggerHandler | ( | void | ) |
| void triggerSec_DRZ400 | ( | void | ) |

| void triggerSetup_DRZ400 | ( | void | ) |

| byte checkSyncToothCount |
| volatile unsigned long curGap |
| volatile unsigned long curGap2 |
| volatile unsigned long curGap3 |
| volatile unsigned long curTime |
| volatile unsigned long curTime2 |
| volatile unsigned long curTime3 |
| volatile uint8_t decoderState = 0 |
| unsigned long elapsedTime |
| int(* getCrankAngle) (void) | ( | void | ) | = nullGetCrankAngle |
Pointer to the getRPM function (Gets pointed to the relevant decoder)
| uint16_t(* getRPM) (void) | ( | void | ) | = nullGetRPM |
Pointer for the tertiary trigger function (Gets pointed to the relevant decoder)
| uint16_t ignition1EndTooth = 0 |
| uint16_t ignition2EndTooth = 0 |
| uint16_t ignition3EndTooth = 0 |
| uint16_t ignition4EndTooth = 0 |
| uint16_t ignition5EndTooth = 0 |
| uint16_t ignition6EndTooth = 0 |
| uint16_t ignition7EndTooth = 0 |
| uint16_t ignition8EndTooth = 0 |
| unsigned long lastCrankAngleCalc |
| volatile unsigned long lastGap |
| int16_t lastToothCalcAdvance = 99 |
| unsigned long lastVVTtime |
| unsigned long MAX_STALL_TIME = 500000UL |
| volatile bool revolutionLastOne = 0 |
| volatile bool revolutionOne = 0 |
| volatile unsigned int secondaryLastToothCount = 0 |
| volatile unsigned long secondaryLastToothTime = 0 |
| volatile unsigned long secondaryLastToothTime1 = 0 |
| volatile unsigned int secondaryToothCount |
| volatile unsigned long targetGap |
| volatile unsigned long targetGap2 |
| volatile unsigned long targetGap3 |
| volatile unsigned long thirdLastToothTime = 0 |
| volatile unsigned long thirdLastToothTime1 = 0 |
| volatile unsigned int thirdToothCount |
| int16_t toothAngles[24] |
| volatile uint16_t toothCurrentCount = 0 |
| volatile unsigned long toothLastMinusOneSecToothTime = 0 |
| volatile unsigned long toothLastMinusOneToothTime = 0 |
| volatile unsigned long toothLastSecToothRisingTime = 0 |
| volatile unsigned long toothLastSecToothTime = 0 |
| volatile unsigned long toothLastThirdToothTime = 0 |
| volatile unsigned long toothLastToothRisingTime = 0 |
| volatile unsigned long toothLastToothTime = 0 |
| volatile unsigned long toothOneMinusOneTime = 0 |
| volatile unsigned long toothOneTime = 0 |
| volatile byte toothSystemCount = 0 |
| volatile unsigned long toothSystemLastToothTime = 0 |
| uint16_t triggerActualTeeth |
| volatile unsigned long triggerFilterTime |
| void(* triggerHandler) (void) | ( | void | ) | = nullTriggerHandler |
| volatile unsigned long triggerSecFilterTime |
| unsigned int triggerSecFilterTime_duration |
| void(* triggerSecondaryHandler) (void) | ( | void | ) | = nullTriggerHandler |
Pointer for the trigger function (Gets pointed to the relevant decoder)
| void(* triggerSetEndTeeth) (void) | ( | void | ) | = triggerSetEndTeeth_missingTooth |
Pointer to the getCrank Angle function (Gets pointed to the relevant decoder)
| void(* triggerTertiaryHandler) (void) | ( | void | ) | = nullTriggerHandler |
Pointer for the secondary trigger function (Gets pointed to the relevant decoder)
| volatile unsigned long triggerThirdFilterTime |
| volatile uint16_t triggerToothAngle |