Hellen says merge #1772 error pin

This commit is contained in:
rusefi 2020-09-09 18:18:59 -04:00
parent 91f9079f82
commit fe3d03ba5a
2 changed files with 10 additions and 2 deletions

View File

@ -48,12 +48,13 @@ char *getFirmwareError(void) {
extern ioportid_t errorLedPort;
extern ioportmask_t errorLedPin;
extern uint8_t errorLedSetState;
/**
* low-level function is used here to reduce stack usage
*/
#define ON_FATAL_ERROR() \
palWritePad(errorLedPort, errorLedPin, 1); \
palWritePad(errorLedPort, errorLedPin, errorLedSetState); \
turnAllPinsOff(); \
enginePins.communicationLedPin.setValue(1);
#endif /* EFI_PROD_CODE */

View File

@ -33,6 +33,7 @@ EnginePins enginePins;
static Logging* logger;
pin_output_mode_e DEFAULT_OUTPUT = OM_DEFAULT;
pin_output_mode_e INVERTED_OUTPUT = OM_INVERTED;
static const char *sparkNames[] = { "coil1", "coil2", "coil3", "coil4", "coil5", "coil6", "coil7", "coil8",
"coil9", "coil10", "coil11", "coil12"};
@ -488,13 +489,19 @@ void OutputPin::unregisterOutput(brain_pin_e oldPin) {
// by reducing stack requirement
ioportid_t errorLedPort;
ioportmask_t errorLedPin;
uint8_t errorLedSetState;
#ifndef LED_ERROR_BRAIN_PIN_MODE
#define LED_ERROR_BRAIN_PIN_MODE DEFAULT_OUTPUT
#endif /* LED_ERROR_BRAIN_PIN_MODE */
void initPrimaryPins(Logging *sharedLogger) {
logger = sharedLogger;
#if EFI_PROD_CODE
enginePins.errorLedPin.initPin("led: ERROR status", LED_ERROR_BRAIN_PIN);
enginePins.errorLedPin.initPin("led: ERROR status", LED_ERROR_BRAIN_PIN, &(LED_ERROR_BRAIN_PIN_MODE));
errorLedPort = getHwPort("primary", LED_ERROR_BRAIN_PIN);
errorLedPin = getHwPin("primary", LED_ERROR_BRAIN_PIN);
errorLedSetState = (LED_ERROR_BRAIN_PIN_MODE == INVERTED_OUTPUT) ? 0 : 1;
#endif /* EFI_PROD_CODE */
}