rpm refactoring

This commit is contained in:
rusefi 2017-07-06 08:43:15 -04:00
parent b61a61d44f
commit f8fb3cdb69
3 changed files with 7 additions and 8 deletions

View File

@ -101,7 +101,7 @@ static angle_t getRunningAdvance(int rpm, float engineLoad DECLARE_ENGINE_PARAME
angle_t getAdvance(int rpm, float engineLoad DECLARE_ENGINE_PARAMETER_SUFFIX) { angle_t getAdvance(int rpm, float engineLoad DECLARE_ENGINE_PARAMETER_SUFFIX) {
angle_t angle; angle_t angle;
if (isCrankingR(rpm)) { if (ENGINE(rpmCalculator).isCranking(PASS_ENGINE_PARAMETER_SIGNATURE)) {
angle = engineConfiguration->crankingTimingAngle; angle = engineConfiguration->crankingTimingAngle;
} else { } else {
if (CONFIG(timingMode) == TM_DYNAMIC) { if (CONFIG(timingMode) == TM_DYNAMIC) {

View File

@ -62,12 +62,12 @@ RpmCalculator::RpmCalculator() {
oneDegreeUs = NAN; oneDegreeUs = NAN;
} }
bool RpmCalculator::isStopped() { bool RpmCalculator::isStopped(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
return false; return false;
} }
bool RpmCalculator::isCranking() { bool RpmCalculator::isCranking(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
return false; return ((rpmValue) > 0 && (rpmValue) < CONFIG(cranking.rpm));
} }
//bool RpmCalculator::isRunning() { //bool RpmCalculator::isRunning() {
@ -80,8 +80,7 @@ bool RpmCalculator::isCranking() {
bool RpmCalculator::isRunning(DECLARE_ENGINE_PARAMETER_SIGNATURE) { bool RpmCalculator::isRunning(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
efitick_t nowNt = getTimeNowNt(); efitick_t nowNt = getTimeNowNt();
if (ENGINE(stopEngineRequestTimeNt) != 0) { if (ENGINE(stopEngineRequestTimeNt) != 0) {
if (nowNt if (nowNt - ENGINE(stopEngineRequestTimeNt) < 3 * US2NT(US_PER_SECOND_LL)) {
- ENGINE(stopEngineRequestTimeNt)< 3 * US2NT(US_PER_SECOND_LL)) {
return false; return false;
} }
} }

View File

@ -57,11 +57,11 @@ public:
/** /**
* Returns true if the engine is not spinning (RPM==0) * Returns true if the engine is not spinning (RPM==0)
*/ */
bool isStopped(); bool isStopped(DECLARE_ENGINE_PARAMETER_SIGNATURE);
/** /**
* Returns true if the engine is cranking * Returns true if the engine is cranking
*/ */
bool isCranking(); bool isCranking(DECLARE_ENGINE_PARAMETER_SIGNATURE);
/** /**
* Returns true if the engine is running and not cranking * Returns true if the engine is running and not cranking
*/ */