auto-sync
This commit is contained in:
parent
d26b9650b6
commit
f7b95e16e3
|
@ -71,8 +71,8 @@ IgnitionOutputPin::IgnitionOutputPin() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void IgnitionOutputPin::reset() {
|
void IgnitionOutputPin::reset() {
|
||||||
outOfOrderCounter = 0;
|
outOfOrder = false;
|
||||||
sparkId = 0;
|
signalFallSparkId = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
OutputPin::OutputPin() {
|
OutputPin::OutputPin() {
|
||||||
|
|
|
@ -60,8 +60,8 @@ class IgnitionOutputPin : public NamedOutputPin {
|
||||||
public:
|
public:
|
||||||
IgnitionOutputPin();
|
IgnitionOutputPin();
|
||||||
void reset();
|
void reset();
|
||||||
int sparkId;
|
int signalFallSparkId;
|
||||||
int outOfOrderCounter; // https://sourceforge.net/p/rusefi/tickets/319/
|
bool outOfOrder; // https://sourceforge.net/p/rusefi/tickets/319/
|
||||||
};
|
};
|
||||||
|
|
||||||
class engine_pins_s {
|
class engine_pins_s {
|
||||||
|
|
|
@ -28,7 +28,7 @@ void turnSparkPinLow(IgnitionEvent *event) {
|
||||||
IgnitionOutputPin *output = event->output;
|
IgnitionOutputPin *output = event->output;
|
||||||
#if SPARK_EXTREME_LOGGING || defined(__DOXYGEN__)
|
#if SPARK_EXTREME_LOGGING || defined(__DOXYGEN__)
|
||||||
scheduleMsg(logger, "spark goes low %d %s %d current=%d cnt=%d id=%d", getRevolutionCounter(), output->name, (int)getTimeNowUs(),
|
scheduleMsg(logger, "spark goes low %d %s %d current=%d cnt=%d id=%d", getRevolutionCounter(), output->name, (int)getTimeNowUs(),
|
||||||
output->currentLogicValue, output->outOfOrderCounter, event->sparkId);
|
output->currentLogicValue, output->outOfOrder, event->sparkId);
|
||||||
#endif /* FUEL_MATH_EXTREME_LOGGING */
|
#endif /* FUEL_MATH_EXTREME_LOGGING */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -39,11 +39,11 @@ void turnSparkPinLow(IgnitionEvent *event) {
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
output->sparkId = event->sparkId;
|
output->signalFallSparkId = event->sparkId;
|
||||||
|
|
||||||
if (!output->currentLogicValue) {
|
if (!output->currentLogicValue) {
|
||||||
warning(CUSTOM_ERR_6149, "out-of-order coil off %s", output->name);
|
warning(CUSTOM_ERR_6149, "out-of-order coil off %s", output->name);
|
||||||
output->outOfOrderCounter++;
|
output->outOfOrder = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
turnPinLow(output);
|
turnPinLow(output);
|
||||||
|
@ -58,12 +58,12 @@ void turnSparkPinHigh(IgnitionEvent *event) {
|
||||||
IgnitionOutputPin *output = event->output;
|
IgnitionOutputPin *output = event->output;
|
||||||
#if SPARK_EXTREME_LOGGING || defined(__DOXYGEN__)
|
#if SPARK_EXTREME_LOGGING || defined(__DOXYGEN__)
|
||||||
scheduleMsg(logger, "spark goes high %d %s %d current=%d cnt=%d id=%d", getRevolutionCounter(), output->name, (int)getTimeNowUs(),
|
scheduleMsg(logger, "spark goes high %d %s %d current=%d cnt=%d id=%d", getRevolutionCounter(), output->name, (int)getTimeNowUs(),
|
||||||
output->currentLogicValue, output->outOfOrderCounter, event->sparkId);
|
output->currentLogicValue, output->outOfOrder, event->sparkId);
|
||||||
#endif /* FUEL_MATH_EXTREME_LOGGING */
|
#endif /* FUEL_MATH_EXTREME_LOGGING */
|
||||||
|
|
||||||
if (output->outOfOrderCounter > 0) {
|
if (output->outOfOrder) {
|
||||||
output->outOfOrderCounter--;
|
output->outOfOrder = false;
|
||||||
if (output->sparkId == event->sparkId) {
|
if (output->signalFallSparkId == event->sparkId) {
|
||||||
// let's save this coil if things do not look right
|
// let's save this coil if things do not look right
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1171,13 +1171,13 @@ void testSparkReverseOrderBug319(void) {
|
||||||
eth.firePrimaryTriggerFall();
|
eth.firePrimaryTriggerFall();
|
||||||
schedulingQueue.executeAll(timeNow);
|
schedulingQueue.executeAll(timeNow);
|
||||||
|
|
||||||
assertEqualsM("out-of-order #1", 1, enginePins.coils[3].outOfOrderCounter);
|
assertEqualsM("out-of-order #1", 1, enginePins.coils[3].outOfOrder);
|
||||||
|
|
||||||
|
|
||||||
timeNow += MS2US(200); // moving time forward to execute all pending actions
|
timeNow += MS2US(200); // moving time forward to execute all pending actions
|
||||||
schedulingQueue.executeAll(timeNow);
|
schedulingQueue.executeAll(timeNow);
|
||||||
|
|
||||||
assertEqualsM("out-of-order #2", 0, enginePins.coils[3].outOfOrderCounter);
|
assertEqualsM("out-of-order #2", 0, enginePins.coils[3].outOfOrder);
|
||||||
|
|
||||||
printf("*************************************************** now let's have a good engine cycle and confirm things work\r\n");
|
printf("*************************************************** now let's have a good engine cycle and confirm things work\r\n");
|
||||||
|
|
||||||
|
@ -1187,12 +1187,12 @@ void testSparkReverseOrderBug319(void) {
|
||||||
|
|
||||||
assertEqualsM("RPM#2", 545, eth.engine.rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_F));
|
assertEqualsM("RPM#2", 545, eth.engine.rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_F));
|
||||||
|
|
||||||
assertEqualsM("out-of-order #3", 0, enginePins.coils[3].outOfOrderCounter);
|
assertEqualsM("out-of-order #3", 0, enginePins.coils[3].outOfOrder);
|
||||||
|
|
||||||
timeNow += MS2US(20);
|
timeNow += MS2US(20);
|
||||||
eth.firePrimaryTriggerFall();
|
eth.firePrimaryTriggerFall();
|
||||||
schedulingQueue.executeAll(timeNow);
|
schedulingQueue.executeAll(timeNow);
|
||||||
assertEqualsM("out-of-order #4", 1, enginePins.coils[3].outOfOrderCounter);
|
assertEqualsM("out-of-order #4", 1, enginePins.coils[3].outOfOrder);
|
||||||
|
|
||||||
printf("*************************************************** (rpm is back) now let's have a good engine cycle and confirm things work\r\n");
|
printf("*************************************************** (rpm is back) now let's have a good engine cycle and confirm things work\r\n");
|
||||||
|
|
||||||
|
@ -1202,12 +1202,12 @@ void testSparkReverseOrderBug319(void) {
|
||||||
|
|
||||||
assertEqualsM("RPM#3", 3000, eth.engine.rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_F));
|
assertEqualsM("RPM#3", 3000, eth.engine.rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_F));
|
||||||
|
|
||||||
assertEqualsM("out-of-order #5", 1, enginePins.coils[3].outOfOrderCounter);
|
assertEqualsM("out-of-order #5", 1, enginePins.coils[3].outOfOrder);
|
||||||
|
|
||||||
timeNow += MS2US(20);
|
timeNow += MS2US(20);
|
||||||
eth.firePrimaryTriggerFall();
|
eth.firePrimaryTriggerFall();
|
||||||
schedulingQueue.executeAll(timeNow);
|
schedulingQueue.executeAll(timeNow);
|
||||||
assertEqualsM("out-of-order #6", 0, enginePins.coils[3].outOfOrderCounter);
|
assertEqualsM("out-of-order #6", 0, enginePins.coils[3].outOfOrder);
|
||||||
|
|
||||||
printf("*************************************************** (rpm is back 2) now let's have a good engine cycle and confirm things work\r\n");
|
printf("*************************************************** (rpm is back 2) now let's have a good engine cycle and confirm things work\r\n");
|
||||||
|
|
||||||
|
@ -1217,10 +1217,10 @@ void testSparkReverseOrderBug319(void) {
|
||||||
|
|
||||||
assertEqualsM("RPM#4", 3000, eth.engine.rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_F));
|
assertEqualsM("RPM#4", 3000, eth.engine.rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_F));
|
||||||
|
|
||||||
assertEqualsM("out-of-order #7", 0, enginePins.coils[3].outOfOrderCounter);
|
assertEqualsM("out-of-order #7", 0, enginePins.coils[3].outOfOrder);
|
||||||
|
|
||||||
timeNow += MS2US(20);
|
timeNow += MS2US(20);
|
||||||
eth.firePrimaryTriggerFall();
|
eth.firePrimaryTriggerFall();
|
||||||
schedulingQueue.executeAll(timeNow);
|
schedulingQueue.executeAll(timeNow);
|
||||||
assertEqualsM("out-of-order #8", 0, enginePins.coils[3].outOfOrderCounter);
|
assertEqualsM("out-of-order #8", 0, enginePins.coils[3].outOfOrder);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue