#674 fix?
This commit is contained in:
parent
d671f569c3
commit
22d73f72e3
|
@ -59,9 +59,6 @@ RpmCalculator::RpmCalculator() {
|
||||||
// we need this initial to have not_running at first invocation
|
// we need this initial to have not_running at first invocation
|
||||||
lastRpmEventTimeNt = (efitime_t) -10 * US2NT(US_PER_SECOND_LL);
|
lastRpmEventTimeNt = (efitime_t) -10 * US2NT(US_PER_SECOND_LL);
|
||||||
revolutionCounterSinceBootForUnitTest = 0;
|
revolutionCounterSinceBootForUnitTest = 0;
|
||||||
|
|
||||||
// WAT? this was just assigned a non-zero value a few lines above? which one is right?
|
|
||||||
lastRpmEventTimeNt = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RpmCalculator::isStopped(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
bool RpmCalculator::isStopped(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
|
@ -89,11 +86,6 @@ bool RpmCalculator::isRunning(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
* @return true if engine is spinning (cranking or running)
|
* @return true if engine is spinning (cranking or running)
|
||||||
*/
|
*/
|
||||||
bool RpmCalculator::checkIfSpinning(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
bool RpmCalculator::checkIfSpinning(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
if (lastRpmEventTimeNt == 0) {
|
|
||||||
// here we assume 64 bit time does not overflow
|
|
||||||
// zero value is the default meaning no RPM events since reboot
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
efitick_t nowNt = getTimeNowNt();
|
efitick_t nowNt = getTimeNowNt();
|
||||||
if (ENGINE(needToStopEngine(nowNt))) {
|
if (ENGINE(needToStopEngine(nowNt))) {
|
||||||
setStopped(PASS_ENGINE_PARAMETER_SIGNATURE);
|
setStopped(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||||
|
|
|
@ -14,9 +14,10 @@ TEST(sensors, testFasterEngineSpinningUp) {
|
||||||
|
|
||||||
EngineTestHelper eth(TEST_ENGINE);
|
EngineTestHelper eth(TEST_ENGINE);
|
||||||
EXPAND_EngineTestHelper
|
EXPAND_EngineTestHelper
|
||||||
|
|
||||||
// turn on FasterEngineSpinUp mode
|
// turn on FasterEngineSpinUp mode
|
||||||
engineConfiguration->bc.isFasterEngineSpinUpEnabled = true;
|
engineConfiguration->bc.isFasterEngineSpinUpEnabled = true;
|
||||||
|
eth.firePrimaryTriggerRise();
|
||||||
|
|
||||||
// set ignition mode
|
// set ignition mode
|
||||||
engineConfiguration->ignitionMode = IM_INDIVIDUAL_COILS;
|
engineConfiguration->ignitionMode = IM_INDIVIDUAL_COILS;
|
||||||
// set cranking threshold (used below)
|
// set cranking threshold (used below)
|
||||||
|
@ -65,7 +66,7 @@ TEST(sensors, testFasterEngineSpinningUp) {
|
||||||
// check if the mode is changed when fully synched
|
// check if the mode is changed when fully synched
|
||||||
ASSERT_EQ(CRANKING, engine->rpmCalculator.getState());
|
ASSERT_EQ(CRANKING, engine->rpmCalculator.getState());
|
||||||
// check RPM
|
// check RPM
|
||||||
ASSERT_EQ( 300, engine->rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_SIGNATURE)) << "RPM#2";
|
ASSERT_EQ( 200, engine->rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_SIGNATURE)) << "RPM#2";
|
||||||
// test if they are simultaneous in cranking mode too
|
// test if they are simultaneous in cranking mode too
|
||||||
ASSERT_EQ(IM_SIMULTANEOUS, engine->getCurrentInjectionMode(PASS_ENGINE_PARAMETER_SIGNATURE));
|
ASSERT_EQ(IM_SIMULTANEOUS, engine->getCurrentInjectionMode(PASS_ENGINE_PARAMETER_SIGNATURE));
|
||||||
// test if ignition mode is restored to ind.coils
|
// test if ignition mode is restored to ind.coils
|
||||||
|
@ -73,8 +74,8 @@ TEST(sensors, testFasterEngineSpinningUp) {
|
||||||
// two simultaneous injections
|
// two simultaneous injections
|
||||||
ASSERT_EQ( 4, engine->executor.size()) << "plain#2";
|
ASSERT_EQ( 4, engine->executor.size()) << "plain#2";
|
||||||
// check real events
|
// check real events
|
||||||
eth.assertEvent5(&engine->executor, "inj start#2", 0, (void*)startSimultaniousInjection, eth.getTimeNowUs(), 97975);
|
eth.assertEvent5(&engine->executor, "inj start#2", 0, (void*)startSimultaniousInjection, eth.getTimeNowUs(), 147975);
|
||||||
eth.assertEvent5(&engine->executor, "inj end#2", 1, (void*)endSimultaniousInjection, eth.getTimeNowUs(), 100000);
|
eth.assertEvent5(&engine->executor, "inj end#2", 1, (void*)endSimultaniousInjection, eth.getTimeNowUs(), 150000);
|
||||||
|
|
||||||
// skip, clear & advance 1 more revolution at higher RPM
|
// skip, clear & advance 1 more revolution at higher RPM
|
||||||
eth.fireFall(60);
|
eth.fireFall(60);
|
||||||
|
|
Loading…
Reference in New Issue