Starter seems to be engaged forever #1965
This commit is contained in:
parent
905d740b4b
commit
a9e0bffbbd
|
@ -30,7 +30,7 @@ void setMockAfrVoltage(float voltage DECLARE_ENGINE_PARAMETER_SUFFIX);
|
|||
void setMockMafVoltage(float voltage DECLARE_ENGINE_PARAMETER_SUFFIX);
|
||||
void setMockIatVoltage(float voltage DECLARE_ENGINE_PARAMETER_SUFFIX);
|
||||
void setMockCltVoltage(float voltage DECLARE_ENGINE_PARAMETER_SUFFIX);
|
||||
void setMockState(brain_pin_e pin, bool state DECLARE_ENGINE_PARAMETER_SUFFIX);
|
||||
void setMockState(brain_pin_e pin, bool state);
|
||||
|
||||
void printCurrentState(Logging *logging, int seconds, const char *engineTypeName, const char *firmwareBuildId);
|
||||
|
||||
|
|
|
@ -75,8 +75,8 @@ void setMockVBattVoltage(float voltage DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
|||
setMockVoltage(engineConfiguration->vbattAdcChannel, voltage PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
}
|
||||
|
||||
void setMockState(brain_pin_e pin, bool state DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||
#if ! EFI_PROD_CODE
|
||||
void setMockState(brain_pin_e pin, bool state) {
|
||||
#if EFI_UNIT_TEST
|
||||
mockPinStates[static_cast<int>(pin)] = state;
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#include "efi_gpio.h"
|
||||
#include "drivers/gpio/gpio_ext.h"
|
||||
#include "perf_trace.h"
|
||||
#include "engine_controller.h"
|
||||
|
||||
#if EFI_GPIO_HARDWARE
|
||||
#include "pin_repository.h"
|
||||
|
@ -75,19 +76,17 @@ bool RegisteredOutputPin::isPinConfigurationChanged() {
|
|||
pin_output_mode_e newMode = *(pin_output_mode_e *) ((void *) (&((char*) engineConfiguration)[pinModeOffset]));
|
||||
return curPin != newPin || curMode != newMode;
|
||||
#else
|
||||
return false;
|
||||
return true;
|
||||
#endif // EFI_PROD_CODE
|
||||
}
|
||||
|
||||
void RegisteredOutputPin::init() {
|
||||
#if EFI_PROD_CODE
|
||||
void RegisteredOutputPin::init(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||
brain_pin_e newPin = *(brain_pin_e *) ((void *) (&((char*) engineConfiguration)[pinOffset]));
|
||||
pin_output_mode_e *newMode = (pin_output_mode_e *) ((void *) (&((char*) engineConfiguration)[pinModeOffset]));
|
||||
|
||||
if (isPinConfigurationChanged()) {
|
||||
this->initPin(registrationName, newPin, newMode);
|
||||
}
|
||||
#endif // EFI_PROD_CODE
|
||||
}
|
||||
|
||||
void RegisteredOutputPin::unregister() {
|
||||
|
@ -176,6 +175,7 @@ EnginePins::EnginePins() :
|
|||
if ((outputPin)->currentLogicValue != (logicValue)) { \
|
||||
(outputPin)->currentLogicValue = (logicValue); \
|
||||
} \
|
||||
setMockState((outputPin)->brainPin, logicValue); \
|
||||
}
|
||||
#endif /* EFI_PROD_CODE */
|
||||
|
||||
|
@ -228,7 +228,7 @@ void EnginePins::startPins(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
|||
|
||||
RegisteredOutputPin * pin = registeredOutputHead;
|
||||
while (pin != nullptr) {
|
||||
pin->init();
|
||||
pin->init(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||
pin = pin->next;
|
||||
}
|
||||
}
|
||||
|
@ -471,6 +471,10 @@ void OutputPin::initPin(const char *msg, brain_pin_e brainPin) {
|
|||
}
|
||||
|
||||
void OutputPin::initPin(const char *msg, brain_pin_e brainPin, const pin_output_mode_e *outputMode) {
|
||||
#if EFI_UNIT_TEST
|
||||
this->brainPin = brainPin;
|
||||
#endif
|
||||
|
||||
#if EFI_GPIO_HARDWARE && EFI_PROD_CODE
|
||||
if (brainPin == GPIO_UNASSIGNED)
|
||||
return;
|
||||
|
|
|
@ -35,7 +35,7 @@ TEST(idle, fsioPidParameters) {
|
|||
applyFsioExpression(QUOTE(MAGIC_OFFSET_FOR_IDLE_MIN_VALUE), "ac_on_switch 0 cfg_acIdleExtraMin if" PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
|
||||
ASSERT_EQ(1, hasAcToggle(PASS_ENGINE_PARAMETER_SIGNATURE));
|
||||
setMockState(engineConfiguration->acSwitch, true PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
setMockState(engineConfiguration->acSwitch, true);
|
||||
timeNowUs += MS2US(15);
|
||||
ASSERT_TRUE(getAcToggle(PASS_ENGINE_PARAMETER_SIGNATURE));
|
||||
|
||||
|
@ -43,7 +43,7 @@ TEST(idle, fsioPidParameters) {
|
|||
ASSERT_EQ(40, getIdlePidOffset(PASS_ENGINE_PARAMETER_SIGNATURE));
|
||||
ASSERT_EQ(30, getIdlePidMinValue(PASS_ENGINE_PARAMETER_SIGNATURE));
|
||||
|
||||
setMockState(engineConfiguration->acSwitch, false PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
setMockState(engineConfiguration->acSwitch, false);
|
||||
timeNowUs += MS2US(15);
|
||||
ASSERT_FALSE(getAcToggle(PASS_ENGINE_PARAMETER_SIGNATURE));
|
||||
|
||||
|
|
|
@ -11,9 +11,18 @@
|
|||
TEST(start, startStop) {
|
||||
WITH_ENGINE_TEST_HELPER(BMW_M73_PROTEUS);
|
||||
// this is a pull-up, so 'true' on start-up
|
||||
setMockState(engineConfiguration->startStopButtonPin, true PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
setMockState(engineConfiguration->startStopButtonPin, true);
|
||||
|
||||
ASSERT_EQ(efiReadPin(engineConfiguration->starterControlPin), 0);
|
||||
ASSERT_EQ(efiReadPin(engineConfiguration->starterControlPin), false);
|
||||
|
||||
slowStartStopButtonCallback(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||
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);
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue