tear down Engine god object #4511
This commit is contained in:
parent
752d986593
commit
ec0e567989
|
@ -205,7 +205,7 @@ void Engine::updateSlowSensors() {
|
|||
#if EFI_ENGINE_CONTROL
|
||||
int rpm = Sensor::getOrZero(SensorType::Rpm);
|
||||
triggerCentral.isEngineSnifferEnabled = rpm < engineConfiguration->engineSnifferRpmThreshold;
|
||||
sensorChartMode = rpm < engineConfiguration->sensorSnifferRpmThreshold ? engineConfiguration->sensorChartMode : SC_OFF;
|
||||
getEngineState()->sensorChartMode = rpm < engineConfiguration->sensorSnifferRpmThreshold ? engineConfiguration->sensorChartMode : SC_OFF;
|
||||
|
||||
engineState.updateSlowSensors();
|
||||
#endif
|
||||
|
|
|
@ -223,10 +223,6 @@ public:
|
|||
bool tdcMarkEnabled = true;
|
||||
#endif // EFI_UNIT_TEST
|
||||
|
||||
/**
|
||||
* this is based on sensorChartMode and sensorSnifferRpmThreshold settings
|
||||
*/
|
||||
sensor_chart_e sensorChartMode = SC_OFF;
|
||||
|
||||
bool slowCallBackWasInvoked = false;
|
||||
|
||||
|
|
|
@ -24,6 +24,11 @@ public:
|
|||
*/
|
||||
angle_t engineCycle;
|
||||
|
||||
/**
|
||||
* this is based on sensorChartMode and sensorSnifferRpmThreshold settings
|
||||
*/
|
||||
sensor_chart_e sensorChartMode = SC_OFF;
|
||||
|
||||
// Per-injection fuel mass, including TPS accel enrich
|
||||
float injectionMass[MAX_CYLINDER_COUNT] = {0};
|
||||
|
||||
|
|
|
@ -313,7 +313,7 @@ void rpmShaftPositionCallback(trigger_event_e ckpSignalType,
|
|||
#if EFI_SENSOR_CHART
|
||||
// this 'index==0' case is here so that it happens after cycle callback so
|
||||
// it goes into sniffer report into the first position
|
||||
if (engine->sensorChartMode == SC_TRIGGER) {
|
||||
if (getEngineState()->sensorChartMode == SC_TRIGGER) {
|
||||
angle_t crankAngle = engine->triggerCentral.getCurrentEnginePhase(nowNt).value_or(0);
|
||||
int signal = 1000 * ckpSignalType + trgEventIndex;
|
||||
scAddData(crankAngle, signal);
|
||||
|
|
|
@ -24,10 +24,38 @@
|
|||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "pch.h"
|
||||
|
||||
#include <rusefi/arrays.h>
|
||||
#include <rusefi/crc.h>
|
||||
#include <rusefi/fragments.h>
|
||||
#include <rusefi/interpolation.h>
|
||||
#include <rusefi/isnan.h>
|
||||
#include <rusefi/math.h>
|
||||
#include <rusefi/pt2001.h>
|
||||
|
||||
#include "global.h"
|
||||
#include "efifeatures.h"
|
||||
#include "rusefi_generated.h"
|
||||
#include "loggingcentral.h"
|
||||
#include "error_handling.h"
|
||||
#include "efi_gpio.h"
|
||||
#include "tunerstudio_outputs.h"
|
||||
#include "engine.h"
|
||||
#include "engine_configuration.h"
|
||||
#include "engine_controller.h"
|
||||
#include "engine_math.h"
|
||||
#include "pwm_generator_logic.h"
|
||||
#include "perf_trace.h"
|
||||
|
||||
|
||||
#include <rusefi/math.h>
|
||||
#include "trigger_central.h"
|
||||
#include "trigger_decoder.h"
|
||||
#include "global.h"
|
||||
#include "sensor.h"
|
||||
#include "error_handling.h"
|
||||
#include "engine_state.h"
|
||||
#include "engine_math.h"
|
||||
#include "loggingcentral.h"
|
||||
#include "obd_error_codes.h"
|
||||
#include "trigger_decoder.h"
|
||||
#include "cyclic_buffer.h"
|
||||
|
@ -324,7 +352,7 @@ void PrimaryTriggerDecoder::updateInstantRpm(
|
|||
|
||||
|
||||
#if EFI_SENSOR_CHART
|
||||
if (engine->sensorChartMode == SC_RPM_ACCEL || engine->sensorChartMode == SC_DETAILED_RPM) {
|
||||
if (getEngineState()->sensorChartMode == SC_RPM_ACCEL || getEngineState()->sensorChartMode == SC_DETAILED_RPM) {
|
||||
angle_t currentAngle = triggerFormDetails->eventAngles[currentCycle.current_index];
|
||||
if (engineConfiguration->sensorChartMode == SC_DETAILED_RPM) {
|
||||
scAddData(currentAngle, m_instantRpm);
|
||||
|
@ -415,16 +443,16 @@ void PrimaryTriggerDecoder::onTriggerError() {
|
|||
|
||||
void PrimaryTriggerDecoder::onNotEnoughTeeth(int /*actual*/, int /*expected*/) {
|
||||
warning(CUSTOM_PRIMARY_NOT_ENOUGH_TEETH, "primary trigger error: not enough teeth between sync points: expected %d/%d got %d/%d",
|
||||
TRIGGER_WAVEFORM(getExpectedEventCount(TriggerWheel::T_PRIMARY)),
|
||||
TRIGGER_WAVEFORM(getExpectedEventCount(TriggerWheel::T_SECONDARY)),
|
||||
getTriggerCentral()->triggerShape.getExpectedEventCount(TriggerWheel::T_PRIMARY),
|
||||
getTriggerCentral()->triggerShape.getExpectedEventCount(TriggerWheel::T_SECONDARY),
|
||||
currentCycle.eventCount[0],
|
||||
currentCycle.eventCount[1]);
|
||||
}
|
||||
|
||||
void PrimaryTriggerDecoder::onTooManyTeeth(int /*actual*/, int /*expected*/) {
|
||||
warning(CUSTOM_PRIMARY_TOO_MANY_TEETH, "primary trigger error: too many teeth between sync points: expected %d/%d got %d/%d",
|
||||
TRIGGER_WAVEFORM(getExpectedEventCount(TriggerWheel::T_PRIMARY)),
|
||||
TRIGGER_WAVEFORM(getExpectedEventCount(TriggerWheel::T_SECONDARY)),
|
||||
getTriggerCentral()->triggerShape.getExpectedEventCount(TriggerWheel::T_PRIMARY),
|
||||
getTriggerCentral()->triggerShape.getExpectedEventCount(TriggerWheel::T_SECONDARY),
|
||||
currentCycle.eventCount[0],
|
||||
currentCycle.eventCount[1]);
|
||||
}
|
||||
|
|
|
@ -180,7 +180,7 @@ void onFastAdcComplete(adcsample_t*) {
|
|||
efiAssertVoid(CUSTOM_STACK_ADC, getCurrentRemainingStack() > 128, "lowstck#9b");
|
||||
|
||||
#if EFI_SENSOR_CHART && EFI_SHAFT_POSITION_INPUT
|
||||
if (engine->sensorChartMode == SC_AUX_FAST1) {
|
||||
if (getEngineState()->sensorChartMode == SC_AUX_FAST1) {
|
||||
float voltage = getAdcValue("fAux1", engineConfiguration->auxFastSensor1_adcChannel);
|
||||
scAddData(engine->triggerCentral.getCurrentEnginePhase(getTimeNowNt()).value_or(0), voltage);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue