better unit test logging

This commit is contained in:
rusefi 2020-07-20 13:38:33 -04:00
parent 117e98b753
commit 097ca21626
4 changed files with 29 additions and 13 deletions

View File

@ -97,7 +97,9 @@ void InjectorOutputPin::open() {
overlappingCounter++;
#if FUEL_MATH_EXTREME_LOGGING
if (printFuelDebug) {
printf("turnInjectionPinHigh %s %d %d\r\n", name, overlappingCounter, (int)getTimeNowUs());
}
#endif /* FUEL_MATH_EXTREME_LOGGING */
if (overlappingCounter > 1) {
@ -106,7 +108,9 @@ void InjectorOutputPin::open() {
// * this is another kind of overlap which happens in case of a small duty cycle after a large duty cycle
// */
#if FUEL_MATH_EXTREME_LOGGING
printf("overlapping, no need to touch pin %s %d\r\n", output->name, (int)getTimeNowUs());
if (printFuelDebug) {
printf("overlapping, no need to touch pin %s %d\r\n", name, (int)getTimeNowUs());
}
#endif /* FUEL_MATH_EXTREME_LOGGING */
} else {
setHigh();
@ -135,13 +139,17 @@ void turnInjectionPinHigh(InjectionEvent *event) {
void InjectorOutputPin::close() {
#if FUEL_MATH_EXTREME_LOGGING
if (printFuelDebug) {
printf("InjectorOutputPin::close %s %d %d\r\n", name, overlappingCounter, (int)getTimeNowUs());
}
#endif /* FUEL_MATH_EXTREME_LOGGING */
overlappingCounter--;
if (overlappingCounter > 0) {
#if FUEL_MATH_EXTREME_LOGGING
if (printFuelDebug) {
printf("was overlapping, no need to touch pin %s %d\r\n", name, (int)getTimeNowUs());
}
#endif /* FUEL_MATH_EXTREME_LOGGING */
} else {
setLow();
@ -315,7 +323,9 @@ static ALWAYS_INLINE void handleFuel(const bool limitedFuel, uint32_t trgEventIn
}
#if FUEL_MATH_EXTREME_LOGGING
if (printFuelDebug) {
scheduleMsg(logger, "handleFuel ind=%d %d", trgEventIndex, getRevolutionCounter());
}
#endif /* FUEL_MATH_EXTREME_LOGGING */
ENGINE(tpsAccelEnrichment.onNewValue(Sensor::get(SensorType::Tps1).value_or(0) PASS_ENGINE_PARAMETER_SUFFIX));

View File

@ -25,6 +25,10 @@ EXTERN_ENGINE;
extern bool verboseMode;
#endif /* EFI_UNIT_TEST */
#if EFI_PRINTF_FUEL_DETAILS || FUEL_MATH_EXTREME_LOGGING
extern bool printFuelDebug;
#endif // EFI_PRINTF_FUEL_DETAILS
static cyclic_buffer<int> ignitionErrorDetection;
static Logging *logger;
@ -47,7 +51,7 @@ static void fireSparkBySettingPinLow(IgnitionEvent *event, IgnitionOutputPin *ou
#if SPARK_EXTREME_LOGGING
scheduleMsg(logger, "spark goes low %d %s %d current=%d cnt=%d id=%d", getRevolutionCounter(), output->name, (int)getTimeNowUs(),
output->currentLogicValue, output->outOfOrder, event->sparkId);
#endif /* FUEL_MATH_EXTREME_LOGGING */
#endif /* SPARK_EXTREME_LOGGING */
/**
* there are two kinds of 'out-of-order'
@ -119,7 +123,9 @@ static void prepareCylinderIgnitionSchedule(angle_t dwellAngleDuration, floatms_
event->dwellPosition.setAngle(dwellStartAngle PASS_ENGINE_PARAMETER_SUFFIX);
#if FUEL_MATH_EXTREME_LOGGING
if (printFuelDebug) {
printf("addIgnitionEvent %s ind=%d\n", output->name, event->dwellPosition.triggerEventIndex);
}
// scheduleMsg(logger, "addIgnitionEvent %s ind=%d", output->name, event->dwellPosition->eventIndex);
#endif /* FUEL_MATH_EXTREME_LOGGING */
}
@ -223,7 +229,7 @@ static void startDwellByTurningSparkPinHigh(IgnitionEvent *event, IgnitionOutput
#if SPARK_EXTREME_LOGGING
scheduleMsg(logger, "spark goes high %d %s %d current=%d cnt=%d id=%d", getRevolutionCounter(), output->name, (int)getTimeNowUs(),
output->currentLogicValue, output->outOfOrder, event->sparkId);
#endif /* FUEL_MATH_EXTREME_LOGGING */
#endif /* SPARK_EXTREME_LOGGING */
if (output->outOfOrder) {
output->outOfOrder = false;
@ -308,7 +314,7 @@ bool scheduleOrQueue(AngleBasedEvent *event,
if (isPending) {
#if SPARK_EXTREME_LOGGING
scheduleMsg(logger, "isPending thus not adding to queue index=%d rev=%d now=%d", trgEventIndex, getRevolutionCounter(), (int)getTimeNowUs());
#endif /* FUEL_MATH_EXTREME_LOGGING */
#endif /* SPARK_EXTREME_LOGGING */
} else {
LL_APPEND2(ENGINE(angleBasedEventsHead), event, nextToothEvent);
}
@ -350,7 +356,7 @@ static ALWAYS_INLINE void handleSparkEvent(bool limitedSpark, uint32_t trgEventI
#if SPARK_EXTREME_LOGGING
scheduleMsg(logger, "scheduling sparkUp ind=%d %d %s now=%d %d later id=%d", trgEventIndex, getRevolutionCounter(), event->getOutputForLoggins()->name, (int)getTimeNowUs(), (int)chargeDelayUs,
event->sparkId);
#endif /* FUEL_MATH_EXTREME_LOGGING */
#endif /* SPARK_EXTREME_LOGGING */
/**
@ -382,7 +388,7 @@ static ALWAYS_INLINE void handleSparkEvent(bool limitedSpark, uint32_t trgEventI
} else {
#if SPARK_EXTREME_LOGGING
scheduleMsg(logger, "to queue sparkDown ind=%d %d %s now=%d for id=%d", trgEventIndex, getRevolutionCounter(), event->getOutputForLoggins()->name, (int)getTimeNowUs(), event->sparkEvent.position.triggerEventIndex);
#endif /* FUEL_MATH_EXTREME_LOGGING */
#endif /* SPARK_EXTREME_LOGGING */
}
@ -461,7 +467,7 @@ static void scheduleAllSparkEventsUntilNextTriggerTooth(uint32_t trgEventIndex,
#if SPARK_EXTREME_LOGGING
scheduleMsg(logger, "time to invoke ind=%d %d %d", trgEventIndex, getRevolutionCounter(), (int)getTimeNowUs());
#endif /* FUEL_MATH_EXTREME_LOGGING */
#endif /* SPARK_EXTREME_LOGGING */
scheduleByAngle(
sDown,

View File

@ -480,7 +480,7 @@ void TriggerCentral::handleShaftSignal(trigger_event_e signal, efitick_t timesta
#if TRIGGER_EXTREME_LOGGING
scheduleMsg(logger, "trigger %d %d %d", triggerIndexForListeners, getRevolutionCounter(), (int)getTimeNowUs());
#endif /* FUEL_MATH_EXTREME_LOGGING */
#endif /* TRIGGER_EXTREME_LOGGING */
/**
* Here we invoke all the listeners - the main engine control logic is inside these listeners

View File

@ -36,7 +36,7 @@
#define EFI_GPIO_HARDWARE TRUE
#define FUEL_MATH_EXTREME_LOGGING FALSE
#define FUEL_MATH_EXTREME_LOGGING TRUE
#define EFI_DEFAILED_LOGGING FALSE