2018-12-31 13:00:41 -08:00
|
|
|
/*
|
2019-05-05 15:53:34 -07:00
|
|
|
* @file cdm_ion_sense.h
|
2018-12-31 13:00:41 -08:00
|
|
|
*
|
2019-05-05 15:53:34 -07:00
|
|
|
* @date Dec 31, 2018
|
2020-01-07 21:02:40 -08:00
|
|
|
* @author Andrey Belomutskiy, (c) 2012-2020
|
2018-12-31 13:00:41 -08:00
|
|
|
*/
|
|
|
|
|
2020-04-01 16:00:56 -07:00
|
|
|
#pragma once
|
2018-12-31 13:00:41 -08:00
|
|
|
|
|
|
|
#include "global.h"
|
2022-09-05 01:09:59 -07:00
|
|
|
#include "tunerstudio_outputs.h"
|
2018-12-31 13:00:41 -08:00
|
|
|
|
2019-01-04 20:47:39 -08:00
|
|
|
class CdmState {
|
|
|
|
public:
|
|
|
|
CdmState();
|
2019-05-05 15:53:34 -07:00
|
|
|
int totalCdmEvents = 0;
|
|
|
|
|
|
|
|
int accumilatingAtRevolution = -1;
|
2019-01-04 20:47:39 -08:00
|
|
|
/**
|
|
|
|
* accumulated value for engine cycle which is not over yet
|
|
|
|
*/
|
2019-05-05 15:53:34 -07:00
|
|
|
int accumulatingCurrentValue;
|
2019-01-04 20:47:39 -08:00
|
|
|
/**
|
|
|
|
* event counter for previous complete engine cycle
|
|
|
|
*/
|
2019-05-05 15:53:34 -07:00
|
|
|
int currentValue = 0;
|
|
|
|
int currentValueAtIndex = -1;
|
2019-01-04 20:47:39 -08:00
|
|
|
void onNewSignal(int currentRevolution);
|
2019-05-05 15:53:34 -07:00
|
|
|
void applyAccumulatedData(int currentRevolution);
|
|
|
|
int getValue(int currentRevolution);
|
2019-01-04 20:47:39 -08:00
|
|
|
};
|
|
|
|
|
2019-01-03 20:51:29 -08:00
|
|
|
#if EFI_TUNER_STUDIO
|
2018-12-31 13:00:41 -08:00
|
|
|
void ionPostState(TunerStudioOutputChannels *tsOutputChannels);
|
2019-01-03 20:51:29 -08:00
|
|
|
#endif
|
2018-12-31 13:00:41 -08:00
|
|
|
|
2019-01-04 20:47:39 -08:00
|
|
|
void cdmIonInit(void);
|
2019-05-05 15:53:34 -07:00
|
|
|
int getCurrentCdmValue(int currentRevolution);
|
2019-01-04 20:47:39 -08:00
|
|
|
|