better fields location, better initialization logic
This commit is contained in:
parent
082e7d268d
commit
1b0c46aaa7
|
@ -115,12 +115,12 @@ static angle_t getAdvanceCorrections(int rpm DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||||
#if EFI_TUNER_STUDIO || defined(__DOXYGEN__)
|
#if EFI_TUNER_STUDIO || defined(__DOXYGEN__)
|
||||||
tsOutputChannels.debugFloatField1 = iatCorrection;
|
tsOutputChannels.debugFloatField1 = iatCorrection;
|
||||||
tsOutputChannels.debugFloatField2 = engine->engineState.cltTimingCorrection;
|
tsOutputChannels.debugFloatField2 = engine->engineState.cltTimingCorrection;
|
||||||
tsOutputChannels.debugFloatField3 = engine->fsioTimingAdjustment;
|
tsOutputChannels.debugFloatField3 = engine->fsioState.fsioTimingAdjustment;
|
||||||
#endif /* EFI_TUNER_STUDIO */
|
#endif /* EFI_TUNER_STUDIO */
|
||||||
}
|
}
|
||||||
|
|
||||||
return iatCorrection
|
return iatCorrection
|
||||||
+ engine->fsioTimingAdjustment
|
+ engine->fsioState.fsioTimingAdjustment
|
||||||
+ engine->engineState.cltTimingCorrection
|
+ engine->engineState.cltTimingCorrection
|
||||||
// todo: uncomment once we get useable knock - engine->knockCount
|
// todo: uncomment once we get useable knock - engine->knockCount
|
||||||
;
|
;
|
||||||
|
|
|
@ -178,8 +178,8 @@ void Engine::reset() {
|
||||||
etbAutoTune = false;
|
etbAutoTune = false;
|
||||||
sensorChartMode = SC_OFF;
|
sensorChartMode = SC_OFF;
|
||||||
actualLastInjection = 0;
|
actualLastInjection = 0;
|
||||||
fsioTimingAdjustment = 0;
|
fsioState.fsioTimingAdjustment = 0;
|
||||||
fsioIdleTargetRPMAdjustment = 0;
|
fsioState.fsioIdleTargetRPMAdjustment = 0;
|
||||||
isAlternatorControlEnabled = false;
|
isAlternatorControlEnabled = false;
|
||||||
callFromPitStopEndTime = 0;
|
callFromPitStopEndTime = 0;
|
||||||
rpmHardLimitTimestamp = 0;
|
rpmHardLimitTimestamp = 0;
|
||||||
|
|
|
@ -307,6 +307,10 @@ typedef void (*configuration_callback_t)(Engine*);
|
||||||
class FsioState {
|
class FsioState {
|
||||||
public:
|
public:
|
||||||
FsioState();
|
FsioState();
|
||||||
|
float fsioTimingAdjustment;
|
||||||
|
float fsioIdleTargetRPMAdjustment;
|
||||||
|
float servoValues[SERVO_COUNT];
|
||||||
|
|
||||||
#if EFI_ENABLE_ENGINE_WARNING
|
#if EFI_ENABLE_ENGINE_WARNING
|
||||||
/**
|
/**
|
||||||
* Shall we purposely miss on some cylinders in order to attract driver's attention to some problem
|
* Shall we purposely miss on some cylinders in order to attract driver's attention to some problem
|
||||||
|
@ -337,7 +341,6 @@ public:
|
||||||
Engine(persistent_config_s *config);
|
Engine(persistent_config_s *config);
|
||||||
Engine();
|
Engine();
|
||||||
void setConfig(persistent_config_s *config);
|
void setConfig(persistent_config_s *config);
|
||||||
void reset();
|
|
||||||
injection_mode_e getCurrentInjectionMode(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
injection_mode_e getCurrentInjectionMode(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
||||||
|
|
||||||
InjectionSignalPair fuelActuators[INJECTION_PIN_COUNT];
|
InjectionSignalPair fuelActuators[INJECTION_PIN_COUNT];
|
||||||
|
@ -456,10 +459,6 @@ public:
|
||||||
|
|
||||||
bool isRunningPwmTest;
|
bool isRunningPwmTest;
|
||||||
|
|
||||||
// todo: move this into FsioState class
|
|
||||||
float fsioTimingAdjustment;
|
|
||||||
float fsioIdleTargetRPMAdjustment;
|
|
||||||
float servoValues[SERVO_COUNT];
|
|
||||||
|
|
||||||
FsioState fsioState;
|
FsioState fsioState;
|
||||||
|
|
||||||
|
@ -569,6 +568,7 @@ private:
|
||||||
* 'spinning' means the engine is not stopped
|
* 'spinning' means the engine is not stopped
|
||||||
*/
|
*/
|
||||||
bool isSpinning;
|
bool isSpinning;
|
||||||
|
void reset();
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -90,10 +90,7 @@ public:
|
||||||
LEElement * fsioLogics[FSIO_COMMAND_COUNT];
|
LEElement * fsioLogics[FSIO_COMMAND_COUNT];
|
||||||
};
|
};
|
||||||
|
|
||||||
FsioPointers::FsioPointers() {
|
FsioPointers::FsioPointers() : fsioLogics() {
|
||||||
for (int i = 0; i < FSIO_COMMAND_COUNT; i++) {
|
|
||||||
fsioLogics[i] = NULL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static FsioPointers state;
|
static FsioPointers state;
|
||||||
|
@ -441,7 +438,7 @@ static bool updateValueOrWarning(int fsioIndex, const char *msg, float *value DE
|
||||||
}
|
}
|
||||||
|
|
||||||
static void useFsioForServo(int servoIndex DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
static void useFsioForServo(int servoIndex DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||||
updateValueOrWarning(8 - 1 + servoIndex, "servo", &engine->servoValues[servoIndex] PASS_ENGINE_PARAMETER_SUFFIX);
|
updateValueOrWarning(8 - 1 + servoIndex, "servo", &engine->fsioState.servoValues[servoIndex] PASS_ENGINE_PARAMETER_SUFFIX);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -506,11 +503,11 @@ void runFsio(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
#endif /* EFI_ENABLE_CRITICAL_ENGINE_STOP */
|
#endif /* EFI_ENABLE_CRITICAL_ENGINE_STOP */
|
||||||
|
|
||||||
if (engineConfiguration->useFSIO15ForIdleRpmAdjustment) {
|
if (engineConfiguration->useFSIO15ForIdleRpmAdjustment) {
|
||||||
updateValueOrWarning(MAGIC_OFFSET_FOR_IDLE_TARGET_RPM, "RPM target", &ENGINE(fsioIdleTargetRPMAdjustment) PASS_ENGINE_PARAMETER_SUFFIX);
|
updateValueOrWarning(MAGIC_OFFSET_FOR_IDLE_TARGET_RPM, "RPM target", &ENGINE(fsioState.fsioIdleTargetRPMAdjustment) PASS_ENGINE_PARAMETER_SUFFIX);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (engineConfiguration->useFSIO16ForTimingAdjustment) {
|
if (engineConfiguration->useFSIO16ForTimingAdjustment) {
|
||||||
updateValueOrWarning(MAGIC_OFFSET_FOR_TIMING_FSIO, "timing", &ENGINE(fsioTimingAdjustment) PASS_ENGINE_PARAMETER_SUFFIX);
|
updateValueOrWarning(MAGIC_OFFSET_FOR_TIMING_FSIO, "timing", &ENGINE(fsioState.fsioTimingAdjustment) PASS_ENGINE_PARAMETER_SUFFIX);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (engineConfiguration->useFSIO8ForServo1) {
|
if (engineConfiguration->useFSIO8ForServo1) {
|
||||||
|
|
|
@ -213,7 +213,7 @@ static percent_t automaticIdleController() {
|
||||||
} else {
|
} else {
|
||||||
targetRpm = interpolate2d("cltRpm", clt, CONFIG(cltIdleRpmBins), CONFIG(cltIdleRpm), CLT_CURVE_SIZE);
|
targetRpm = interpolate2d("cltRpm", clt, CONFIG(cltIdleRpmBins), CONFIG(cltIdleRpm), CLT_CURVE_SIZE);
|
||||||
}
|
}
|
||||||
targetRpm += engine->fsioIdleTargetRPMAdjustment;
|
targetRpm += engine->fsioState.fsioIdleTargetRPMAdjustment;
|
||||||
|
|
||||||
|
|
||||||
// check if within the dead zone
|
// check if within the dead zone
|
||||||
|
|
Loading…
Reference in New Issue