diff --git a/firmware/Doxyfile b/firmware/Doxyfile index 31884e2b81..24c2626799 100644 --- a/firmware/Doxyfile +++ b/firmware/Doxyfile @@ -404,13 +404,13 @@ EXTRACT_ALL = YES # be included in the documentation. # The default value is: NO. -EXTRACT_PRIVATE = NO +EXTRACT_PRIVATE = YES # If the EXTRACT_PACKAGE tag is set to YES all members with package or internal # scope will be included in the documentation. # The default value is: NO. -EXTRACT_PACKAGE = NO +EXTRACT_PACKAGE = YES # If the EXTRACT_STATIC tag is set to YES all static members of a file will be # included in the documentation. diff --git a/firmware/console/status_loop.cpp b/firmware/console/status_loop.cpp index 200c716166..7dc435e51b 100644 --- a/firmware/console/status_loop.cpp +++ b/firmware/console/status_loop.cpp @@ -610,7 +610,7 @@ void updateTunerStudioState(TunerStudioOutputChannels *tsOutputChannels DECLARE_ tsOutputChannels->wallFuelAmount = wallFuel.getWallFuel(0); tsOutputChannels->wallFuelCorrection = engine->wallFuelCorrection; // TPS acceleration - tsOutputChannels->deltaTps = engine->tpsAccelEnrichment.getDelta(); + tsOutputChannels->deltaTps = engine->tpsAccelEnrichment.getMaxDelta(); tsOutputChannels->tpsAccelFuel = engine->engineState.tpsAccelEnrich; // engine load acceleration tsOutputChannels->engineLoadAccelDelta = engine->engineLoadAccelEnrichment.getEngineLoadEnrichment(PASS_ENGINE_PARAMETER_F) * 100 / getMap(); diff --git a/firmware/controllers/algo/accel_enrichment.cpp b/firmware/controllers/algo/accel_enrichment.cpp index 07c734e2c7..b5875658e7 100644 --- a/firmware/controllers/algo/accel_enrichment.cpp +++ b/firmware/controllers/algo/accel_enrichment.cpp @@ -65,7 +65,7 @@ floatms_t WallFuel::getWallFuel(int injectorIndex) { return wallFuel[injectorIndex]; } -float AccelEnrichmemnt::getDelta() { +float AccelEnrichmemnt::getMaxDelta() { if (cb.getCount() == 0) return 0; // no recent data return cb.maxValue(cb.getSize()); @@ -73,7 +73,7 @@ float AccelEnrichmemnt::getDelta() { // todo: eliminate code duplication between these two methods! Some pointer magic would help. floatms_t AccelEnrichmemnt::getTpsEnrichment(DECLARE_ENGINE_PARAMETER_F) { - float d = getDelta(); + float d = getMaxDelta(); if (d > engineConfiguration->tpsAccelEnrichmentThreshold) { return d * engineConfiguration->tpsAccelEnrichmentMultiplier; } @@ -84,7 +84,7 @@ floatms_t AccelEnrichmemnt::getTpsEnrichment(DECLARE_ENGINE_PARAMETER_F) { } float AccelEnrichmemnt::getEngineLoadEnrichment(DECLARE_ENGINE_PARAMETER_F) { - float d = getDelta(); + float d = getMaxDelta(); if (d > engineConfiguration->engineLoadAccelEnrichmentThreshold) { return d * engineConfiguration->engineLoadAccelEnrichmentMultiplier; } @@ -96,18 +96,20 @@ float AccelEnrichmemnt::getEngineLoadEnrichment(DECLARE_ENGINE_PARAMETER_F) { void AccelEnrichmemnt::reset() { cb.clear(); - delta = 0; - currentValue = NAN; + previousValue = NAN; } void AccelEnrichmemnt::onNewValue(float currentValue DECLARE_ENGINE_PARAMETER_S) { - if (!cisnan(this->currentValue)) { - delta = currentValue - this->currentValue; + if (!cisnan(previousValue)) { + /** + * this could be negative, zero or positive + */ + float delta = currentValue - previousValue; FuelSchedule *fs = engine->engineConfiguration2->injectionEvents; cb.add(delta * fs->eventsCount); } - this->currentValue = currentValue; + previousValue = currentValue; } void AccelEnrichmemnt::onEngineCycleTps(DECLARE_ENGINE_PARAMETER_F) { diff --git a/firmware/controllers/algo/accel_enrichment.h b/firmware/controllers/algo/accel_enrichment.h index 82daa8118c..0046073c4a 100644 --- a/firmware/controllers/algo/accel_enrichment.h +++ b/firmware/controllers/algo/accel_enrichment.h @@ -27,17 +27,16 @@ public: * @return Extra fuel squirt duration for TPS acceleration */ floatms_t getTpsEnrichment(DECLARE_ENGINE_PARAMETER_F); - float getDelta(); + float getMaxDelta(); void onEngineCycle(DECLARE_ENGINE_PARAMETER_F); void onEngineCycleTps(DECLARE_ENGINE_PARAMETER_F); void reset(); - float delta; cyclic_buffer cb; + void onNewValue(float currentValue DECLARE_ENGINE_PARAMETER_S); private: - float currentValue; - void onNewValue(float currentValue DECLARE_ENGINE_PARAMETER_S); + float previousValue; }; class WallFuel { @@ -52,7 +51,7 @@ public: void reset(); private: /** - * Amount of fuel on the wall, in injector open time scale, for specific injector. + * Amount of fuel on the wall, in ms of injector open time, for specific injector. */ floatms_t wallFuel[INJECTION_PIN_COUNT]; }; diff --git a/firmware/controllers/trigger/main_trigger_callback.cpp b/firmware/controllers/trigger/main_trigger_callback.cpp index 77ed36d24f..9ce2830fac 100644 --- a/firmware/controllers/trigger/main_trigger_callback.cpp +++ b/firmware/controllers/trigger/main_trigger_callback.cpp @@ -176,7 +176,7 @@ static ALWAYS_INLINE void handleFuel(bool limitedFuel, uint32_t eventIndex, int if (!fs->hasEvents[eventIndex]) return; - ENGINE(tpsAccelEnrichment.onEngineCycleTps(PASS_ENGINE_PARAMETER_F)); + ENGINE(tpsAccelEnrichment.onNewValue(getTPS(PASS_ENGINE_PARAMETER_F) PASS_ENGINE_PARAMETER)); ENGINE(engineLoadAccelEnrichment.onEngineCycle(PASS_ENGINE_PARAMETER_F)); ENGINE(fuelMs) = getFuelMs(rpm PASS_ENGINE_PARAMETER) * CONFIG(globalFuelCorrection);