Better handling of RPM during stop of cranking #3803

reuse existing magic constant
This commit is contained in:
Andrey 2022-01-17 21:18:43 -05:00
parent bc66096574
commit a1374062f0
2 changed files with 6 additions and 6 deletions

View File

@ -17,11 +17,6 @@
#define NOISY_RPM -1
#define UNREALISTIC_RPM 30000
#ifndef RPM_LOW_THRESHOLD
// no idea what is the best value, 25 is as good as any other guess
#define RPM_LOW_THRESHOLD 25
#endif
typedef enum {
/**
* The engine is not spinning, RPM=0

View File

@ -17,6 +17,11 @@
#define MAP_CAM_BUFFER 64
#ifndef RPM_LOW_THRESHOLD
// no idea what is the best value, 25 is as good as any other guess
#define RPM_LOW_THRESHOLD 25
#endif
class Engine;
typedef void (*ShaftPositionListener)(trigger_event_e signal, uint32_t index, efitick_t edgeTimestamp);
@ -74,7 +79,7 @@ public:
// Trigger event some time in the past second = engine moving
// distributor single tooth, large engines crank at close to 120 RPM
// todo: make this logic account current trigger to stop idle much faster if we have more teeth on trigger wheels?
return getTimeSinceTriggerEvent(nowNt) < 1.0f;
return getTimeSinceTriggerEvent(nowNt) < 60.0 / RPM_LOW_THRESHOLD / 2;
}
bool engineMovedRecently() const {