auto-sync
This commit is contained in:
parent
8fa63683b8
commit
f7c0d4ee5b
|
@ -82,6 +82,8 @@
|
|||
|
||||
#define SPARK_EXTREME_LOGGING FALSE
|
||||
|
||||
#define TRIGGER_EXTREME_LOGGING FALSE
|
||||
|
||||
#define EFI_INTERNAL_FLASH TRUE
|
||||
|
||||
/**
|
||||
|
|
|
@ -133,7 +133,9 @@ static void prepareThermistorCurve(thermistor_conf_s *tc, thermistor_curve_s * c
|
|||
float T1 = tc->tempC_1 + KELV;
|
||||
float T2 = tc->tempC_2 + KELV;
|
||||
float T3 = tc->tempC_3 + KELV;
|
||||
#if EXTREME_TERM_LOGGING || defined(__DOXYGEN__)
|
||||
scheduleMsg(logger, "T1=%..100000f/T2=%..100000f/T3=%..100000f", T1, T2, T3);
|
||||
#endif
|
||||
|
||||
float L1 = logf(tc->resistance_1);
|
||||
if (L1 == tc->resistance_1) {
|
||||
|
@ -141,27 +143,31 @@ static void prepareThermistorCurve(thermistor_conf_s *tc, thermistor_curve_s * c
|
|||
}
|
||||
float L2 = logf(tc->resistance_2);
|
||||
float L3 = logf(tc->resistance_3);
|
||||
#if EXTREME_TERM_LOGGING || defined(__DOXYGEN__)
|
||||
scheduleMsg(logger, "R1=%..100000f/R2=%..100000f/R3=%..100000f", tc->resistance_1, tc->resistance_2,
|
||||
tc->resistance_3);
|
||||
scheduleMsg(logger, "L1=%..100000f/L2=%..100000f/L3=%..100000f", L1, L2, L3);
|
||||
#endif
|
||||
|
||||
float Y1 = 1 / T1;
|
||||
float Y2 = 1 / T2;
|
||||
float Y3 = 1 / T3;
|
||||
|
||||
scheduleMsg(logger, "Y1=%..100000f/Y2=%..100000f/Y3=%..100000f", Y1, Y2, Y3);
|
||||
|
||||
float U2 = (Y2 - Y1) / (L2 - L1);
|
||||
float U3 = (Y3 - Y1) / (L3 - L1);
|
||||
|
||||
scheduleMsg(logger, "U2=%..100000f/U3=%..100000f", U2, U3);
|
||||
|
||||
curve->s_h_c = (U3 - U2) / (L3 - L2) * pow(L1 + L2 + L3, -1);
|
||||
curve->s_h_b = U2 - curve->s_h_c * (L1 * L1 + L1 * L2 + L2 * L2);
|
||||
curve->s_h_a = Y1 - (curve->s_h_b + L1 * L1 * curve->s_h_c) * L1;
|
||||
|
||||
#if EXTREME_TERM_LOGGING || defined(__DOXYGEN__)
|
||||
scheduleMsg(logger, "Y1=%..100000f/Y2=%..100000f/Y3=%..100000f", Y1, Y2, Y3);
|
||||
scheduleMsg(logger, "U2=%..100000f/U3=%..100000f", U2, U3);
|
||||
scheduleMsg(logger, "s_h_c=%..100000f/s_h_b=%..100000f/s_h_a=%..100000f", curve->s_h_c, curve->s_h_b,
|
||||
curve->s_h_a);
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -84,7 +84,7 @@ static ALWAYS_INLINE void handleSparkEvent(bool limitedSpark, uint32_t trgEventI
|
|||
#endif
|
||||
|
||||
#if SPARK_EXTREME_LOGGING || defined(__DOXYGEN__)
|
||||
scheduleMsg(logger, "sparkUp ind=%d %d %s %d", trgEventIndex, getRevolutionCounter(), iEvent->output->name, (int)getTimeNowUs());
|
||||
scheduleMsg(logger, "scheduling sparkUp ind=%d %d %s %d %d later", trgEventIndex, getRevolutionCounter(), iEvent->output->name, (int)getTimeNowUs(), (int)chargeDelayUs);
|
||||
#endif /* FUEL_MATH_EXTREME_LOGGING */
|
||||
|
||||
/**
|
||||
|
@ -107,17 +107,17 @@ static ALWAYS_INLINE void handleSparkEvent(bool limitedSpark, uint32_t trgEventI
|
|||
float timeTillIgnitionUs = ENGINE(rpmCalculator.oneDegreeUs) * iEvent->sparkPosition.angleOffset;
|
||||
|
||||
#if EFI_UNIT_TEST || defined(__DOXYGEN__)
|
||||
printf("spark delay=%f angle=%f\r\n", timeTillIgnitionUs, iEvent->sparkPosition.angleOffset);
|
||||
printf("spark delay=%f angle=%f\r\n", timeTillIgnitionUs, iEvent->sparkPosition.angleOffset);
|
||||
#endif
|
||||
|
||||
#if SPARK_EXTREME_LOGGING || defined(__DOXYGEN__)
|
||||
scheduleMsg(logger, "scheduling sparkDown ind=%d %d %s %d", trgEventIndex, getRevolutionCounter(), iEvent->output->name, (int)getTimeNowUs());
|
||||
scheduleMsg(logger, "scheduling sparkDown ind=%d %d %s %d %d later", trgEventIndex, getRevolutionCounter(), iEvent->output->name, (int)getTimeNowUs(), (int)timeTillIgnitionUs);
|
||||
#endif /* FUEL_MATH_EXTREME_LOGGING */
|
||||
|
||||
scheduleTask(true, "spark1 down", sDown, (int) timeTillIgnitionUs, (schfunc_t) &turnSparkPinLow, iEvent->output);
|
||||
scheduleTask(true, "spark1 down", sDown, (int) timeTillIgnitionUs, (schfunc_t) &turnSparkPinLow, iEvent->output);
|
||||
} else {
|
||||
#if SPARK_EXTREME_LOGGING || defined(__DOXYGEN__)
|
||||
scheduleMsg(logger, "to queue sparkDown ind=%d %d %s %d", trgEventIndex, getRevolutionCounter(), iEvent->output->name, (int)getTimeNowUs());
|
||||
scheduleMsg(logger, "to queue sparkDown ind=%d %d %s %d for %d", trgEventIndex, getRevolutionCounter(), iEvent->output->name, (int)getTimeNowUs(), iEvent->sparkPosition.eventIndex);
|
||||
#endif /* FUEL_MATH_EXTREME_LOGGING */
|
||||
/**
|
||||
* Spark should be scheduled in relation to some future trigger event, this way we get better firing precision
|
||||
|
@ -125,7 +125,7 @@ static ALWAYS_INLINE void handleSparkEvent(bool limitedSpark, uint32_t trgEventI
|
|||
bool isPending = assertNotInList<IgnitionEvent>(ENGINE(iHead), iEvent);
|
||||
if (isPending) {
|
||||
#if SPARK_EXTREME_LOGGING || defined(__DOXYGEN__)
|
||||
scheduleMsg(logger, "not adding to queue sparkDown ind=%d %d %s %d", trgEventIndex, getRevolutionCounter(), iEvent->output->name, (int)getTimeNowUs());
|
||||
scheduleMsg(logger, "not adding to queue sparkDown ind=%d %d %s %d", trgEventIndex, getRevolutionCounter(), iEvent->output->name, (int)getTimeNowUs());
|
||||
#endif /* FUEL_MATH_EXTREME_LOGGING */
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -236,6 +236,10 @@ void TriggerCentral::handleShaftSignal(trigger_event_e signal DECLARE_ENGINE_PAR
|
|||
}
|
||||
|
||||
if (triggerState.isValidIndex(PASS_ENGINE_PARAMETER_F)) {
|
||||
#if TRIGGER_EXTREME_LOGGING || defined(__DOXYGEN__)
|
||||
scheduleMsg(logger, "trigger %d %d %d", triggerIndexForListeners, getRevolutionCounter(), (int)getTimeNowUs());
|
||||
#endif /* FUEL_MATH_EXTREME_LOGGING */
|
||||
|
||||
/**
|
||||
* Here we invoke all the listeners - the main engine control logic is inside these listeners
|
||||
*/
|
||||
|
|
|
@ -1109,3 +1109,40 @@ void testFuelSchedulerBug299smallAndLarge(void) {
|
|||
timeNow += MS2US(20);
|
||||
schedulingQueue.executeAll(timeNow);
|
||||
}
|
||||
|
||||
void testSparkReverseOrderBug319(void) {
|
||||
printf("*************************************************** testSparkReverseOrderBug319 small to medium\r\n");
|
||||
|
||||
EngineTestHelper eth(TEST_ENGINE);
|
||||
EXPAND_EngineTestHelper
|
||||
|
||||
engineConfiguration->isInjectionEnabled = false;
|
||||
engineConfiguration->specs.cylindersCount = 4;
|
||||
engineConfiguration->ignitionMode = IM_INDIVIDUAL_COILS;
|
||||
|
||||
engineConfiguration->trigger.type = TT_ONE;
|
||||
|
||||
|
||||
timeNow = 0;
|
||||
setWholeTimingTable(0 PASS_ENGINE_PARAMETER);
|
||||
|
||||
timeNow += MS2US(20);
|
||||
eth.firePrimaryTriggerRise();
|
||||
|
||||
timeNow += MS2US(20);
|
||||
eth.firePrimaryTriggerFall();
|
||||
|
||||
schedulingQueue.executeAll(timeNow);
|
||||
|
||||
timeNow += MS2US(20);
|
||||
eth.firePrimaryTriggerRise();
|
||||
|
||||
timeNow += MS2US(20);
|
||||
eth.firePrimaryTriggerFall();
|
||||
|
||||
assertEqualsM("queue size", 7, schedulingQueue.size());
|
||||
schedulingQueue.executeAll(timeNow);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
void testTriggerDecoder(void);
|
||||
void testFuelSchedulerBug299smallAndMedium(void);
|
||||
void testFuelSchedulerBug299smallAndLarge(void);
|
||||
void testSparkReverseOrderBug319(void);
|
||||
void testRpmCalculator(void);
|
||||
void testStartupFuelPumping(void);
|
||||
void test1995FordInline6TriggerDecoder(void);
|
||||
|
|
Loading…
Reference in New Issue