minor trigger refactoring
This commit is contained in:
parent
8bcbb2b9b1
commit
2d96fb3ef6
|
@ -313,11 +313,11 @@ void Engine::OnTriggerSynchronizationLost() {
|
||||||
// Needed for early instant-RPM detection
|
// Needed for early instant-RPM detection
|
||||||
rpmCalculator.setStopSpinning();
|
rpmCalculator.setStopSpinning();
|
||||||
|
|
||||||
triggerCentral.triggerState.resetTriggerState();
|
triggerCentral.triggerState.resetState();
|
||||||
|
|
||||||
for (size_t i = 0; i < efi::size(triggerCentral.vvtState); i++) {
|
for (size_t i = 0; i < efi::size(triggerCentral.vvtState); i++) {
|
||||||
for (size_t j = 0; j < efi::size(triggerCentral.vvtState[0]); j++) {
|
for (size_t j = 0; j < efi::size(triggerCentral.vvtState[0]); j++) {
|
||||||
triggerCentral.vvtState[i][j].resetTriggerState();
|
triggerCentral.vvtState[i][j].resetState();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,7 +47,7 @@ TriggerCentral::TriggerCentral() :
|
||||||
triggerState("TRG")
|
triggerState("TRG")
|
||||||
{
|
{
|
||||||
memset(&hwEventCounters, 0, sizeof(hwEventCounters));
|
memset(&hwEventCounters, 0, sizeof(hwEventCounters));
|
||||||
triggerState.resetTriggerState();
|
triggerState.resetState();
|
||||||
noiseFilter.resetAccumSignalData();
|
noiseFilter.resetAccumSignalData();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -57,7 +57,7 @@
|
||||||
TriggerDecoderBase::TriggerDecoderBase(const char* name)
|
TriggerDecoderBase::TriggerDecoderBase(const char* name)
|
||||||
: name(name)
|
: name(name)
|
||||||
{
|
{
|
||||||
resetTriggerState();
|
resetState();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TriggerDecoderBase::getShaftSynchronized() {
|
bool TriggerDecoderBase::getShaftSynchronized() {
|
||||||
|
@ -77,7 +77,7 @@ void TriggerDecoderBase::setShaftSynchronized(bool value) {
|
||||||
shaft_is_synchronized = value;
|
shaft_is_synchronized = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TriggerDecoderBase::resetTriggerState() {
|
void TriggerDecoderBase::resetState() {
|
||||||
setShaftSynchronized(false);
|
setShaftSynchronized(false);
|
||||||
toothed_previous_time = 0;
|
toothed_previous_time = 0;
|
||||||
|
|
||||||
|
@ -195,8 +195,8 @@ int TriggerDecoderBase::getCrankSynchronizationCounter() const {
|
||||||
return crankSynchronizationCounter;
|
return crankSynchronizationCounter;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PrimaryTriggerDecoder::resetTriggerState() {
|
void PrimaryTriggerDecoder::resetState() {
|
||||||
TriggerDecoderBase::resetTriggerState();
|
TriggerDecoderBase::resetState();
|
||||||
|
|
||||||
prevInstantRpmValue = 0;
|
prevInstantRpmValue = 0;
|
||||||
m_instantRpm = 0;
|
m_instantRpm = 0;
|
||||||
|
@ -831,7 +831,7 @@ uint32_t TriggerDecoderBase::findTriggerZeroEventIndex(
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
resetTriggerState();
|
resetState();
|
||||||
|
|
||||||
if (shape.shapeDefinitionError) {
|
if (shape.shapeDefinitionError) {
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -139,7 +139,7 @@ public:
|
||||||
uint32_t totalTriggerErrorCounter;
|
uint32_t totalTriggerErrorCounter;
|
||||||
uint32_t orderingErrorCounter;
|
uint32_t orderingErrorCounter;
|
||||||
|
|
||||||
virtual void resetTriggerState();
|
virtual void resetState();
|
||||||
void setShaftSynchronized(bool value);
|
void setShaftSynchronized(bool value);
|
||||||
bool getShaftSynchronized();
|
bool getShaftSynchronized();
|
||||||
|
|
||||||
|
@ -188,7 +188,7 @@ private:
|
||||||
class PrimaryTriggerDecoder : public TriggerDecoderBase, public trigger_state_primary_s {
|
class PrimaryTriggerDecoder : public TriggerDecoderBase, public trigger_state_primary_s {
|
||||||
public:
|
public:
|
||||||
PrimaryTriggerDecoder(const char* name);
|
PrimaryTriggerDecoder(const char* name);
|
||||||
void resetTriggerState() override;
|
void resetState() override;
|
||||||
|
|
||||||
void resetHasFullSync() {
|
void resetHasFullSync() {
|
||||||
// If this trigger doesn't need disambiguation, we already have phase sync
|
// If this trigger doesn't need disambiguation, we already have phase sync
|
||||||
|
|
Loading…
Reference in New Issue