Missing dwell altogether in some corner cases #796

flirting with the fix but not yet the fix
This commit is contained in:
rusefi 2019-11-06 00:10:44 -05:00
parent 4910d37387
commit fbdbc0656a
2 changed files with 7 additions and 7 deletions

View File

@ -129,7 +129,7 @@ bool RpmCalculator::checkIfSpinning(efitick_t nowNt DECLARE_ENGINE_PARAMETER_SUF
return true; return true;
} }
void RpmCalculator::assignRpmValue(int value DECLARE_ENGINE_PARAMETER_SUFFIX) { void RpmCalculator::assignRpmValue(float value DECLARE_ENGINE_PARAMETER_SUFFIX) {
previousRpmValue = rpmValue; previousRpmValue = rpmValue;
rpmValue = value; rpmValue = value;
if (rpmValue <= 0) { if (rpmValue <= 0) {
@ -146,7 +146,7 @@ void RpmCalculator::assignRpmValue(int value DECLARE_ENGINE_PARAMETER_SUFFIX) {
} }
} }
void RpmCalculator::setRpmValue(int value DECLARE_ENGINE_PARAMETER_SUFFIX) { void RpmCalculator::setRpmValue(float value DECLARE_ENGINE_PARAMETER_SUFFIX) {
assignRpmValue(value PASS_ENGINE_PARAMETER_SUFFIX); assignRpmValue(value PASS_ENGINE_PARAMETER_SUFFIX);
spinning_state_e oldState = state; spinning_state_e oldState = state;
// Change state // Change state
@ -248,7 +248,7 @@ void rpmShaftPositionCallback(trigger_event_e ckpSignalType,
rpmState->setRpmValue(NOISY_RPM PASS_ENGINE_PARAMETER_SUFFIX); rpmState->setRpmValue(NOISY_RPM PASS_ENGINE_PARAMETER_SUFFIX);
} else { } else {
int mult = (int)getEngineCycle(engine->getOperationMode(PASS_ENGINE_PARAMETER_SIGNATURE)) / 360; int mult = (int)getEngineCycle(engine->getOperationMode(PASS_ENGINE_PARAMETER_SIGNATURE)) / 360;
int rpm = (int) (60 * US2NT(US_PER_SECOND_LL) * mult / diffNt); float rpm = (int) (60 * US2NT(US_PER_SECOND_LL) * mult / diffNt);
rpmState->setRpmValue(rpm > UNREALISTIC_RPM ? NOISY_RPM : rpm PASS_ENGINE_PARAMETER_SUFFIX); rpmState->setRpmValue(rpm > UNREALISTIC_RPM ? NOISY_RPM : rpm PASS_ENGINE_PARAMETER_SUFFIX);
} }
} }
@ -354,7 +354,7 @@ void initRpmCalculator(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX) {
* The callback would be executed once after the duration of time which * The callback would be executed once after the duration of time which
* it takes the crankshaft to rotate to the specified angle. * it takes the crankshaft to rotate to the specified angle.
*/ */
void scheduleByAngle(int rpm, scheduling_s *timer, angle_t angle, void scheduleByAngle(float rpm, scheduling_s *timer, angle_t angle,
schfunc_t callback, void *param DECLARE_ENGINE_PARAMETER_SUFFIX) { schfunc_t callback, void *param DECLARE_ENGINE_PARAMETER_SUFFIX) {
efiAssertVoid(CUSTOM_ANGLE_NAN, !cisnan(angle), "NaN angle?"); efiAssertVoid(CUSTOM_ANGLE_NAN, !cisnan(angle), "NaN angle?");
efiAssertVoid(CUSTOM_ERR_6634, isValidRpm(rpm), "RPM check expected"); efiAssertVoid(CUSTOM_ERR_6634, isValidRpm(rpm), "RPM check expected");

View File

@ -90,12 +90,12 @@ public:
*/ */
void onNewEngineCycle(); void onNewEngineCycle();
uint32_t getRevolutionCounterM(void) const; uint32_t getRevolutionCounterM(void) const;
void setRpmValue(int value DECLARE_ENGINE_PARAMETER_SUFFIX); void setRpmValue(float value DECLARE_ENGINE_PARAMETER_SUFFIX);
/** /**
* The same as setRpmValue() but without state change. * The same as setRpmValue() but without state change.
* We need this to be public because of calling rpmState->assignRpmValue() from rpmShaftPositionCallback() * We need this to be public because of calling rpmState->assignRpmValue() from rpmShaftPositionCallback()
*/ */
void assignRpmValue(int value DECLARE_ENGINE_PARAMETER_SUFFIX); void assignRpmValue(float value DECLARE_ENGINE_PARAMETER_SUFFIX);
uint32_t getRevolutionCounterSinceStart(void) const; uint32_t getRevolutionCounterSinceStart(void) const;
/** /**
* RPM rate of change between current RPM and RPM measured during previous engine cycle * RPM rate of change between current RPM and RPM measured during previous engine cycle
@ -166,6 +166,6 @@ float getCrankshaftAngleNt(efitime_t timeNt DECLARE_ENGINE_PARAMETER_SUFFIX);
#define addEngineSnifferEvent(n, msg) {} #define addEngineSnifferEvent(n, msg) {}
#endif /* EFI_ENGINE_SNIFFER */ #endif /* EFI_ENGINE_SNIFFER */
void scheduleByAngle(int rpm, scheduling_s *timer, angle_t angle, schfunc_t callback, void *param DECLARE_ENGINE_PARAMETER_SUFFIX); void scheduleByAngle(float rpm, scheduling_s *timer, angle_t angle, schfunc_t callback, void *param DECLARE_ENGINE_PARAMETER_SUFFIX);
#endif /* RPM_REPORTER_H_ */ #endif /* RPM_REPORTER_H_ */