2020-11-18 16:34:09 -08:00
|
|
|
/*
|
|
|
|
* @file test_start_stop.cpp
|
|
|
|
*
|
|
|
|
* @date Nov 18, 2020
|
|
|
|
* @author Andrey Belomutskiy, (c) 2012-2020
|
|
|
|
*/
|
|
|
|
|
2020-11-18 17:12:58 -08:00
|
|
|
#include "engine_test_helper.h"
|
|
|
|
#include "engine_controller.h"
|
2020-11-18 16:34:09 -08:00
|
|
|
|
2020-11-18 17:12:58 -08:00
|
|
|
TEST(start, startStop) {
|
|
|
|
WITH_ENGINE_TEST_HELPER(BMW_M73_PROTEUS);
|
|
|
|
// this is a pull-up, so 'true' on start-up
|
2020-11-18 19:47:40 -08:00
|
|
|
setMockState(engineConfiguration->startStopButtonPin, true);
|
2020-11-18 17:53:03 -08:00
|
|
|
|
2020-11-18 19:47:40 -08:00
|
|
|
ASSERT_EQ(efiReadPin(engineConfiguration->starterControlPin), false);
|
2020-11-18 17:53:03 -08:00
|
|
|
|
|
|
|
slowStartStopButtonCallback(PASS_ENGINE_PARAMETER_SIGNATURE);
|
2020-11-18 19:47:40 -08:00
|
|
|
ASSERT_EQ(efiReadPin(engineConfiguration->starterControlPin), false);
|
|
|
|
|
|
|
|
|
|
|
|
eth.smartMoveTimeForwardSeconds(10);
|
|
|
|
// inverted since pull-up
|
|
|
|
setMockState(engineConfiguration->startStopButtonPin, false);
|
|
|
|
slowStartStopButtonCallback(PASS_ENGINE_PARAMETER_SIGNATURE);
|
|
|
|
ASSERT_EQ(efiReadPin(engineConfiguration->starterControlPin), true);
|
|
|
|
|
2020-11-18 19:56:05 -08:00
|
|
|
eth.smartMoveTimeForwardSeconds(5);
|
|
|
|
slowStartStopButtonCallback(PASS_ENGINE_PARAMETER_SIGNATURE);
|
|
|
|
|
|
|
|
eth.smartMoveTimeForwardSeconds(5);
|
|
|
|
slowStartStopButtonCallback(PASS_ENGINE_PARAMETER_SIGNATURE);
|
|
|
|
|
|
|
|
eth.smartMoveTimeForwardSeconds(5);
|
|
|
|
slowStartStopButtonCallback(PASS_ENGINE_PARAMETER_SIGNATURE);
|
|
|
|
// todo: FIX THIS, starter wire should go off on timeout!
|
|
|
|
ASSERT_EQ(efiReadPin(engineConfiguration->starterControlPin), true);
|
|
|
|
|
|
|
|
|
2020-11-18 17:12:58 -08:00
|
|
|
}
|