This commit is contained in:
parent
d28eeaaac2
commit
7fe5edf5e2
|
@ -20,7 +20,11 @@ class Engine;
|
|||
|
||||
#define HW_EVENT_TYPES 6
|
||||
|
||||
// todo: maybe merge TriggerCentral and TriggerState classes into one class?
|
||||
/**
|
||||
* Maybe merge TriggerCentral and TriggerState classes into one class?
|
||||
* Probably not: we have an instance of TriggerState which is used for trigger initialization,
|
||||
* also composition probably better than inheritance here
|
||||
*/
|
||||
class TriggerCentral {
|
||||
public:
|
||||
TriggerCentral();
|
||||
|
@ -28,7 +32,7 @@ public:
|
|||
void handleShaftSignal(trigger_event_e signal DECLARE_ENGINE_PARAMETER_SUFFIX);
|
||||
int getHwEventCounter(int index);
|
||||
void resetCounters();
|
||||
TriggerState triggerState;
|
||||
TriggerStateWithRunningStatistics triggerState;
|
||||
efitick_t nowNt;
|
||||
angle_t vvtPosition;
|
||||
/**
|
||||
|
|
|
@ -398,6 +398,8 @@ void TriggerState::decodeTriggerEvent(trigger_event_e const signal, efitime_t no
|
|||
}
|
||||
}
|
||||
|
||||
runtimeStatistics();
|
||||
|
||||
if (ENGINE(sensorChartMode) == SC_RPM_ACCEL || ENGINE(sensorChartMode) == SC_DETAILED_RPM) {
|
||||
angle_t currentAngle = TRIGGER_SHAPE(eventAngles[currentCycle.current_index]);
|
||||
// todo: make this '90' depend on cylinder count?
|
||||
|
|
|
@ -82,11 +82,6 @@ public:
|
|||
uint32_t prevTotalTime[PWM_PHASE_MAX_WAVE_PER_PWM];
|
||||
int expectedTotalTime[PWM_PHASE_MAX_WAVE_PER_PWM];
|
||||
|
||||
// we need two instances of TriggerState
|
||||
// todo: re-imiplement as a sub-class to reduce memory consumption
|
||||
// uint32_t timeOfLastEvent[PWM_PHASE_MAX_COUNT];
|
||||
// float instantRpmValue[PWM_PHASE_MAX_COUNT];
|
||||
|
||||
/**
|
||||
* how many times since ECU reboot we had unexpected number of teeth in trigger cycle
|
||||
*/
|
||||
|
@ -98,6 +93,8 @@ public:
|
|||
void reset();
|
||||
void resetRunningCounters();
|
||||
|
||||
virtual void runtimeStatistics();
|
||||
|
||||
uint32_t runningRevolutionCounter;
|
||||
/**
|
||||
* this is start of real trigger cycle
|
||||
|
@ -115,6 +112,13 @@ private:
|
|||
efitime_t prevCycleDuration;
|
||||
};
|
||||
|
||||
class TriggerStateWithRunningStatistics : public TriggerState {
|
||||
public:
|
||||
uint32_t timeOfLastEvent[PWM_PHASE_MAX_COUNT];
|
||||
float instantRpmValue[PWM_PHASE_MAX_COUNT];
|
||||
virtual void runtimeStatistics();
|
||||
};
|
||||
|
||||
angle_t getEngineCycle(operation_mode_e operationMode);
|
||||
uint32_t findTriggerZeroEventIndex(TriggerState *state, TriggerShape * shape, trigger_config_s const*triggerConfig DECLARE_ENGINE_PARAMETER_SUFFIX);
|
||||
|
||||
|
|
|
@ -205,6 +205,14 @@ void TriggerState::resetRunningCounters() {
|
|||
runningOrderingErrorCounter = 0;
|
||||
}
|
||||
|
||||
void TriggerState::runtimeStatistics() {
|
||||
// empty base implementation
|
||||
}
|
||||
|
||||
void TriggerStateWithRunningStatistics::runtimeStatistics() {
|
||||
// empty base implementation
|
||||
}
|
||||
|
||||
efitime_t TriggerState::getTotalEventCounter() {
|
||||
return totalEventCountBase + currentCycle.current_index;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue