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 angle;
if (isCrankingR(rpm)) {
if (ENGINE(rpmCalculator).isCranking(PASS_ENGINE_PARAMETER_SIGNATURE)) {
angle = engineConfiguration->crankingTimingAngle;
} else {
if (CONFIG(timingMode) == TM_DYNAMIC) {

View File

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

View File

@ -57,11 +57,11 @@ public:
/**
* 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
*/
bool isCranking();
bool isCranking(DECLARE_ENGINE_PARAMETER_SIGNATURE);
/**
* Returns true if the engine is running and not cranking
*/