This commit is contained in:
rusefi 2018-07-26 17:11:47 -04:00
parent a396c9b587
commit 405755e312
3 changed files with 10 additions and 4 deletions

View File

@ -20,7 +20,7 @@ static LoggingWithStorage logger;
static SimplePwm pwmTest[5];
extern OutputPin warningPin;
extern OutputPin warningLedPin;
extern EnginePins enginePins;
EXTERN_ENGINE;
@ -31,7 +31,7 @@ static void startPwmTest(int freq) {
engine->isRunningPwmTest = true;
// PD13 pin is initialized elsewhere already
startSimplePwm(&pwmTest[0], "tester", &warningPin, 10, 0.5f, applyPinState);
startSimplePwm(&pwmTest[0], "tester", &warningLedPin, 10, 0.5f, applyPinState);
/**
* See custom_engine.cpp for pinout
*/

View File

@ -733,5 +733,5 @@ int getRusEfiVersion(void) {
if (initBootloader() != 0)
return 123;
#endif /* EFI_BOOTLOADER_INCLUDE_CODE */
return 20180723;
return 20180724;
}

View File

@ -74,6 +74,7 @@ static void prepareCylinderIgnitionSchedule(angle_t dwellAngle, IgnitionEvent *e
assertAngleRange(ignitionPositionWithinEngineCycle, "aPWEC", CUSTOM_ERR_6566);
cfg_float_t_1f timing_offset_cylinder = CONFIG(timing_offset_cylinder[event->cylinderIndex]);
const angle_t localAdvance = -ENGINE(engineState.timingAdvance) + ignitionPositionWithinEngineCycle + timing_offset_cylinder;
efiAssertVoid(CUSTOM_ERR_6689, !cisnan(localAdvance), "findAngle#9");
efiAssertVoid(CUSTOM_ERR_6589, !cisnan(localAdvance), "localAdvance#1");
const int index = ENGINE(ignitionPin[event->cylinderIndex]);
@ -176,11 +177,16 @@ static int globalSparkIdCoutner = 0;
static ALWAYS_INLINE void handleSparkEvent(bool limitedSpark, uint32_t trgEventIndex, IgnitionEvent *iEvent,
int rpm DECLARE_ENGINE_PARAMETER_SUFFIX) {
angle_t advance = iEvent->advance;
const floatms_t dwellMs = ENGINE(engineState.sparkDwell);
if (cisnan(dwellMs) || dwellMs <= 0) {
warning(CUSTOM_DWELL, "invalid dwell to handle: %.2f at %d", dwellMs, rpm);
return;
}
if (cisnan(advance)) {
warning(CUSTOM_ERR_6688, "NaN advance");
return;
}
floatus_t chargeDelayUs = ENGINE(rpmCalculator.oneDegreeUs) * iEvent->dwellPosition.angleOffset;
int isIgnitionError = chargeDelayUs < 0;
@ -224,7 +230,7 @@ static ALWAYS_INLINE void handleSparkEvent(bool limitedSpark, uint32_t trgEventI
* Spark event is often happening during a later trigger event timeframe
* TODO: improve precision
*/
float advance = iEvent->advance;
efiAssertVoid(CUSTOM_ERR_6591, !cisnan(advance), "findAngle#4");
assertAngleRange(advance, "findAngle#a5", CUSTOM_ERR_6549);
TRIGGER_SHAPE(findTriggerPosition(&iEvent->sparkPosition, advance PASS_ENGINE_PARAMETER_SUFFIX));