decouple MAP sampling from trigger central

This commit is contained in:
Matthew Kennedy 2024-08-28 01:19:53 -07:00
parent 436a7fc805
commit 7ffbaf4e5e
4 changed files with 9 additions and 11 deletions

View File

@ -30,6 +30,7 @@
#if EFI_ENGINE_CONTROL && EFI_SHAFT_POSITION_INPUT
#include "spark_logic.h"
#include "map_averaging.h"
static void handleFuel(efitick_t nowNt, float currentPhase, float nextPhase) {
ScopePerf perf(PE::HandleFuel);
@ -113,6 +114,12 @@ void mainTriggerCallback(uint32_t trgEventIndex, efitick_t edgeTimestamp, angle_
* For spark we schedule both start of coil charge and actual spark based on trigger angle
*/
onTriggerEventSparkLogic(rpm, edgeTimestamp, currentPhase, nextPhase);
#if !EFI_UNIT_TEST
#if EFI_MAP_AVERAGING
mapAveragingTriggerCallback(trgEventIndex, edgeTimestamp, currentPhase, nextPhase);
#endif /* EFI_MAP_AVERAGING */
#endif /* EFI_UNIT_TEST */
}
#endif /* EFI_ENGINE_CONTROL */

View File

@ -23,8 +23,6 @@
#include "pch.h"
#if EFI_MAP_AVERAGING
#include "map_averaging.h"
@ -217,7 +215,7 @@ void refreshMapAveragingPreCalc() {
* Shaft Position callback used to schedule start and end of MAP averaging
*/
void mapAveragingTriggerCallback(
uint32_t index, efitick_t edgeTimestamp) {
uint32_t index, efitick_t edgeTimestamp, angle_t currentPhase, angle_t nextPhase) {
#if EFI_ENGINE_CONTROL
// update only once per engine cycle
if (index != 0) {

View File

@ -19,7 +19,7 @@ void initMapAveraging();
void refreshMapAveragingPreCalc();
void mapAveragingTriggerCallback(
uint32_t index, efitick_t edgeTimestamp);
uint32_t index, efitick_t edgeTimestamp, angle_t currentPhase, angle_t nextPhase);
#if EFI_TUNER_STUDIO
void postMapState(TunerStudioOutputChannels *tsOutputChannels);

View File

@ -18,7 +18,6 @@
#include "trigger_simulator.h"
#include "trigger_emulator_algo.h"
#include "map_averaging.h"
#include "main_trigger_callback.h"
#include "status_loop.h"
#include "engine_sniffer.h"
@ -645,12 +644,6 @@ void TriggerCentral::handleShaftSignal(trigger_event_e signal, efitick_t timesta
// Schedule the TDC mark
tdcMarkCallback(triggerIndexForListeners, timestamp);
#if !EFI_UNIT_TEST
#if EFI_MAP_AVERAGING
mapAveragingTriggerCallback(triggerIndexForListeners, timestamp);
#endif /* EFI_MAP_AVERAGING */
#endif /* EFI_UNIT_TEST */
#if EFI_LOGIC_ANALYZER
waTriggerEventListener(signal, triggerIndexForListeners, timestamp);
#endif