Rpm calculator refactor (#459)

* initial portion

* fixes

* merge2
This commit is contained in:
andreika-git 2017-07-08 18:02:28 +03:00 committed by rusefi
parent a3b10a0a04
commit 4005cc83cc
3 changed files with 2 additions and 3 deletions

View File

@ -104,7 +104,7 @@ static msg_t csThread(void) {
while (true) {
int rpm = getRpmE(engine);
int is_cranking = ENGINE(rpmCalculator).isCranking(PASS_ENGINE_PARAMETER_SIGNATURE);
int is_running = rpm > 0 && !is_cranking;
bool is_running = ENGINE(rpmCalculator).isRunning(PASS_ENGINE_PARAMETER_SIGNATURE);
if (is_running) {
// blinking while running
enginePins.runningPin.setValue(0);

View File

@ -50,6 +50,7 @@ RpmCalculator::RpmCalculator() {
#endif /* EFI_PROD_CODE */
rpmValue = 0;
assignRpmValue(0);
state = STOPPED;
// we need this initial to have not_running at first invocation
lastRpmEventTimeNt = (efitime_t) -10 * US2NT(US_PER_SECOND_LL);

View File

@ -128,8 +128,6 @@ float getCrankshaftAngleNt(efitime_t timeNt DECLARE_ENGINE_PARAMETER_SUFFIX);
int getRevolutionCounter(void);
bool isCranking(void);
#define isValidRpm(rpm) ((rpm) > 0 && (rpm) < UNREALISTIC_RPM)
#if EFI_ENGINE_SNIFFER