parent
e896afe2f6
commit
fda7a3a775
|
@ -13,8 +13,13 @@ void setAlgorithm(engine_load_mode_e algo);
|
|||
|
||||
void setFlatInjectorLag(float value);
|
||||
|
||||
#define fixAngle(angle, msg, code) fixAngle2(angle, msg, code, engine->engineCycle)
|
||||
|
||||
/**
|
||||
* See also wrapVvt
|
||||
* TODO: replace all usages of fixAngle with wrapAngle?
|
||||
* Should we make this a nice method instead of that off macro which changes parameter value?
|
||||
*/
|
||||
#define fixAngle(angle, msg, code) wrapAngle2(angle, msg, code, engine->engineCycle)
|
||||
#define wrapAngle(angle, msg, code) fixAngle(angle, msg, code)
|
||||
|
||||
/**
|
||||
* @return time needed to rotate crankshaft by one degree, in milliseconds.
|
||||
|
|
|
@ -388,7 +388,7 @@ void findTriggerPosition(TriggerWaveform *triggerShape,
|
|||
// convert engine cycle angle into trigger cycle angle
|
||||
angle += triggerShape->tdcPosition + engineConfiguration->globalTriggerAngleOffset;
|
||||
efiAssertVoid(CUSTOM_ERR_6577, !cisnan(angle), "findAngle#2");
|
||||
fixAngle2(angle, "addFuel#2", CUSTOM_ERR_6555, getEngineCycle(triggerShape->getOperationMode()));
|
||||
wrapAngle2(angle, "addFuel#2", CUSTOM_ERR_6555, getEngineCycle(triggerShape->getOperationMode()));
|
||||
|
||||
int triggerEventIndex = triggerShape->findAngleIndex(details, angle);
|
||||
angle_t triggerEventAngle = details->eventAngles[triggerEventIndex];
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
* @brief Shifts angle into the [0..720) range for four stroke and [0..360) for two stroke
|
||||
* I guess this implementation would be faster than 'angle % engineCycle'
|
||||
*/
|
||||
#define fixAngle2(angle, msg, code, engineCycle) \
|
||||
#define wrapAngle2(angle, msg, code, engineCycle) \
|
||||
{ \
|
||||
if (cisnan(angle)) { \
|
||||
firmwareError(CUSTOM_ERR_ANGLE, "aNaN%s", msg); \
|
||||
|
|
|
@ -160,6 +160,9 @@ static angle_t adjustCrankPhase(int camIndex) {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* See also wrapAngle
|
||||
*/
|
||||
static angle_t wrapVvt(angle_t vvtPosition, int period) {
|
||||
// Wrap VVT position in to the range [-360, 360)
|
||||
while (vvtPosition < -period / 2) {
|
||||
|
|
Loading…
Reference in New Issue