Starter is engaged on start-up in pull-up configuration #1969

This commit is contained in:
rusefi 2020-11-25 23:38:43 -05:00
parent 1375b946ae
commit b189d85228
1 changed files with 14 additions and 0 deletions

View File

@ -542,6 +542,20 @@ void OutputPin::initPin(const char *msg, brain_pin_e brainPin, const pin_output_
// mystery state being driven on the pin (potentially dangerous).
setDefaultPinState(outputMode);
efiSetPadMode(msg, brainPin, mode);
if (brain_pin_is_onchip(brainPin)) {
int actualValue = palReadPad(port, pin);
// we had enough drama with pin configuration in board.h and else that we shall self-check
// todo: handle OM_OPENDRAIN and OM_OPENDRAIN_INVERTED as well
if (*outputMode == OM_DEFAULT || *outputMode == OM_INVERTED) {
if (*outputMode == OM_INVERTED) {
actualValue = !actualValue;
}
if (actualValue) {
firmwareError(OBD_PCM_Processor_Fault, "startup pin state %s", hwPortname(brainPin));
}
}
}
#endif /* EFI_GPIO_HARDWARE */
}