Skip to content

Commit

Permalink
tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
mck1117 committed Aug 29, 2024
1 parent 14c7013 commit 65809b1
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
10 changes: 6 additions & 4 deletions firmware/controllers/modules/map_averaging/map_averaging.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -214,10 +214,6 @@ void MapAveragingModule::onEnginePhase(float rpm,

ScopePerf perf(PE::MapAveragingTriggerCallback);

if (engineConfiguration->mapMinBufferLength != mapMinBufferLength) {
applyMapMinBufferLength();
}

int samplingCount = engineConfiguration->measureMapOnlyInOneCylinder ? 1 : engineConfiguration->cylindersCount;

for (int i = 0; i < samplingCount; i++) {
Expand All @@ -240,6 +236,12 @@ void MapAveragingModule::onEnginePhase(float rpm,
#endif
}

void MapAveragingModule::onConfigurationChange(engine_configuration_s const * previousConfig) {
if (!previousConfig || engineConfiguration->mapMinBufferLength != previousConfig->mapMinBufferLength) {
applyMapMinBufferLength();
}
}

void initMapAveraging() {
applyMapMinBufferLength();
}
Expand Down
2 changes: 2 additions & 0 deletions firmware/controllers/modules/map_averaging/map_averaging.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ MapAverager& getMapAvg(size_t idx);
class MapAveragingModule : public EngineModule {
public:
#if EFI_MAP_AVERAGING
void onConfigurationChange(engine_configuration_s const * previousConfig);

void onFastCallback() override;
void onEnginePhase(float rpm,
efitick_t edgeTimestamp,
Expand Down
1 change: 0 additions & 1 deletion simulator/simulator/rusEfiFunctionalTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
#include "sensor_chart.h"
#include "bench_test.h"
#include "tunerstudio.h"
#include "map_averaging.h"
#include "mmc_card.h"
#include "memstreams.h"
#include <chprintf.h>
Expand Down
1 change: 1 addition & 0 deletions unit_tests/engine_test_helper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ EngineTestHelper::EngineTestHelper(engine_type_e engineType, configuration_callb
initDataStructures();

resetConfigurationExt(configurationCallback, engineType);
engineConfiguration->isMapAveragingEnabled = false;

validateConfig();

Expand Down

0 comments on commit 65809b1

Please sign in to comment.